Record Class LayoutUtil.Point2D
java.lang.Object
java.lang.Record
cloud.opencode.base.graph.layout.LayoutUtil.Point2D
- Record Components:
x- x-coordinate | x坐标y- y-coordinate | y坐标
- Enclosing class:
LayoutUtil
Immutable 2D point for graph layout.
用于图布局的不可变二维点。
- Since:
- JDK 25, opencode-base-graph V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(LayoutUtil.Point2D other) Add another point (vector addition).doubledistanceTo(LayoutUtil.Point2D other) Calculate distance to another point.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.multiply(double scalar) Multiply by scalar.subtract(LayoutUtil.Point2D other) Subtract another point (vector subtraction).toString()Returns a string representation of this record class.doublex()Returns the value of thexrecord component.doubley()Returns the value of theyrecord component.
-
Constructor Details
-
Point2D
-
-
Method Details
-
distanceTo
Calculate distance to another point. 计算到另一点的距离。- Parameters:
other- the other point | 另一点- Returns:
- distance | 距离
-
add
Add another point (vector addition). 添加另一点(向量加法)。- Parameters:
other- the other point | 另一点- Returns:
- new point | 新点
-
subtract
Subtract another point (vector subtraction). 减去另一点(向量减法)。- Parameters:
other- the other point | 另一点- Returns:
- new point | 新点
-
multiply
Multiply by scalar. 标量乘法。- Parameters:
scalar- the scalar | 标量- Returns:
- new point | 新点
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with thecomparemethod from their corresponding wrapper classes. -
x
-
y
-