跳到主要内容

KCurve2d 接口

export interface KCurve2d 

所有二维曲线的基类。

The root class for all 2d curves.

方法

clone

clone(): KCurve2d;

复制一个当前曲线。

Return the cloned curve of this.

返回值: KCurve2d

复制的曲线。

The cloned curve.

getClosestPoint

getClosestPoint(point: KPoint2d, tolerance?: number): KPoint2d;

获得在指定容差下曲线上距离传入点最近的一点。

Get the closest point on curve for the input point with specified tolerance.

参数:

  • point: KPoint2d

    传入点。

    The input point.

  • tolerance: number

    指定容差,默认容差是1e-6。

    The specified tolerance.The default value is 1e-6.

返回值: KPoint2d

最近点。

The closest point.

getCurvatureVector

getCurvatureVector(point: KPoint2d): KVector2d;

求曲线上某点处的曲率向量。

Get curve's curvature vector for the input point on the curve.

参数:

  • point: KPoint2d

    曲线上一点。

    A point on curve.

返回值: KVector2d

曲率向量。 向量的模为曲率值,向量的方向为曲率方向。

A curvature vector. Its norm represents the curvature value. Its direction represents the curvature's direction.

getInterval

getInterval(): KInterval;

获取曲线的参数域区间。

Get the parameter interval of the curve.

返回值: KInterval

曲线的参数域区间。

The parameter interval of the curve.

getParam

getParam(point: KPoint2d): number;

反求输入点对应的曲线参数值。

Get point's corresponding parameter value on the curve.

参数:

  • point: KPoint2d

    曲线上的一点。

    Point on curve

返回值: number

输入点对应的曲线参数值。

The corresponding parameter of the point on curve.

getPoint

getPoint(t: number): KPoint2d;

求曲线参数值对应的曲线上的点位置。

Get the point on the curve specified by the input parameter t.

参数:

  • t: number

    参数值

    Parameter value

返回值: KPoint2d

曲线参数对应的曲线上的点。

The point on the curve for the input parameter.

getType

getType(): KCurve2dType;

获得曲线的类型。

Get the curve's type.

返回值: KCurve2dType

曲线的类型。

The curve's type.

isEqual

isEqual(curve: KCurve2d, tolerance?: number): boolean;

检查两个曲线在指定容差下是否相等。

Check whether two curves are equal with specified tolerance.

参数:

  • curve: KCurve2d

  • tolerance: number

    指定容差,默认容差是1e-6。

    The specified tolerance.The default value is 1e-6.

返回值: boolean

如果相等上返回true。

Return true if equal, otherwise return false.

isPointOnCurve

isPointOnCurve(point: KPoint2d, tolerance?: number): boolean;

检查传入点在指定容差下是否位于曲线上。

Check whether the input point is on the curve or not with specified tolerance.

参数:

  • point: KPoint2d

    传入点。

    The input point.

  • tolerance: number

    指定容差,默认容差是1e-6。

    The specified tolerance.The default value is 1e-6.

返回值: boolean

如果在曲线上返回true。

Return true if on the curve, otherwise return false.

reverse

reverse(): void;

把当前曲线反向。

reverse the current curve.

返回值: void

transform

transform(matrix: KMatrix3): boolean;

对当前曲线进行变换。

Transform this curve to a new one.

参数:

  • matrix: KMatrix3

    变换矩阵。

    The transform matrix.

返回值: boolean

当执行正确的话,返回true。

Return true if successful, otherwise return false.