forked from M-Labs/nalgebra
Re-export conversion functions.
This commit is contained in:
parent
48b550c24e
commit
f2bad264ef
@ -49,6 +49,33 @@ pub fn rotate<N: Real>(m: &Mat<N, U4, U4>, angle: N, axis: &Vec<N, U3>) -> Mat<N
|
||||
m * Rotation3::from_axis_angle(&Unit::new_normalize(*axis), angle).to_homogeneous()
|
||||
}
|
||||
|
||||
/// Builds a rotation 4 * 4 matrix around the X axis and right-multiply it to `m`.
|
||||
///
|
||||
/// # Parameters
|
||||
/// * m − Input matrix multiplied by this rotation matrix.
|
||||
/// * angle − Rotation angle expressed in radians.
|
||||
pub fn rotate_x<N: Real>(m: &Mat<N, U4, U4>, angle: N) -> Mat<N, U4, U4> {
|
||||
rotate(m, angle, &Vec::x())
|
||||
}
|
||||
|
||||
/// Builds a rotation 4 * 4 matrix around the Y axis and right-multiply it to `m`.
|
||||
///
|
||||
/// # Parameters
|
||||
/// * m − Input matrix multiplied by this rotation matrix.
|
||||
/// * angle − Rotation angle expressed in radians.
|
||||
pub fn rotate_y<N: Real>(m: &Mat<N, U4, U4>, angle: N) -> Mat<N, U4, U4> {
|
||||
rotate(m, angle, &Vec::y())
|
||||
}
|
||||
|
||||
/// Builds a rotation 4 * 4 matrix around the Z axis and right-multiply it to `m`.
|
||||
///
|
||||
/// # Parameters
|
||||
/// * m − Input matrix multiplied by this rotation matrix.
|
||||
/// * angle − Rotation angle expressed in radians.
|
||||
pub fn rotate_z<N: Real>(m: &Mat<N, U4, U4>, angle: N) -> Mat<N, U4, U4> {
|
||||
rotate(m, angle, &Vec::z())
|
||||
}
|
||||
|
||||
/// Builds a scale 4 * 4 matrix created from 3 scalars and right-multiply it to `m`.
|
||||
///
|
||||
/// # Parameters
|
||||
|
@ -3,7 +3,7 @@
|
||||
pub use self::matrix_clip_space::{ortho, perspective};
|
||||
pub use self::matrix_projection::{pick_matrix, project, project_no, project_zo, unproject, unproject_no, unproject_zo};
|
||||
pub use self::matrix_relationnal::{equal_columns, equal_columns_eps, equal_columns_eps_vec, not_equal_columns, not_equal_columns_eps, not_equal_columns_eps_vec};
|
||||
pub use self::matrix_transform::{identity, look_at, look_at_lh, rotate, scale, look_at_rh, translate};
|
||||
pub use self::matrix_transform::{identity, look_at, look_at_lh, rotate, scale, look_at_rh, translate, rotate_x, rotate_y, rotate_z};
|
||||
pub use self::scalar_common::{max3_scalar, max4_scalar, min3_scalar, min4_scalar};
|
||||
pub use self::scalar_constants::{epsilon, pi};
|
||||
pub use self::vector_common::{max, max2, max3, max4, min, min2, min3, min4};
|
||||
|
@ -11,7 +11,7 @@ pub use self::norm::{distance2, l1_distance, l1_norm, l2_distance, l2_norm, leng
|
||||
pub use self::normal::{triangle_normal};
|
||||
pub use self::normalize_dot::{fast_normalize_dot, normalize_dot};
|
||||
pub use self::rotate_normalized_axis::{quat_rotate_normalized_axis, rotate_normalized_axis};
|
||||
pub use self::rotate_vector::{orientation, rotate_vec2, rotate_vec3, rotate_vec4, rotate_x, rotate_x_vec3, rotate_y, rotate_y_vec3, rotate_z, rotate_z_vec3, slerp};
|
||||
pub use self::rotate_vector::{orientation, rotate_vec2, rotate_vec3, rotate_vec4, rotate_x_vec4, rotate_x_vec3, rotate_y_vec4, rotate_y_vec3, rotate_z_vec4, rotate_z_vec3, slerp};
|
||||
pub use self::transform::{rotation, scaling, translation};
|
||||
pub use self::transform2::{proj, proj2d, reflect, reflect2d, scale_bias, scale_bias_matrix, shear2d_x, shear_x, shear_y, shear_y_mat3, shear_z};
|
||||
pub use self::transform2d::{rotate2d, scale2d, translate2d};
|
||||
|
@ -32,7 +32,7 @@ pub fn rotate_x_vec3<N: Real>(v: &Vec<N, U3>, angle: N) -> Vec<N, U3> {
|
||||
}
|
||||
|
||||
/// Rotate a three dimensional vector in homogeneous coordinates around the `X` axis.
|
||||
pub fn rotate_x<N: Real>(v: &Vec<N, U4>, angle: N) -> Vec<N, U4> {
|
||||
pub fn rotate_x_vec4<N: Real>(v: &Vec<N, U4>, angle: N) -> Vec<N, U4> {
|
||||
Rotation3::from_axis_angle(&Vector3::x_axis(), angle).to_homogeneous() * v
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ pub fn rotate_y_vec3<N: Real>(v: &Vec<N, U3>, angle: N) -> Vec<N, U3> {
|
||||
}
|
||||
|
||||
/// Rotate a three dimensional vector in homogeneous coordinates around the `Y` axis.
|
||||
pub fn rotate_y<N: Real>(v: &Vec<N, U4>, angle: N) -> Vec<N, U4> {
|
||||
pub fn rotate_y_vec4<N: Real>(v: &Vec<N, U4>, angle: N) -> Vec<N, U4> {
|
||||
Rotation3::from_axis_angle(&Vector3::y_axis(), angle).to_homogeneous() * v
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ pub fn rotate_z_vec3<N: Real>(v: &Vec<N, U3>, angle: N) -> Vec<N, U3> {
|
||||
}
|
||||
|
||||
/// Rotate a three dimensional vector in homogeneous coordinates around the `Z` axis.
|
||||
pub fn rotate_z<N: Real>(v: &Vec<N, U4>, angle: N) -> Vec<N, U4> {
|
||||
pub fn rotate_z_vec4<N: Real>(v: &Vec<N, U4>, angle: N) -> Vec<N, U4> {
|
||||
Rotation3::from_axis_angle(&Vector3::z_axis(), angle).to_homogeneous() * v
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ pub use gtx::{
|
||||
triangle_normal,
|
||||
fast_normalize_dot, normalize_dot,
|
||||
quat_rotate_normalized_axis, rotate_normalized_axis,
|
||||
orientation, rotate_vec2, rotate_vec3, rotate_vec4, rotate_x, rotate_x_vec3, rotate_y, rotate_y_vec3, rotate_z, rotate_z_vec3, slerp,
|
||||
orientation, rotate_vec2, rotate_vec3, rotate_vec4, rotate_x_vec4, rotate_x_vec3, rotate_y_vec4, rotate_y_vec3, rotate_z_vec4, rotate_z_vec3, slerp,
|
||||
rotation, scaling, translation,
|
||||
proj, proj2d, reflect, reflect2d, scale_bias, scale_bias_matrix, shear2d_x, shear_x, shear_y, shear_y_mat3, shear_z,
|
||||
rotate2d, scale2d, translate2d,
|
||||
@ -45,7 +45,7 @@ pub use ext::{
|
||||
ortho, perspective,
|
||||
pick_matrix, project, project_no, project_zo, unproject, unproject_no, unproject_zo,
|
||||
equal_columns, equal_columns_eps, equal_columns_eps_vec, not_equal_columns, not_equal_columns_eps, not_equal_columns_eps_vec,
|
||||
identity, look_at, look_at_lh, rotate, scale, look_at_rh, translate,
|
||||
identity, look_at, look_at_lh, rotate, scale, look_at_rh, translate, rotate_x, rotate_y, rotate_z,
|
||||
max3_scalar, max4_scalar, min3_scalar, min4_scalar,
|
||||
epsilon, pi,
|
||||
max, max2, max3, max4, min, min2, min3, min4,
|
||||
@ -57,6 +57,8 @@ pub use ext::{
|
||||
quat_angle, quat_angle_axis, quat_axis
|
||||
};
|
||||
|
||||
pub use na::{convert, convert_ref, convert_unchecked, convert_ref_unchecked, try_convert, try_convert_ref};
|
||||
|
||||
mod aliases;
|
||||
mod constructors;
|
||||
mod common;
|
||||
|
@ -1,4 +1,4 @@
|
||||
use base::{Scalar, Vector, DimName, U0, U1, U2, U3, U4, Vector2, Vector3};
|
||||
use base::{Scalar, Vector, DimName, U0, U1, U2, Vector2, Vector3};
|
||||
use storage::Storage;
|
||||
use typenum::{Cmp, Greater};
|
||||
|
||||
@ -7,6 +7,7 @@ macro_rules! impl_swizzle {
|
||||
($(where $BaseDim: ty: $name: ident() -> $Result: ident[$($i: expr),*]);*) => {
|
||||
$(
|
||||
impl<N: Scalar, D: DimName, S: Storage<N, D>> Vector<N, D, S> {
|
||||
/// Builds a new vector from components of `self`.
|
||||
#[inline]
|
||||
pub fn $name(&self) -> $Result<N>
|
||||
where D::Value: Cmp<$BaseDim, Output=Greater> {
|
||||
|
Loading…
Reference in New Issue
Block a user