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. - 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
- Chain
Curve - The curve that results from chaining one curve with another. The second curve is effectively reparametrized so that its start is at the end of the first.
- 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.
- Constant
Curve - A curve with a constant value over its domain.
- Continuation
Curve - The curve that results from chaining two curves.
- 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.
- Curve
Reparam Curve - A curve that has been reparametrized by another curve, using that curve to transform the
sample times before sampling. Curves of this type are produced by
Curve::reparametrize_by_curve
. - 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.
- Easing
Curve - A
Curve
that is defined by - 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
. - Forever
Curve - The curve that results from repeating a curve forever.
- Function
Curve - A curve defined by a function together with a fixed domain.
- Graph
Curve - A curve that is the graph of another curve over its parameter space. Curves of this type are
produced by
Curve::graph
. - 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
- Interval
- A nonempty closed interval, possibly unbounded in either direction.
- 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.
- Linear
Reparam Curve - A curve that has had its domain changed by a linear reparametrization (stretching and scaling).
Curves of this type are produced by
Curve::reparametrize_linear
. - MapCurve
- A curve whose samples are defined by mapping samples from another curve through a
given function. Curves of this type are produced by
Curve::map
. - Mat2
- A 2x2 column major matrix.
- Mat3
- A 3x3 column major matrix.
- Mat4
- A 4x4 column major matrix.
- Ping
Pong Curve - The curve that results from chaining a curve with its reversed version. The transition point is guaranteed to make no jump.
- 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.
- Reparam
Curve - A curve whose sample space is mapped onto that of some base curve’s before sampling.
Curves of this type are produced by
Curve::reparametrize
. - Repeat
Curve - The curve that results from repeating a curve
N
times. - Reverse
Curve - The curve that results from reversing another.
- 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.
- Sample
Auto Curve - A curve that is defined by neighbor interpolation over a set of evenly-spaced samples, interpolated automatically using a particularly well-behaved interpolation.
- Sample
Curve - A curve that is defined by explicit neighbor interpolation over a set of evenly-spaced samples.
- Segment2d
- A segment of a line going through the origin along a direction in 2D space.
- Segment3d
- A segment of a line going through the origin along a direction 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.
- Uneven
Sample Auto Curve - A curve that is defined by interpolation over unevenly spaced samples, interpolated automatically using a particularly well-behaved interpolation.
- Uneven
Sample Curve - A curve that is defined by interpolation over unevenly spaced samples with explicit interpolation.
- Vec2
- A 2-dimensional vector.
- Vec3
- A 3-dimensional vector.
- Vec4
- A 4-dimensional vector.
- ZipCurve
- A curve that combines the output data from two constituent curves into a tuple output. Curves
of this type are produced by
Curve::zip
.
Enums§
- Chain
Error - An error indicating that an end-to-end composition couldn’t be performed because of malformed inputs.
- Convex
Polygon Error - An error that happens when creating a
ConvexPolygon
. - Cubic
Nurbs Error - Error during construction of
CubicNurbs
- Ease
Function - Curve functions over the unit interval, commonly used for easing transitions.
- Euler
Rot - Euler rotation sequences.
- Linear
Reparam Error - An error indicating that a linear reparametrization couldn’t be performed because of malformed inputs.
- Ping
Pong Error - An error indicating that a ping ponging of a curve couldn’t be performed because of malformed inputs.
- Repeat
Error - An error indicating that a repetition of a curve couldn’t be performed because of malformed inputs.
- Resampling
Error - An error indicating that a resampling operation could not be performed because of malformed inputs.
- Reverse
Error - An error indicating that a reversion of a curve couldn’t be performed because of malformed inputs.
- 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.
- Curve
- A trait for a type that can represent values of type
T
parametrized over a fixed interval. - Cyclic
Cubic Generator - Implement this on cubic splines that can generate a cyclic cubic curve from their spline parameters.
- Ease
- A type whose values can be eased between.
- Float
Ext - A trait for extending
f32
andf64
with extra methods. - FromRng
- Ergonomics trait for a type with a
Standard
distribution, allowing values to be generated uniformly from anRng
by a method in its own namespace. - 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.
- Shape
Sample - Exposes methods to uniformly sample a variety of primitive shapes.
- Stable
Interpolate - A type with a natural interpolation that provides strong subdivision guarantees.
- Vec2
Swizzles - Vec3
Swizzles - Vec4
Swizzles
Functions§
- interval
- Create an
Interval
with a givenstart
andend
. Alias ofInterval::new
.