//=========================================================Interpolate========================================================================//
ccIndexedTransformation ccIndexedTransformation::Interpolate(	double index,
																const ccIndexedTransformation& trans1,
																const ccIndexedTransformation& trans2)
{
	double dt = trans2.getIndex() - trans1.getIndex();
	if (dt == 0){
		assert(index == trans1.getIndex());
		return trans1;
	}

	//we compute the transformation matrix between trans1 and trans2
	double t = (index - trans1.getIndex())/dt;
	assert(t >= 0 && t <= 1);
	
	ccGLMatrix mat = ccGLMatrix::Interpolate(static_cast<PointCoordinateType>(t),trans1,trans2);

	return ccIndexedTransformation(mat, index);
}
static bool IndexCompOperator(const ccIndexedTransformation& a, double index)
{
	return a.getIndex() < index;
}
static bool IndexedSortOperator(const ccIndexedTransformation& a, const ccIndexedTransformation& b)
{
	return a.getIndex() < b.getIndex();
}