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:
OdGeNurbSurface()
— The default constructor. Creates an empty surface object.OdGeNurbSurface(int degreeInU, int degreeInV, int propsInU, int propsInV, int numControlPointsInU, int numControlPointsInV, const OdGePoint3dArray& controlPoints, const OdGeDoubleArray& weights, const OdGeKnotVector& uKnots, const OdGeKnotVector& vKnots, const OdGeTol& tol = OdGeContext::gTol)
— Creates an OdGeNurbSurface object with specified parameters:
degreeInU
, degreeInV
— Defines degrees in U and V parameter directions respectively.propsInU
, propsInV
— Surface properties in the corresponding direction. All available values for these parameters are determined by the OdGe::NurbSurfaceProperties
enumeration. For example, to set a surface that has two poles in the U direction (at minimum and maximum U values), pass the kPoleAtBoth value for the propsInU parameter.numControlPointsInU
, numControlPointsInV
— Defines number of control points in the corresponding directions.controlPoints
– An array of control points for the surface.weights
— An array of weights corresponding to control points.uKnots
, vKnots
— Knot vectors in the corresponding directions.tol
, — Geometric tolerance.OdGeNurbSurface(const OdGeNurbSurface& source)
— Creates an OdGeNurbSurface
object copied from a source object.OdGeNurbSurface(const OdGeEllipCylinder& cylinder)
— Creates an OdGeNurbSurface
object based on the passed elliptic cylinder.OdGeNurbSurface(const OdGeEllipCone& cone)
— Creates an OdGeNurbSurface
object based on the passed elliptic cone.The OdGeNurbSurface
class provides a set of methods to interact with the data that defines the 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 U direction.arrTangentsInV
— An array of tangent vectors for U 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.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().
The paramOfPrec() method calculates the 2D parametric point on the surface from the passed 3D within geometric tolerance. If 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 of usage:
OdGePoint3d point(1.0, 0.0, 0.0);
OdGePoint3d paramOnSurf = nurbSurf1.paramOfPrec(point);
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));
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.
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 – 2020. Open Design Alliance. All rights reserved.
|