# Geometric

## Description

`static` `class` `Tinman.Core.Math.Geometric`

Helper class for computing geometric intersections.

## Public / Methods

`[Pure]`
`public` `static` `method` `AngleAdd` → `(2)`

in : float64

Cosine of first angle to add.

in : float64

Cosine of second angle to add.

returns → float64

This method computes `cos(acos(a) + acos(b))` without trigonometric functions: `a * b - sqrt(1 - a^2) * sqrt(1 - b^2)`

### AngleFlip

`[Pure]`
`public` `static` `method` `AngleFlip` → `(1)`

in : float64

Cosine of angle to flip.

returns → float64

Cosine of flipped angle.

Flips the given angle at 90°.

This method computes `cos(90° - acos(a))` without trigonometric functions: `sqrt(1 - a^2)`

### AngleSub

`[Pure]`
`public` `static` `method` `AngleSub` → `(2)`

in : float64

Cosine of first angle to subtract in the range.

in : float64

Cosine of second angle to subtract.

returns → float64

Cosine of subtracted angle.

Subtracts the given cosine angles.

This method computes `cos(acos(a) - acos(b))` without trigonometric functions: `a * b + sqrt(1 - a^2) * sqrt(1 - b^2)`

For common values of in, the formula reduces to these forms:

• cos(90°) => sqrt(1 - b^2)

• cos(180°) => -b

### AreaPolygon

`public` `static` `method` `AreaPolygon` → `(3)`

in : Vec2D [ ]

`[not-null]`
The polygon vertices.

in : int32

`[0..v.Length-1]`
Index of first polygon vertex.

in : int32

`[0..v.Length-1]`
Index of last polygon vertex.

returns → float64

The signed area of the simple polygon.

Computes the signed area of the given simple polygon.

The polygon is defined as follows:

```v[a    ] := first polygon vertex
v[a + n] := n-th polygon vertex
v[b    ] := last polygon vertex (not equal to first)

where b - a >= 2
b - a >= n >= 0```

Inverting the order of the polygon vertices will flip the sign of the area value. For a standard Cartesian coordinate system (X-axis points to the right, Y-axis points upwards), clockwise polygons have negative area values and counter-clockwise polygons have positive area values.

### AreaTriangle

`[Pure]`
`public` `static` `method` `AreaTriangle1` → `(3)`

v1 in : Vec2D

First vertex of triangle.

v2 in : Vec2D

Second vertex of triangle.

v3 in : Vec2D

Third vertex of triangle.

returns → float64

The signed area of the triangle.

Computes the area of the given triangle.

`[Pure]`
`public` `static` `method` `AreaTriangle2` → `(6)`

x1 in : float64

X-coordinate of first vertex of triangle.

y1 in : float64

Y-coordinate of first vertex of triangle.

x2 in : float64

X-coordinate of second vertex of triangle.

y2 in : float64

Y-coordinate of second vertex of triangle.

x3 in : float64

X-coordinate of third vertex of triangle.

y3 in : float64

Y-coordinate of third vertex of triangle.

returns → float64

The signed area of the triangle.

Computes the area of the given triangle.

`[Pure]`
`public` `static` `method` `AreaTriangle3` → `(3)`

v1 in : Vec3D

First vertex of triangle.

v2 in : Vec3D

Second vertex of triangle.

v3 in : Vec3D

Third vertex of triangle.

returns → float64

The area of the triangle.

Computes the area of the given triangle.

`[Pure]`
`public` `static` `method` `AreaTriangle4` → `(9)`

x1 in : float64

X-coordinate of first vertex of triangle.

y1 in : float64

Y-coordinate of first vertex of triangle.

z1 in : float64

Z-coordinate of first vertex of triangle.

x2 in : float64

X-coordinate of second vertex of triangle.

y2 in : float64

Y-coordinate of second vertex of triangle.

z2 in : float64

Z-coordinate of second vertex of triangle.

x3 in : float64

X-coordinate of third vertex of triangle.

y3 in : float64

Y-coordinate of third vertex of triangle.

z3 in : float64

Z-coordinate of third vertex of triangle.

returns → float64

The area of the triangle.

Computes the area of the given triangle.

### CartesianToSpherical

`[Pure]`
`public` `static` `method` `CartesianToSpherical1` → `(1)`

