跳到主要内容

KGeomLoop2d 接口

export interface KGeomLoop2d 

二维环的接口类。

The interface of a geometry loop 2d.

方法

area

area(): number;

获得二维环的面积。

The area of the loop2d.

返回值: number

返回二维环的面积。

Return the area of the loop2d.

centroid

centroid(): KPoint2d;

获得二维环的质心。

The centroid of the loop2d.

返回值: KPoint2d

返回二维环的质心。

Return the centroid of the loop2d.

containsPoint

containsPoint(point: KPoint2d, bIncludeOn?: boolean): boolean;

检查传入点是否在二维环中。

Check point is inside of geometry loop2d.

参数:

  • point: KPoint2d

    被判断点。

    The check point

  • bIncludeOn: boolean

    是否考虑二维环的边界, 默认不考虑。 Whether to consider the case: input point is on the loop2d's boundary. True means the point is on the boundary of the loop2d is also be think in loop2d. Default value is false.

返回值: boolean

返回输入点是否在二维环中。

Return true if the point is in loop2d.

getCurves

getCurves(): KBoundedCurve2d[];

获得二维环的所有轮廓线数组。

The curves of a loop2d.

返回值: KBoundedCurve2d[]

返回二维环的所有轮廓线。

Return all curves of the loop2d.

isCCW

isCCW(): boolean;

判断该二维环是否为逆时针。

Whether the loop is counter-clockwise.

返回值: boolean

返回二维环的绕向是否为逆时针。

Return true if the loop2d is counter-clockwise.

isSelfIntersect

isSelfIntersect(): boolean;

该环是否自相交。

Whether the loop is self-intersect.

返回值: boolean

返回二维环是否存在自相交。

Return true if the loop2d is self-intersected.

isValid

isValid(): boolean;

检查该二维环是否有效:是否自相交, 是否封闭,轮廓线是否一个一个首尾向量。 Whether the loop is valid: - no self-intersection, - closed, - connected one by one and tail to head.

返回值: boolean

返回二维环是否有效。

Return true if the loop2d is valid.