forked from M-Labs/nalgebra
Update slice->view in nalgebra-glm
This commit is contained in:
parent
6c8947ccc0
commit
f007772f4b
@ -93,6 +93,6 @@ pub fn mat3_to_quat<T: RealNumber>(x: &TMat3<T>) -> Qua<T> {
|
|||||||
|
|
||||||
/// Converts a rotation matrix in homogeneous coordinates to a quaternion.
|
/// Converts a rotation matrix in homogeneous coordinates to a quaternion.
|
||||||
pub fn to_quat<T: RealNumber>(x: &TMat4<T>) -> Qua<T> {
|
pub fn to_quat<T: RealNumber>(x: &TMat4<T>) -> Qua<T> {
|
||||||
let rot = x.fixed_slice::<3, 3>(0, 0).into_owned();
|
let rot = x.fixed_view::<3, 3>(0, 0).into_owned();
|
||||||
mat3_to_quat(&rot)
|
mat3_to_quat(&rot)
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ pub fn proj2d<T: Number>(m: &TMat3<T>, normal: &TVec2<T>) -> TMat3<T> {
|
|||||||
let mut res = TMat3::identity();
|
let mut res = TMat3::identity();
|
||||||
|
|
||||||
{
|
{
|
||||||
let mut part = res.fixed_slice_mut::<2, 2>(0, 0);
|
let mut part = res.fixed_view_mut::<2, 2>(0, 0);
|
||||||
part -= normal * normal.transpose();
|
part -= normal * normal.transpose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ pub fn proj<T: Number>(m: &TMat4<T>, normal: &TVec3<T>) -> TMat4<T> {
|
|||||||
let mut res = TMat4::identity();
|
let mut res = TMat4::identity();
|
||||||
|
|
||||||
{
|
{
|
||||||
let mut part = res.fixed_slice_mut::<3, 3>(0, 0);
|
let mut part = res.fixed_view_mut::<3, 3>(0, 0);
|
||||||
part -= normal * normal.transpose();
|
part -= normal * normal.transpose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ pub fn reflect2d<T: RealNumber>(m: &TMat3<T>, normal: &TVec2<T>) -> TMat3<T> {
|
|||||||
let mut res = TMat3::identity();
|
let mut res = TMat3::identity();
|
||||||
|
|
||||||
{
|
{
|
||||||
let mut part = res.fixed_slice_mut::<2, 2>(0, 0);
|
let mut part = res.fixed_view_mut::<2, 2>(0, 0);
|
||||||
part -= (normal * T::from_subset(&2.0)) * normal.transpose();
|
part -= (normal * T::from_subset(&2.0)) * normal.transpose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ pub fn reflect<T: RealNumber>(m: &TMat4<T>, normal: &TVec3<T>) -> TMat4<T> {
|
|||||||
let mut res = TMat4::identity();
|
let mut res = TMat4::identity();
|
||||||
|
|
||||||
{
|
{
|
||||||
let mut part = res.fixed_slice_mut::<3, 3>(0, 0);
|
let mut part = res.fixed_view_mut::<3, 3>(0, 0);
|
||||||
part -= (normal * T::from_subset(&2.0)) * normal.transpose();
|
part -= (normal * T::from_subset(&2.0)) * normal.transpose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user