cartesian in : Vec3D

The cartesian coordinates.

returns → Vec3D

The spherical coordinates.

Converts the given cartesian coordinates into spherical coordinates.

The components of the returned vector have the following semantic:

```spherical.X := radius (distance to origin).
spherical.Y := azimuthal angle (angle from positive X-axis in radians) in the range [-PI..PI].
spherical.Z := polar angle (angle from positive Z-axis in radians) in the range [0..PI].```

`[Pure]`
`public` `static` `method` `CartesianToSpherical2` → `(3)`

in : float64

The cartesian X-coordinate.

in : float64

The cartesian Y-coordinate.

in : float64

The cartesian Z-coordinate.

returns → Vec3D

The spherical coordinates.

Converts the given cartesian coordinates into spherical coordinates.

The components of the returned vector have the following semantic:

```spherical.X := radius (distance to origin).
spherical.Y := azimuthal angle (angle from positive X-axis in radians) in the range [-PI..PI].
spherical.Z := polar angle (angle from positive Z-axis in radians) in the range [0..PI].```

### CheckIntersectionOfLineSegments

`[Pure]`
`public` `static` `method` `CheckIntersectionOfLineSegments1` → `(4)`

v1 in : Vec2D

Start of first line segment.

v2 in : Vec2D

End of first line segment.

v3 in : Vec2D

Start of second line segment.

v4 in : Vec2D

End of second line segment.

returns → bool

`true` if the line segments intersect, `false` if not.

Checks if the given line segments intersect.

`[Pure]`
`public` `static` `method` `CheckIntersectionOfLineSegments2` → `(8)`

x1 in : float64

X-coordinate of start of first line segment.

y1 in : float64

Y-coordinate of start of first line segment.

x2 in : float64

X-coordinate of end of first line segment.

y2 in : float64

Y-coordinate of end of first line segment.

x3 in : float64

X-coordinate of start of second line segment.

y3 in : float64

X-coordinate of start of second line segment.

x4 in : float64

X-coordinate of end of second line segment.

y4 in : float64

X-coordinate of end of second line segment.

returns → bool

`true` if the line segments intersect, `false` if not.

Checks if the given line segments intersect.

### ConeFitAngle

`[Pure]`
`public` `static` `method` `ConeFitAngle` → `(3)`

in : float64

X-coordinate of sphere center.

in : float64

Y-coordinate of sphere center.

in : float64

returns → float64

The opening angle of the cone, in radians. Will be Maths.NanD if in, in or in is negative or if the cone apex is inside of the sphere.

Computes the opening angle of the right circular cone having the smallest volume that contains the given sphere.

The cone apex is at (0,0,0). The cone axis is collinear to (1,0,0). The sphere center is at (in, in, 0).

### ConeFitDistance

`[Pure]`
`public` `static` `method` `ConeFitDistance` → `(4)`

in : float64

The cone opening angle, in radians.

in : float64

X-coordinate of sphere center.

in : float64

Y-coordinate of sphere center.

in : float64

returns → float64

