Skip to main content

KInterval

kds-plugin-document / Exports / KInterval

Interface: KInterval

KInterval类代表着一维空间中的一个区间。

The KInterval class represents an interval in 1d space

Table of contents

Properties

Methods

Properties

end

Readonly end: number

获取区间的终点。

Get end of the interval.

Defined in

api.d.ts:8826


length

Readonly length: number

获取区间的长度。

Get length of the interval.

Defined in

api.d.ts:8838


middle

Readonly middle: number

获取区间的中点。

Get middle of the interval.

Defined in

api.d.ts:8832


start

Readonly start: number

获取区间的起点。

Get start of the interval.

Defined in

api.d.ts:8820

Methods

clone

clone(): KInterval

克隆当前区间,返回一个新对象。

Return the cloned object.

Returns

KInterval

返回克隆的新对象。

Return the new cloned object.

Defined in

api.d.ts:8866


contains

contains(point, includeEnds, disTol?): boolean

判断当前区间是否包含某个数值。

Check whether the interval contains a value.

Parameters

NameTypeDescription
pointnumber要检查的数值。 The value to check.
includeEndsboolean是否把当前区间当作是闭区间。 Whether take the interval as closed.
disTol?number用于判断包含关系的容差。如果没有给定则采用全局距离容差。 The tolerance used to check the value is containded by the interval. If it is not provided, global distance tolerance will be used.

Returns

boolean

如果区间包含输入值,则返回真,否则为假。

True, if the interval contains the value, otherwise false.

Defined in

api.d.ts:8965


containsInterval

containsInterval(interval, includeEnds, disTol?): boolean

判断当前区间是否包含另外一个区间。

Check whether the current interval contains the other interval.

Parameters

NameTypeDescription
intervalKInterval是否被当前区间包含的另一个区间。 The other interval to be checked.
includeEndsboolean是否把两个区间当作是闭区间。 Whether take the two intervals as closed.
disTol?number用于判断包含关系的容差。如果没有给定则采用全局距离容差。 The tolerance used to check the value is containded by the interval. If it is not provided, global distance tolerance will be used.

Returns

boolean

如果当前区间包含输入的区间,则返回真,否则为假。

True, if current interval contains the other interval, otherwise false.

Defined in

api.d.ts:8988


expanded

expanded(length): KInterval

构建一个新的区间,起点和终点分别是当前区间起点和终点向外扩张给定距离。

Create a new interval whose start and end are expended by the given number.

Parameters

NameTypeDescription
lengthnumber扩张距离。 The expand distance.

Returns

KInterval

一个新区间。

A new interval.

Defined in

api.d.ts:8914


interpolate

interpolate(alpha): number

根据插值系数求得区间起点和终点之间的插值结果。

Get the interpolated value by the input coefficient.

Parameters

NameTypeDescription
alphanumber插值系数。 The interplate coefficient.

Returns

number

区间插值结果。

Interplation result.

Defined in

api.d.ts:8942


intersection

intersection(interval): KInterval

求当前区间和另外一个区间的相交部分,返回相交部分的区间。如果两个区间不相交,则返回一个不合法区间。

Get the intersected part between current interval and the other interval. If two intervals are not intersected, then return an invalid interval.

Parameters

NameTypeDescription
intervalKInterval另外一个区间。 The other interval.

Returns

KInterval

两个区间的相交部分。如果两个区间不相交,则返回一个不合法区间。

A new interval for the intersected parts of the two intervals. If two intervals are not intersected, then return an invalid interval.

Defined in

api.d.ts:9027


intersects

intersects(interval, includeEnds, disTol?): boolean

判断当前区间是否和另外一个区间相交。

Check whther the current interval intersects with the other interval.

Parameters

NameTypeDescription
intervalKInterval输入另一个区间。 The other interval.
includeEndsboolean是否把两个区间当作是闭区间。 Whether take the two intervals as closed.
disTol?number用于判断相交关系的容差。如果没有给定则采用全局距离容差。 The tolerance used to check the two intervals are intersected. If it is not provided, global distance tolerance will be used.

Returns

boolean

返回两个区间是否有交。

Reture true if two intervals have common parts.

Defined in

api.d.ts:9011


isEqual

isEqual(other, numTol?): boolean

判断当前区间和另外一个区间是否相等。

Returns true if this interval equals to another within specified tolerance.

Parameters

NameTypeDescription
otherKInterval另一个区间。 The other interval.
numTol?number用于判断两个区间的起点和终点是否相等的容差。如果不提供,则使用全局容差。 The tolerance used to check whether the starts and ends of two intervals are equal.

Returns

boolean

如果两个区间的起点和终点在容差范围内,则返回真,否则为假。

True, if the starts and ends of two intervals are equal within tolerance. Otherwise, false.

Defined in

api.d.ts:8856


isValid

isValid(): boolean

判断当前区间是否合法。

Check whether the interval is valid.

Returns

boolean

返回区间是否合法。

Return true if the interval is valid.

Defined in

api.d.ts:8886


multiplied

multiplied(num): KInterval

构建一个新区间,起点和终点是当前区间的起点和终点乘上一个数。

Create a new interval whose start and end are multiplied the given number.

Parameters

NameTypeDescription
numnumber乘数 The multiply number.

Returns

KInterval

一个新区间。

A new interval.

Defined in

api.d.ts:8928


offset

offset(num): KInterval

构建一个新的区间,起点和终点分别是当前区间的起点和终点加上输入数值。

Create a new interval which is offset by the given number.

Parameters

NameTypeDescription
numnumber起点和终点需要偏移的数值。 The offset value to be added to start and end.

Returns

KInterval

一个新的区间。

A new interval object.

Defined in

api.d.ts:8900


toString

toString(): String

把当前区间转成字符串。

Convert the interval to string format.

Returns

String

返回区间字符串。

Return the interval string format.

Defined in

api.d.ts:8876


union

union(interval): KInterval

合并当前区间和另外一个区间,返回叠加在一起后的区间。如果两个区间不相交,则返回一个不合法区间。

Combine the current interval and the other interval, return a new interval. If two intervals are not intersected, then return an invalid interval.

Parameters

NameTypeDescription
intervalKInterval另外一个区间。 The other interval.

Returns

KInterval

合并后的区间。如果两个区间不相交,则返回一个不合法区间。

A new interval which has combined the two intervals. If two intervals are not intersected, then return an invalid interval.

Defined in

api.d.ts:9043