Drawings SDK Developer Guide > Working with .dwg Files > Working with Entities > Working with Specific Entitites > Working with NURBS Surfaces > Computed Properties of NURBS Surfaces
Computed Properties of NURBS Surfaces

The OdDbNurbSurface class allows you to evaluate a point on a surface and its derivatives with respect to the u- and v-directions.

Evaluate a Point on a Surface

To evaluate a point on a surface based on the u- and v-parameters, use the evaluate() method, which requires three parameters: two double values to specify the u- and v-parameters, and one OdGePoint3d object through which the point is returned.

For example:


OdGePoint3d pntSurf;
pNurbSurf->evaluate(1.7, 0.4, pntSurf);

odPrintConsoleString(L"\nPoint on surface: (%f; %f; %f)", pntSurf.x, pntSurf.y, pntSurf.z);

Evaluate the First Derivatives

To evaluate a point on a surface and the first derivatives based on u- and v-parameters, use the evaluate() method, which requires five parameters: two double values to specify the u- and v-parameters, one OdGePoint3d object through which the point is returned, and two OdGeVector3d objects through which the first derivatives are returned.

For example:


OdGePoint3d pntSurf;
OdGeVector3d uDeriv, vDeriv;
pNurbSurf->evaluate(1.7, 0.4, pntSurf, uDeriv, vDeriv);

odPrintConsoleString(L"\nPoint on surface: (%f; %f; %f)", pntSurf.x, pntSurf.y, pntSurf.z);
odPrintConsoleString(L"\nU-derivative: (%f; %f; %f)", uDeriv.x, uDeriv.y, uDeriv.z);
odPrintConsoleString(L"\nV-derivative: (%f; %f; %f)", vDeriv.x, vDeriv.y, vDeriv.z);

Evaluate First and Second Derivatives

To evaluate a point on a surface and the first and second derivatives based on u- and v-parameters, use the evaluate() method, which requires eight parameters: two double values to specify the u- and v-parameters, one OdGePoint3d object through which the point is returned, and five OdGeVector3d objects through which the derivatives are returned: u-derivative, v-derivative, uu-derivative, uv-derivative, and vv-derivative.

For example:


OdGePoint3d pntSurf;
OdGeVector3d uDeriv, vDeriv, uuDeriv, uvDeriv, vvDeriv;
pNurbSurf->evaluate(1.7, 0.4, pntSurf, uDeriv, vDeriv, uuDeriv, uvDeriv, vvDeriv);

odPrintConsoleString(L"\nPoint on surface: (%f; %f; %f)", pntSurf.x, pntSurf.y, pntSurf.z);
odPrintConsoleString(L"\nU-derivative: (%f; %f; %f)", uDeriv.x, uDeriv.y, uDeriv.z);
odPrintConsoleString(L"\nV-derivative: (%f; %f; %f)", vDeriv.x, vDeriv.y, vDeriv.z);
odPrintConsoleString(L"\nUU-derivative: (%f; %f; %f)", uuDeriv.x, uuDeriv.y, uuDeriv.z);
odPrintConsoleString(L"\nUV-derivative: (%f; %f; %f)", uvDeriv.x, uvDeriv.y, uvDeriv.z);
odPrintConsoleString(L"\nVV-derivative: (%f; %f; %f)", vvDeriv.x, vvDeriv.y, vvDeriv.z);

Evaluate a Specified Number of Derivatives

To evaluate a point on a surface and a specified number of derivatives based on u- and v-parameters, use the evaluate() method, which requires five parameters: two double values to specify the u- and v-parameters, one integer value to specify the degree of derivatives, one OdGePoint3d object through which the point is returned, and one OdGeVector3dArray object through which the derivatives are returned in the following order: u-deriv, v-deriv, uu-deriv, uv-deriv, and vv-deriv.

For example:


OdGePoint3d pntSurf;
OdGeVector3dArray derivatives;
pNurbSurf->evaluate(1.7, 0.4, 2, pntSurf, derivatives);

odPrintConsoleString(L"\nPoint on surface: (%f; %f; %f)", pntSurf.x, pntSurf.y, pntSurf.z);
odPrintConsoleString(L"\nU-derivative: (%f; %f; %f)", derivatives[0].x, derivatives[0].y, derivatives[0].z);
odPrintConsoleString(L"\nV-derivative: (%f; %f; %f)", derivatives[1].x, derivatives[1].y, derivatives[1].z);

See Also

Working with NURBS Surfaces

Copyright © 2002 – 2021. Open Design Alliance. All rights reserved.