跳到主要内容

KInterval interface

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

The KInterval class represents an interval in 1d space

Signature:

export interface KInterval 

Properties

Property

Modifiers

Type

Description

end

readonly

number

获取区间的终点。

Get end of the interval.

length

readonly

number

获取区间的长度。

Get length of the interval.

middle

readonly

number

获取区间的中点。

Get middle of the interval.

start

readonly

number

获取区间的起点。

Get start of the interval.

Methods

Method

Description

clone()

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

Return the cloned object.

contains(point, includeEnds, disTol)

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

Check whether the interval contains a value.

containsInterval(interval, includeEnds, disTol)

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

Check whether the current interval contains the other interval.

expanded(length)

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

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

interpolate(alpha)

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

Get the interpolated value by the input coefficient.

intersection(interval)

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

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

intersects(interval, includeEnds, disTol)

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

Check whther the current interval intersects with the other interval.

isEqual(other, numTol)

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

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

isValid()

判断当前区间是否合法。

Check whether the interval is valid.

multiplied(num)

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

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

offset(num)

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

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

toString()

把当前区间转成字符串。

Convert the interval to string format.

union(interval)

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

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