Package qupath.lib.geom
Class Point2
java.lang.Object
qupath.lib.geom.Point2
- All Implemented Interfaces:
Externalizable,Serializable,Point
A 2D point (x & y coordinates).
- Author:
- Pete Bankhead
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintdim()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
-
Point2
public Point2()Default constructor for a point at location (0,0). -
Point2
public Point2(double x, double y) Point constructor.- Parameters:
x-y-
-
-
Method Details
-
hashCode
public int hashCode() -
equals
-
getX
public double getX()Get the x coordinate of this point.- Returns:
-
getY
public double getY()Get the y coordinate of this point.- Returns:
-
distanceSq
public double distanceSq(double x, double y) Calculate the squared distance between this point and a specified x and y location.- Parameters:
x-y-- Returns:
-
distance
public double distance(double x, double y) Calculate the distance between this point and a specified x and y location.- Parameters:
x-y-- Returns:
-
distance
Calculate the distance between this point and another point.- Parameters:
p-- Returns:
-
get
public double get(int dim) Description copied from interface:PointGet the value of the ordinate for the specified dimension. -
dim
public 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
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
distanceSq
Description copied from interface:PointCalculate the squared distance to another point, with the samePoint.dim().- Specified by:
distanceSqin interfacePoint- Returns:
- See Also:
-
distance
Description copied from interface:PointCalculate the distance to another point, with the samePoint.dim().
-