Skip to main content

KArc2d

kds-plugin-document / Exports / KArc2d

Interface: KArc2d

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

The KArc2d class represents an arc in 2d space.

Hierarchy

Table of contents

Properties

Methods

Properties

arcAngle

Readonly arcAngle: number

获取圆弧的角度跨度。如果圆弧是逆时针方向的,则角度为正,否则为负。

Get the sweep angle of the arc. The returned value is positive if arc is counter-clockwise, vice versa.

Defined in

api.d.ts:5169


center

Readonly center: KPoint2d

获取当前圆弧的圆心。

Get arc's circle center.

Defined in

api.d.ts:5132


circle

Readonly circle: KCircle2d

获取圆弧所在的圆。

Get the circle of the arc.

Defined in

api.d.ts:5175


endAngle

Readonly endAngle: number

获取圆弧终止角度

Get the end angle of the arc

Defined in

api.d.ts:5162


endPoint

Readonly endPoint: KPoint2d

获得轮廓线的终点。

Get bounded curve's end point.

Inherited from

KBoundedCurve2d.endPoint

Defined in

api.d.ts:5449


isCCW

Readonly isCCW: boolean

判断圆弧是不是逆时针方向

Get whether the arc is ccw or not.

Defined in

api.d.ts:5150


length

Readonly length: number

获得轮廓线的长度。

Get bounded curve's length.

Inherited from

KBoundedCurve2d.length

Defined in

api.d.ts:5461


middlePoint

Readonly middlePoint: KPoint2d

获取当前圆弧的中点。

Get arc's middle point.

Overrides

KBoundedCurve2d.middlePoint

Defined in

api.d.ts:5144


radius

Readonly radius: number

获取当前圆弧的半径长度。

Get arc's circle radius.

Defined in

api.d.ts:5138


startAngle

Readonly startAngle: number

获取圆弧起始角度

Get the start angle of the arc

Defined in

api.d.ts:5156


startPoint

Readonly startPoint: KPoint2d

获得轮廓线的起点。

Get bounded curve's start point.

Inherited from

KBoundedCurve2d.startPoint

Defined in

api.d.ts:5443

Methods

clone

clone(): KCurve2d

复制一个当前曲线。

Return the cloned curve of this.

Returns

KCurve2d

复制的曲线。

The cloned curve.

Inherited from

KBoundedCurve2d.clone

Defined in

api.d.ts:6297


getApproximatePointsByAngle

getApproximatePointsByAngle(angleSpan?): KPoint2d[]

按给定圆心角对当前圆弧进行离散。

Discretize the Arc to points with specified angle.

Parameters

NameTypeDescription
angleSpan?number圆心角(以弧度为单位)。 如果没有输入角度值或者输入值过小(<1.0e-6),则默认使用PI/60个弧度。 Central angle span in radians. If angleSpan is not provided or the value is too small(<1.0e-6), then it will use default value PI/60.

Returns

KPoint2d[]

离散点列。

The discretized points.

Defined in

api.d.ts:5284


getApproximatePointsByRatio

getApproximatePointsByRatio(ratio?): KPoint2d[]

对当前圆弧进行离散,保证相邻两点之间的弦高和弦长之比小于给定的比例值。

Discretize the Arc to points with specified ratio between sagitta and chord length.

Parameters

NameTypeDescription
ratio?number相邻两点之间圆弧段的弦高和弦长之比。 如果没有输入弦高和弦长比例值或者输入值不在(0,1)之间,则默认会采用PI/60为刻度去离散圆弧。 ratio = sagitta / chord length. If ratio is not provided or the value is not between (0,1), then it will use step = PI/60 radians to discretize the arc.

Returns

KPoint2d[]

离散点列。

The discretized points.

Defined in

api.d.ts:5251


getApproximatePointsBySagitta

getApproximatePointsBySagitta(sagitta?): KPoint2d[]

对当前圆弧进行离散,保证相邻两点之间的弦高小于给定值。

Discretize the Arc to points with specified sagitta.

Parameters

NameTypeDescription
sagitta?number相邻两点之间圆弧段的弦高。 如果没有输入弦高值、输入值过小(<1.0e-6)或者过大(> Radius-1.0e-6),则默认会采用PI/60为刻度去离散圆弧。 The sagitta between two adjacent points. If sagitta is not provided or the value is too small(<1.0e-6) or big(> Radius-1.0e-6), then it will use step = PI/60 radians to discretize the arc.

Returns

KPoint2d[]

离散点列。

