///////////////////////////////////////////////////////////////////////////////
|
// Copyright (C) 2002-2016, Open Design Alliance (the "Alliance").
|
// All rights reserved.
|
//
|
// This software and its documentation and related materials are owned by
|
// the Alliance. The software may only be incorporated into application
|
// programs owned by members of the Alliance, subject to a signed
|
// Membership Agreement and Supplemental Software License Agreement with the
|
// Alliance. The structure and organization of this software are the valuable
|
// trade secrets of the Alliance and its suppliers. The software is also
|
// protected by copyright law and international treaty provisions. Application
|
// programs incorporating this software must include the following statement
|
// with their copyright notices:
|
//
|
// This application incorporates Teigha(R) software pursuant to a license
|
// agreement with Open Design Alliance.
|
// Teigha(R) Copyright (C) 2002-2016 by Open Design Alliance.
|
// All rights reserved.
|
//
|
// By use of this software, its documentation or related materials, you
|
// acknowledge and accept the above terms.
|
///////////////////////////////////////////////////////////////////////////////
|
|
#ifndef OD_GE_CURVE_2D_H
|
#define OD_GE_CURVE_2D_H /*!DOM*/
|
|
class OdGePointOnCurve2d;
|
class OdGeInterval;
|
class OdGeMatrix2d;
|
class OdGeLine2d;
|
class OdGePointOnCurve2dData;
|
class OdGeBoundBlock2d;
|
|
#include "Ge/GeEntity2d.h"
|
#include "Ge/GeIntArray.h"
|
#include "Ge/GePoint2d.h"
|
#include "Ge/GePoint2dArray.h"
|
#include "Ge/GeVector2d.h"
|
#include "Ge/GeVector2dArray.h"
|
#include "Ge/GeCurve2dPtrArray.h"
|
#include "Ge/GeDoubleArray.h"
|
|
#include "TD_PackPush.h"
|
|
/** \details
|
This class is the base class for all OdGe 2D curves.
|
|
Library: TD_Ge
|
|
<group OdGe_Classes>
|
*/
|
class GE_TOOLKIT_EXPORT OdGeCurve2d : public OdGeEntity2d
|
{
|
public:
|
|
|
/** \details
|
Returns the parametric interval of the curve.
|
|
\param interval [out] Receives the parametric interval of the curve.
|
|
\note
|
By default this function throws exception "not Implemented". Should be implemented in derived classes.
|
*/
|
void getInterval(
|
OdGeInterval& interval) const;
|
|
/** \details
|
Returns the parametric interval of the curve.
|
|
\param interval [out] Receives the parametric interval of the curve.
|
\param start [out] Receives the start point of interval.
|
\param end [out] Receives the end point of interval.
|
|
\note
|
By default this function throws exception "not Implemented". Should be implemented in derived classes.
|
*/
|
void getInterval(
|
OdGeInterval& interval,
|
OdGePoint2d& start,
|
OdGePoint2d& end) const;
|
|
/** \details
|
Reverses the parameter direction this curve.
|
|
\remarks
|
The point set of this curve is unchanged.
|
|
\note
|
By default this function throws exception "not Implemented". Should be implemented in derived classes.
|
*/
|
OdGeCurve2d& reverseParam();
|
|
/** \details
|
Sets to natural domain of the curve
|
|
\note
|
By default this function throws exception "not Implemented". Should be implemented in derived classes.
|
*/
|
OdGeCurve2d& setInterval();
|
|
/** \details
|
Sets the parametric interval of this curve.
|
|
\param interval [in] Parametric interval of this curve
|
|
\note
|
By default this function throws exception "not Implemented". Should be implemented in derived classes.
|
*/
|
bool setInterval(
|
const OdGeInterval& interval);
|
|
/** \details
|
Returns the distance between the input point and the closest
|
point on this curve.
|
|
\note
|
By default this function throws exception "not Implemented". Should be implemented in derived classes.
|
*/
|
double distanceTo(
|
const OdGePoint2d& point,
|
const OdGeTol& tol = OdGeContext::gTol) const;
|
|
/** \details
|
Returns the distance between the closest points between this
|
curve and the input curve.
|
|
\note
|
By default this function throws exception "not Implemented". Should be implemented in derived classes.
|
*/
|
double distanceTo(
|
const OdGeCurve2d& otherCur,
|
const OdGeTol& tol = OdGeContext::gTol) const;
|
|
/** \details
|
Finds the closest point on this curve to the input point.
|
|
\note
|
This function is the same as getClosestPointTo().
|
*/
|
OdGePoint2d closestPointTo(
|
const OdGePoint2d& point,
|
const OdGeTol& tol = OdGeContext::gTol) const;
|
|
/** \details
|
Finds the closest points between this curve and the input curve.
|
|
\note
|
This function is the same as getClosestPointTo().
|
*/
|
OdGePoint2d closestPointTo(
|
const OdGeCurve2d& curve2d,
|
OdGePoint2d& pntOnOtherCrv,
|
const OdGeTol& tol= OdGeContext::gTol) const;
|
|
/** \details
|
Finds the closest point on this curve to the input point.
|
|
\note
|
By default this function throws exception "not Implemented". Should be implemented in derived classes.
|
*/
|
void getClosestPointTo(
|
const OdGePoint2d& point,
|
OdGePointOnCurve2d& pntOnCrv,
|
const OdGeTol& tol = OdGeContext::gTol) const;
|
|
/** \details
|
Finds the closest points between this curve and the input curve.
|
|
\note
|
By default this function throws exception "not Implemented". Should be implemented in derived classes.
|
*/
|
void getClosestPointTo(
|
const OdGeCurve2d& curve2d,
|
OdGePointOnCurve2d& pntOnThisCrv,
|
OdGePointOnCurve2d& pntOnOtherCrv,
|
const OdGeTol& tol = OdGeContext::gTol) const;
|
|
/** \details
|
Finds the point on the input curve whose normal passes through the input point.
|
|
\note
|
By default this function throws exception "not Implemented". Should be implemented in derived classes.
|
*/
|
bool getNormalPoint(
|
const OdGePoint2d& point,
|
OdGePointOnCurve2d& pntOnCrv,
|
const OdGeTol& tol = OdGeContext::gTol) const;
|
|
TD_USING(OdGeEntity2d::isOn);
|
|
/** \details
|
Determines if pnt lies on curve.
|
The param parameter is only set to a meaningful value
|
if this function returns true.
|
|
\note
|
By default this function throws exception "not Implemented". Should be implemented in derived classes.
|
*/
|
bool isOn(
|
const OdGePoint2d& point,
|
double& param,
|
const OdGeTol& tol = OdGeContext::gTol) const;
|
|
/** \details
|
Determines if input parameter value is within valid parametric range of curve.
|
|
\note
|
By default this function throws exception "not Implemented". Should be implemented in derived classes.
|
*/
|
bool isOn(
|
double param,
|
const OdGeTol& tol = OdGeContext::gTol) const;
|
|
/** \details
|
Returns the parameter value of a point.
|
|
\param point [in] Input point on the curve.
|
\param tol [in] Geometric tolerance.
|
|
\remarks
|
The returned parameters specify a point within tol of point.
|
If point is not on the curve, the results are unpredictable.
|
If you are not sure the point is on the curve, use
|
isOn () instead of this function.
|
|
\note
|
By default this function throws exception "not Implemented". Should be implemented in derived classes.
|
*/
|
double paramOf(
|
const OdGePoint2d& point,
|
const OdGeTol& tol = OdGeContext::gTol) const;
|
|
/** \details
|
Return the offset of the curve.
|
|
\note
|
By default this function throws exception "not Implemented". Should be implemented in derived classes.
|
*/
|
void getTrimmedOffset(
|
double distance,
|
OdGeCurve2dPtrArray& offsetCurveList,
|
OdGe::OffsetCrvExtType extensionType = OdGe::kFillet,
|
const OdGeTol& tol = OdGeContext::gTol) const;
|
|
/** \details
|
Returns true if and only if the curve is closed within the specified tolerance.
|
|
\param tol [in] Geometric tolerance.
|
*/
|
bool isClosed(
|
const OdGeTol& tol = OdGeContext::gTol) const;
|
|
/** \details
|
Determines if the curve is periodic. The curve is periodic if and
|
only if it is closed and the two points evalPoint(t) and
|
evalPoint(t+period) are always the same point for all values of t.
|
|
\note
|
By default this function throws exception "not Implemented". Should be implemented in derived classes.
|
*/
|
bool isPeriodic(
|
double& period) const;
|
|
/** \details
|
Returns true, and a linear entity coincident with this curve,
|
if and only if this curve is linear.
|
|
\param line [out] Receives the line coincident with this curve.
|
\param tol [in] Geometric tolerance.
|
|
\remarks
|
An infinite line is returned, even if this curve is bounded.
|
|
\note
|
By default this function throws exception "not Implemented". Should be implemented in derived classes.
|
*/
|
bool isLinear(
|
OdGeLine2d& line,
|
const OdGeTol& tol = OdGeContext::gTol) const;
|
|
/** \details
|
Returns the arc length of the curve between the two parameter values.
|
|
\note
|
By default this function throws exception "not Implemented". Should be implemented in derived classes.
|
*/
|
double length(
|
double fromParam,
|
double toParam,
|
double tol
|
#ifndef SWIG
|
= OdGeContext::gTol.equalPoint()
|
#endif
|
) const;
|
|
double length(
|
double tol
|
#ifndef SWIG
|
= OdGeContext::gTol.equalPoint()
|
#endif
|
) const;
|
|
/** \details
|
Returns the parameter value of the point whose arc length distance.
|
|
\note
|
By default this function throws exception "not Implemented". Should be implemented in derived classes.
|
*/
|
double paramAtLength(
|
double datumParam,
|
double length,
|
bool posParamDir
|
#ifndef SWIG
|
= true
|
#endif
|
, double tol
|
#ifndef SWIG
|
= OdGeContext::gTol.equalPoint()
|
#endif
|
) const;
|
|
/** \details
|
Returns the area of the interval of the curve defined by
|
startParam and endParam.
|
*/
|
bool area(
|
double startParam, double endParam,
|
double& value,
|
const OdGeTol& tol = OdGeContext::gTol) const;
|
|
/** \details
|
Determines if the curve is degenerate and if so
|
returns type of entity that the curve degenerates.
|
|
\note
|
By default this function throws exception "not Implemented". Should be implemented in derived classes.
|
*/
|
bool isDegenerate(
|
OdGe::EntityId& degenerateType,
|
const OdGeTol& tol = OdGeContext::gTol) const;
|
|
/** \details
|
Determines if the curve is degenerate and if so returns
|
the entity that the curve degenerates into.
|
|
\note
|
By default this function throws exception "not Implemented". Should be implemented in derived classes.
|
*/
|
bool isDegenerate(
|
OdGeEntity2d*& pConvertedEntity,
|
const OdGeTol& tol = OdGeContext::gTol) const;
|
|
/** \details
|
Returns two segments that are obtained by splitting the curve
|
at the input parameter value. If the specified parameter value
|
does not lie within the parametric interval of the curve or if
|
it corresponds to the start or endpoint of the curve, then piece1
|
and piece2 are set to null.
|
|
\note
|
By default this function throws exception "not Implemented". Should be implemented in derived classes.
|
*/
|
void getSplitCurves(
|
double param,
|
OdGeCurve2d*& piece1,
|
OdGeCurve2d*& piece2) const;
|
|
/** \details
|
Explode curve into its component sub-curves.
|
|
\note
|
By default this function throws exception "not Implemented". Should be implemented in derived classes.
|
*/
|
bool explode(
|
OdGeCurve2dPtrArray& explodedCurves,
|
OdGeIntArray& newExplodedCurve,
|
const OdGeInterval* interval = NULL) const;
|
|
/** \details
|
Local closest points.
|
|
\note
|
By default this function throws exception "not Implemented". Should be implemented in derived classes.
|
*/
|
void getLocalClosestPoints(
|
const OdGePoint2d& point,
|
OdGePointOnCurve2d& approxPnt,
|
const OdGeInterval* nbhd = NULL,
|
const OdGeTol& tol = OdGeContext::gTol) const;
|
|
/** \details
|
|
\note
|
By default this function throws exception "not Implemented". Should be implemented in derived classes.
|
*/
|
void getLocalClosestPoints(
|
const OdGeCurve2d& otherCurve,
|
OdGePointOnCurve2d& approxPntOnThisCrv,
|
OdGePointOnCurve2d& approxPntOnOtherCrv,
|
const OdGeInterval* nbhd1 = NULL,
|
const OdGeInterval* nbhd2 = NULL,
|
const OdGeTol& tol = OdGeContext::gTol) const;
|
|
/** \details
|
oriented bounding box of curve.
|
|
\note
|
By default this function throws exception "not Implemented". Should be implemented in derived classes.
|
*/
|
OdGeBoundBlock2d boundBlock() const;
|
OdGeBoundBlock2d boundBlock(
|
const OdGeInterval& range) const;
|
|
/** \details
|
bounding box whose sides are parallel to coordinate axes.
|
|
\note
|
By default this function throws exception "not Implemented". Should be implemented in derived classes.
|
*/
|
OdGeBoundBlock2d orthoBoundBlock() const;
|
OdGeBoundBlock2d orthoBoundBlock(
|
const OdGeInterval& range) const;
|
|
/** \details
|
Returns true, and the start point, if and only if the parametric interval of the curve has a lower bound.
|
|
\param startPoint [out] Receives the start point of the interval.
|
|
\note
|
By default this function throws exception "not Implemented". Should be implemented in derived classes.
|
*/
|
bool hasStartPoint(
|
OdGePoint2d& startPoint) const;
|
|
/** \details
|
Returns true, and the end point, if and only if the parametric interval of the curve has an upper bound.
|
|
\param endPoint [out] Receives the end point of the interval.
|
|
\note
|
By default this function throws exception "not Implemented". Should be implemented in derived classes.
|
*/
|
bool hasEndPoint(
|
OdGePoint2d& endPoint) const;
|
|
/** \details
|
Returns the point on the curve corresponding to the specified parameter value, and the derviatives at that point.
|
|
\param param [in] Parameter to be evaluated.
|
\param numDeriv [in] The number of derivatives to be computed
|
(should not be set larger than 2).
|
\param derivatives [out] Receives an array of derivatives at the point corresponding to param.
|
|
\note
|
By default this function throws exception "not Implemented". Should be implemented in derived classes.
|
*/
|
OdGePoint2d evalPoint(
|
double param) const;
|
OdGePoint2d evalPoint(
|
double param,
|
int numDeriv,
|
OdGeVector2dArray& derivatives) const;
|
|
/** \details
|
Returns sample points along this curve and their parameter values in the specified arrays.
|
|
\param fromParam [in] Starting parameter value.
|
\param toParam [in] Ending parameter value.
|
\param approxEps [in] Approximate spacing along a curve.
|
pointArray Returns an array of sample points.
|
paramArray Returns an array of parameters at each point.
|
*/
|
void getSamplePoints(
|
double fromParam,
|
double toParam,
|
double approxEps,
|
OdGePoint2dArray& pointArray,
|
OdGeDoubleArray& paramArray) const;
|
void getSamplePoints(
|
int numSample,
|
OdGePoint2dArray& pointArray) const;
|
|
OdGeCurve2d& operator =(const OdGeCurve2d& curve);
|
|
//////////////////////////////////////////////////////////////////////////
|
// TD Special :
|
|
void getSamplePoints(
|
double fromParam,
|
double toParam,
|
double approxEps,
|
OdGePoint2dArray& pointArray,
|
OdGeDoubleArray* pParamArray = NULL) const;
|
|
/** \details
|
Appends sample points along this curve and their parameter values to the specified arrays.
|
|
\param fromParam [in] Starting parameter value.
|
\param toParam [in] Ending parameter value.
|
\param approxEps [in] Approximate spacing along a curve.
|
\param numSample [in] Number of samples.
|
\param pointArray [out] Receives an array of sample points.
|
\param pParamArray [in] Pointer to an array to receive the parameters at each point.
|
*/
|
void appendSamplePoints(
|
double fromParam,
|
double toParam,
|
double approxEps,
|
OdGePoint2dArray& pointArray,
|
OdGeDoubleArray* pParamArray = NULL) const;
|
|
void appendSamplePoints(
|
int numSample,
|
OdGePoint2dArray& pointArray) const;
|
|
protected:
|
/** \param source [in] Object to be cloned.
|
*/
|
OdGeCurve2d();
|
OdGeCurve2d(
|
const OdGeCurve2d& source);
|
};
|
|
#include "TD_PackPop.h"
|
|
#endif // OD_GE_CURVE_2D_H
|