KLine2d 接口
export interface KLine2d extends KCurve2d 
KLine2d类代表二维空间的一条直线。 我们用一个点加一个向量来确定一条直。
The KLine2d class represents a line in 2d space.
继承: KCurve2d
属性
direction
readonly direction: KVector2d;
获得直线的方向。
Get line's direction.
类型: KVector2d
leftDirection
readonly leftDirection: KVector2d;
获得直线的左侧方向。
Get Line2d's left direction (perpendicular vector pointing to the left side).
类型: KVector2d
origin
readonly origin: KPoint2d;
获得直线的原点。
Get line's origin point
类型: KPoint2d
rightDirection
readonly rightDirection: KVector2d;
获得直线的右侧方向。
Get Line2d's right direction (perpendicular vector pointing to the right side).
类型: KVector2d
方法
onLeftSide
onLeftSide(point: KPoint2d, tol?: number): boolean;
检查一个点是不是在直线的左侧。
Check whether a point is on the left side of the line.
参数:
- 
point: KPoint2d待检查的点。 Point to check. 
- 
tol: number距离容差。如果没有给定,则采用全局容差。 distance tolerance. If it is not provided, then global tolerance is used. 
返回值: boolean
如果点在直线左侧则返回真,否则为假。
True, if the point is on the left side of the line, otherwise false.
onRightSide
onRightSide(point: KPoint2d, tol?: number): boolean;
检查一个点是不是在直线的右侧。
Check whether a point is on the right side of the line.
参数:
- 
point: KPoint2d待检查的点。 Point to check. 
- 
tol: number距离容差。如果没有给定,则采用全局容差。 distance tolerance. If it is not provided, then global tolerance is used. 
返回值: boolean
如果点在直线右侧则返回真,否则为假。
True, if the point is on the right side of the line, otherwise false.
side
side(point: KPoint2d, tol?: number): 1 | 0 | -1;
检查一个点相对当前这条二维直线的位置。如果在曲线左侧,则返回1。如果在曲线上,则返回0。如果在曲线右侧,则返回-1。
Check the position of the point against the current 2d line. Return 1, if the point is on the left side. Return 0, if the point is on the line. Return -1, if the point is one the right side.
参数:
- 
point: KPoint2d待检查的点。 Point to check. 
- 
tol: number距离容差。如果没有给定,则采用全局容差。 distance tolerance. If it is not provided, then global tolerance is used. 
返回值: 1 | 0 | -1
如果在曲线左侧,则返回1。如果在曲线上,则返回0。如果在曲线右侧,则返回-1。
Return 1, if the point is on the left side. Return 0, if the point is on the line. Return -1, if the point is one the right side.