The translation along the X-axis that must be applied to the cone apex in order to make the cone touch the sphere, while containing it. Will be Maths.NanD if in or in is negative or if in is outside of the range ]0..pi[.

Computes the translation that must be applied to the given right circular to make it contain the given sphere, while only touching it in a single point.

The cone apex is at (0,0,0). The cone axis is collinear to (1,0,0). The sphere center is at (in, in, 0).

### DistanceLineToLine

`[Pure]`
`public` `static` `method` `DistanceLineToLine` → `(4)`

s1 in : Vec3D

Point on first line.

v1 in : Vec3D

Direction vector of first line.

s2 in : Vec3D

Point on second line.

v2 in : Vec3D

Direction vector of second line.

returns → Vec2D

The coefficient vector for computing the two nearest points on both lines:

```p1 = s1 + v1 * X
p2 = s2 + v2 * Y```

Computes the pair of nearest points on two lines.

### DistancePointToHorizon

`[Pure]`
`public` `static` `method` `DistancePointToHorizon` → `(2)`

point in : Vec3D

The point coordinates.

`[>0]`

returns → float64

The distance to the horizon, in terrain-space.

Computes the distance from the given point to the horizon circle on a sphere centered at the coordinate origin and having the given radius.

### DistancePointToLine

`public` `static` `method` `DistancePointToLine` → `(3)`

in : Vec3D

The point.

in : Vec3D

A point on the line.

in : Vec3D

Unit-length direction vector of the line.

returns → Vec3D

The point on the line that is nearest to in.

Returns the distance of the given point to the specified line.

### DistancePointToLineSegment

`[Pure]`
`public` `static` `method` `DistancePointToLineSegment1` → `(2)`

in : Vec2D

Start point of line segment.

in : Vec2D

End point of line segment.

returns → float64

The distance of the point on line segment from where the distance has been computed.

Computes the distance between the point `(0|0)` and the given line segment.

`[Pure]`
`public` `static` `method` `DistancePointToLineSegment2` → `(4)`

ax in : float64

X-coordinate of start point of line segment.

ay in : float64

Y-coordinate of start point of line segment.

bx in : float64

X-coordinate of end point of line segment.

by in : float64

Y-coordinate of end point of line segment.

returns → float64

The distance of the point on line segment from where the distance has been computed.

Computes the distance between the point `(0|0)` and the given line segment.

`[Pure]`
`public` `static` `method` `DistancePointToLineSegment3` → `(2)`

in : Vec3D

Start point of line segment.

in : Vec3D

End point of line segment.

returns → float64

The distance of the point on line segment from where the distance has been computed.

Computes the distance between the point `(0|0)` and the given line segment.

`[Pure]`
`public` `static` `method` `DistancePointToLineSegment4` → `(6)`

ax in : float64

X-coordinate of start point of line segment.

ay in : float64

Y-coordinate of start point of line segment.

az in : float64

Z-coordinate of start point of line segment.

bx in : float64

X-coordinate of end point of line segment.

by in : float64

Y-coordinate of end point of line segment.

bz in : float64

Z-coordinate of end point of line segment.

returns → float64

The distance of the point on line segment from where the distance has been computed.

Computes the distance between the point `(0|0)` and the given line segment.

`[Pure]`
`public` `static` `method` `DistancePointToLineSegment5` → `(3)`

in : Vec2D

Start point of line segment.

in : Vec2D

End point of line segment.

result out : Vec2D

The distance (see Vec2D.X) and weight of point on line segment from where the distance has been computed (see Vec2D.Y, `0` = start point, `1` = end point).

Computes the distance between the point `(0|0)` and the given line segment.

`[Pure]`
`public` `static` `method` `DistancePointToLineSegment6` → `(5)`

ax in : float64

X-coordinate of start point of line segment.

ay in : float64

Y-coordinate of start point of line segment.

bx in : float64

X-coordinate of end point of line segment.

by in : float64

Y-coordinate of end point of line segment.

result out : Vec2D

The distance (see Vec2D.X) and weight of point on line segment from where the distance has been computed (see Vec2D.Y, `0` = start point, `1` = end point).

Computes the distance between the point `(0|0)` and the given line segment.

`[Pure]`
`public` `static` `method` `DistancePointToLineSegment7` → `(3)`

in : Vec3D

Start point of line segment.

in : Vec3D

End point of line segment.

result out : Vec2D

The distance (see Vec2D.X) and weight of point on line segment from where the distance has been computed (see Vec2D.Y, `0` = start point, `1` = end point).

Computes the distance between the point `(0|0)` and the given line segment.

`[Pure]`
`public` `static` `method` `DistancePointToLineSegment8` → `(7)`

ax in : float64

X-coordinate of start point of line segment.

ay in : float64

Y-coordinate of start point of line segment.

az in : float64

Z-coordinate of start point of line segment.

bx in : float64

X-coordinate of end point of line segment.

by in : float64

Y-coordinate of end point of line segment.

bz in : float64

Z-coordinate of end point of line segment.

result out : Vec2D

The distance (see Vec2D.X) and weight of point on line segment from where the distance has been computed (see Vec2D.Y, `0` = start point, `1` = end point).

Computes the distance between the point `(0|0)` and the given line segment.

### DistancePointToTriangle

`[Pure]`
`public` `static` `method` `DistancePointToTriangle` → `(4)`

point in : Vec3D

The point.

in : Vec3D

First triangle vertex.

in : Vec3D

Second triangle vertex.

in : Vec3D

Third triangle vertex.

returns → float64

The positive distance.

Computes the distance between a triangle and the given point.

### IntersectionOfCircles

`[Pure]`
`public` `static` `method` `IntersectionOfCircles` → `(3)`

in : float64

Distance between the center points of the circles.

r0 in : float64

r1 in : float64

returns → Vec2D

If Vec2D.Undefined, the circles do not intersect.
If Vec2D.Y is zero, the circles intersect in a single point.
Otherwise, the circles intersect in two points.
The intersection points can be computed as follows:
(X, -Y)
(X, +Y)

Computes the intersection of the given circles.

The first circle is centered at the coordinate origin, the second circle is centered at (d,0).

### IntersectionOfLines

`[Pure]`
`public` `static` `method` `IntersectionOfLines1` → `(4)`

v1 in : Vec2D

First point on first line.

v2 in : Vec2D

Second point on first line.

v3 in : Vec2D

First point on second line.

v4 in : Vec2D

Second point on second line.

returns → Vec2D

The intersection point or Vec2D.Undefined if the lines parallel.

Computes the intersection of the given lines.

`[Pure]`
`public` `static` `method` `IntersectionOfLines2` → `(8)`

x1 in : float64

X-coordinate of first point on first line.

y1 in : float64

Y-coordinate of first point on first line.

x2 in : float64

X-coordinate of second point on first line.

y2 in : float64

Y-coordinate of second point on first line.

x3 in : float64

X-coordinate of first point on second line.

y3 in : float64

Y-coordinate of first point on second line.

x4 in : float64

X-coordinate of second point on second line.

y4 in : float64

Y-coordinate of second point on second line.

returns → Vec2D

The intersection point or Vec2D.Undefined if the lines parallel.

Computes the intersection of the given lines.

### IntersectionOfLineSegments

`[Pure]`
`public` `static` `method` `IntersectionOfLineSegments1` → `(4)`

v1 in : Vec2D

Start of first line segment.

v2 in : Vec2D

End of first line segment.

v3 in : Vec2D

Start of second line segment.

v4 in : Vec2D

End of second line segment.

returns → Vec2D

The intersection point or Vec2D.Undefined if the line segments are parallel or do not intersect.

Computes the intersection of the given line segments.

`[Pure]`
`public` `static` `method` `IntersectionOfLineSegments2` → `(8)`

x1 in : float64

X-coordinate of start of first line segment.

y1 in : float64

Y-coordinate of start of first line segment.

x2 in : float64

X-coordinate of end of first line segment.

y2 in : float64

Y-coordinate of end of first line segment.

x3 in : float64

X-coordinate of start of second line segment.

y3 in : float64

Y-coordinate of start of second line segment.

x4 in : float64

X-coordinate of end of second line segment.

y4 in : float64

Y-coordinate of end of second line segment.

returns → Vec2D

The intersection point or Vec2D.Undefined if the line segments are parallel or do not intersect.

Computes the intersection of the given line segments.

### IntersectionOfRayAndPlane

`[Pure]`
`public` `static` `method` `IntersectionOfRayAndPlane` → `(4)`

origin in : Vec3D

The ray origin.

direction in : Vec3D

The ray direction.

normal in : Vec3D

Normal vector of plane.

dot in : float64

Dot product of normal in with any point in the plane.

returns → Vec3D

The intersection point or Vec3D.Undefined if there is no intersection.

Computes the intersection between the given ray and plane.

### IntersectionOfRayAndPlaneX

`[Pure]`
`public` `static` `method` `IntersectionOfRayAndPlaneX` → `(4)`

origin in : Vec3D

The ray origin.

direction in : Vec3D

The ray direction.

dot in : float64

Dot product of the plane normal `(1,0,0)` with any point in the plane.

maximum opt : float64 = Maths.MaxDouble

Maximum ray distance to return.

returns → Vec3D

The intersection point or Vec3D.Undefined if there is no intersection.

Computes the intersection between the given ray and plane.

### IntersectionOfRayAndPlaneY

`[Pure]`
`public` `static` `method` `IntersectionOfRayAndPlaneY` → `(4)`

origin in : Vec3D

The ray origin.

direction in : Vec3D

The ray direction.

dot in : float64

Dot product of the plane normal `(0,1,0)` with any point in the plane.

maximum opt : float64 = Maths.MaxDouble

Maximum ray distance to return.

returns → Vec3D

The intersection point or Vec3D.Undefined if there is no intersection.

Computes the intersection between the given ray and plane.

### IntersectionOfRayAndPlaneZ

`[Pure]`
`public` `static` `method` `IntersectionOfRayAndPlaneZ` → `(4)`

origin in : Vec3D

The ray origin.

direction in : Vec3D

The ray direction.

dot in : float64

Dot product of the plane normal `(0,0,1)` with any point in the plane.

maximum opt : float64 = Maths.MaxDouble

Maximum ray distance to return.

returns → Vec3D

The intersection point or Vec3D.Undefined if there is no intersection.

Computes the intersection between the given ray and plane.

### IntersectionOfRayAndSphere

`[Pure]`
`public` `static` `method` `IntersectionOfRayAndSphere` → `(4)`

origin in : Vec3D

The ray origin.

direction in : Vec3D

The ray direction.

Sphere radius (center lies at coordinate origin).

sign opt : int32 = 0

Determines which intersection point to return:
`<0` : point behind origin in
`=0` : any point
`>0` : point in front of origin in

returns → Vec3D

The intersection point that is nearest origin in or Vec3D.Undefined.

Computes the intersection between the given ray and sphere.

### IntersectionOfRayAndTriangle

`[Pure]`
`public` `static` `method` `IntersectionOfRayAndTriangle` → `(6)`

origin in : Vec3D

The ray origin.

direction in : Vec3D

The ray direction.

v1 in : Vec3D

First triangle vertex.

v2 in : Vec3D

Second triangle vertex.

v3 in : Vec3D

Third triangle vertex.

weights out : Vec3D

The barycentric weights of the found intersection point of or Vec3D.Undefined if there is no intersection.

returns → float64

The distance between the origin in and the found intersection point, divided by the length of direction in. Will be negative iff there is no intersection.

Computes the intersection between the given ray and triangle.

### IsConcave

`public` `static` `method` `IsConcave` → `(4)`

in : Vec2D

First vertex.

in : Vec2D

Second vertex.

in : Vec2D

Third vertex.

in : Vec2D

Fourth vertex.

returns → bool

`true` if the quadrilateral is concave, `false` if it is convex.

Checks if the given quadrilateral is concave.

### Length

`[Pure]`
`public` `static` `method` `Length1` → `(2)`

in : float64

X-component of vector.

in : float64

Y-component of vector.

returns → float64

The vector length.

Computes the length of the given vector.

`[Pure]`
`public` `static` `method` `Length2` → `(3)`

in : float64

X-component of vector.

in : float64

Y-component of vector.

in : float64

Z-component of vector.

returns → float64

The vector length.

Computes the length of the given vector.

`[Pure]`
`public` `static` `method` `Length3` → `(2)`

in : float32

X-component of vector.

in : float32

Y-component of vector.

returns → float32

The vector length.

Computes the length of the given vector.

`[Pure]`
`public` `static` `method` `Length4` → `(3)`

in : float32

X-component of vector.

in : float32

Y-component of vector.

in : float32

Z-component of vector.

returns → float32

The vector length.

Computes the length of the given vector.

### LengthSqr

`[Pure]`
`public` `static` `method` `LengthSqr1` → `(2)`

in : float64

X-component of vector.

in : float64

Y-component of vector.

returns → float64

The square vector length.

Computes the square length of the given vector.

`[Pure]`
`public` `static` `method` `LengthSqr2` → `(3)`

in : float64

X-component of vector.

in : float64

Y-component of vector.

in : float64

Z-component of vector.

returns → float64

The square vector length.

Computes the square length of the given vector.

`[Pure]`
`public` `static` `method` `LengthSqr3` → `(2)`

in : float32

X-component of vector.

in : float32

Y-component of vector.

returns → float32

The square vector length.

Computes the square length of the given vector.

`[Pure]`
`public` `static` `method` `LengthSqr4` → `(3)`

in : float32

X-component of vector.

in : float32

Y-component of vector.

in : float32

Z-component of vector.

returns → float32

The square vector length.

Computes the square length of the given vector.

### Lerp

`[Pure]`
`public` `static` `method` `Lerp1` → `(3)`

in : Vec2F

First input vector (maps to `f=0`).

in : Vec2F

Second input vector (maps to `f=1`).

in : float32

The interpolation factor in the range [0..1].

returns → Vec2F

The interpolated vector.

Linearly interpolates between the given vectors.

`[Pure]`
`public` `static` `method` `Lerp2` → `(3)`

in : Vec2D

First input vector (maps to `f=0`).

in : Vec2D

Second input vector (maps to `f=1`).

in : float64

The interpolation factor in the range [0..1].

returns → Vec2D

The interpolated vector.

Linearly interpolates between the given vectors.

`[Pure]`
`public` `static` `method` `Lerp3` → `(3)`

in : Vec3F

First input vector (maps to `f=0`).

in : Vec3F

Second input vector (maps to `f=1`).

in : float32

The interpolation factor in the range [0..1].

returns → Vec3F

The interpolated vector.

Linearly interpolates between the given vectors.

`[Pure]`
`public` `static` `method` `Lerp4` → `(3)`

in : Vec3D

First input vector (maps to `f=0`).

in : Vec3D

Second input vector (maps to `f=1`).

in : float64

The interpolation factor in the range [0..1].

returns → Vec3D

The interpolated vector.

Linearly interpolates between the given vectors.

### NormalToPlane

`[Pure]`
`public` `static` `method` `NormalToPlane` → `(3)`

normal in : Vec3D

The unit-length normal vector.

out : Vec3D

Unit-length vector in plane, perpendicular to out.

out : Vec3D

Unit-length vector in plane, perpendicular to out.

Computes two perpendicular unit-length vectors that lie in the plane that is defined by the given normal in vector.

The cross-product of out and out points into the same direction as normal in.

### PointOnLine

`[Pure]`
`public` `static` `method` `PointOnLine` → `(3)`

in : Vec3D

The point.

in : Vec3D

A point on the line.

in : Vec3D

Direction vector of the line.

returns → float64

The coefficient `t` for computing the projected point on the line:

`p' = s + v * t`

Computes the projection of a point to a line.

### RLength

`[Pure]`
`public` `static` `method` `RLength1` → `(2)`

in : float64

X-component of vector.

in : float64

Y-component of vector.

returns → float64

The reciprocal vector length or `0` if all vector components are zero.

Computes the reciprocal length of the given vector.

`[Pure]`
`public` `static` `method` `RLength2` → `(3)`

in : float64

X-component of vector.

in : float64

Y-component of vector.

in : float64

Z-component of vector.

returns → float64

The reciprocal vector length or `0` if all vector components are zero.

Computes the reciprocal length of the given vector.

`[Pure]`
`public` `static` `method` `RLength3` → `(2)`

in : float32

X-component of vector.

in : float32

Y-component of vector.

returns → float32

The reciprocal vector length or `0` if all vector components are zero.

Computes the reciprocal length of the given vector.

`[Pure]`
`public` `static` `method` `RLength4` → `(3)`

in : float32

X-component of vector.

in : float32

Y-component of vector.

in : float32

Z-component of vector.

returns → float32

The reciprocal vector length or `0` if all vector components are zero.

Computes the reciprocal length of the given vector.

### Slerp

`[Pure]`
`public` `static` `method` `Slerp1` → `(3)`

in : Vec2D

First input vector (maps to `f=0`).

in : Vec2D

Second input vector (maps to `f=1`).

in : float64

The interpolation factor in the range [0..1].

returns → Vec2D

The interpolated vector.

Spherically interpolates between the given vectors.

`[Pure]`
`public` `static` `method` `Slerp2` → `(3)`

in : Vec3D

First input vector (maps to `f=0`).

in : Vec3D

Second input vector (maps to `f=1`).

in : float64

The interpolation factor in the range [0..1].

returns → Vec3D

The interpolated vector.

Spherically interpolates between the given vectors.

### SortByX

`[Pure]`
`public` `static` `method` `SortByX` → `(2)`

in : Vec2D

First point.

in : Vec2D

Second point.

returns → int32

The comparison result.

Sorts the given 2D points by their coordinates (X ascending, Y ascending).

### SortByXY

`[Pure]`
`public` `static` `method` `SortByXY` → `(2)`

in : Vec2D

First point.

in : Vec2D

Second point.

returns → int32

The comparison result.

Sorts the given 2D points by their coordinates (X ascending, Y ascending).

### SphericalToCartesian

`[Pure]`
`public` `static` `method` `SphericalToCartesian1` → `(1)`

spherical in : Vec3D

The spherical coordinates.

returns → Vec3D

The cartesian coordinates.

Converts the given spherical coordinates into cartesian coordinates.

The components of the given vector have the following semantic:

```spherical.X := radius (distance to origin).
spherical.Y := azimuthal angle (angle from positive X-axis in radians) in the range [-PI..PI].
spherical.Z := polar angle (angle from positive Z-axis in radians) in the range [0..PI].```

`[Pure]`
`public` `static` `method` `SphericalToCartesian2` → `(3)`

in : float64

The spherical X-coordinate.

in : float64

The spherical Y-coordinate.

in : float64

The spherical Z-coordinate.

returns → Vec3D

The cartesian coordinates.

Converts the given spherical coordinates into cartesian coordinates.

The components of the given vector have the following semantic:

```spherical.X := radius (distance to origin).
spherical.Y := azimuthal angle (angle from positive X-axis in radians) in the range [-PI..PI].
spherical.Z := polar angle (angle from positive Z-axis in radians) in the range [0..PI].```

### Volume

`[Pure]`
`public` `static` `method` `Volume1` → `(4)`

in : Vec3D

First vertex of tetrahedron.

in : Vec3D

Second vertex of tetrahedron.

in : Vec3D

Third vertex of tetrahedron.

in : Vec3D

Fourth vertex of tetrahedron.

returns → float64

The volume of the tetrahedron.

Computes the volume of the given tetrahedron.

`[Pure]`
`public` `static` `method` `Volume2` → `(12)`

x1 in : float64

X-coordinate of first vertex of tetrahedron.

y1 in : float64

Y-coordinate of first vertex of tetrahedron.

z1 in : float64

Z-coordinate of first vertex of tetrahedron.

x2 in : float64

X-coordinate of second vertex of tetrahedron.

y2 in : float64

Y-coordinate of second vertex of tetrahedron.

z2 in : float64

Z-coordinate of second vertex of tetrahedron.

x3 in : float64

X-coordinate of third vertex of tetrahedron.

y3 in : float64

Y-coordinate of third vertex of tetrahedron.

z3 in : float64

Z-coordinate of third vertex of tetrahedron.

x4 in : float64

X-coordinate of fourth vertex of tetrahedron.

y4 in : float64

Y-coordinate of fourth vertex of tetrahedron.

z4 in : float64

Z-coordinate of fourth vertex of tetrahedron.

returns → float64

The volume of the tetrahedron.

Computes the volume of the given tetrahedron.

### Winding

`[Pure]`
`public` `static` `method` `Winding1` → `(3)`

in : Vec2D

Start of first line segment.

in : Vec2D

End of first line segment, start of second line segment.

in : Vec2D

End of second line segment.

returns → int32

The winding (see remarks).

Returns the winding at the joint of two connected line segments.

The winding is defined as the sign of the Z-component of the cross product between `b-a` and `c-b`. The Z-components of `a`, `b` and `c` are assumed to be `0`. A winding of zero means that all three points lie on the same line (i.e. the input vectors of the cross product are collinear). For a standard Cartesian coordinate system (X-axis points to the right, Y-axis points upwards), clockwise is negative and counter-clockwise is positive.

`[Pure]`
`public` `static` `method` `Winding2` → `(6)`

ax in : float64

X-coordinate of start of first line segment.

ay in : float64

Y-coordinate of start of first line segment.

bx in : float64

X-coordinate of end of first line segment, start of second line segment.

by in : float64

Y-coordinate of end of first line segment, start of second line segment.

cx in : float64

X-coordinate of end of second line segment.

cy in : float64

Y-coordinate of end of second line segment.

returns → int32

The winding (see remarks).

Returns the winding at the joint of two connected line segments.

The winding is defined as the sign of the Z-component of the cross product between `b-a` and `c-b`. The Z-components of `a`, `b` and `c` are assumed to be `0`. A winding of zero means that all three points lie on the same line (i.e. the input vectors of the cross product are collinear). For a standard Cartesian coordinate system (X-axis points to the right, Y-axis points upwards), clockwise is negative and counter-clockwise is positive.