The geometry library has functions and types for 2-dimensional and 3-dimensional vector spaces.
The Geom2 and Geom3 index sets define the space's coordinates.
For the Geom2 space vectors and matrices can be constructed with functions vector2d
and matrix2d.
For the Geom3 space vectors and matrices can be constructed with functions vector3d
and matrix3d.
Base vectors are also available. Values basis2d and basis3d are tuples containing the
vectors. They can be used like
let (ex, ey) = basis2d in
...
end
basis2d :: Tuple(Geom2!, Geom2!) basis3d :: Tuple(Geom3!, Geom3!, Geom3!) azimuth :: for_unit a: (a*Geom3!) -> radian cross :: for_unit a, b: (a*Geom3!, b*Geom3!) -> a*b*Geom3! cross_sqrt :: for_unit a: (a*Geom3!, a*Geom3!) -> a*Geom3! det2d :: for_unit a, Geom2!u: (a*Geom2! per Geom2!) -> a^2 det3d :: for_unit a, Geom3!u: (a*Geom3! per Geom3!) -> a^3 euler_rotation :: (radian, radian, radian) -> Geom3! per Geom3! inclination :: for_unit a: (a*Geom3!) -> radian matrix2d :: for_unit a: (a, a, a, a) -> a*Geom2! per Geom2! matrix3d :: for_unit a: (a, a, a, a, a, a, a, a, a) -> a*Geom3! per Geom3! polar_angle :: for_unit a: (a*Geom2!) -> radian rotation :: (radian, radian, radian) -> Geom3! per Geom3! signed_volume :: for_unit a: (a*Geom3!, a*Geom3!, a*Geom3!) -> a^3 surface_area :: for_unit a: (List(Tuple(a*Geom3!, a*Geom3!, a*Geom3!))) -> a^2 surface_volume :: for_unit a: (List(Tuple(a*Geom3!, a*Geom3!, a*Geom3!))) -> a^3 to_cartesian2d :: for_unit a: (a, radian) -> a*Geom2! to_cartesian3d :: for_unit a: (a, radian, radian) -> a*Geom3! to_polar2d :: for_unit a: (a*Geom2!) -> Tuple(a, radian) to_polar3d :: for_unit a: (a*Geom3!) -> Tuple(a, radian, radian) triangle_area :: for_unit a: (a*Geom3!, a*Geom3!, a*Geom3!) -> a^2 vector2d :: for_unit a: (a, a) -> a*Geom2! vector3d :: for_unit a: (a, a, a) -> a*Geom3!
Index set for a 2D geometric space. Defined as the set {x, y}.
Index set for a 3D geometric space. Defined as the set {x, y, z}.
:: Tuple(Geom2!, Geom2!)
Basis vectors for Geom2.
Example:
let (ex, ey) = basis2d in
...
end
:: Tuple(Geom3!, Geom3!, Geom3!)
Basis vectors for Geom3.
Example:
let (i, j, k) = basis3d in
...
end`
:: for_unit a: (a*Geom3!) -> radian
The azimuth for polar coordinates.
For any vector v the following equality holds
to_cartesian3d(norm(v), inclination(v), azimuth(v)) = v
:: for_unit a, b: (a*Geom3!, b*Geom3!) -> a*b*Geom3!
The cross product between two vectors.
:: for_unit a: (a*Geom3!, a*Geom3!) -> a*Geom3!
The cross product between two vectors, but with the norms averaged to keep the same unit of measurement.
:: for_unit a, Geom2!u: (a*Geom2! per Geom2!) -> a^2
Determinant of a Geom2 matrix
:: for_unit a, Geom3!u: (a*Geom3! per Geom3!) -> a^3
Determinant of a Geom3 matrix
:: (radian, radian, radian) -> Geom3! per Geom3!
Creates a rotation matrix from angles in the x, y and z direction.
:: for_unit a: (a*Geom3!) -> radian
The inclination for polar coordinates.
For any vector v the following equality holds
to_cartesian3d(norm(v), inclination(v), azimuth(v)) = v
:: for_unit a: (a, a, a, a) -> a*Geom2! per Geom2!
Creates a Geom2 matrix. The arguments are in row-major order.
:: for_unit a: (a, a, a, a, a, a, a, a, a) -> a*Geom3! per Geom3!
Creates a Geom3 matrix. The arguments are in row-major order.
:: for_unit a: (a*Geom2!) -> radian
The angle for polar coordinates in Geom2.
For any vector v the following equality holds
to_cartesian2d(norm(v), polar_angle(v)) = v
:: (radian, radian, radian) -> Geom3! per Geom3!
Deprecated. Use euler_rotation instead.
:: for_unit a: (a*Geom3!, a*Geom3!, a*Geom3!) -> a^3
Volume enclosed by three position vectors.
:: for_unit a: (List(Tuple(a*Geom3!, a*Geom3!, a*Geom3!))) -> a^2
Total area of a surface build from triangles. Sums the triangle area of the individual triangles.
:: for_unit a: (List(Tuple(a*Geom3!, a*Geom3!, a*Geom3!))) -> a^3
Total volume of a body build from triangles. Sums the triangle volume of the individual triangles.
:: for_unit a: (a, radian) -> a*Geom2!
Creates a vector in cartesian coordinates from polar coordinates.
For any vector v the following equality holds
to_cartesian2d(norm(v), polar_angle(v)) = v
:: for_unit a: (a, radian, radian) -> a*Geom3!
Creates a vector in cartesian coordinates from polar coordinates.
For any vector v the following equality holds
to_cartesian3d(norm(v), inclination(v), azimuth(v)) = v
:: for_unit a: (a*Geom2!) -> Tuple(a, radian)
Gives polar coordinates for a vector in cartesian coordinates. A tuple with the norm and the angle.
For any vector v the following equality holds
let (nrm, ang) = to_polar2d(v) in to_cartesian2d(nrm, ang) end = v
:: for_unit a: (a*Geom3!) -> Tuple(a, radian, radian)
Gives polar coordinates for a vector in cartesian coordinates. A tuple with the norm, the inclination and the azimuth.
For any vector v the following equality holds
let (nrm, inc, azi) = to_polar3d(v) in to_cartesian3d(nrm, inc, azi) end = v
:: for_unit a: (a*Geom3!, a*Geom3!, a*Geom3!) -> a^2
Area of the triangle given by three position vectors.
:: for_unit a: (a, a) -> a*Geom2!
Creates a Geom2 vector.
:: for_unit a: (a, a, a) -> a*Geom3!
Creates a Geom3 vector.
Version v0.6.0, 2026-03-05T15:49:20.907230814+01:00[Europe/Amsterdam]