public class Point extends Object implements Comparable<Point>, Serializable
Modifier and Type | Field and Description |
---|---|
static int |
BEHINDB |
static int |
ERROR |
static int |
INFRONTOFA |
static int |
LEFT |
static int |
ONSEGMENT |
static int |
RIGHT |
Constructor and Description |
---|
Point()
Default Constructor.
|
Point(double x,
double y)
constructs a 3D point with a z value of 0.
|
Point(double x,
double y,
double z)
constructs a 3D point
|
Point(Point p)
simple copy constructor
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Point o) |
double |
distance(Point p) |
double |
distance3D(Point p) |
boolean |
equals(Object obj)
return true iff this point [x,y] coordinates are the same as p [x,y]
coordinates.
|
double |
getX()
returns the x-coordinate of this point.
|
double |
getY()
returns the y-coordinate of this point.
|
double |
getZ()
returns the z-coordinate of this point.
|
int |
hashCode() |
int |
pointLineTest(Point a,
Point b)
tests the relation between this point (as a 2D [x,y] point) and a 2D
segment a,b (the Z values are ignored), returns one of the following:
LEFT, RIGHT, INFRONTOFA, BEHINDB, ONSEGMENT
|
void |
setX(double x)
Sets the x coordinate.
|
void |
setY(double y)
Sets the y coordinate.
|
void |
setZ(double z)
Sets the z coordinate.
|
String |
toString() |
public static final int ONSEGMENT
public static final int LEFT
public static final int RIGHT
public static final int INFRONTOFA
public static final int BEHINDB
public static final int ERROR
public Point()
public Point(double x, double y, double z)
public Point(double x, double y)
public Point(Point p)
public double getX()
public void setX(double x)
x
- The new x coordinate.public double getY()
public void setY(double y)
y
- The new y coordinate.public double getZ()
public void setZ(double z)
z
- The new z coordinate.public double distance(Point p)
public double distance3D(Point p)
public int pointLineTest(Point a, Point b)
a
- the first point of the segment.b
- the second point of the segment.public boolean equals(Object obj)
public int compareTo(Point o)
compareTo
in interface Comparable<Point>
Copyright © 2016. All rights reserved.