Class VectorMath
Various vector math utility functions.
Version
A lot of functions in the Polygon class have been moved to this class the names have changed slightly and everything now consistently assumes a left handed coordinate system now instead of sometimes using a left handed one and sometimes using a right handed one. This is why the 'Left' methods in the Polygon class redirect to methods named 'Right'. The functionality is exactly the same.
Note the difference between segments and lines. Lines are infinitely long but segments have only a finite length.
Public Static Methods
Calculates the intersection points between a "capsule" (segment expanded by a radius), and a line.
Returns the closest point on the line.
Factor along the line which is closest to the point.
Factor along the line which is closest to the point.
Factor of the nearest point on the segment.
Returns the closest point on the segment.
Returns the closest point on the segment in the XZ plane.
Complex number multiplication.
Complex number multiplication.
Determinant of the 2x2 matrix [c1, c2].
Returns if the points a in a clockwise order.
Returns true if the points a in a clockwise order or if they are colinear.
Returns true if the points a in a clockwise order or if they are colinear.
Returns if the points a in a clockwise order.
Returns if the points a in a clockwise order.
Returns if the points are colinear (lie on a straight line)
Returns if the points are colinear (lie on a straight line)
Returns if the points are colinear (lie on a straight line)
Returns if the points are colinear (lie on a straight line)
Returns if the points are colinear (lie on a straight line)
Intersection of a line and a circle.
Calculates the two intersection points (point + direction*t) on the line where it intersects with a circle at the origin.
Intersection point between two infinite lines.
Intersection point between two infinite lines.
Returns the intersection factors for line 1 and line 2.
Returns the intersection factors for line 1 and line 2.
Returns the intersection factor for line 1 with line 2.
Returns the intersection point between the two lines.
Returns the intersection point between the two lines.
Returns the intersection point between the two lines.
Returns the intersection point between the two lines.
Calculates the point start1 + dir1*t where the two infinite lines intersect.
Calculates the point start1 + dir1*factor1 == start2 + dir2*factor2 where the two infinite lines intersect.
Returns the intersection factor for line 1 with ray 2.
Normalize vector and also return the magnitude.
Normalize vector and also return the magnitude.
Returns if the ray (start1, end1) intersects the segment (start2, end2).
True if the matrix will reverse orientations of faces.
True if the matrix will reverse orientations of faces in the XZ plane.
Returns if p lies on the right side of the line a - b.
Returns if p lies on the right side of the line a - b.
Returns if p lies on the left side of the line a - b.
Returns if p lies on the left side of the line a - b.
Returns if p lies on the right side of the line a - b.
Returns if p lies on the right side of the line a - b.
Returns the intersection point between the two line segments in XZ space.
Does the line segment intersect the bounding box.
Returns if the line segment start2 - end2 intersects the line segment start1 - end1.
Returns if the line segment start2 - end2 intersects the line segment start1 - end1.
Returns if the two line segments intersects.
Returns which side of the line a - b that p lies on.
Signed area of a triangle in the XZ plane multiplied by 2.
Signed area of a triangle in the XZ plane multiplied by 2.
Returns the squared distance between p and the segment a-b.
Returns the approximate shortest squared distance between x,z and the segment p-q.
Returns the approximate shortest squared distance between x,z and the segment p-q.
3D minimum distance between 2 segments.
Squared distance between two points in the XZ plane.