Kernel SDK Developer's Guide > Working with the Ge Library > Working with Surfaces > Working with NURBS Surfaces
Working with NURBS Surfaces

The Ge library provides a geometrical representation for NURBS surfaces with the OdGeNurbSurface class. Use this class to create and modify NURBS surface geometrical entities. This class is derived from the OdGeSurface class, so it has all the features of base surfaces. For more information, see Working with Surfaces.

To create an OdGeNurbSurface object, use the appropriate constructor from the constructors list:

The OdGeNurbSurface class provides a set of methods to interact with the data that defines the surface.

Define Multiple Parameters of a NURBS Surface

The getDefinition() method is the overall method for obtaining all data that is used for constructing the surface:

void getDefinition(int& degreeInU, int& degreeInV, int& propsInU, int& propsInV, int& numControlPointsInU, int& numControlPointsInV, OdGePoint3dArray& controlPoints, OdGeDoubleArray& weights, OdGeKnotVector& uKnots, OdGeKnotVector& vKnots) const;

For example:

nurbSurf1.getDefinition(degreeU, degreeV, propsInU, propsInV, numCntrlPntsU, numCntrlPntsV, cntrlPnts, weights, uKnots, vKnots);

The set() method is used to set defining data of the surface object after creation. For example:

OdGeNurbSurface nurbSurf1;
OdGeNurbSurface nurbSurf2();
nurbSurf1.set(degreeInU, degreeInV, nurbSurf2.singularityInU(), nurbSurf2.singularityInV(), numControlPointsInU, numControlPointsInV, controlPnts, weights, uKnots, vKnots);

You can also use the setFitData() method to build the NURBS surface using fit data. Parameters:

  • fitPoints — Array of 3D points to be interpolated by the surface.
  • arrTangentsInU — An array of tangent vectors for the U direction.
  • arrTangentsInV — An array of tangent vectors for the V direction.
  • arrMixedDerivs – An array of derivatives for both directions.
  • uKnots — Knot vector in the U direction.
  • vKnots — Knot vector in the V direction.
  • tol, — Geometric tolerance.

Work with NURBS Surface Parameters Separately

In addition to the getDefinition() method, you can use individual get-methods for a specific geometrical property of the surface: degreeInU(), degreeInV(), getControlPoints(), getUKnots(), getVKnots(), getWeights(), isPeriodicInU(), isPeriodicInV(), isRationalInU(), isRationalInV(), numControlPointsInU(), numControlPointsInV(), numKnotsInU(), numKnotsInV(), singularityInU(), singularityInV(), getDerivativesAt(), loc().

Get a Parameter Point on the Surface

The paramOfPrec() method calculates the 2D parametric point on the surface from the passed 3D point within a geometric tolerance. If the point is not on this surface, the results are unpredictable. If you are not sure the point is on this surface, use isOn() instead of this method. This method is slower than paramOf() but more accurate. Example:


OdGePoint3d point(1.0, 0.0, 0.0);
OdGePoint3d paramOnSurf = nurbSurf1.paramOfPrec(point);

Convert Surfaces to NURBS Surfaces

Objects inherited from the OdGeSurface class can be converted to an OdGeNurbSurface object using one of the convertFrom() methods. The methods accept the following parameters:

  • source — Pointer to a surface object to convert.
  • tol — Geometric tolerance.
  • sameParametrization — Flag that specifies whether to preserve parameterization during conversion.

One of the methods also accepts the domain parameter that specifies which UV-interval of the source object should be converted. In the next example, cone is an instance of a class inherited from the OdGeCone class which is inherited from the OdGeSurface class:


OdGeNurbSurface* pConvertedSurf = OdGeNurbSurface::convertFrom(static_cast<const OdGeSurface*>(&cone));

Join NURB Surfaces

You can join this NURBS surface to other NURBS surfaces with the joinWith() method. This method accepts several parameters:

  • surface — Surface to join with this surface.
  • thisConnectionSide — The side of this surface to which another surface is attached.
  • surfaceConnectionSide — The side of the other surface to which this surface is attached.
  • tol — Geometric tolerance.

Note that joining works in the case of coinciding edges of the same parameter (U-U, V-V).


OdGeNurbCurve3d joinedSurface = nurbSurf1.joinWith(nurbSurf2, OdGeNurbSurface::kUpperV, OdGeNurbSurface::kLowerV);

The next illustration demonstrates which sides to pass in different cases. It is assumed that other joined surfaces (0, 1, 2 and 3) have the same parameterization as the original surface.

Compute Surface Isolines

Isolines are used to give a visual clue to the shape of an object. You can calculate isolines of a NURBS surface with the computeUIsoLine() and computeVIsoLine() methods for U and V parameters respectively. The methods that compute isolines require two arguments — a parameter value for which an isoline is calculated and a NURBS curve that receives isoline parameters such as control points, weights, etc. For example:


OdGeNurbCurve3d isoCrvV;
nurbSurf1.computeVIsoLine(0.5, isoCrvV);

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