KLine2d
kds-plugin-document / Exports / KLine2d
Interface: KLine2d
KLine2d类代表二维空间的一条直线。 我们用一个点加一个向量来确定一条直。
The KLine2d class represents a line in 2d space.
Hierarchy
↳
KLine2d
Table of contents
Properties
Methods
- clone
- getClosestPoint
- getCurvatureVector
- getInterval
- getParam
- getPoint
- getType
- isEqual
- isPointOnCurve
- onLeftSide
- onRightSide
- reverse
- side
- transform
Properties
direction
• Readonly
direction: KVector2d
获得直线的方向。
Get line's direction.
Defined in
api.d.ts:9236
leftDirection
• Readonly
leftDirection: KVector2d
获得直线的左侧方向。
Get Line2d's left direction (perpendicular vector pointing to the left side).
Defined in
api.d.ts:9242
origin
• Readonly
origin: KPoint2d
获得直线的原点。
Get line's origin point
Defined in
api.d.ts:9230
rightDirection
• Readonly
rightDirection: KVector2d
获得直线的右侧方向。
Get Line2d's right direction (perpendicular vector pointing to the right side).
Defined in
api.d.ts:9248
Methods
clone
▸ clone(): KCurve2d
复制一个当前曲线。
Return the cloned curve of this.
Returns
复制的曲线。
The cloned curve.
Inherited from
Defined in
api.d.ts:6447
getClosestPoint
▸ getClosestPoint(point
, tolerance?
): KPoint2d
获得在指定容差下曲线上距离传入点最近的一点。
Get the closest point on curve for the input point with specified tolerance.
Parameters
Name | Type | Description |
---|---|---|
point | KPoint2d | 传入点。 The input point. |
tolerance? | number | 指定容差,默认容差是1e-6。 The specified tolerance.The default value is 1e-6. |
Returns
最近点。
The closest point.
Inherited from
Defined in
api.d.ts:6419
getCurvatureVector
▸ getCurvatureVector(point
): KVector2d
求曲线上某点处的曲率向量。
Get curve's curvature vector for the input point on the curve.
Parameters
Name | Type | Description |
---|---|---|
point | KPoint2d | 曲线上一点。 A point on curve. |
Returns
曲率向量。 向量的模为曲率值,向量的方向为曲率方向。
A curvature vector. Its norm represents the curvature value. Its direction represents the curvature's direction.
Inherited from
Defined in
api.d.ts:6469
getInterval
▸ getInterval(): KInterval
获取曲线的参数域区间。
Get the parameter interval of the curve.
Returns
曲线的参数域区间。
The parameter interval of the curve.
Inherited from
Defined in
api.d.ts:6341
getParam
▸ getParam(point
): number
反求输入点对应的曲线参数值。
Get point's corresponding parameter value on the curve.
Parameters
Name | Type | Description |
---|---|---|
point | KPoint2d | 曲线上的一点。 Point on curve |
Returns
number
输入点对应的曲线参数值。
The corresponding parameter of the point on curve.
Inherited from
Defined in
api.d.ts:6369
getPoint
▸ getPoint(t
): KPoint2d
求曲线参数值对应的曲线上的点位置。
Get the point on the curve specified by the input parameter t.
Parameters
Name | Type | Description |
---|---|---|
t | number | 参数值 Parameter value |
Returns
曲线参数对应的曲线上的点。
The point on the curve for the input parameter.
Inherited from
Defined in
api.d.ts:6355
getType
▸ getType(): KCurve2dType
获得曲线的类型。
Get the curve's type.
Returns
曲线的类型。
The curve's type.
Inherited from
Defined in
api.d.ts:6331
isEqual
▸ isEqual(curve
, tolerance?
): boolean
检查两个曲线在指定容差下是否相等。
Check whether two curves are equal with specified tolerance.
Parameters
Name | Type | Description |
---|---|---|
curve | KCurve2d | - |
tolerance? | number | 指定容差,默认容差是1e-6。 The specified tolerance.The default value is 1e-6. |
Returns
boolean
如果相等上返回true。
Return true if equal, otherwise return false.
Inherited from
Defined in
api.d.ts:6437
isPointOnCurve
▸ isPointOnCurve(point
, tolerance?
): boolean
检查传入点在指定容差下是否位于曲线上。
Check whether the input point is on the curve or not with specified tolerance.
Parameters
Name | Type | Description |
---|---|---|
point | KPoint2d | 传入点。 The input point. |
tolerance? | number | 指定容差,默认容差是1e-6。 The specified tolerance.The default value is 1e-6. |
Returns
boolean
如果在曲线上返回true。
Return true if on the curve, otherwise return false.
Inherited from
Defined in
api.d.ts:6401
onLeftSide
▸ onLeftSide(point
, tol?
): boolean
检查一个点是不是在直线的左侧。
Check whether a point is on the left side of the line.
Parameters
Name | Type | Description |
---|---|---|
point | KPoint2d | 待检查的点。 Point to check. |
tol? | number | 距离容差。如果没有给定,则采用全局容差。 distance tolerance. If it is not provided, then global tolerance is used. |
Returns
boolean
如果点在直线左侧则返回真,否则为假。
True, if the point is on the left side of the line, otherwise false.
Defined in
api.d.ts:9285
onRightSide
▸ onRightSide(point
, tol?
): boolean
检查一个点是不是在直线的右侧。
Check whether a point is on the right side of the line.
Parameters
Name | Type | Description |
---|---|---|
point | KPoint2d | 待检查的点。 Point to check. |
tol? | number | 距离容差。如果没有给定,则采用全局容差。 distance tolerance. If it is not provided, then global tolerance is used. |
Returns
boolean
如果点在直线右侧则返回真,否则为假。
True, if the point is on the right side of the line, otherwise false.
Defined in
api.d.ts:9303
reverse
▸ reverse(): void
把当前曲线反向。
reverse the current curve.
Returns
void
Inherited from
Defined in
api.d.ts:6453
side
▸ side(point
, tol?
): 0
| 1
| -1
检查一个点相对当前这条二维直线的位置。如果在曲线左侧,则返回1。如果在曲线上,则返回0。如果在曲线右侧,则返回-1。
Check the position of the point against the current 2d line. Return 1, if the point is on the left side. Return 0, if the point is on the line. Return -1, if the point is one the right side.
Parameters
Name | Type | Description |
---|---|---|
point | KPoint2d | 待检查的点。 Point to check. |
tol? | number | 距离容差。如果没有给定,则采用全局容差。 distance tolerance. If it is not provided, then global tolerance is used. |
Returns
0
| 1
| -1
如果在曲线左侧,则返回1。如果在曲线上,则返回0。如果在曲线右侧,则返回-1。
Return 1, if the point is on the left side. Return 0, if the point is on the line. Return -1, if the point is one the right side.
Defined in
api.d.ts:9267
transform
▸ transform(matrix
): boolean
对当前曲线进行变换。
Transform this curve to a new one.
Parameters
Name | Type | Description |
---|---|---|
matrix | KMatrix3 | 变换矩阵。 The transform matrix. |
Returns
boolean
当执行正确的话,返回true。
Return true if successful, otherwise return false.
Inherited from
Defined in
api.d.ts:6383