Package qupath.lib.geom
Class Point2
java.lang.Object
qupath.lib.geom.Point2
- All Implemented Interfaces:
- Externalizable,- Serializable,- Comparable<Point2>,- Point
A 2D point (x & y coordinates).
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionintintdim()Number of values used to represent this point.doubledistance(double x, double y) Calculate the distance between this point and a specified x and y location.doubleCalculate the distance to another point, with the samePoint.dim().doubleCalculate the distance between this point and another point.doubledistanceSq(double x, double y) Calculate the squared distance between this point and a specified x and y location.doubledistanceSq(Point p) Calculate the squared distance to another point, with the samePoint.dim().booleandoubleget(int dim) Get the value of the ordinate for the specified dimension.doublegetX()Get the x coordinate of this point.doublegetY()Get the y coordinate of this point.inthashCode()voidtoString()void
- 
Constructor Details- 
Point2public Point2()Default constructor for a point at location (0,0).
- 
Point2public Point2(double x, double y) Point constructor.- Parameters:
- x-
- y-
 
 
- 
- 
Method Details- 
getXpublic double getX()Get the x coordinate of this point.- Returns:
 
- 
getYpublic double getY()Get the y coordinate of this point.- Returns:
 
- 
distanceSqpublic double distanceSq(double x, double y) Calculate the squared distance between this point and a specified x and y location.- Parameters:
- x-
- y-
- Returns:
 
- 
distancepublic double distance(double x, double y) Calculate the distance between this point and a specified x and y location.- Parameters:
- x-
- y-
- Returns:
 
- 
distanceCalculate the distance between this point and another point.- Parameters:
- p-
- Returns:
 
- 
getpublic double get(int dim) Description copied from interface:PointGet the value of the ordinate for the specified dimension.
- 
dimpublic int dim()Description copied from interface:PointNumber of values used to represent this point.For an x,y coordinate pair this should return 2. 
- 
toString
- 
hashCodepublic int hashCode()
- 
equals
- 
writeExternal- Specified by:
- writeExternalin interface- Externalizable
- Throws:
- IOException
 
- 
readExternal- Specified by:
- readExternalin interface- Externalizable
- Throws:
- IOException
- ClassNotFoundException
 
- 
compareTo- Specified by:
- compareToin interface- Comparable<Point2>
 
- 
distanceSqDescription copied from interface:PointCalculate the squared distance to another point, with the samePoint.dim().- Specified by:
- distanceSqin interface- Point
- Parameters:
- p-
- Returns:
- See Also:
 
- 
distanceDescription copied from interface:PointCalculate the distance to another point, with the samePoint.dim().
 
-