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

The Ge library provides a representation for offset surfaces. An offset surface is produced by offsetting from a base surface by a specified offset distance. Consequently, all points of the offset surface lie a given perpendicular distance from the base surface.

Offset surfaces are represented in the Ge library by the OdGeOffsetSurface class. An offset surface object can contain a pointer to the surface from which it is offset, so modifying the base surface modifies the offset surface, but modifying the offset surface does not modify the base surface. Another option is to create an offset independent of modifications of the base surface, setting a pointer to a copy of the base surface.

The positive direction of the offset at each point of the base surface is the direction of the normal vector at that point.

The base surface can be offset in two directions by specifying a positive or negative offset distance value or by reversing the normal vector. An offset surface with a 0.0 offset distance is an exact replica of the base surface.

To create an offset surface, use the OdGeOffsetSurface() constructor which has three signatures:

  • OdGeOffsetSurface() — Creates an OdGeOffsetSurface object setting the offset distance to 0.0 and the base surface pointer to NULL.
  • OdGeOffsetSurface(OdGeSurface* baseSurface, double offsetDistance, bool makeCopy = true) — Creates an OdGeOffsetSurface object with the specified pointer to the base surface, the offset distance, and a special flag that determines if the offset surface points to its own copy of the base surface or directly to the base surface.
  • OdGeOffsetSurface(const OdGeOffsetSurface& source) — Creates an OdGeOffsetSurface object as a copy of the source object.

After the offset surface object is created, you can set a new base curve and offset distance for the object using the set() method. Use makeCopy = false if you want the offset to ponit to the base curve directly, in this case modifying the base surface modifies the offset surface:

OdGeOffsetSurface offsetSurf1;
offsetSurf1.set(&sphere1, -1, false);

Using the getConstructionSurface() and curveoffsetDistance() methods you can get the base curve and the offset distance for the offset object respectively. The getSurface() method provides the ability to create a copy of the offset surface as a simple surface:

void getConstructionSurface(OdGeSurface*& baseSurface) const;
double OdGeOffsetSurface::offsetDist() const;
bool OdGeOffsetSurface::getSurface(OdGeSurface*& simpleSurface) const;
Copyright © 2002 – 2020. Open Design Alliance. All rights reserved.