[][src]Module tray_rust::linalg

The linalg module provides some basic linear algebra functionality for transforming 3D geometry

Re-exports

pub use self::vector::Vector;
pub use self::normal::Normal;
pub use self::point::Point;
pub use self::ray::Ray;
pub use self::matrix4::Matrix4;
pub use self::transform::Transform;
pub use self::quaternion::Quaternion;
pub use self::keyframe::Keyframe;
pub use self::animated_transform::AnimatedTransform;

Modules

animated_transform

Provides an animated transformation that moves an object between a set of specified keyframes.

keyframe

Provides a keyframe transformation which is a transform associated with a specific point in time

matrix4
normal
point
quaternion

Provides a Quaternion type for properly interpolating rotations

ray
transform
vector

Enums

Axis

Enum representing on of the 3 spatial axes

Functions

clamp

Clamp x to be between min and max

coordinate_system

Compute a local ortho-normal coordinate system from a single vector.

cross

Compute the cross product of two vectors

dot

Compute the dot product of two vectors

lerp

Lerp between a and b at some distance t where t is in [0, 1] and t = 0 returns a and t = 1 returns b

reflect

Compute the reflection of w about v, both vectors should be normalized

refract

Compute the refraction of w entering surface with normal n where eta is the refractive index of the incident material divided by that of the exiting materia. In the case of total internal refraction this will return None.

solve_quadratic

Try to solve the quadratic equation a*t^2 + b*t + c = 0 and return the two real roots if a solution exists

spherical_dir

Compute the direction specified by theta and phi in the spherical coordinate system

spherical_dir_coords

Compute the direction specified by theta and phi in the coordinate system formed by x, y and z

spherical_phi

Compute the value of phi for the vector in the spherical coordinate system

spherical_theta

Compute the value of theta for the vector in the spherical coordinate system

to_radians

Convert value in degrees to radians TODO: See where f32::to_radians ends up, if it gets stabilized into Rust switch back to it