Resolve all name conflicts.

This commit is contained in:
sebcrozet 2018-09-22 18:11:51 +02:00 committed by Sébastien Crozet
parent 1b2fc74f33
commit cff8f398ba
10 changed files with 97 additions and 95 deletions

View File

@ -130,30 +130,6 @@ pub fn int_bits_to_float_vec<D: Dimension>(v: &Vec<i32, D>) -> Vec<f32, D>
// x * (exp).exp2()
//}
/// The maximum between each component of `x` and `y`.
pub fn max<N: Number, D: Dimension>(x: &Vec<N, D>, y: N) -> Vec<N, D>
where DefaultAllocator: Alloc<N, D> {
x.map(|x| na::sup(&x, &y))
}
/// Component-wise maximum between `x` and `y`.
pub fn max_vec<N: Number, D: Dimension>(x: &Vec<N, D>, y: &Vec<N, D>) -> Vec<N, D>
where DefaultAllocator: Alloc<N, D> {
na::sup(x, y)
}
/// The minimum between each component of `x` and `y`.
pub fn min<N: Number, D: Dimension>(x: &Vec<N, D>, y: N) -> Vec<N, D>
where DefaultAllocator: Alloc<N, D> {
x.map(|x| na::inf(&x, &y))
}
/// Component-wise minimum between `x` and `y`.
pub fn min_vec<N: Number, D: Dimension>(x: &Vec<N, D>, y: &Vec<N, D>) -> Vec<N, D>
where DefaultAllocator: Alloc<N, D> {
na::inf(x, y)
}
/// Returns `x * (1.0 - a) + y * a`, i.e., the linear blend of x and y using the floating-point value a.
///
/// The value for a is not restricted to the range `[0, 1]`.

View File

@ -1,18 +1,18 @@
//! (Reexported) Additional features not specified by GLSL specification
pub use self::matrix_clip_space::*;
pub use self::matrix_projection::*;
pub use self::matrix_relationnal::*;
pub use self::matrix_transform::*;
pub use self::scalar_common::*;
pub use self::scalar_constants::*;
pub use self::vector_common::*;
pub use self::vector_relational::*;
pub use self::quaternion_common::*;
pub use self::quaternion_geometric::*;
pub use self::quaternion_relational::*;
pub use self::quaternion_transform::*;
pub use self::quaternion_trigonometric::*;
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::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};
pub use self::vector_relational::{equal_eps, equal_eps_vec, not_equal_eps, not_equal_eps_vec};
pub use self::quaternion_common::{quat_conjugate, quat_inverse, quat_lerp, quat_slerp};
pub use self::quaternion_geometric::{quat_cross, quat_dot, quat_length, quat_magnitude, quat_normalize};
pub use self::quaternion_relational::{quat_equal, quat_equal_eps, quat_not_equal, quat_not_equal_eps};
pub use self::quaternion_transform::{quat_exp, quat_log, quat_pow, quat_rotate};
pub use self::quaternion_trigonometric::{quat_angle, quat_angle_axis, quat_axis};
mod matrix_clip_space;

View File

