Package il.ac.idc.jdt
Class Point
- java.lang.Object
- 
- il.ac.idc.jdt.Point
 
- 
- All Implemented Interfaces:
- Serializable,- Comparable<Point>
 
 public class Point extends Object implements Comparable<Point>, Serializable This class represents a 3D point, with some simple geometric methods (pointLineTest).- See Also:
- Serialized Form
 
- 
- 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Point o)doubledistance(Point p)doubledistance3D(Point p)booleanequals(Object obj)return true iff this point [x,y] coordinates are the same as p [x,y] coordinates.doublegetX()returns the x-coordinate of this point.doublegetY()returns the y-coordinate of this point.doublegetZ()returns the z-coordinate of this point.inthashCode()intpointLineTest(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, ONSEGMENTvoidsetX(double x)Sets the x coordinate.voidsetY(double y)Sets the y coordinate.voidsetZ(double z)Sets the z coordinate.StringtoString()
 
- 
- 
- 
Field Detail- 
ONSEGMENTpublic static final int ONSEGMENT - See Also:
- Constant Field Values
 
 - 
LEFTpublic static final int LEFT - See Also:
- Constant Field Values
 
 - 
RIGHTpublic static final int RIGHT - See Also:
- Constant Field Values
 
 - 
INFRONTOFApublic static final int INFRONTOFA - See Also:
- Constant Field Values
 
 - 
BEHINDBpublic static final int BEHINDB - See Also:
- Constant Field Values
 
 - 
ERRORpublic static final int ERROR - See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
Pointpublic Point() Default Constructor.
 constructs a 3D point at (0,0,0).
 - 
Pointpublic Point(double x, double y, double z)constructs a 3D point
 - 
Pointpublic Point(double x, double y)constructs a 3D point with a z value of 0.
 - 
Pointpublic Point(Point p) simple copy constructor
 
- 
 - 
Method Detail- 
getXpublic double getX() returns the x-coordinate of this point.
 - 
setXpublic void setX(double x) Sets the x coordinate.- Parameters:
- x- The new x coordinate.
 
 - 
getYpublic double getY() returns the y-coordinate of this point.
 - 
setYpublic void setY(double y) Sets the y coordinate.- Parameters:
- y- The new y coordinate.
 
 - 
getZpublic double getZ() returns the z-coordinate of this point.
 - 
setZpublic void setZ(double z) Sets the z coordinate.- Parameters:
- z- The new z coordinate.
 
 - 
distancepublic double distance(Point p) - Returns:
- the L2 distanse NOTE: 2D only!!!
 
 - 
distance3Dpublic double distance3D(Point p) - Returns:
- the L2 distanse NOTE: 3D only!!!
 
 - 
pointLineTestpublic 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- Parameters:
- a- the first point of the segment.
- b- the second point of the segment.
- Returns:
- the value (flag) of the relation between this point and the a,b line-segment.
 
 - 
equalspublic boolean equals(Object obj) return true iff this point [x,y] coordinates are the same as p [x,y] coordinates. (the z value is ignored).
 - 
compareTopublic int compareTo(Point o) - Specified by:
- compareToin interface- Comparable<Point>
 
 
- 
 
-