Exemplo n.º 1
0
    Real Curve3<Real>::GetTorsion ( Real t ) const
    {
        Vector3<Real> velocity = GetFirstDerivative( t );
        Vector3<Real> acceleration = GetSecondDerivative( t );
        Vector3<Real> cross = velocity.Cross( acceleration );
        Real denom = cross.SquaredLength();

        if ( denom >= Math<Real>::ZERO_TOLERANCE )
        {
            Vector3<Real> jerk = GetThirdDerivative( t );
            Real numer = cross.Dot( jerk );
            return numer / denom;
        }
        else
        {
            // Torsion is indeterminate, just return 0.
            return ( Real )0;
        }
    }
Exemplo n.º 2
0
Real Curve<Real>::GetTorsion (Real t)
{
    Vector3 velocity = GetFirstDerivative(t);
    Vector3 acceleration = GetSecondDerivative(t);
    Vector3 _cross = velocity.cross(acceleration);
    Real denom = _cross.squaredNorm();

    if (denom >= REAL_ZERO_TOLERANCE)
    {
        Vector3 jerk = GetThirdDerivative(t);
        Real numer = dot(_cross,jerk);
        return numer/denom;
    }
    else
    {
        // Torsion is indeterminate, just return 0.
        return (Real)0;
    }
}