跳到主要内容

KCircle2d 接口

export interface KCircle2d extends KCurve2d 

KCircle2d类代表着二维空间中的一个圆。

The KCircle2d class represents a circle in 2d space.

继承: KCurve2d

属性

center

readonly center: KPoint2d;

获取圆心。

Get center of the circle.

类型: KPoint2d

radius

readonly radius: number;

获取圆的半径。

Get radius of the circle.

方法

getTangent

getTangent(point: KPoint2d): KVector2d;

获取圆上一点的法向量。 注意:传入点需要确保落在圆上。

Get circle's tangent vector of a point on the circle. NOTE: the caller need to make sure the point is on the circle.

参数:

  • point: KPoint2d

    圆上一点。

    A point on the circle.

返回值: KVector2d

切向量。

The tangent vector.

transform

transform(matrix: KMatrix3): boolean;

对当前圆进行变换。 注意:如果变换之后的几何不是一个圆,则会抛出error, 本操作仅支持旋转和平移。

Transform this circle to a new one. NOTE: If the new one is not a circle, it will throw error. Only support for rotate and move translation now.

参数:

  • matrix: KMatrix3

    变换矩阵。

    The transform matrix.

返回值: boolean

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

Return true if successful, otherwise return false.