Class: Triplet

Triplet

A triplet of points.

Constructor

new Triplet(a, b, c)

Constructs a triplet (a, b, c) of points.
Parameters:
Name Type Description
a Point
b Point
c Point
Source:

Members

a

Returns the first point.
Source:

b

Returns the second point.
Source:

c

Returns the third point.
Source:

Methods

copy() → {Triplet}

Returns a new triplet, copied of this.
Source:
Returns:
Type
Triplet

crossProductMagnitude() → {number}

Returns the cross product of the vector ab and bc.
Source:
Returns:
Type
number

isCollinear() → {boolean}

Returns true iff a, b and c are on the same line.
Source:
Returns:
Type
boolean

isIn(p) → {boolean}

Returns true iff p is in the triangle formed by the triplet. Cf. http://stackoverflow.com/a/2049593/1333666
Parameters:
Name Type Description
p Point
Source:
Returns:
Type
boolean

isLeft() → {boolean}

Returns true iff c is left to ab.
Source:
Returns:
Type
boolean

isLeftOn() → {boolean}

Returns true iff c is left to ab or collinear.
Source:
Returns:
Type
boolean

isRight() → {boolean}

Returns true iff c is right to ab.
Source:
Returns:
Type
boolean

isRightOn() → {boolean}

Returns true iff c is right to ab or collinear.
Source:
Returns:
Type
boolean

orientation() → {number}

Returns the orientation of the point c compared to ab. If -1 then c is on the right, else if 0 then c is on the same line that ab, else if 1 then c is on the left.
Source:
Returns:
-1, 0 or 1
Type
number

toString() → {String}

Returns a string representation of the triplet. Each number is represented with at most precision figures after the decimal point.
Source:
Returns:
Type
String