java.lang.Object
java.awt.geom.Point2D
- 所有已实现的接口:
-
Cloneable
- 直接已知的子类:
-
Point,Point2D.Double,Point2D.Float
Point2D类定义了表示在(x,y)坐标空间中位置的点。
这个类只是所有存储2D坐标的对象的抽象超类。坐标的实际存储表示留给子类。
- 自1.2版本起:
- 1.2
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDouble类定义了以双精度double表示的点。static classFloat类定义了以浮点精度表示的点。 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()创建一个与此对象相同类和相同内容的新对象。doubledistance(double px, double py) 返回从此Point2D到指定点的距离。static doubledistance(double x1, double y1, double x2, double y2) 返回两点之间的距离。double返回从此Point2D到指定Point2D的距离。doubledistanceSq(double px, double py) 返回从此Point2D到指定点的距离的平方。static doubledistanceSq(double x1, double y1, double x2, double y2) 返回两点之间的距离的平方。doubledistanceSq(Point2D pt) 返回从此Point2D到指定Point2D的距离的平方。boolean确定两个点是否相等。abstract doublegetX()返回此Point2D的X坐标,以双精度表示。abstract doublegetY()返回此Point2D的Y坐标,以双精度表示。inthashCode()返回此Point2D的哈希码。abstract voidsetLocation(double x, double y) 将此Point2D的位置设置为指定的双精度坐标。void将此Point2D的位置设置为与指定Point2D对象相同的坐标。
-
Constructor Details
-
Point2D
protected Point2D()这是一个无法直接实例化的抽象类。针对特定类型的实现子类可用于实例化,并提供多种格式来存储满足下面各种访问器方法所需信息。- 自1.2版本起:
- 1.2
- 另请参阅:
-
-
Method Details
-
getX
public abstract double getX()返回此Point2D的X坐标,以双精度表示。- 返回:
-
此
Point2D的X坐标。 - 自1.2版本起:
- 1.2
-
getY
public abstract double getY()返回此Point2D的Y坐标,以双精度表示。- 返回:
-
此
Point2D的Y坐标。 - 自1.2版本起:
- 1.2
-
setLocation
public abstract void setLocation(double x, double y) 将此Point2D的位置设置为指定的双精度坐标。- 参数:
-
x- 此Point2D的新X坐标 -
y- 此Point2D的新Y坐标 - 自1.2版本起:
- 1.2
-
setLocation
将此Point2D的位置设置为与指定Point2D对象相同的坐标。- 参数:
-
p- 要设置为此Point2D的指定Point2D - 自1.2版本起:
- 1.2
-
distanceSq
public static double distanceSq(double x1, double y1, double x2, double y2) 返回两点之间的距离的平方。- 参数:
-
x1- 第一个指定点的X坐标 -
y1- 第一个指定点的Y坐标 -
x2- 第二个指定点的X坐标 -
y2- 第二个指定点的Y坐标 - 返回:
- 两组指定坐标之间的距离的平方。
- 自1.2版本起:
- 1.2
-
distance
public static double distance(double x1, double y1, double x2, double y2) 返回两点之间的距离。- 参数:
-
x1- 第一个指定点的X坐标 -
y1- 第一个指定点的Y坐标 -
x2- 第二个指定点的X坐标 -
y2- 第二个指定点的Y坐标 - 返回:
- 两组指定坐标之间的距禮。
- 自1.2版本起:
- 1.2
-
distanceSq
public double distanceSq(double px, double py) 返回从此Point2D到指定点的距离的平方。- 参数:
-
px- 要测量与此Point2D的指定点的X坐标 -
py- 要测量与此Point2D的指定点的Y坐标 - 返回:
-
此
Point2D与指定点之间的距离的平方。 - 自1.2版本起:
- 1.2
-
distanceSq
返回从此Point2D到指定Point2D的距离的平方。- 参数:
-
pt- 要测量与此Point2D的指定点 - 返回:
-
此
Point2D到指定Point2D的距离的平方。 - 自1.2版本起:
- 1.2
-
distance
public double distance(double px, double py) 返回从此Point2D到指定点的距离。- 参数:
-
px- 要测量与此Point2D的指定点的X坐标 -
py- 要测量与此Point2D的指定点的Y坐标 - 返回:
-
此
Point2D到指定点的距离。 - 自1.2版本起:
- 1.2
-
distance
返回从此Point2D到指定Point2D的距离。- 参数:
-
pt- 要测量与此Point2D的指定点 - 返回:
-
此
Point2D到指定Point2D的距离。 - 自1.2版本起:
- 1.2
-
clone
创建一个与此对象相同类和相同内容的新对象。- 覆盖:
-
clone在类Object中 - 返回:
- 此实例的克隆。
- 抛出:
-
OutOfMemoryError- 如果内存不足 - 自1.2版本起:
- 1.2
- 另请参阅:
-
hashCode
public int hashCode()返回此Point2D的哈希码。 -
equals
确定两个点是否相等。如果两个Point2D实例的x和y成员字段的值,表示它们在坐标空间中的位置,相同,则它们相等。
-