Options
All
  • Public
  • Public/Protected
  • All
Menu
classdesc

A line consists of two vertices a and b.

This is some refactored code from my 'Morley Triangle' test
https://github.com/IkarosKappler/morleys-trisector-theorem

requires

Vertex

Hierarchy

Implements

Index

Constructors

constructor

Properties

a

member

{Vertex}

memberof

VertTuple

instance

b

member

{Vertex}

memberof

VertTuple

instance

Readonly className

className: string = "Line"

Required to generate proper CSS classes and other class related IDs.

isDestroyed

isDestroyed: boolean
member

isDestroyed

memberof

VertTuple

instance

Readonly uid

uid: UID

The UID of this drawable object.

member

{UID}

memberof

VertTuple

instance
readonly

Methods

add

angle

  • Get the angle between this and the passed line (in radians).

    method

    angle

    instance
    memberof

    VertTuple

    Parameters

    • Optional line: VertTuple<any>

      (optional) The line to calculate the angle to. If null the baseline (x-axis) will be used.

    Returns number

    this

clone

colinear

  • Checks if this and the given line are co-linear.

    The constant Vertex.EPSILON is used for tolerance.

    method

    colinear

    instance
    memberof

    VertTuple

    Parameters

    Returns boolean

    true if both lines are co-linear.

denominator

  • Get the denominator of this and the given line.

    If the denominator is zero (or close to zero) both line are co-linear.

    method

    denominator

    instance
    memberof

    VertTuple

    Parameters

    Returns number

destroy

  • destroy(): void
  • This function should invalidate any installed listeners and invalidate this object. After calling this function the object might not hold valid data any more and should not be used.

    Returns void

getClosestPoint

  • Get the closest point on this line to the specified point.

    method

    getClosestPoint

    instance
    memberof

    VertTuple

    Parameters

    • p: Vertex

      The point (vertex) to measre the distance to.

    Returns Vertex

    The point on the line that is closest to p.

getClosestT

  • Get the closest position T from this line to the specified point.

    The counterpart for this function is Line.vertAt(Number).

    name

    getClosetT

    method

    getClosestT

    instance
    memberof

    VertTuple

    Parameters

    • p: XYCoords

      The point (vertex) to measure the distance to.

    Returns number

    The line position t of minimal distance to p.

hasPoint

  • hasPoint(point: XYCoords, insideBoundsOnly?: boolean): boolean
  • Check if the given point is located on this line. Optionally also check if that point is located between point a and b.

    method

    hasPoint

    instance
    memberof

    VertTuple

    Parameters

    • point: XYCoords

      The point to check.

    • Optional insideBoundsOnly: boolean

      If set to to true (default=false) the point must be between start and end point of the line.

    Returns boolean

    True if the given point is on this line.

intersection

  • Get the intersection if this line and the specified line.

    method

    intersection

    instance
    memberof

    Line

    Parameters

    • line: Line

      The second line.

    Returns Vertex | undefined

    The intersection (may lie outside the end-points) or undefined if both lines are parallel.

length

  • length(): number

moveTo

normalize

pointDistance

  • pointDistance(p: Vertex): number
  • The the minimal distance between this line and the specified point.

    method

    pointDistance

    instance
    memberof

    VertTuple

    Parameters

    • p: Vertex

      The point (vertex) to measre the distance to.

    Returns number

    The absolute minimal distance.

scale

setLength

  • Set the length of this vector to the given amount. This only works if this vector is not a null vector.

    method

    setLength

    memberof

    VertTuple

    Parameters

    • length: number

      The desired length.

    Returns VertTuple<Line>

    this (for chaining)

sub

toString

  • toString(): string
  • Create a string representation of this line.

    method

    totring

    instance
    memberof

    VertTuple

    Returns string

    The string representing this line.

vertAt

  • Get line point at position t in [0 ... 1]:

    [P(0)]=[A]--------------------[P(t)]------[B]=[P(1)]


    The counterpart of this function is Line.getClosestT(Vertex).
    method

    vertAt

    instance
    memberof

    VertTuple

    Parameters

    • t: number

      The position scalar.

    Returns Vertex

    The vertex a position t.

Object literals

Static Private vtutils

vtutils: object

dist2

Legend

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

Generated using TypeDoc