@ -27,25 +27,25 @@ pub fn max4<N: Number, D: Dimension>(a: &Vec<N, D>, b: &Vec<N, D>, c: &Vec<N, D>
max2(&max2(a, b), &max2(c, d))
}
/// Component-wise maximum between a vector and a scalar.
/// Component-wise minimum between a vector and a scalar.
pub fn min<N: Number, D: Dimension>(x: &Vec<N, D>, y: N) -> Vec<N, D>
where DefaultAllocator: Alloc<N, D> {
x.map(|x| na::inf(&x, &y))
}
/// Component-wise maximum between two vectors.
/// Component-wise minimum between two vectors.
pub fn min2<N: Number, D: Dimension>(x: &Vec<N, D>, y: &Vec<N, D>) -> Vec<N, D>
where DefaultAllocator: Alloc<N, D> {
na::inf(x, y)
}
/// Component-wise maximum between three vectors.
/// Component-wise minimum between three vectors.
pub fn min3<N: Number, D: Dimension>(a: &Vec<N, D>, b: &Vec<N, D>, c: &Vec<N, D>) -> Vec<N, D>
where DefaultAllocator: Alloc<N, D> {
min2(&min2(a, b), c)
}
/// Component-wise maximum between four vectors.
/// Component-wise minimum between four vectors.
pub fn min4<N: Number, D: Dimension>(a: &Vec<N, D>, b: &Vec<N, D>, c: &Vec<N, D>, d: &Vec<N, D>) -> Vec<N, D>
where DefaultAllocator: Alloc<N, D> {
min2(&min2(a, b), &min2(c, d))

View File

@ -49,14 +49,14 @@ pub fn normalize<N: Real, D: Dimension>(x: &Vec<N, D>) -> Vec<N, D>
}
/// For the incident vector `i` and surface orientation `n`, returns the reflection direction : `result = i - 2.0 * dot(n, i) * n`.
pub fn reflect<N: Number, D: Dimension>(i: &Vec<N, D>, n: &Vec<N, D>) -> Vec<N, D>
pub fn reflect_vec<N: Number, D: Dimension>(i: &Vec<N, D>, n: &Vec<N, D>) -> Vec<N, D>
where DefaultAllocator: Alloc<N, D> {
let _2 = N::one() + N::one();
i - n * (n.dot(i) * _2)
}
/// For the incident vector `i` and surface normal `n`, and the ratio of indices of refraction `eta`, return the refraction vector.
pub fn refract<N: Real, D: Dimension>(i: &Vec<N, D>, n: &Vec<N, D>, eta: N) -> Vec<N, D>
pub fn refract_vec<N: Real, D: Dimension>(i: &Vec<N, D>, n: &Vec<N, D>, eta: N) -> Vec<N, D>
where DefaultAllocator: Alloc<N, D> {
let ni = n.dot(i);

View File

@ -1,17 +1,16 @@
//! (Reexported) Recommended features not specified by GLSL specification
//pub use self::bitfield::*;
pub use self::constants::*;
pub use self::epsilon::*;
pub use self::constants::{e, two_pi, euler, four_over_pi, golden_ratio, half_pi, ln_ln_two, ln_ten, ln_two, one, one_over_pi, one_over_root_two, one_over_two_pi, quarter_pi, root_five, root_half_pi, root_ln_four, root_pi, root_three, root_two, root_two_pi, third, three_over_two_pi, two_over_pi, two_over_root_pi, two_thirds, zero};
//pub use self::integer::*;
pub use self::matrix_access::*;
pub use self::matrix_inverse::*;
pub use self::matrix_access::{column, row, set_column, set_row};
pub use self::matrix_inverse::{affine_inverse, inverse_transpose};
//pub use self::packing::*;
//pub use self::reciprocal::*;
//pub use self::round::*;
pub use self::type_ptr::*;
pub use self::type_ptr::{make_mat2, make_mat2x2, make_mat2x3, make_mat2x4, make_mat3, make_mat3x2, make_mat3x3, make_mat3x4, make_mat4, make_mat4x2, make_mat4x3, make_mat4x4, make_quat, make_vec1, make_vec2, make_vec3, make_vec4, value_ptr, value_ptr_mut, vec1_to_vec2, vec1_to_vec3, vec1_to_vec4, vec2_to_vec1, vec2_to_vec2, vec2_to_vec3, vec2_to_vec4, vec3_to_vec1, vec3_to_vec2, vec3_to_vec3, vec3_to_vec4, vec4_to_vec1, vec4_to_vec2, vec4_to_vec3, vec4_to_vec4};
//pub use self::ulp::*;
pub use self::quaternion::*;
pub use self::quaternion::{quat_cast, quat_euler_angles, quat_greater_than, quat_greater_than_equal, quat_less_than, quat_less_than_equal, quat_look_at, quat_look_at_lh, quat_look_at_rh, quat_pitch, quat_roll, quat_yaw};
//mod bitfield;

View File

@ -1,4 +1,4 @@
use na::{Real, U3, U4, UnitQuaternion, Vector3, Rotation3};
use na::{Real, U3, U4, UnitQuaternion, Vector3};
use aliases::{Qua, Vec, Mat};
@ -34,13 +34,6 @@ pub fn quat_less_than_equal<N: Real>(x: &Qua<N>, y: &Qua<N>) -> Vec<bool, U4> {
pub fn quat_cast<N: Real>(x: &Qua<N>) -> Mat<N, U4, U4> {
::quat_to_mat4(x)
}
/// Convert a rotation matrix to a quaternion.
pub fn quat_to_mat3<N: Real>(x: &Mat<N, U3, U3>) -> Qua<N> {
let rot = Rotation3::from_matrix_unchecked(x);
UnitQuaternion::from_rotation_matrix(&rot).unwrap()
}
/// Computes a right-handed look-at quaternion (equivalent to a right-handed look-at matrix).
pub fn quat_look_at<N: Real>(direction: &Vec<N, U3>, up: &Vec<N, U3>) -> Qua<N> {
quat_look_at_rh(direction, up)

View File

@ -1,23 +1,23 @@
//! (Reexported) Experimental features not specified by GLSL specification.
pub use self::component_wise::*;
pub use self::component_wise::{comp_add, comp_max, comp_min, comp_mul};
//pub use self::euler_angles::*;
pub use self::exterior_product::*;
pub use self::handed_coordinate_space::*;
pub use self::matrix_cross_product::*;
pub use self::matrix_operation::*;
pub use self::norm::*;
pub use self::normal::*;
pub use self::normalize_dot::*;
pub use self::rotate_normalized_axis::*;
pub use self::rotate_vector::*;
pub use self::transform::*;
pub use self::transform2::*;
pub use self::transform2d::*;
pub use self::vector_angle::*;
pub use self::vector_query::*;
pub use self::quaternion::*;
pub use self::exterior_product::{cross2d};
pub use self::handed_coordinate_space::{left_handed, right_handed};
pub use self::matrix_cross_product::{matrix_cross, matrix_cross3};
pub use self::matrix_operation::{diagonal2x2, diagonal2x3, diagonal2x4, diagonal3x2, diagonal3x3, diagonal3x4, diagonal4x2, diagonal4x3, diagonal4x4};
pub use self::norm::{distance2, l1_distance, l1_norm, l2_distance, l2_norm, length2, magnitude2};
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::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};
pub use self::vector_angle::{angle};
pub use self::vector_query::{are_collinear, are_collinear2d, are_orthogonal, is_comp_null, is_normalized, is_null};
pub use self::quaternion::{quat_to_mat3, quat_rotate_vec, quat_cross_vec, mat3_to_quat, quat_extract_real_component, quat_fast_mix, quat_inv_cross_vec, quat_length2, quat_magnitude2, quat_identity, quat_rotate_vec3, quat_rotation, quat_short_mix, quat_to_mat4, to_quat};

View File

@ -3,12 +3,12 @@ use na::{Real, Unit, Rotation3, Vector4, UnitQuaternion, U3, U4};
use aliases::{Qua, Vec, Mat};
/// Rotate the vector `v` by the quaternion `q` assumed to be normalized.
pub fn quat_cross<N: Real>(q: &Qua<N>, v: &Vec<N, U3>) -> Vec<N, U3> {
pub fn quat_cross_vec<N: Real>(q: &Qua<N>, v: &Vec<N, U3>) -> Vec<N, U3> {
UnitQuaternion::new_unchecked(*q) * v
}
/// Rotate the vector `v` by the inverse of the quaternion `q` assumed to be normalized.
pub fn quat_inv_cross<N: Real>(v: &Vec<N, U3>, q: &Qua<N>) -> Vec<N, U3> {
pub fn quat_inv_cross_vec<N: Real>(v: &Vec<N, U3>, q: &Qua<N>) -> Vec<N, U3> {
UnitQuaternion::new_unchecked(*q).inverse() * v
}
@ -37,7 +37,7 @@ pub fn quat_magnitude2<N: Real>(q: &Qua<N>) -> N {
}
/// The quaternion representing the identity rotation.
pub fn quat_quat_identity<N: Real>() -> Qua<N> {
pub fn quat_identity<N: Real>() -> Qua<N> {
UnitQuaternion::identity().unwrap()
}
@ -47,7 +47,7 @@ pub fn quat_rotate_vec3<N: Real>(q: &Qua<N>, v: &Vec<N, U3>) -> Vec<N, U3> {
}
/// Rotates a vector in homogeneous coordinates by a quaternion assumed to be normalized.
pub fn quat_rotate<N: Real>(q: &Qua<N>, v: &Vec<N, U4>) -> Vec<N, U4> {
pub fn quat_rotate_vec<N: Real>(q: &Qua<N>, v: &Vec<N, U4>) -> Vec<N, U4> {
// UnitQuaternion::new_unchecked(*q) * v
let rotated = Unit::new_unchecked(*q) * v.fixed_rows::<U3>(0);
Vector4::new(rotated.x, rotated.y, rotated.z, v.w)
@ -86,6 +86,6 @@ pub fn mat3_to_quat<N: Real>(x: &Mat<N, U3, U3>) -> Qua<N> {
/// Converts a rotation matrix in homogeneous coordinates to a quaternion.
pub fn to_quat<N: Real>(x: &Mat<N, U4, U4>) -> Qua<N> {
let rot = x.fixed_slice::<U3, U3>(0, 0).into_owned();
to_quat(&rot)
mat3_to_quat(&rot)
}

View File

@ -1,4 +1,4 @@
use na::{Real, U2, U3, UnitComplex, Matrix3};
use na::{Real, U2, U3, UnitComplex};
use traits::Number;
use aliases::{Mat, Vec};

View File

@ -1,7 +1,4 @@
#![allow(dead_code)]
extern crate num_traits as num;
#[macro_use]
@ -11,17 +8,54 @@ extern crate nalgebra as na;
pub use aliases::*;
pub use constructors::*;
pub use common::*;
pub use geometric::*;
pub use matrix::*;
pub use traits::*;
pub use trigonometric::*;
pub use vector_relational::*;
pub use exponential::*;
pub use common::{abs, ceil, clamp, clamp2, clamp3, float_bits_to_int, float_bits_to_int_vec, float_bits_to_uint, float_bits_to_uint_vec, floor, fract, fract2, int_bits_to_float, int_bits_to_float_vec, mix, modf, modf_vec, round, sign, smoothstep, step, step_scalar, step_vec, trunc, uint_bits_to_float, uint_bits_to_float_scalar};
pub use geometric::{reflect_vec, cross, distance, dot, faceforward, length, magnitude, normalize, refract_vec};
pub use matrix::{transpose, determinant, inverse, matrix_comp_mult, outer_product};
pub use traits::{Dimension, Number, Alloc};
pub use trigonometric::{acos, acosh, asin, asinh, atan, atan2, atanh, cos, cosh, degrees, radians, sin, sinh, tan, tanh};
pub use vector_relational::{all, any, equal, greater_than, greater_than_equal, less_than, less_than_equal, not, not_equal};
pub use exponential::{exp, exp2, inversesqrt, log, log2, pow, sqrt};
pub use gtx::*;
pub use gtc::*;
pub use ext::*;
pub use gtx::{
comp_add, comp_max, comp_min, comp_mul,
cross2d,
left_handed, right_handed,
matrix_cross, matrix_cross3,
diagonal2x2, diagonal2x3, diagonal2x4, diagonal3x2, diagonal3x3, diagonal3x4, diagonal4x2, diagonal4x3, diagonal4x4,
distance2, l1_distance, l1_norm, l2_distance, l2_norm, length2, magnitude2,
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,
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,
angle,
are_collinear, are_collinear2d, are_orthogonal, is_comp_null, is_normalized, is_null,
quat_to_mat3, quat_rotate_vec, quat_cross_vec, mat3_to_quat, quat_extract_real_component, quat_fast_mix, quat_inv_cross_vec, quat_length2, quat_magnitude2, quat_identity, quat_rotate_vec3, quat_rotation, quat_short_mix, quat_to_mat4, to_quat
};
pub use gtc::{
e, two_pi, euler, four_over_pi, golden_ratio, half_pi, ln_ln_two, ln_ten, ln_two, one, one_over_pi, one_over_root_two, one_over_two_pi, quarter_pi, root_five, root_half_pi, root_ln_four, root_pi, root_three, root_two, root_two_pi, third, three_over_two_pi, two_over_pi, two_over_root_pi, two_thirds, zero,
column, row, set_column, set_row,
affine_inverse, inverse_transpose,
make_mat2, make_mat2x2, make_mat2x3, make_mat2x4, make_mat3, make_mat3x2, make_mat3x3, make_mat3x4, make_mat4, make_mat4x2, make_mat4x3, make_mat4x4, make_quat, make_vec1, make_vec2, make_vec3, make_vec4, value_ptr, value_ptr_mut, vec1_to_vec2, vec1_to_vec3, vec1_to_vec4, vec2_to_vec1, vec2_to_vec2, vec2_to_vec3, vec2_to_vec4, vec3_to_vec1, vec3_to_vec2, vec3_to_vec3, vec3_to_vec4, vec4_to_vec1, vec4_to_vec2, vec4_to_vec3, vec4_to_vec4,
quat_cast, quat_euler_angles, quat_greater_than, quat_greater_than_equal, quat_less_than, quat_less_than_equal, quat_look_at, quat_look_at_lh, quat_look_at_rh, quat_pitch, quat_roll, quat_yaw
};
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,
max3_scalar, max4_scalar, min3_scalar, min4_scalar,
epsilon, pi,
max, max2, max3, max4, min, min2, min3, min4,
equal_eps, equal_eps_vec, not_equal_eps, not_equal_eps_vec,
quat_conjugate, quat_inverse, quat_lerp, quat_slerp,
quat_cross, quat_dot, quat_length, quat_magnitude, quat_normalize,
quat_equal, quat_equal_eps, quat_not_equal, quat_not_equal_eps,
quat_exp, quat_log, quat_pow, quat_rotate,
quat_angle, quat_angle_axis, quat_axis
};
mod aliases;
mod constructors;
@ -35,6 +69,6 @@ mod exponential;
//mod integer;
//mod packing;
pub mod ext;
pub mod gtc;
pub mod gtx;
mod ext;
mod gtc;
mod gtx;