src/taesooLib/BaseLib/math/dualQuaternion.cpp
dualQuaternion dualQuaternion::sDLB(int inCount, const double inWeightList[], const dualQuaternion inDualQuatList[])
{
	assert(inCount>0);

	// Find max weight index for pivoting to that quaternion, so shortest arc is taken
	int pivot_idx = 0;
	for (int n=1; n<inCount; n++)
		if (inWeightList[pivot_idx] < inWeightList[n])
			pivot_idx = n;
	dualQuaternion const& dq_pivot = inDualQuatList[pivot_idx];

	dualQuaternion res(dualQuaternion::zero);
	for (int n=0; n<inCount; n++)
	{
		dualQuaternion const& dq = inDualQuatList[n];
		double weight = inWeightList[n];

		// Make sure dot product is >= 0
		if (dq.dotReal(dq_pivot)<0.0)
			weight = -weight;

		res += weight*dq;
	}

	res.normalizeIt();

	return res;
}
//
// Do dual quaternion linear interpolation. Result is normalized afterwards.
//
Do dual quaternion linear interpolation. Result is normalized afterwards.
Do dual quaternion linear interpolation . Result is normalized afterwards .
dualQuaternion dualQuaternion::sDLB(int inCount, const double inWeightList[], const dualQuaternion inDualQuatList[])
{
	assert(inCount>0);
	int pivot_idx = 0;
	for (int n=1; n<inCount; n++)
		if (inWeightList[pivot_idx] < inWeightList[n])
			pivot_idx = n;
	dualQuaternion const& dq_pivot = inDualQuatList[pivot_idx];
	dualQuaternion res(dualQuaternion::zero);
	for (int n=0; n<inCount; n++)
	{
		dualQuaternion const& dq = inDualQuatList[n];
		double weight = inWeightList[n];
		if (dq.dotReal(dq_pivot)<0.0)
			weight = -weight;
		res += weight*dq;
	}
	res.normalizeIt();
	return res;
}
dualQuaternion dualQuaternion :: sDLB ( int inCount , const double inWeightList [ ] , const dualQuaternion inDualQuatList [ ] ) { assert ( inCount > 0 ) ; int pivot_idx = 0 ; for ( int n = 1 ; n < inCount ; n ++ ) if ( inWeightList [ pivot_idx ] < inWeightList [ n ] ) pivot_idx = n ; dualQuaternion const & dq_pivot = inDualQuatList [ pivot_idx ] ; dualQuaternion res ( dualQuaternion :: zero ) ; for ( int n = 0 ; n < inCount ; n ++ ) { dualQuaternion const & dq = inDualQuatList [ n ] ; double weight = inWeightList [ n ] ; if ( dq . dotReal ( dq_pivot ) < 0.0 ) weight = - weight ; res += weight * dq ; } res . normalizeIt ( ) ; return res ; }
Do dual quaternion linear interpolation.
Do dual quaternion linear interpolation .
// Find max weight index for pivoting to that quaternion, so shortest arc is taken // Make sure dot product is >= 0