NaturalSpline3<Real>::NaturalSpline3 (BoundaryType type, int numSegments,
    Real* times, Vector3<Real>* points)
    :
    MultipleCurve3<Real>(numSegments, times)
{
    mA = points;

    switch (type)
    {
        case BT_FREE:
        {
            CreateFreeSpline();
            break;
        }
        case BT_CLAMPED:
        {
            Vector3<Real> derStart = mA[1] - mA[0];
            Vector3<Real> derFinal = mA[mNumSegments] - mA[mNumSegments-1];
            CreateClampedSpline(derStart, derFinal);
            break;
        }
        case BT_CLOSED:
        {
            CreateClosedSpline();
            break;
        }
    }
}
Example #2
0
 NaturalSpline1<Real>::NaturalSpline1 ( bool free, int numSamples,
                                        Real* times, Real* values )
     :
     mNumSamples( numSamples ),
     mNumSegments( numSamples - 1 ),
     mTimes( times ),
     mA( values )
 {
     assertion( numSamples >= 2 && times && values, "Invalid input\n" );
     if ( free )
     {
         CreateFreeSpline();
     }
     else
     {
         CreatePeriodicSpline();
     }
 }