SnapAngularAxis fix
floating point error there acos param could be slightly higher than 1. Caused it to return undefined. A clamp ought to fix it.
This commit is contained in:
parent
8b0e1b2426
commit
358cddfd9a
|
@ -794,7 +794,7 @@ namespace LinearAlgebra3D
|
||||||
{
|
{
|
||||||
::LinearAlgebra::Vector4<ScalarType> worldStartNormal( WorldAxisOf(Rotation(startAngularAxis.xyz), localStartNormal.xyz), (ScalarType)0 );
|
::LinearAlgebra::Vector4<ScalarType> worldStartNormal( WorldAxisOf(Rotation(startAngularAxis.xyz), localStartNormal.xyz), (ScalarType)0 );
|
||||||
targetMem = ::LinearAlgebra::Vector4<ScalarType>( worldStartNormal.xyz.Cross(worldEndNormal.xyz), (ScalarType)0);
|
targetMem = ::LinearAlgebra::Vector4<ScalarType>( worldStartNormal.xyz.Cross(worldEndNormal.xyz), (ScalarType)0);
|
||||||
targetMem *= (ScalarType)::std::acos( worldStartNormal.Dot(worldEndNormal) );
|
targetMem *= (ScalarType)::std::acos( ::Utility::Value::Clamp(worldStartNormal.Dot(worldEndNormal), (ScalarType)0, (ScalarType)1) );
|
||||||
return targetMem += startAngularAxis;
|
return targetMem += startAngularAxis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue