Exemplo n.º 1
0
	// -------------------------------------------------------------------------
	void Hermite::getTangent(float* tangent, float distance)
	{
		unsigned int segment = 0;
		unsigned int amount = mAmount - 2;

		do 
		{
			if(segment > amount)
			{
				getTangentOnSegment(tangent, mSegments[amount]->getLengthFromBeginning() / mSegments[amount]->getLength(), amount);
				return;
			}

			if((mSegments[segment]->getLengthFromBeginning() + mSegments[segment]->getLength()) >= distance)
				break;
		}while(++segment);

		getTangentOnSegment(tangent, (distance - mSegments[segment]->getLengthFromBeginning()) / mSegments[segment]->getLength(), segment);	
	}
Exemplo n.º 2
0
// -------------------------------------------------------------------------
void Hermite::getTangent(osg::Vec3& tangent, double distance)
{
	unsigned int segment = 0;
	unsigned int max = _segments->size() - 1;
	
	do 
	{
		if(segment > max)
		{
			getTangentOnSegment(tangent, (*_segments)[max].getLengthFromBeginning() / (*_segments)[max].getLength(), max);
			return;
		}

		if(((*_segments)[segment].getLengthFromBeginning() + (*_segments)[segment].getLength()) >= distance)
			break;
	}while(++segment);

	getTangentOnSegment(tangent, (distance - (*_segments)[segment].getLengthFromBeginning()) / (*_segments)[segment].getLength(), segment);	
}