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
-
Method Summary
Modifier and TypeMethodDescriptionint
dim()
Number of values used to represent this point.double
distance
(double x, double y) Calculate the distance between this point and a specified x and y location.double
Calculate the distance to another point, with the samePoint.dim()
.double
Calculate the distance between this point and another point.double
distanceSq
(double x, double y) Calculate the squared distance between this point and a specified x and y location.double
distanceSq
(Point p) Calculate the squared distance to another point, with the samePoint.dim()
.boolean
double
get
(int dim) Get the value of the ordinate for the specified dimension.double
getX()
Get the x coordinate of this point.double
getY()
Get the y coordinate of this point.int
hashCode()
void
toString()
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:Point
Get the value of the ordinate for the specified dimension. -
dim
public int dim()Description copied from interface:Point
Number of values used to represent this point.For an x,y coordinate pair this should return 2.
-
toString
-
writeExternal
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
readExternal
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
ClassNotFoundException
-
distanceSq
Description copied from interface:Point
Calculate the squared distance to another point, with the samePoint.dim()
.- Specified by:
distanceSq
in interfacePoint
- Parameters:
p
-- Returns:
- See Also:
-
distance
Description copied from interface:Point
Calculate the distance to another point, with the samePoint.dim()
.
-