From 7087421bb9f94e044838ebdbd6ef0bc2e88d97f2 Mon Sep 17 00:00:00 2001 From: Dander7BD Date: Tue, 21 Jan 2014 10:32:44 +0100 Subject: [PATCH] InterpolateAxisYToAxis_Nlerp implemented --- Code/OysterMath/LinearMath.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Code/OysterMath/LinearMath.h b/Code/OysterMath/LinearMath.h index b8dfe481..0fac61e6 100644 --- a/Code/OysterMath/LinearMath.h +++ b/Code/OysterMath/LinearMath.h @@ -726,6 +726,21 @@ namespace LinearAlgebra3D template inline ::LinearAlgebra::Vector4 NormalProjection( const ::LinearAlgebra::Vector4 &vector, const ::LinearAlgebra::Vector4 &normalizedAxis ) { return normalizedAxis * ( vector.Dot(normalizedAxis) ); } + + template + ::LinearAlgebra::Matrix4x4 & SnapAxisYToAxis_Nlerp( ::LinearAlgebra::Matrix4x4 &rotation, const ::LinearAlgebra::Vector4 &normalizedAxis ) + { + + } + + template + ::LinearAlgebra::Matrix4x4 & InterpolateAxisYToAxis_Nlerp( ::LinearAlgebra::Matrix4x4 &rotation, const ::LinearAlgebra::Vector4 &normalizedAxis, ScalarType t ) + { + ::LinearAlgebra::Vector4 interpolated = ::LinearAlgebra::Nlerp( rotation.v[1], normalizedAxis, t ); + if( interpolated.Dot(interpolated) == 0 ) + return rotation; // return no change + return SnapAxisYToAxis_Nlerp( rotation, interpolated ); + } } #include "Utilities.h"