SnapAngularAxis introduced
This commit is contained in:
parent
c7bc7281d8
commit
190f7e2882
|
@ -325,6 +325,12 @@ namespace LinearAlgebra2D
|
|||
|
||||
namespace LinearAlgebra3D
|
||||
{
|
||||
template<typename ScalarType>
|
||||
inline ::LinearAlgebra::Vector3<ScalarType> WorldAxisOf( const ::LinearAlgebra::Quaternion<ScalarType> &rotation, const ::LinearAlgebra::Vector3<ScalarType> &localAxis )
|
||||
{
|
||||
return (rotation*localAxis*rotation.GetConjugate()).imaginary;
|
||||
}
|
||||
|
||||
// All Matrix to AngularAxis conversions here is incorrect
|
||||
//template<typename ScalarType>
|
||||
//inline ::LinearAlgebra::Vector4<ScalarType> AngularAxis( const ::LinearAlgebra::Matrix3x3<ScalarType> &rotationMatrix )
|
||||
|
@ -741,6 +747,15 @@ namespace LinearAlgebra3D
|
|||
inline ::LinearAlgebra::Vector4<ScalarType> NormalProjection( const ::LinearAlgebra::Vector4<ScalarType> &vector, const ::LinearAlgebra::Vector4<ScalarType> &normalizedAxis )
|
||||
{ return normalizedAxis * ( vector.Dot(normalizedAxis) ); }
|
||||
|
||||
template<typename ScalarType>
|
||||
::LinearAlgebra::Vector3<ScalarType> & SnapAngularAxis( ::LinearAlgebra::Vector4<ScalarType> &startAngularAxis, const ::LinearAlgebra::Vector4<ScalarType> &localStartNormal, const ::LinearAlgebra::Vector4<ScalarType> &worldEndNormal, ::LinearAlgebra::Vector3<ScalarType> &targetMem = ::LinearAlgebra::Vector3<ScalarType>() )
|
||||
{
|
||||
::LinearAlgebra::Vector4<ScalarType> worldStartNormal( WorldAxisOf(Rotation(startAngularAxis), localStartNormal), (ScalarType)0 );
|
||||
targetMem = worldStartNormal.xyz.Cross(worldEndNormal.xyz);
|
||||
targetMem *= (ScalarType)::std::asin( worldStartNormal.Dot(worldEndNormal) );
|
||||
return targetMem;
|
||||
}
|
||||
|
||||
template<typename ScalarType>
|
||||
::LinearAlgebra::Matrix4x4<ScalarType> & SnapAxisYToNormal_UsingNlerp( ::LinearAlgebra::Matrix4x4<ScalarType> &rotation, const ::LinearAlgebra::Vector4<ScalarType> &normalizedAxis )
|
||||
{
|
||||
|
|
|
@ -324,6 +324,7 @@ namespace Oyster { namespace Math3D //! Oyster's native math library specialized
|
|||
using ::LinearAlgebra3D::InterpolateAxisYToNormal_UsingNlerp;
|
||||
using ::LinearAlgebra3D::InterpolateOrientation_UsingNonRigidNlerp;
|
||||
using ::LinearAlgebra3D::InterpolateOrientation_UsingSlerp;
|
||||
using ::LinearAlgebra3D::SnapAngularAxis;
|
||||
} }
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue