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

All curve entities are inherited from the OdGeCurve2d and OdGeCurve3d classes for 2D and 3D modeling space respectively and include such curves as: linear entities (lines, line segments, rays), elliptical and circular arcs, splines etc.

Curves in the OdGe library are parametric. A parametric curve is defined by a continuous function with one argument, such as f(u) that maps some interval of the parameter u into either 2D or 3D space, depending on whether the curve is 2D or 3D. Curves derived from OdGeCurve2d and OdGeCurve3d classes have the getInterval() method which returns the parametric interval or the interval and the start point and endpoint of the specific curve:

void getInterval(OdGeInterval& interval) const;
void getInterval(OdGeInterval& interval, OdGePoint3d& start, OdGePoint3d& end) const;

You can also obtain the point on the curve that corresponds to a given parametric value using the OdGeCurve2d::evalPoint() and OdGeCurve3d::evalPoint() methods:

OdGePoint2d OdGeCurve2d::evalPoint(double param) const;
OdGePoint3d OdGeCurve3d::evalPoint(double param) const; 

The OdGeCurve2d and OdGeCurve3d classes provide methods for working with such curve characteristics as orientation, closure, planarity and length.

The orientation of a curve is determined by the direction in which its parameter increases. Use the reverseParam() method of a specific curve to reverse the orientation of a curve.

Curves can be either closed or open. A closed curve has start points and endpoints that are the same. Use the isClosed() methods for 2D and 3D curves to determine whether a curve is closed:

bool OdGeCurve2d::isClosed(const OdGeTol& tol = OdGeContext::gTol) const;
bool OdGeCurve3d::isClosed(const OdGeTol& tol = OdGeContext::gTol) const;

A 3D curve can be planar (all of its points reside in the same plane) or nonplanar. The isPlanar() method is used to determine whether a 3D curve is planar:

bool OdGeCurve3d::isPlanar(OdGePlane& plane, const OdGeTol& tol = OdGeContext::gTol) const;

The length of the curve can be obtained using the length() method. The method calculates the whole length of the curve as well as the length over the specified parameter range:

double OdGeCurve2d::length(double fromParam, double toParam, double tol = OdGeContext::gTol.equalPoint()) const; 
double OdGeCurve2d::length(double tol = OdGeContext::gTol.equalPoint()) const;

double OdGeCurve3d::length(double fromParam, double toParam, double tol = OdGeContext::gTol.equalPoint()) const; 
double OdGeCurve3d::length(double tol = OdGeContext::gTol.equalPoint()) const;

For more details, see the following topics:

Working with Rays

Working with Line Segments

Working with Lines

Working with Circular Arcs

Working with Elliptical Arcs

Working with Composite Curves

Working with Curve Boundaries

Working with NURBS Curves

Working with Offset Curves

Working with Curves Defined on Surfaces

 

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