Module math

Source

Modules§

extent2
Vector type suited for 2D extents (width and height).
extent3
Vector type suited for 3D extents (width, height and depth).
rgb
Vector type suited for RGB color data.
rgba
Vector type suited for RGBA color data.
vec2
Vector type suited for 2D spatial coordinates.
vec3
Vector type suited for 3D spatial coordinates.
vec4
Vector type suited for homogeneous 3D spatial coordinates.

Structs§

Aabb
Axis-aligned Bounding Box (3D), represented by min and max points.
Aabr
Axis-aligned Bounding Rectangle (2D), represented by min and max points.
Disk
Disk (2D), represented by center and radius.
Ellipsis
Ellipsis (2D), represented by center and radius in both axii.
Extent2
Vector type suited for 2D extents (width and height).
Extent3
Vector type suited for 3D extents (width, height and depth).
LineSegment2
2D Line segment, represented by two points, start and end.
LineSegment3
3D Line segment, represented by two points, start and end.
Mat4
4x4 matrix.
Potato
Nobody can possibly use this ???
Ray
3D ray, represented by a starting point and a normalized direction vector.
Rect
2D rectangle, represented by a bottom-left position, and 2D extents.
Rect3
A Rect extended to 3D.
Rgb
Vector type suited for RGB color data.
Rgba
Vector type suited for RGBA color data.
Sphere
Sphere (3D), represented by center and radius.
Vec2
Vector type suited for 2D spatial coordinates.
Vec3
Vector type suited for 3D spatial coordinates.
Vec4
Vector type suited for homogeneous 3D spatial coordinates.

Traits§

Clamp
A scalar or vector that can be constrained to be between two values (inclusive).
Clamp01
A scalar or vector that can be constrained to be between 0 and 1 (inclusive).
ClampMinus1
A scalar or vector that can be constrained to be between -1 and 1 (inclusive).
ColorComponent
Trait for types that are suitable for representing a color component value.
IsBetween
A value that can tell whether or not it is between two bounds (inclusive).
IsBetween01
A value that can tell whether or not it is between 0 and 1 (inclusive).
Lerp
A value that can be linearly interpolated.
MulAdd
Fused multiply-add. Computes (self * a) + b with only one rounding error, yielding a more accurate result than an unfused multiply-add.
Slerp
A value that can be Spherically Linearly interpolated.
Wrap
A value that can wrap itself around given bounds.

Functions§

aabb_to_planes
Each Vec4 <a, b, c, -d> should be interpreted as reprenting plane equation
aabb_to_points
append_intersection_points 🔒
calc_focused_light_volume_points
calc_view_frust_object
NOTE: Expects points computed from aabb_to_points.
calc_view_frustum_world_coord
clip_object_by_aabb
clip_object_by_plane
clip_points_by_plane
Returns true if and only if the final point in the polygon (i.e. the first point added to the new polygon) is outside the clipping plane (this implies that the polygon must be non-degenerate).
clip_test
Return value is ‘Some(segment)’ if line segment intersects the current test plane. Otherwise ‘None’ is returned in which case the line segment is entirely clipped.
fit_psr
Computes an axis aligned bounding box that contains the provided points when transformed into the coordinate space specificed by mat.
include_object_light_volume
intersection_line_aabb
mat_mul_points
mul_addDeprecated
Returns (val * mul) + add.
partial_max
Compares and returns the maximum of two values, using partial ordering.
partial_min
Compares and returns the minimum of two values, using partial ordering.
point_before_plane
point_plane_distance