 # Evaluate partial derivatives of NURBS surface

Hello,

Given my NURBS surface and a 2D parameter (s,t), I want to evaluate its surface coordinate P and its derivatives Ds, Dt, Dss, Dst, Dtt at (s,t).

From the SDK I guess I’d need to use this method

``````ON_BOOL32
ON_NurbsSurface::Evaluate( // returns false if unable to evaluate
double s, double t,       // evaluation parameter
int der_count,  // number of derivatives (>=0)
int v_stride,   // v[] array stride (>=Dimension())
double* v,      // v[] array of length stride*(ndir+1)
int side,       // optional - determines which side to evaluate from
//         0 = default
//         1 = from NE quadrant
//         2 = from NW quadrant
//         3 = from SW quadrant
//         4 = from SE quadrant
int hint       // optional - evaluation hint (int) used to speed
//            repeated evaluations
) const
``````

I assume I should set `der_count` as 2 and the output will be `v`.
However, I don’t understand what `v_stride` is, and how the data is stored inside `v`. Is there any example showing this?

Many thanks,
Pablo

You’re probably better off using the `ON_Surface::Ev1Der` or `ON_Surface::Ev2Der`.
Their function signatures are easier to understand.

``````  ON_BOOL32 Ev1Der( // returns false if unable to evaluate
double u, double v,   // evaluation parameters (s,t)
ON_3dPoint& point,    // returns value of surface
ON_3dVector& du,      // first partial derivatives (Ds)
ON_3dVector& dv,      // (Dt)
int quadrant = 0,     // optional - determines which side to evaluate from
//         0 = default
//         1 from NE quadrant
//         2 from NW quadrant
//         3 from SW quadrant
//         4 from SE quadrant
int* hint = 0         // optional - evaluation hint (int) used to speed
//            repeated evaluations
) const;

ON_BOOL32 Ev2Der( // returns false if unable to evaluate
double u, double v,   // evaluation parameters (s,t)
ON_3dPoint& point,    // returns value of surface
ON_3dVector& du,      // first partial derivatives (Ds)
ON_3dVector& dv,      // (Dt)
ON_3dVector& duu,     // second partial derivatives (Dss)
ON_3dVector& duv,     // (Dst)
ON_3dVector& dvv,     // (Dtt)
int quadrant= 0,      // optional - determines which side to evaluate from
//         0 = default
//         1 from NE quadrant
//         2 from NW quadrant
//         3 from SW quadrant
//         4 from SE quadrant
int* hint = 0         // optional - evaluation hint (int) used to speed
//            repeated evaluations
) const;
``````

Thanks for the info! I wonder if there’s also an `EvDer` for third order? For derivatives Ds^2t and Dst^2.

Pablo

In that case you’ll probably need to figure out the `Evaluate` function. I’m sure it can do higher order derivatives (but keep in mind your curves, surfaces must be of higher degree as well).