Maths.Maps
Utility class for mapping coordinates between various spaces.
Methods
BarycentricToCartesian
#Convert a two-dimensional barycentric coordinate into cartesian coordinates.
Parameters:
| a (double) | First barycentric parameter. |
| b (double) | Second barycentric parameter. |
| c (double) | Third barycentric parameter. |
| A (Point2d) | First barycentric point in cartesian space. |
| B (Point2d) | Second barycentric point in cartesian space. |
| C (Point2d) | Third barycentric point in cartesian space. |
| point (out Point2d) | Cartesian point. |
BarycentricToCartesian
#Convert a three-dimensional barycentric coordinate into cartesian coordinates.
Parameters:
| a (double) | First barycentric parameter. |
| b (double) | Second barycentric parameter. |
| c (double) | Third barycentric parameter. |
| A (Point3d) | First barycentric point in cartesian space. |
| B (Point3d) | Second barycentric point in cartesian space. |
| C (Point3d) | Third barycentric point in cartesian space. |
| point (out Point3d) | Cartesian point. |
BarycentricToTrilinear
#Convert barycentric coordinates into trilinear coordinates.
Parameters:
| A (Point2d) | First corner of triangle. |
| B (Point2d) | Second corner of triangle. |
| C (Point2d) | Third corner of triangle. |
| a (double) | First barycentric parameter. |
| b (double) | Second barycentric parameter. |
| c (double) | Third barycentric parameter. |
| u (out double) | First trilinear parameter. |
| v (out double) | Second trilinear parameter. |
| w (out double) | Third trilinear parameter. |
BarycentricToTrilinear
#Convert barycentric coordinates into trilinear coordinates.
Parameters:
| A (Point3d) | First corner of triangle. |
| B (Point3d) | Second corner of triangle. |
| C (Point3d) | Third corner of triangle. |
| a (double) | First barycentric parameter. |
| b (double) | Second barycentric parameter. |
| c (double) | Third barycentric parameter. |
| u (out double) | First trilinear parameter. |
| v (out double) | Second trilinear parameter. |
| w (out double) | Third trilinear parameter. |
CartesianToBarycentric
#Convert a two dimensional cartesian coordinate into areal barycentric parameters.
Parameters:
| point (Point2d) | Cartesian point. |
| A (Point2d) | First barycentric triangle point. |
| B (Point2d) | Second barycentric triangle point. |
| C (Point2d) | Third barycentric triangle point. |
| a (out double) | First barycentric parameter. |
| b (out double) | Second barycentric parameter. |
| c (out double) | Third barycentric parameter. |
CartesianToBarycentric
#Convert a three dimensional cartesian coordinate into areal barycentric parameters. Note, the mapping of point onto the triangle is used. For full control over the conversion we suggest using the two-dimensional overload instead, and performing any planarisation ahead of time.
Parameters:
| point (Point3d) | Cartesian point. |
| A (Point3d) | First barycentric triangle point. |
| B (Point3d) | Second barycentric triangle point. |
| C (Point3d) | Third barycentric triangle point. |
| a (out double) | First barycentric parameter. |
| b (out double) | Second barycentric parameter. |
| c (out double) | Third barycentric parameter. |
CartesianToElliptic
#Convert a cartesian world coordinate into elliptic coordinates.
Parameters:
| a (double) | Distance from world origin to either elliptic pole. |
| point (Point2d) | Cartesian point. |
| tolerance (double) | Tolerance for approximation. Zero or less will revert to default tolerance. |
| iterations (int) | Maximum number of allowed iterations. Zero or less will revert to default iteration cap. |
| radial (out double) | Mu parameter. |
| angular (out double) | Nu parameter. |
CubeToSphere
#Map coordinates from the double-unit cube (centered on world-origin, edge=2) to the unit-sphere (centered on world origin, radius=1), such that points on the surface of the cube end up on the surface of the sphere.
DiscToPlane
#Map the unit disc onto the World XY plane using a tangent mapping. Points coincident with the disc boundary or points beyond the disc, will be mapped to infinity.
DiscToPlane
#Map the unit disc onto the World XY plane using a tangent mapping. Points coincident with the disc boundary or points beyond the disc, will be mapped to infinity.
DiscToSquare
#public static void DiscToSquare(DiscMapping mapping, double u, double v, out double x, out double y)
Convert a 2d coordinate from the unit disc interior to the unit square interior.
Parameters:
| mapping (Maths.Maps.DiscMapping) | Mapping conversion. |
| u (double) | Circle u coordinate. |
| v (double) | Circle v coordinate. |
| x (out double) | Square x coordinate. |
| y (out double) | Square y coordinate. |
EllipticToCartesian
#Convert a set of two dimensional elliptic coordinates into cartesian world coordinates.
Parameters:
| a (double) | Distance from world origin to either elliptic pole. |
| radial (double) | First elliptic parameter, associated with the distance from the poles. |
| angular (double) | Second elliptic parameter, associated with the rotation around the poles. |
| point (out Point2d) | Cartesian world point associated with (radial, angular). |
EllipticToCartesian
#Convert a set of two dimensional elliptic coordinates into cartesian world coordinates.
FromUnitInterval
#Map a number from the unit interval to a custom interval.
HilbertIndexToUnitSquare
#Convert a Hilbert linear index into a unit (x,y) coordinate.
HilbertParameterToUnitSquare
#Convert a Hilbert curve parameter into a coordinate in the unit square.
LocalToLocal
#Map a point from one local coordinate system into another.
LocalToWorld
#Map a point in a local coordinate system into world coordinates.
PlaneToDisc
#Map the World XY plane onto the unit disc using a polar arc-tangent mapping.
PlaneToPlane
#public static void PlaneToPlane(PlaneMapping mapping, double x, double y, out double u, out double v)
Map XY coordinates using natural logarithms.
Parameters:
| mapping (Maths.Maps.PlaneMapping) | Mapping algorithm. |
| x (double) | X coordinate. |
| y (double) | Y coordinate. |
| u (out double) | Mapped x coordinate. |
| v (out double) | Mapped y coordinate. |
SphereToCube
#Map coordinates from the unit sphere (centered on world-origin, radius=1) to the double-unit-box (centered on world origin, edge=2), such that points on the surface of the sphere end up on the surface of the box.
SphericalToCartesian
#Convert world polar coordinates into cartesian coordinates.
SphericalToCartesian
#Convert world polar coordinates into cartesian coordinates.
SphericalToCartesian
#Convert local polar coordinates into cartesian coordinates.
SphericalToCartesian
#Convert local polar coordinates into cartesian coordinates.
SquareToDisc
#public static void SquareToDisc(DiscMapping mapping, double x, double y, out double u, out double v)
Convert a 2d coordinate from the unit square interior to the unit disc interior.
Parameters:
| mapping (Maths.Maps.DiscMapping) | Mapping conversion. |
| x (double) | Square x coordinate. |
| y (double) | Square y coordinate. |
| u (out double) | Circle u coordinate. |
| v (out double) | Circle v coordinate. |
ToUnitInterval
#Map a number from a custom interval to the unit interval.
TrilinearToBarycentric
#Convert trilinear coordinates into barycentric coordinates.
Parameters:
| A (Point2d) | First corner of triangle. |
| B (Point2d) | Second corner of triangle. |
| C (Point2d) | Third corner of triangle. |
| u (double) | First trilinear parameter. |
| v (double) | Second trilinear parameter. |
| w (double) | Third trilinear parameter. |
| a (out double) | First barycentric parameter. |
| b (out double) | Second barycentric parameter. |
| c (out double) | Third barycentric parameter. |
TrilinearToBarycentric
#Convert trilinear coordinates into barycentric coordinates.
Parameters:
| A (Point3d) | First corner of triangle. |
| B (Point3d) | Second corner of triangle. |
| C (Point3d) | Third corner of triangle. |
| u (double) | First trilinear parameter. |
| v (double) | Second trilinear parameter. |
| w (double) | Third trilinear parameter. |
| a (out double) | First barycentric parameter. |
| b (out double) | Second barycentric parameter. |
| c (out double) | Third barycentric parameter. |
UnitSquareToHilbertIndex
#Convert an (x,y) integer coordinate to a Hilbert linear index.
UnitSquareToHilbertParameter
#Convert an (x,y) coordinate in the unit square to a linear parameter along the Hilbert curve.
WorldToLocal
#Map a point in world coordinates into a local coordinate system.