collision. lineLine

the line-line collision object

Methods

(static) closest(target, point1, point2) → {Object}

given a target position, finds the closest point on a line

Parameters:
NameTypeDescription
targetObject
point1Object

first endpoint on the line

point2Object

second endpoint on the line

Returns:
  • closest point
Type: 
Object

(static) collide(a, b, c, d) → {boolean}

returns true if two lines are colliding

Parameters:
NameTypeDescription
aObject

first endpoint on the first line

bObject

second endpoint on the first line

cObject

first endpoint on the second line

dObject

second endpoint on the second line

Returns:
Type: 
boolean

(static) intersect(a, b, c, d) → {Object}

returns the intersection point of two lines if they are intersecting

Parameters:
NameTypeDescription
aObject

first endpoint on the first line

bObject

second endpoint on the first line

cObject

first endpoint on the second line

dObject

second endpoint on the second line

Returns:
  • the intersection point
Type: 
Object