KPoint2d
kds-plugin-document / Exports / KPoint2d
Interface: KPoint2d
KPoint2d类代表一个二维点。 二维点有二个坐标。 二维点的坐标是不可变的。
The KPoint2d class represents a 2D point. A 2D point is an ordered triplet of numbers (labeled x, y). NOTE: KPoint2d's x, y are immutable.
Table of contents
Properties
Methods
Properties
x
• Readonly
x: number
获得x坐标。
Get point's x value.
Defined in
api.d.ts:9462
y
• Readonly
y: number
获得y坐标。
Get point's y value.
Defined in
api.d.ts:9468
Methods
added
▸ added(vec
): KPoint2d
对当前点应用一向量,实现对点的平移。
Return a new KPoint3d which is this point add the input vector.
Parameters
Name | Type |
---|---|
vec | KVector2d |
Returns
新的点。
The new point.
Defined in
api.d.ts:9500
appliedMatrix3
▸ appliedMatrix3(matrix
): KPoint2d
通过一个矩阵对当前点进行变换,获得一新点。
Return a new KPoint3d which is the result of this point transformed by the input matrix.
Parameters
Name | Type | Description |
---|---|---|
matrix | KMatrix3 | 传入变换矩阵。 the input transform matrix. |
Returns
新点。
The new point.
Defined in
api.d.ts:9566
clone
▸ clone(): KPoint2d
复制一个当前点。
Return the cloned point of this.
Returns
复制点。
The cloned point.
Defined in
api.d.ts:9552
distanceTo
▸ distanceTo(other
): number
求当前点到另一个点的距离。
Get the distance to another point.
Parameters
Name | Type | Description |
---|---|---|
other | KPoint2d | 另外一个点。 The other point. |
Returns
number
两点之间距离。
The distance between the two points.
Defined in
api.d.ts:9528
isEqual
▸ isEqual(other
, tolerance?
): boolean
检查两个点在特定容差下是否相等。
Check whether two points are equal with specified tolerance.
Parameters
Name | Type | Description |
---|---|---|
other | KPoint2d | 需要比较的点。 The point to compare this point with. |
tolerance? | number | 指定容差,默认值为1e-6。 The specified tolerance.The default value is 1e-6. |
Returns
boolean
如果相等则返回true。
Return true if equal, otherwise return false.
Defined in
api.d.ts:9486
squaredDistanceTo
▸ squaredDistanceTo(other
): number
求当前点到另一个点的平方距离。
Get the distance to another point.
Parameters
Name | Type | Description |
---|---|---|
other | KPoint2d | 另外一个点。 The other point. |
Returns
number
两点之间平方距离。
The square distance between the two points.
Defined in
api.d.ts:9542
subtracted
▸ subtracted(point
): KVector2d
获得由目标点指向当前点的向量。
Return a new KVector3d which is this point subtract another point.
Parameters
Name | Type | Description |
---|---|---|
point | KPoint2d | 要减的点。 The point to subtract. |
Returns
新的向量。
The new vector.
Defined in
api.d.ts:9514