Class VectorMath

Public

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

ClampMagnitudeXZ (v, maxMagnitude)
Public Static
ClosestPointOnLine (lineStart, lineEnd, point)

Returns the closest point on the line.

Public Static
ClosestPointOnLineFactor (lineStart, lineEnd, point)

Factor along the line which is closest to the point.

Public Static
ClosestPointOnLineFactor (lineStart, lineEnd, point)

Factor along the line which is closest to the point.

Public Static
ClosestPointOnLineFactor (lineStart, lineEnd, point)

Factor of the nearest point on the segment.

Public Static
ClosestPointOnSegment (lineStart, lineEnd, point)

Returns the closest point on the segment.

Public Static
ClosestPointOnSegmentXZ (lineStart, lineEnd, point)

Returns the closest point on the segment in the XZ plane.

Public Static
ComplexMultiply (a, b)

Complex number multiplication.

Public Static
ComplexMultiplyConjugate (a, b)

Complex number multiplication.

Public Static
IsClockwiseMarginXZ (a, b, c)

Returns if the points a in a clockwise order.

Public Static
IsClockwiseOrColinear (a, b, c)

Returns true if the points a in a clockwise order or if they are colinear.

Public Static
IsClockwiseOrColinearXZ (a, b, c)

Returns true if the points a in a clockwise order or if they are colinear.

Public Static
IsClockwiseXZ (a, b, c)

Returns if the points a in a clockwise order.

Public Static
IsClockwiseXZ (a, b, c)

Returns if the points a in a clockwise order.

Public Static
IsColinear (a, b, c)

Returns if the points are colinear (lie on a straight line)

Public Static
IsColinear (a, b, c)

Returns if the points are colinear (lie on a straight line)

Public Static
IsColinearAlmostXZ (a, b, c)

Returns if the points are colinear (lie on a straight line)

Public Static
IsColinearXZ (a, b, c)

Returns if the points are colinear (lie on a straight line)

Public Static
IsColinearXZ (a, b, c)

Returns if the points are colinear (lie on a straight line)

Public Static
LineCircleIntersectionFactor (circleCenter, linePoint1, linePoint2, radius)

Intersection of a line and a circle.

Public Static
LineDirIntersectionPointXZ (start1, dir1, start2, dir2)

Intersection point between two infinite lines.

Public Static
LineDirIntersectionPointXZ (start1, dir1, start2, dir2, intersects)

Intersection point between two infinite lines.

Public Static
LineIntersectionFactorXZ (start1, end1, start2, end2, factor1, factor2)

Returns the intersection factors for line 1 and line 2.

Public Static
LineIntersectionFactorXZ (start1, end1, start2, end2, factor1, factor2)

Returns the intersection factors for line 1 and line 2.

Public Static
LineIntersectionFactorXZ (start1, end1, start2, end2)

Returns the intersection factor for line 1 with line 2.

Public Static
LineIntersectionPoint (start1, end1, start2, end2)

Returns the intersection point between the two lines.

Public Static
LineIntersectionPoint (start1, end1, start2, end2, intersects)

Returns the intersection point between the two lines.

Public Static
LineIntersectionPointXZ (start1, end1, start2, end2)

Returns the intersection point between the two lines.

Public Static
LineIntersectionPointXZ (start1, end1, start2, end2, intersects)

Returns the intersection point between the two lines.

Public Static
LineRayIntersectionFactorXZ (start1, end1, start2, end2)

Returns the intersection factor for line 1 with ray 2.

Public Static
MagnitudeXZ (v)
Public Static
Normalize (v, magnitude)

Normalize vector and also return the magnitude.

Public Static
Normalize (v, magnitude)

Normalize vector and also return the magnitude.

Public Static
RaySegmentIntersectXZ (start1, end1, start2, end2)

Returns if the ray (start1, end1) intersects the segment (start2, end2).

Public Static
ReversesFaceOrientations (matrix)

True if the matrix will reverse orientations of faces.

Public Static
ReversesFaceOrientationsXZ (matrix)

True if the matrix will reverse orientations of faces in the XZ plane.

Public Static
RightOrColinear (a, b, p)

Returns if p lies on the right side of the line a - b.

Public Static
RightOrColinear (a, b, p)

Returns if p lies on the right side of the line a - b.

Public Static
RightOrColinearXZ (a, b, p)

Returns if p lies on the left side of the line a - b.

Public Static
RightOrColinearXZ (a, b, p)

Returns if p lies on the left side of the line a - b.

Public Static
RightXZ (a, b, p)

Returns if p lies on the right side of the line a - b.

Public Static
RightXZ (a, b, p)

Returns if p lies on the right side of the line a - b.

Public Static
SegmentIntersectionPointXZ (start1, end1, start2, end2, intersects)

Returns the intersection point between the two line segments in XZ space.

Public Static
SegmentIntersectsBounds (bounds, a, b)

Does the line segment intersect the bounding box.

Public Static
SegmentsIntersect (start1, end1, start2, end2)

Returns if the line segment start2 - end2 intersects the line segment start1 - end1.

Public Static
SegmentsIntersectXZ (start1, end1, start2, end2)

Returns if the line segment start2 - end2 intersects the line segment start1 - end1.

Public Static
SegmentsIntersectXZ (start1, end1, start2, end2)

Returns if the two line segments intersects.

Public Static
SideXZ (a, b, p)

Returns which side of the line a - b that p lies on.

Public Static
SignedTriangleAreaTimes2XZ (a, b, c)

Signed area of a triangle in the XZ plane multiplied by 2.

Public Static
SignedTriangleAreaTimes2XZ (a, b, c)

Signed area of a triangle in the XZ plane multiplied by 2.

Public Static
SqrDistancePointSegment (a, b, p)

Returns the squared distance between p and the segment a-b.

Public Static
SqrDistancePointSegmentApproximate (x, z, px, pz, qx, qz)

Returns the approximate shortest squared distance between x,z and the segment p-q.

Public Static
SqrDistancePointSegmentApproximate (a, b, p)

Returns the approximate shortest squared distance between x,z and the segment p-q.

Public Static
SqrDistanceSegmentSegment (s1, e1, s2, e2)

3D minimum distance between 2 segments.

Public Static
SqrDistanceXZ (a, b)

Squared distance between two points in the XZ plane.

Public Static