the line-line collision object
- Source
Methods
(static) closest(target, point1, point2) → {Object}
given a target position, finds the closest point on a line
Parameters:
Name | Type | Description |
---|---|---|
target | Object | |
point1 | Object | first endpoint on the line |
point2 | Object | second endpoint on the line |
- Source
Returns:
- closest point
- Type:
- Object
(static) collide(a, b, c, d) → {boolean}
returns true if two lines are colliding
Parameters:
Name | Type | Description |
---|---|---|
a | Object | first endpoint on the first line |
b | Object | second endpoint on the first line |
c | Object | first endpoint on the second line |
d | Object | second endpoint on the second line |
- Source
Returns:
- Type:
- boolean
(static) intersect(a, b, c, d) → {Object}
returns the intersection point of two lines if they are intersecting
Parameters:
Name | Type | Description |
---|---|---|
a | Object | first endpoint on the first line |
b | Object | second endpoint on the first line |
c | Object | first endpoint on the second line |
d | Object | second endpoint on the second line |
- Source
Returns:
- the intersection point
- Type:
- Object