Expand description
The math prelude.
This includes the most common types in this crate, re-exported for your convenience.
Structs§
- Annulus
- A primitive shape formed by the region between two circles, also known as a ring.
- Arc2d
- A primitive representing an arc between two points on a circle.
- BVec2
- A 2-dimensional
bool
vector mask. - BVec3
- A 3-dimensional
bool
vector mask. - BVec4
- A 4-dimensional
bool
vector mask. - BVec3A
- A 3-dimensional SIMD vector mask.
- BVec4A
- A 4-dimensional SIMD vector mask.
- Boxed
Polygon - A polygon with a variable number of vertices, allocated on the heap
in a
Box<[Vec2]>
. - Boxed
Polyline2d - A series of connected line segments in 2D space, allocated on the heap
in a
Box<[Vec2]>
. - Boxed
Polyline3d - A series of connected line segments in 3D space, allocated on the heap
in a
Box<[Vec3]>
. - Capsule2d
- A 2D capsule primitive, also known as a stadium or pill shape.
- Capsule3d
- A 3D capsule primitive centered on the origin A three-dimensional capsule is defined as a surface at a distance (radius) from a line
- Circle
- A circle primitive, representing the set of points some distance from the origin
- Circular
Sector - A primitive representing a circular sector: a pie slice of a circle.
- Circular
Segment - A primitive representing a circular segment: the area enclosed by the arc of a circle and its chord (the line between its endpoints).
- Cone
- A cone primitive centered on the midpoint between the tip of the cone and the center of its base.
- Conical
Frustum - A conical frustum primitive. A conical frustum can be created by slicing off a section of a cone.
- Convex
Polygon - A convex polygon with
N
vertices. - CubicB
Spline - A spline interpolated continuously across the nearest four control points. The curve does not necessarily pass through any of the control points.
- Cubic
Bezier - A spline composed of a single cubic Bezier curve.
- Cubic
Cardinal Spline - A spline interpolated continuously across the nearest four control points, with the position of
the curve specified at every control point and the tangents computed automatically. The associated
CubicCurve
has one segment between each pair of adjacent control points. - Cubic
Curve - A collection of
CubicSegment
s chained into a single parametric curve. It is aCurve
with domain[0, N]
, whereN
is its number of segments. - Cubic
Hermite - A spline interpolated continuously between the nearest two control points, with the position and velocity of the curve specified at both control points. This curve passes through all control points, with the specified velocity which includes direction and parametric speed.
- Cubic
Nurbs - Non-uniform Rational B-Splines (NURBS) are a powerful generalization of the
CubicBSpline
which can represent a much more diverse class of curves (like perfect circles and ellipses). - Cubic
Segment - A segment of a cubic curve, used to hold precomputed coefficients for fast interpolation.
It is a
Curve
with domain[0, 1]
. - Cuboid
- A cuboid primitive, which is like a cube, except that the x, y, and z dimensions are not required to be the same.
- Cylinder
- A cylinder primitive centered on the origin
- Dir2
- A normalized vector pointing in a direction in 2D space
- Dir3
- A normalized vector pointing in a direction in 3D space
- Dir3A
- A normalized SIMD vector pointing in a direction in 3D space.
- Ellipse
- An ellipse primitive, which is like a circle, but the width and height can be different
- Extrusion
- A 3D shape representing an extruded 2D
base_shape
. - IRect
- A rectangle defined by two opposite corners.
- IVec2
- A 2-dimensional vector.
- IVec3
- A 3-dimensional vector.
- IVec4
- A 4-dimensional vector.
- Infinite
Plane3d - An unbounded plane in 3D space. It forms a separating surface through the origin, stretching infinitely far
- Isometry2d
- An isometry in two dimensions, representing a rotation followed by a translation. This can often be useful for expressing relative positions and transformations from one position to another.
- Isometry3d
- An isometry in three dimensions, representing a rotation followed by a translation. This can often be useful for expressing relative positions and transformations from one position to another.
- Line2d
- An infinite line going through the origin along a direction in 2D space.
- Line3d
- An infinite line going through the origin along a direction in 3D space.
- Mat2
- A 2x2 column major matrix.
- Mat3
- A 3x3 column major matrix.
- Mat4
- A 4x4 column major matrix.
- Mat3A
- A 3x3 column major matrix.
- Plane2d
- An unbounded plane in 2D space. It forms a separating surface through the origin, stretching infinitely far
- Plane3d
- A bounded plane in 3D space. It forms a surface starting from the origin with a defined height and width.
- Polygon
- A polygon with N vertices.
- Polyline2d
- A series of connected line segments in 2D space.
- Polyline3d
- A series of connected line segments in 3D space.
- Quat
- A quaternion representing an orientation.
- Rational
Curve - A collection of
RationalSegment
s chained into a single parametric curve. It is aCurve
with domain[0, N]
, whereN
is the number of segments. - Rational
Segment - A segment of a rational cubic curve, used to hold precomputed coefficients for fast interpolation.
It is a
Curve
with domain[0, 1]
. - Ray2d
- An infinite half-line starting at
origin
and going indirection
in 2D space. - Ray3d
- An infinite half-line starting at
origin
and going indirection
in 3D space. - Rect
- A rectangle defined by two opposite corners.
- Rectangle
- A rectangle primitive, which is like a square, except that the width and height can be different
- Regular
Polygon - A polygon centered on the origin where all vertices lie on a circle, equally far apart.
- Rhombus
- A rhombus primitive, also known as a diamond shape. A four sided polygon, centered on the origin, where opposite sides are parallel but without requiring right angles.
- Rot2
- A counterclockwise 2D rotation.
- Segment2d
- A line segment defined by two endpoints in 2D space.
- Segment3d
- A line segment defined by two endpoints in 3D space.
- Sphere
- A sphere primitive, representing the set of all points some distance from the origin
- Tetrahedron
- A tetrahedron primitive.
- Torus
- A torus primitive, often representing a ring or donut shape The set of points some distance from a circle centered at the origin
- Triangle2d
- A triangle in 2D space
- Triangle3d
- A 3D triangle primitive.
- URect
- A rectangle defined by two opposite corners.
- UVec2
- A 2-dimensional vector.
- UVec3
- A 3-dimensional vector.
- UVec4
- A 4-dimensional vector.
- Vec2
- A 2-dimensional vector.
- Vec3
- A 3-dimensional vector.
- Vec4
- A 4-dimensional vector.
- Vec3A
- A 3-dimensional vector.
Enums§
- Convex
Polygon Error - An error that happens when creating a
ConvexPolygon
. - Cubic
Nurbs Error - Error during construction of
CubicNurbs
- Euler
Rot - Euler rotation sequences.
- Torus
Kind - The type of torus determined by the minor and major radii
- Winding
Order - The winding order for a set of points
Traits§
- Cubic
Generator - Implement this on cubic splines that can generate a cubic curve from their spline parameters.
- Cyclic
Cubic Generator - Implement this on cubic splines that can generate a cyclic cubic curve from their spline parameters.
- Float
Ext - A trait for extending
f32
andf64
with extra methods. - Measured2d
- A trait for getting measurements of 2D shapes
- Measured3d
- A trait for getting measurements of 3D shapes
- Primitive2d
- A marker trait for 2D primitives
- Primitive3d
- A marker trait for 3D primitives
- Rational
Generator - Implement this on cubic splines that can generate a rational cubic curve from their spline parameters.
- Stable
Interpolate - A type with a natural interpolation that provides strong subdivision guarantees.
- Vec2
Swizzles - Vec3
Swizzles - Vec4
Swizzles
Functions§
- bvec2
- Creates a 2-dimensional
bool
vector mask. - bvec3
- Creates a 3-dimensional
bool
vector mask. - bvec4
- Creates a 4-dimensional
bool
vector mask. - bvec3a
- Creates a 3-dimensional
bool
vector mask. - bvec4a
- Creates a 4-dimensional
bool
vector mask. - ivec2
- Creates a 2-dimensional vector.
- ivec3
- Creates a 3-dimensional vector.
- ivec4
- Creates a 4-dimensional vector.
- mat2
- Creates a 2x2 matrix from two column vectors.
- mat3
- Creates a 3x3 matrix from three column vectors.
- mat4
- Creates a 4x4 matrix from four column vectors.
- mat3a
- Creates a 3x3 matrix from three column vectors.
- quat
- Creates a quaternion from
x
,y
,z
andw
values. - uvec2
- Creates a 2-dimensional vector.
- uvec3
- Creates a 3-dimensional vector.
- uvec4
- Creates a 4-dimensional vector.
- vec2
- Creates a 2-dimensional vector.
- vec3
- Creates a 3-dimensional vector.
- vec4
- Creates a 4-dimensional vector.
- vec3a
- Creates a 3-dimensional vector.