The discretized points.

Defined in

api.d.ts:5268


getApproximatePointsInfoByNormalTol

getApproximatePointsInfoByNormalTol(normTol?, areaTol?): Object

对当前有界曲线进行离散,保证相邻两点之间的法向夹角小于给定值,相邻两点之间的曲线段和弦之间的近似三角形面积小于给定值。

Discretize bounded curve to points with specified normal tolerance and area tolerance.

Parameters

NameTypeDescription
normTol?number相邻两点之间法向夹角误差(angle < acos(1-normTol))。 如果没有输入法向误差值或者输入值过小(<1.0e-6)或者过大(>1.0 - 1.0e-6),则默认会采用0.01。 The normal tolerance between two adjacent points (angle < acos(1-normTol)). If normTol is not provided or the value is too small(<1.0e-6) or too big(>1.0 - 1.0e-6), then it will use default value 0.01.
areaTol?number相邻两点之间的曲线段和弦之间的近似三角形面积。 如果没有输入面积值或者面积值过小(<1.0e-6), 则不使用面积误差作为判断条件。 The approximate area between the bounded curve and the chord of two adjacent points. If the area is not provided or the vlaue is too small(<1.0e-6), then the check condition will not use the area.

Returns

Object

离散点列和它们的参数值。

The approximate points info which contains the point locations and parameters.

NameType
paramsnumber[]
pointsKPoint2d[]

Inherited from

KBoundedCurve2d.getApproximatePointsInfoByNormalTol

Defined in

api.d.ts:5505


getApproximatePointsInfoByRatio

getApproximatePointsInfoByRatio(ratio?, areaTol?): Object

对当前有界曲线进行离散,保证相邻两点之间的弦高和弦长之比小于给定的比例值,相邻两点之间的曲线段和弦之间的近似三角形面积小于给定值。

Discretize bounded curve to points with specified ratio and area tolerance.

Parameters

NameTypeDescription
ratio?number相邻两点之间曲线段的弦高和弦长之比。 如果没有输入弦高和弦长比例值或者输入值不在(0,1)之间,则默认会采用0.1。 ratio = sagitta / chord length. If ratio is not provided or the value is not between (0,1), then it will use ratio = 0.1 to discretize the bounded curve.
areaTol?number相邻两点之间的曲线段和弦之间的近似三角形面积。 如果没有输入面积值或者面积值过小(<1.0e-6), 则不使用面积误差作为判断条件。 The approximate area between the bounded curve and the chord of two adjacent points. If the area is not provided or the vlaue is too small(<1.0e-6), then the check condition will not use the area.

Returns

Object

离散点列和它们的参数值。

The approximate points info which contains the point locations and parameters.

NameType
paramsnumber[]
pointsKPoint2d[]

Inherited from

KBoundedCurve2d.getApproximatePointsInfoByRatio

Defined in

api.d.ts:5483


getBounding

getBounding(): KBoundingBox2d

获得当前有界曲线的轴对齐的包围盒。

Get the Axis-aligned bounding box of the bounded curve

Returns

KBoundingBox2d

轴对齐的包围盒

the Axis-aligned bounding box

Inherited from

KBoundedCurve2d.getBounding

Defined in

api.d.ts:5555


getClosestPoint

getClosestPoint(point, tolerance?): KPoint2d

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

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

Parameters

NameTypeDescription
pointKPoint2d传入点。 The input point.
tolerance?number指定容差,默认容差是1e-6。 The specified tolerance.The default value is 1e-6.

Returns

KPoint2d

最近点。

The closest point.

Inherited from

KBoundedCurve2d.getClosestPoint

Defined in

api.d.ts:6269


getCurvatureVector

getCurvatureVector(point): KVector2d

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

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

Parameters

NameTypeDescription
pointKPoint2d曲线上一点。 A point on curve.

Returns

KVector2d

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

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

Inherited from

KBoundedCurve2d.getCurvatureVector

Defined in

api.d.ts:6319


getInterval

getInterval(): KInterval

获取曲线的参数域区间。

Get the parameter interval of the curve.

Returns

KInterval

曲线的参数域区间。

The parameter interval of the curve.

Inherited from

KBoundedCurve2d.getInterval

Defined in

api.d.ts:6191


getParam

getParam(point): number

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

Get point's corresponding parameter value on the curve.

Parameters

NameTypeDescription
pointKPoint2d曲线上的一点。 Point on curve

Returns

number

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

The corresponding parameter of the point on curve.

Inherited from

