跳到主要内容

KLine2d interface

KLine2d类代表二维空间的一条直线。 我们用一个点加一个向量来确定一条直。

The KLine2d class represents a line in 2d space.

Signature:

export interface KLine2d extends KCurve2d 

Links: export interface KLine2d extends KCurve2d

Extends: KCurve2d

Properties

Property

Modifiers

Type

Description

direction

readonly

KVector2d

获得直线的方向。

Get line's direction.

leftDirection

readonly

KVector2d

获得直线的左侧方向。

Get Line2d's left direction (perpendicular vector pointing to the left side).

origin

readonly

KPoint2d

获得直线的原点。

Get line's origin point

rightDirection

readonly

KVector2d

获得直线的右侧方向。

Get Line2d's right direction (perpendicular vector pointing to the right side).

Methods

Method

Description

onLeftSide(point, tol)

检查一个点是不是在直线的左侧。

Check whether a point is on the left side of the line.

onRightSide(point, tol)

检查一个点是不是在直线的右侧。

Check whether a point is on the right side of the line.

side(point, tol)

检查一个点相对当前这条二维直线的位置。如果在曲线左侧,则返回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.