跳到主要内容

KSurface 接口

export interface KSurface 

三维空间所有面的基类。

Root class for all surface in 3d space.

方法

clone

clone(): KSurface;

复制一个当前面。

Return the cloned surface of this.

返回值: KSurface

复制的面。

The cloned surface.

coplanar

coplanar(other: KSurface, tolerance?: number): boolean;

考虑两个面的边界,以指定容差检查两个面是否共面。

Check whether two surface are coplanar with respecting their sides and specified tolerance.

参数:

  • other: KSurface

    要比较的另一个面。

    The surface to compare this surface with.

  • tolerance: number

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

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

返回值: boolean

如果共面返回true。

Return true if coplanar, otherwise return false.

coplanarUnsigned

coplanarUnsigned(other: KSurface, tolerance?: number): boolean;

忽略两个面的边界,以指定容差检查两个面是否共面。

Check whether two surface are coplanar by ignoring their sides with specified tolerance.

参数:

  • other: KSurface

    要比较的另一个面。

    The surface to compare this surface with.

  • tolerance: number

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

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

返回值: boolean

如果共面返回true。

Return true if coplanar, otherwise return false.

distanceToPoint

distanceToPoint(point: KPoint3d): number;

获得点到面的距离。

Get the distance from the input point to this surface.

参数:

  • point: KPoint3d

    传入点。

    The input point.

返回值: number

传入的点到面的距离。

The distance from the input point to this surface.

faceToUV

faceToUV(face: KFace3d): KUVFace;

通过面的UV参数坐标系将三维面转换成二维面。 注意:需要保证该三维面落在面上。

Convert a 3D face to 2d face based on surface's uv coordinate system. NOTE: The caller needs to make sure the face is on the surface.

参数:

  • face: KFace3d

    输入的三维面。

    The input 3D face.

返回值: KUVFace

二维面。

The 2D face.

getClosestPoint

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

获得面上距离传入点最近的一点,以指定容差。

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

参数:

  • point: KPoint3d

    输入点。

    The input point.

  • tolerance: number

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

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

返回值: KPoint3d

最近点。

The closest point.

getType

getType(): KSurfaceType;

获取面的类型。

Get the surface's type.

返回值: KSurfaceType

面的类型。

The surface's type.

getUVPoint

getUVPoint(point: KPoint3d): KPoint2d;

通过面的UV参数坐标系将三维点转换成二维点。 需要确保传入点在面上。 输出点的x坐标是传入点的u参数。 y坐标是v参数。

Get a 2d point corresponding to a 3d point on the surface. We need make sure the input point is on the surface. The returned point's x coordinate is parameter u of the input 3d point. y coordinate is parameter v of the input 3d point.

参数:

  • point: KPoint3d

    面上一点。

    The input point on the surface

返回值: KPoint2d

二维点。

The 2d point

isCurveOnSurface

isCurveOnSurface(curve: KCurve3d, tolerance?: number): boolean;

以指定容差检查输入曲线是否在面上。

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

参数:

  • curve: KCurve3d

    传入曲线。

    The input curve.

  • tolerance: number

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

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

返回值: boolean

如果在面上返回true。

Return true if on the surface, otherwise return false.

isPointOnSurface

isPointOnSurface(point: KPoint3d, tolerance?: number): boolean;

以指定容差检查输入点是否在面上。

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

参数:

  • point: KPoint3d

    输入点。

    The input point.

  • tolerance: number

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

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

返回值: boolean

如果在面上返回true。

Return true if on the surface, otherwise return false.

loopToUV

loopToUV(loop: KLoop3d): KUVLoop;

通过面的UV参数坐标系将三维环转换成二维环。 注意:需要保证该三维环落在面上。

Convert a 3D loop to 2d loop based on surface's uv coordinate system. NOTE: The caller needs to make sure the loop is on the surface.

参数:

  • loop: KLoop3d

    输入的三维环。

    The input 3D loop.

返回值: KUVLoop

二维环。

The 2D loop.

signedDistanceTo

signedDistanceTo(point: KPoint3d): number;

获得点到面的距离, 如果点在面的正向则距离为正,否则为负。

Get signed distance between the point and the plane. If the point is on the positive normal side, the sign is +, otherwise it's -

参数:

  • point: KPoint3d

    传入点。

    The input point.

返回值: number

传入的点到面的距离。

The distance from the input point to this surface.

transform

transform(matrix: KMatrix4): boolean;

对当前面应用一转换矩阵,从而实现对其几何变换。

Transform this surface to a new one.

参数:

  • matrix: KMatrix4

    转换矩阵。

    The transform matrix.

返回值: boolean

当执行正确的话,返回true;否则为false.。

Return true if successful, otherwise return false.