Exemple #1
0
/////////////////////////////////////////////////////////////////////////////
// COnStationApp construction
COnStationApp::COnStationApp()
{
#ifdef _DEBUG
	// TODO: add construction code here,
	// Place all significant initialization in InitInstance

	//Some static verifications of routines.  Check that all systems are
	//working.
	CJunctionBox::Test();
	ASSERT(GetAngleBetween(10.0f,70.0f)==40.0f);
	ASSERT(GetAngleBetween(350.0f,30.0f)==10.0f);
	ASSERT(GetAngleBetween(180.0f,40.0f)==110.0f);
	ASSERT(GetAngleBetween(40.0f,280.0f)==340.0f);
	ASSERT(GetAngleBetween(280.0f,40.0f)==340.0f);
	ASSERT(GetAngleBetween(190.0f,30.0f)==110.0f);
	ASSERT(WithinNDegrees(10.0f,20.0f,15.0f));
	ASSERT(WithinNDegrees(355.0f,5.0f,15.0f));
	ASSERT(WithinNDegrees(5.0f,355.0f,15.0f));
	ASSERT(!WithinNDegrees(5.0f,355.0f,9.0f));
	ASSERT(WithinNDegrees(90.0f,110.0f,21.0f));
	ASSERT(WithinNDegrees(110.0f,90.0f,21.0f));
	ASSERT(!WithinNDegrees(110.0f,90.0f,19.0f));
	ASSERT(!WithinNDegrees(90.0f,110.0f,19.0f));
	CQuery Q;
	Q.Verify();
#endif
}
Exemple #2
0
QUATERNION QUATERNION::Slerp(QUATERNION quat2, float t)
{
	QUATERNION qout, p1, p2;
	float theta = GetAngleBetween(quat2);
	
	//qout = (*this).MultScalar(sin((1.0f-t)*theta)).Add(quat2.MultScalar(sin(t*theta))).MultScalar(1.0f/sin(theta));
	
	p1 = (*this).MultScalar((sin((1.0f-t)*theta))/sin(theta));
	p2 = quat2.MultScalar(sin(theta*t)/sinh(theta));
	qout = p1.Add(p2);
	
	
	return qout;
}