Options
All
  • Public
  • Public/Protected
  • All
Menu

表示三维世界的一条线

Class representing a line in Three-dimensional coordinate system

Hierarchy

  • Line3

Index

Constructors

constructor

Properties

end

end: Vector3 = ...

线的终点

Ending point of line or segment

start

start: Vector3 = ...

线的起点

Starting point of line or segment

Accessors

center

direction

length

  • get length(): number

lengthSq

  • get lengthSq(): number
  • 线段长度的平方

    Gets the squared length of the current line

    Returns number

Methods

getAlpha

  • getAlpha(point: Vector3, isSegment?: boolean): number
  • 计算点在线上的比例

    Gets the interpolated number

    Parameters

    • point: Vector3

      目标点

    • isSegment: boolean = false

      是否将直线作为线段考虑(线段的取值范围只有 [0, 1])

    Returns number

getDistance

  • getDistance(point: Vector3, isSegment?: boolean): number
  • 获取点到线的距离

    Gets the distance from the point to the current line

    Parameters

    • point: Vector3

      target point

    • isSegment: boolean = false

      Whether to treat the current line as a segment

    Returns number

getProjectedPoint

  • getProjectedPoint(point: Vector3, isSegment?: boolean, useSegmentEnd?: boolean): Vector3
  • 获取点在线上的投影点

    Gets the projected point of the point onto the current line

    Parameters

    • point: Vector3

      目标点 target point

    • isSegment: boolean = false

      是否线段 Whether to treat the current line as a segment

    • useSegmentEnd: boolean = false

      在将直线视为线段的情况下,如果投影点在线段外,是返回线段的端点还是 undefined. (When the projection point is beyond the line segment, use the end of the line segment as the projection point)

    Returns Vector3

interpolate

  • interpolate(alpha: number): Vector3
  • 根据线性比例计算线上的一点

    Gets linear interpolation between start and end of this line

    Parameters

    • alpha: number

    Returns Vector3

isOrthogonal

  • isOrthogonal(line: Line3): boolean
  • 和 line 是否正交垂直

    Determine whether the current line and line area orthogonal

    Parameters

    • line: Line3

      目标直线

    Returns boolean

isParallel

  • isParallel(line: Line3): boolean
  • 和 line 是否平行

    Determine whether the current line and line area parallel

    Parameters

    • line: Line3

      目标直线

    Returns boolean

isPointOnLine

  • isPointOnLine(point: Vector3, tolerance?: number): boolean
  • 点是否在直线上

    Determines if the point is on the line

    Parameters

    • point: Vector3

      目标点

    • tolerance: number = ...

      容差

    Returns boolean

isPointOnSegment

  • isPointOnSegment(point: Vector3, tolerance?: number): boolean
  • 点是否在线段上

    Determine if the point is on the segment

    Parameters

    • point: Vector3

      目标点

    • tolerance: number = ...

      容差

    Returns boolean

set

  • 设置起点和终点

    Sets the start and the end of this line

    Parameters

    • start: Vector3

      Starting point of line or segment

    • end: Vector3

      Ending point of line or segment

    Returns Line3

    当前实例 (This line)

setEnd

  • 设置终点

    Sets the end of this line

    Parameters

    • point: Vector3

      Ending point of line or segment

    Returns Line3

    当前实例 (This line)

setStart

  • 设置起点

    Sets the start of this line

    Parameters

    • point: Vector3

      Starting point of line or segment

    Returns Line3

    当前实例 (This line)

translate

Legend

  • Constructor
  • Property
  • Method
  • Static property
  • Static method
  • Property
  • Private property

Generated using TypeDoc