KBoundedCurve2d.getParam

Defined in

api.d.ts:6219


getParamFromAngle

getParamFromAngle(angle): number

把圆周上的角度值转化成当前二维圆弧的参数域上对应的参数值。

Convert angle value to a parameter value in the parameter interval of the current 2d arc.

Parameters

NameTypeDescription
anglenumber角度值。 angle vlaue.

Returns

number

当前圆弧的参数域上对应的参数。

The corresponding parameter in the arc parameter interval.

Defined in

api.d.ts:5189


getPoint

getPoint(t): KPoint2d

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

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

Parameters

NameTypeDescription
tnumber参数值 Parameter value

Returns

KPoint2d

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

The point on the curve for the input parameter.

Inherited from

KBoundedCurve2d.getPoint

Defined in

api.d.ts:6205


getRegularizeAngleFromParam

getRegularizeAngleFromParam(param): number

把当前圆弧的一个参数值转化成正规的角度值。

Convert a parameter value of the current 2d arc to be a regular angle value in [0, 2PI).

Parameters

NameTypeDescription
paramnumber当前圆弧的参数区间上的一个参数值。 A parameter in the parameter interval of the current 2d arc.

Returns

number

一个0到2*PI之间的正规角度值。

A regular angle value in [0, 2PI).

Defined in

api.d.ts:5203


getTangent

getTangent(point): KVector2d

获得圆弧上一点处的切向量。 注意:该函数调用需要确保传入点在圆弧上。

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

Parameters

NameTypeDescription
pointKPoint2d圆弧上一点。 A point on the arc.

Returns

KVector2d

切向量。

The tangent vector.

Defined in

api.d.ts:5219


getType

getType(): KCurve2dType

获得曲线的类型。

Get the curve's type.

Returns

KCurve2dType

曲线的类型。

The curve's type.

Inherited from

KBoundedCurve2d.getType

Defined in

api.d.ts:6181


isEqual

isEqual(curve, tolerance?): boolean

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

Check whether two curves are equal with specified tolerance.

Parameters

NameTypeDescription
curveKCurve2d-
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

KBoundedCurve2d.isEqual

Defined in

api.d.ts:6287


isPointOnCurve

isPointOnCurve(point, tolerance?): boolean

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

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

Parameters

NameTypeDescription
pointKPoint2d传入点。 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

KBoundedCurve2d.isPointOnCurve

Defined in

api.d.ts:6251


reverse

reverse(): void

把当前曲线反向。

reverse the current curve.

Returns

void

Inherited from

KBoundedCurve2d.reverse

Defined in

api.d.ts:6303


splitByPoint

splitByPoint(point, distTol?): KBoundedCurve2d[]

把当前有界曲线按给定点分成两段。

Split the bounded curve into two segments by the given point.

Parameters

NameTypeDescription
pointKPoint2d分割点。 split point.
distTol?number距离容差。如果不给定,则使用全局容差。 Distance tolerance. If not provided, then global tolerance will be used.

Returns

KBoundedCurve2d[]

多段有界曲线。 如果分割点靠近当前有界曲线的起点或者终点,则返回一条克隆曲线。

Multiple segments of bounded curves. If the split point is close to start or end point, a cloned bounded curve will be returned.

Inherited from

KBoundedCurve2d.splitByPoint

Defined in

api.d.ts:5545


splitByPoints

splitByPoints(points, distTol?): KBoundedCurve2d[]

把当前有界曲线按给定点分成多段。

Split the bounded curve into multiple segments by the given points.

Parameters

NameTypeDescription
pointsKPoint2d[]分割点列。 split points.
distTol?number距离容差。如果不给定,则使用全局容差。 Distance tolerance. If not provided, then global tolerance will be used.

Returns

KBoundedCurve2d[]

多段有界曲线。 如果点列只包含起点和终点,则返回空数组。

Multiple segments of bounded curves. If points only contain start and end points, empty array will be returned.

Inherited from

KBoundedCurve2d.splitByPoints

Defined in

api.d.ts:5525


transform

transform(matrix): boolean

对当前圆弧应用一转换矩阵,从而实现对其几何变换。 如果转换后的几何不是圆弧,将会抛出error。

Transform this arc to a new one If the new one is not a arc, it will throw an error.

Parameters

NameTypeDescription
matrixKMatrix3转换矩阵。 The transform matrix.

Returns

boolean

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

Return true if successful, otherwise return false.

Overrides

KBoundedCurve2d.transform

Defined in

api.d.ts:5235