Пример #1
0
 public BSplineCoeffs(BSplineBasisType type, int numPoints, int degree, double tmin, double tmax)
 {
     this.numPoints = numPoints;
     this.degree    = degree;
     knots          = new double[numPoints + degree + 1];
     if (type == BSplineBasisType.Open)
     {
         for (int i = 0; i <= degree; i++)
         {
             knots[i] = tmin;
         }
         for (int i = degree + 1; i < numPoints; i++)
         {
             knots[i] = tmin + (tmax - tmin) * (i - degree) / (numPoints - degree);
         }
         for (int i = numPoints; i < numPoints + degree + 1; i++)
         {
             knots[i] = tmax;
         }
     }
     else if (type == BSplineBasisType.Periodical)
     {
         for (int i = 0; i < knots.Length; i++)
         {
             knots[i] = tmin + (i - degree) * (tmax - tmin) / (numPoints - degree);
         }
     }
     else
     {
         throw new ArgumentException("Unknown basis type", "type");
     }
     ComputeCoefficients();
 }
Пример #2
0
 public BSplineBasis(BSplineBasisType type, int numPoints, int degree, double tmin, double tmax) :
     this(DefaultTesselation, type, numPoints, degree, tmin, tmax)
 {
     // Nothing to do here
 }
Пример #3
0
 public BSplineBasis(int tesselation, BSplineBasisType type, int numPoints, int degree, double tmin, double tmax) :
     base(type, numPoints, degree, tmin, tmax)
 {
     SetTesselation(tesselation);
 }