Methods
(static) lineCircleIntersection(p1, p2, center, r, internal)
find the intersection points between a line and a circle, return null if they don't intersect
Parameters:
Name | Type | Default | Description |
---|---|---|---|
p1 |
Vector | an object with x, y property denoting a point, can be a p5.Vector object | |
p2 |
Vector | an object with x, y property denoting a point, can be a p5.Vector object | |
center |
Vector | an object with x, y property denoting a point, can be a p5.Vector object | |
r |
number | radius of the circle | |
internal |
boolean | false | flag for calling this internally within the library, return only info needed |
Returns:
an array of two points or null
(static) lineIntersection(p0, p1, p2, p3, segment)
find the intersection point between two line, return null if they don't intersect
Parameters:
Name | Type | Default | Description |
---|---|---|---|
p0 |
Vector | an object with x, y property denoting a point, can be a p5.Vector object | |
p1 |
Vector | an object with x, y property denoting a point, can be a p5.Vector object | |
p2 |
Vector | an object with x, y property denoting a point, can be a p5.Vector object | |
p3 |
Vector | an object with x, y property denoting a point, can be a p5.Vector object | |
segment |
boolean | false | if true, check only if line segments defined by the point intersect, default is false |
Returns:
the intersection point
(static) rotateVector(v, ang)
rotate an vector by an angle, return a new object {x, y}
Parameters:
Name | Type | Description |
---|---|---|
v |
Vector | |
ang |
number |
Returns:
new vector