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

All surface entities are derived from the OdGeSurface class and include surfaces such as: planes, cones, spheres, cylinders, toruses and NURBS surfaces.

Surfaces in the OdGe library are parametric. A parametric surface is defined by a continuous function with two arguments, such as f(u,v) that maps some connected subset of the uv plane into 3D space. Surfaces derived from the OdGeSurface class have a special paramOf() method which returns the pair of u,v parameters at the specific point on the surface, and specific methods for getting and setting start parameters values. For example, for OdGeSphere objects, these methods are getAnglesInU(), getAnglesInV() and setAnglesInU(), setAnglesInV():

OdGePoint2d OdGeSurface::paramOf(const OdGePoint3d& point, const OdGeTol& tol = OdGeContext::gTol) const;

The point on a parametric surface that corresponds to a particular parameter's values can be obtained by evaluating the function at that parameter's values that is a 2D point. Surface objects contain the evalPoint() method — a special method-evaluator for calculating the point corresponding to the parameter pair, as well as the derivatives and the normal at that point:

OdGePoint3d OdGeSurface::evalPoint(const OdGePoint2d& param) const;
OdGePoint3d OdGeSurface::evalPoint(const OdGePoint2d& param, int numDeriv, OdGeVector3dArray& derivatives) const; 
OdGePoint3d OdGeSurface::evalPoint(const OdGePoint2d& param, int numDeriv, OdGeVector3dArray& derivatives, OdGeVector3d& normal) const;

Also, for every surface class, the OdGe library contains the evaluator class OdGePointOnSurface, through which the surface evaluators can be accessed.

The OdGeSurface classes provide methods for working with surface orientation. The normal of the surface at a specific point can be obtained as a cross product of the u-tangent vector and the v-tangent vector at this same point. You can reverse the orientation of the normal using the reverseNormal() method. To check whether the normal is reversed, use the isNormalReversed() method. For example, for an OdGeSphere object:

if (!sphere.isNormalReversed())
  sphere.reverseNormal();

Surfaces can be either closed or open in the u and v direction. Use the isClosedInU() and isClosedInV() methods to determine whether a curve is closed in a particular direction:

bool OdGeSurface::isClosedInU(const OdGeTol& tol = OdGeContext::gTol) const;
bool OdGeSurface::isClosedInV(const OdGeTol& tol = OdGeContext::gTol) const;

Since the OdGeSurface class is derived from the OdGeEntity class, you can use the isKindOf() method to get the type of surface object:

bool isKindOf(OdGe::EntityId entType);

For more details, see the following topics:

Working with Spheres

Working with Cones

Working with Cylinder

Working with Tori

Working with Planes

Working with Bounded Planes

Working with Offset Surfaces

Working with NURBS Surfaces

See Also

Working with Evaluator Classes

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