mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-09-10 06:38:11 +08:00
Modeling Data - Introduce GeomAdaptor_TransformedCurve and unify Eval-based evaluation API (#1139)
Add GeomAdaptor_TransformedCurve as a new base class for BRepAdaptor_Curve that wraps a GeomAdaptor_Curve (or Adaptor3d_CurveOnSurface) with an applied gp_Trsf transformation. This mirrors the existing GeomAdaptor_TransformedSurface pattern for curves. Refactor the adaptor evaluation API across Adaptor3d_Curve and Adaptor3d_Surface hierarchies so that EvalD0/D1/D2/D3/DN are the primary virtual evaluation methods: - Adaptor3d_Curve: Value, D0-DN become non-virtual inline wrappers delegating to EvalD*. Base EvalD* implementations now throw Standard_NotImplemented instead of calling D*. - Adaptor3d_Surface: same pattern applied symmetrically. - Adaptor3d_CurveOnSurface: removes Value/D0-DN overrides (inherited from base); adds EvalD0/D1/D2/D3/DN marked final with the full dispatch logic. - Adaptor3d_IsoCurve: removes Value/D0-DN overrides; adds EvalD* final with iso-curve projection logic (IsoU selects D1V/D2V/D3V, IsoV selects D1U/D2U/D3U). - GeomAdaptor_Curve: removes Value/D0-DN overrides (now inherited inline); EvalD* remain final with BSpline cache and analytical dispatch logic. - GeomAdaptor_Surface: removes Value/D0-DN overrides (now inherited inline); EvalD* remain final with BSpline cache and analytical dispatch logic. - GeomAdaptor_TransformedCurve: overrides EvalD* with transform-and-dispatch logic; no need to override Value/D0-DN (inherited from Adaptor3d_Curve). - GeomAdaptor_TransformedSurface: removes Value/D0-DN overrides (now inherited inline). - BRepAdaptor_Curve: refactored to inherit GeomAdaptor_TransformedCurve, removing all duplicated evaluation and geometry-extraction method implementations. - BRepAdaptor_CompCurve: removes Value/D0-DN overrides; adds EvalD* final with compound-curve parameter mapping and derivative scaling logic. - ProjLib_ProjectOnPlane: removes Value/D0-DN overrides; adds EvalD* final delegating to the projected result adaptor or the OnPlane_* free functions. - GeomFill_SnglrFunc: removes Value/D0-DN overrides; adds EvalD* final implementing the C'(t) x C''(t) singular function with ratio scaling. - ChFiDS_ElSpine: removes Value/D0-D3 overrides; adds EvalD0-D3 final delegating to the internal GeomAdaptor_Curve member. - BiTgte_CurveOnEdge: removes Value/D0-DN overrides; adds EvalD* final. - BiTgte_CurveOnVertex: removes Value/D0-DN overrides; adds EvalD* final (D1-DN throw Standard_NotImplemented as the curve represents a degenerate point). - HelixGeom_HelixCurve: removes Value/D0-D2/DN overrides; adds EvalD0/D1/D2/DN final with trigonometric helix evaluation. Add GTest coverage for GeomAdaptor_TransformedCurve: point/derivative evaluation with transformation, curve-on-surface path, GeomGridEval_Curve batch evaluation.
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include <GCPnts_AbscissaPoint.hxx>
|
||||
#include <Geom_BezierCurve.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
#include <gp_Elips.hxx>
|
||||
#include <gp_Hypr.hxx>
|
||||
@@ -319,59 +320,53 @@ double BRepAdaptor_CompCurve::Period() const
|
||||
return (TLast - TFirst);
|
||||
}
|
||||
|
||||
gp_Pnt BRepAdaptor_CompCurve::Value(const double U) const
|
||||
gp_Pnt BRepAdaptor_CompCurve::EvalD0(double theU) const
|
||||
{
|
||||
double u = U, d;
|
||||
double u = theU, d;
|
||||
int index = CurIndex;
|
||||
Prepare(u, d, index);
|
||||
return myCurves->Value(index).Value(u);
|
||||
return myCurves->Value(index).EvalD0(u);
|
||||
}
|
||||
|
||||
void BRepAdaptor_CompCurve::D0(const double U, gp_Pnt& P) const
|
||||
Geom_Curve::ResD1 BRepAdaptor_CompCurve::EvalD1(double theU) const
|
||||
{
|
||||
double u = U, d;
|
||||
double u = theU, d;
|
||||
int index = CurIndex;
|
||||
Prepare(u, d, index);
|
||||
myCurves->Value(index).D0(u, P);
|
||||
Geom_Curve::ResD1 aRes = myCurves->Value(index).EvalD1(u);
|
||||
aRes.D1 *= d;
|
||||
return aRes;
|
||||
}
|
||||
|
||||
void BRepAdaptor_CompCurve::D1(const double U, gp_Pnt& P, gp_Vec& V) const
|
||||
Geom_Curve::ResD2 BRepAdaptor_CompCurve::EvalD2(double theU) const
|
||||
{
|
||||
double u = U, d;
|
||||
double u = theU, d;
|
||||
int index = CurIndex;
|
||||
Prepare(u, d, index);
|
||||
myCurves->Value(index).D1(u, P, V);
|
||||
V *= d;
|
||||
Geom_Curve::ResD2 aRes = myCurves->Value(index).EvalD2(u);
|
||||
aRes.D1 *= d;
|
||||
aRes.D2 *= d * d;
|
||||
return aRes;
|
||||
}
|
||||
|
||||
void BRepAdaptor_CompCurve::D2(const double U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2) const
|
||||
Geom_Curve::ResD3 BRepAdaptor_CompCurve::EvalD3(double theU) const
|
||||
{
|
||||
double u = U, d;
|
||||
double u = theU, d;
|
||||
int index = CurIndex;
|
||||
Prepare(u, d, index);
|
||||
myCurves->Value(index).D2(u, P, V1, V2);
|
||||
V1 *= d;
|
||||
V2 *= d * d;
|
||||
Geom_Curve::ResD3 aRes = myCurves->Value(index).EvalD3(u);
|
||||
aRes.D1 *= d;
|
||||
aRes.D2 *= d * d;
|
||||
aRes.D3 *= d * d * d;
|
||||
return aRes;
|
||||
}
|
||||
|
||||
void BRepAdaptor_CompCurve::D3(const double U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3) const
|
||||
gp_Vec BRepAdaptor_CompCurve::EvalDN(double theU, int theN) const
|
||||
{
|
||||
double u = U, d;
|
||||
double u = theU, d;
|
||||
int index = CurIndex;
|
||||
Prepare(u, d, index);
|
||||
myCurves->Value(index).D3(u, P, V1, V2, V3);
|
||||
V1 *= d;
|
||||
V2 *= d * d;
|
||||
V3 *= d * d * d;
|
||||
}
|
||||
|
||||
gp_Vec BRepAdaptor_CompCurve::DN(const double U, const int N) const
|
||||
{
|
||||
double u = U, d;
|
||||
int index = CurIndex;
|
||||
Prepare(u, d, index);
|
||||
|
||||
return (myCurves->Value(index).DN(u, N) * std::pow(d, N));
|
||||
return myCurves->Value(index).EvalDN(u, theN) * std::pow(d, theN);
|
||||
}
|
||||
|
||||
double BRepAdaptor_CompCurve::Resolution(const double R3d) const
|
||||
|
||||
@@ -122,38 +122,25 @@ public:
|
||||
|
||||
Standard_EXPORT double Period() const override;
|
||||
|
||||
//! Computes the point of parameter U on the curve
|
||||
Standard_EXPORT gp_Pnt Value(const double U) const override;
|
||||
//! Computes the point of parameter theU on the curve.
|
||||
[[nodiscard]] Standard_EXPORT gp_Pnt EvalD0(double theU) const final;
|
||||
|
||||
//! Computes the point of parameter U.
|
||||
Standard_EXPORT void D0(const double U, gp_Pnt& P) const override;
|
||||
|
||||
//! Computes the point of parameter U on the curve
|
||||
//! with its first derivative.
|
||||
//! Computes the point of parameter theU on the curve with its first derivative.
|
||||
//! Raised if the continuity of the current interval is not C1.
|
||||
Standard_EXPORT void D1(const double U, gp_Pnt& P, gp_Vec& V) const override;
|
||||
[[nodiscard]] Standard_EXPORT Geom_Curve::ResD1 EvalD1(double theU) const final;
|
||||
|
||||
//! Returns the point P of parameter U, the first and second
|
||||
//! derivatives V1 and V2.
|
||||
//! Raised if the continuity of the current interval
|
||||
//! is not C2.
|
||||
Standard_EXPORT void D2(const double U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2) const override;
|
||||
//! Returns the point and the first and second derivatives at parameter theU.
|
||||
//! Raised if the continuity of the current interval is not C2.
|
||||
[[nodiscard]] Standard_EXPORT Geom_Curve::ResD2 EvalD2(double theU) const final;
|
||||
|
||||
//! Returns the point P of parameter U, the first, the second
|
||||
//! and the third derivative.
|
||||
//! Raised if the continuity of the current interval
|
||||
//! is not C3.
|
||||
Standard_EXPORT void D3(const double U,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& V1,
|
||||
gp_Vec& V2,
|
||||
gp_Vec& V3) const override;
|
||||
//! Returns the point and the first, second and third derivatives at parameter theU.
|
||||
//! Raised if the continuity of the current interval is not C3.
|
||||
[[nodiscard]] Standard_EXPORT Geom_Curve::ResD3 EvalD3(double theU) const final;
|
||||
|
||||
//! The returned vector gives the value of the derivative for the
|
||||
//! order of derivation N.
|
||||
//! Returns the derivative of order theN at parameter theU.
|
||||
//! Raised if the continuity of the current interval is not CN.
|
||||
//! Raised if N < 1.
|
||||
Standard_EXPORT gp_Vec DN(const double U, const int N) const override;
|
||||
//! Raised if theN < 1.
|
||||
[[nodiscard]] Standard_EXPORT gp_Vec EvalDN(double theU, int theN) const final;
|
||||
|
||||
//! returns the parametric resolution
|
||||
Standard_EXPORT double Resolution(const double R3d) const override;
|
||||
|
||||
@@ -20,53 +20,37 @@
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
#include <Geom2dAdaptor_Curve.hxx>
|
||||
#include <Geom_BezierCurve.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
#include <GeomAdaptor_Surface.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
#include <gp_Elips.hxx>
|
||||
#include <gp_Hypr.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp_Parab.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Trsf.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <Standard_NoSuchObject.hxx>
|
||||
#include <Standard_NullObject.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <Geom_OffsetCurve.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepAdaptor_Curve, Adaptor3d_Curve)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BRepAdaptor_Curve, GeomAdaptor_TransformedCurve)
|
||||
|
||||
//=================================================================================================
|
||||
//==================================================================================================
|
||||
|
||||
BRepAdaptor_Curve::BRepAdaptor_Curve() = default;
|
||||
|
||||
//=================================================================================================
|
||||
//==================================================================================================
|
||||
|
||||
BRepAdaptor_Curve::BRepAdaptor_Curve(const TopoDS_Edge& E)
|
||||
{
|
||||
Initialize(E);
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
//==================================================================================================
|
||||
|
||||
BRepAdaptor_Curve::BRepAdaptor_Curve(const TopoDS_Edge& E, const TopoDS_Face& F)
|
||||
{
|
||||
Initialize(E, F);
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
//==================================================================================================
|
||||
|
||||
occ::handle<Adaptor3d_Curve> BRepAdaptor_Curve::ShallowCopy() const
|
||||
{
|
||||
occ::handle<BRepAdaptor_Curve> aCopy = new BRepAdaptor_Curve();
|
||||
|
||||
aCopy->myTrsf = myTrsf;
|
||||
|
||||
const occ::handle<Adaptor3d_Curve> aCurve = myCurve.ShallowCopy();
|
||||
const GeomAdaptor_Curve& aGeomCurve = *(occ::down_cast<GeomAdaptor_Curve>(aCurve));
|
||||
aCopy->myCurve = aGeomCurve;
|
||||
@@ -75,12 +59,13 @@ occ::handle<Adaptor3d_Curve> BRepAdaptor_Curve::ShallowCopy() const
|
||||
{
|
||||
aCopy->myConSurf = occ::down_cast<Adaptor3d_CurveOnSurface>(myConSurf->ShallowCopy());
|
||||
}
|
||||
aCopy->myTrsf = myTrsf;
|
||||
aCopy->myEdge = myEdge;
|
||||
|
||||
return aCopy;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
//==================================================================================================
|
||||
|
||||
void BRepAdaptor_Curve::Reset()
|
||||
{
|
||||
@@ -90,7 +75,7 @@ void BRepAdaptor_Curve::Reset()
|
||||
myTrsf = gp_Trsf();
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
//==================================================================================================
|
||||
|
||||
void BRepAdaptor_Curve::Initialize(const TopoDS_Edge& E)
|
||||
{
|
||||
@@ -127,7 +112,7 @@ void BRepAdaptor_Curve::Initialize(const TopoDS_Edge& E)
|
||||
myTrsf = L.Transformation();
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
//==================================================================================================
|
||||
|
||||
void BRepAdaptor_Curve::Initialize(const TopoDS_Edge& E, const TopoDS_Face& F)
|
||||
{
|
||||
@@ -149,126 +134,21 @@ void BRepAdaptor_Curve::Initialize(const TopoDS_Edge& E, const TopoDS_Face& F)
|
||||
myTrsf = L.Transformation();
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
const gp_Trsf& BRepAdaptor_Curve::Trsf() const
|
||||
{
|
||||
return myTrsf;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
bool BRepAdaptor_Curve::Is3DCurve() const
|
||||
{
|
||||
return myConSurf.IsNull();
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
bool BRepAdaptor_Curve::IsCurveOnSurface() const
|
||||
{
|
||||
return !myConSurf.IsNull();
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
const GeomAdaptor_Curve& BRepAdaptor_Curve::Curve() const
|
||||
{
|
||||
return myCurve;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
const Adaptor3d_CurveOnSurface& BRepAdaptor_Curve::CurveOnSurface() const
|
||||
{
|
||||
return *myConSurf;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
//==================================================================================================
|
||||
|
||||
const TopoDS_Edge& BRepAdaptor_Curve::Edge() const
|
||||
{
|
||||
return myEdge;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
//==================================================================================================
|
||||
|
||||
double BRepAdaptor_Curve::Tolerance() const
|
||||
{
|
||||
return BRep_Tool::Tolerance(myEdge);
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
double BRepAdaptor_Curve::FirstParameter() const
|
||||
{
|
||||
if (myConSurf.IsNull())
|
||||
{
|
||||
return myCurve.FirstParameter();
|
||||
}
|
||||
else
|
||||
{
|
||||
return myConSurf->FirstParameter();
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
double BRepAdaptor_Curve::LastParameter() const
|
||||
{
|
||||
if (myConSurf.IsNull())
|
||||
{
|
||||
return myCurve.LastParameter();
|
||||
}
|
||||
else
|
||||
{
|
||||
return myConSurf->LastParameter();
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
GeomAbs_Shape BRepAdaptor_Curve::Continuity() const
|
||||
{
|
||||
if (myConSurf.IsNull())
|
||||
{
|
||||
return myCurve.Continuity();
|
||||
}
|
||||
else
|
||||
{
|
||||
return myConSurf->Continuity();
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
int BRepAdaptor_Curve::NbIntervals(const GeomAbs_Shape S) const
|
||||
{
|
||||
if (myConSurf.IsNull())
|
||||
{
|
||||
return myCurve.NbIntervals(S);
|
||||
}
|
||||
else
|
||||
{
|
||||
return myConSurf->NbIntervals(S);
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
void BRepAdaptor_Curve::Intervals(NCollection_Array1<double>& T, const GeomAbs_Shape S) const
|
||||
{
|
||||
if (myConSurf.IsNull())
|
||||
{
|
||||
myCurve.Intervals(T, S);
|
||||
}
|
||||
else
|
||||
{
|
||||
myConSurf->Intervals(T, S);
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
//==================================================================================================
|
||||
|
||||
occ::handle<Adaptor3d_Curve> BRepAdaptor_Curve::Trim(const double First,
|
||||
const double Last,
|
||||
@@ -294,301 +174,3 @@ occ::handle<Adaptor3d_Curve> BRepAdaptor_Curve::Trim(const double First,
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
bool BRepAdaptor_Curve::IsClosed() const
|
||||
{
|
||||
if (myConSurf.IsNull())
|
||||
{
|
||||
return myCurve.IsClosed();
|
||||
}
|
||||
else
|
||||
{
|
||||
return myConSurf->IsClosed();
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
bool BRepAdaptor_Curve::IsPeriodic() const
|
||||
{
|
||||
if (myConSurf.IsNull())
|
||||
{
|
||||
return myCurve.IsPeriodic();
|
||||
}
|
||||
else
|
||||
{
|
||||
return myConSurf->IsPeriodic();
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
double BRepAdaptor_Curve::Period() const
|
||||
{
|
||||
if (myConSurf.IsNull())
|
||||
{
|
||||
return myCurve.Period();
|
||||
}
|
||||
else
|
||||
{
|
||||
return myConSurf->Period();
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
gp_Pnt BRepAdaptor_Curve::Value(const double U) const
|
||||
{
|
||||
gp_Pnt P;
|
||||
if (myConSurf.IsNull())
|
||||
P = myCurve.Value(U);
|
||||
else
|
||||
P = myConSurf->Value(U);
|
||||
P.Transform(myTrsf);
|
||||
return P;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
void BRepAdaptor_Curve::D0(const double U, gp_Pnt& P) const
|
||||
{
|
||||
if (myConSurf.IsNull())
|
||||
myCurve.D0(U, P);
|
||||
else
|
||||
myConSurf->D0(U, P);
|
||||
P.Transform(myTrsf);
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
void BRepAdaptor_Curve::D1(const double U, gp_Pnt& P, gp_Vec& V) const
|
||||
{
|
||||
if (myConSurf.IsNull())
|
||||
myCurve.D1(U, P, V);
|
||||
else
|
||||
myConSurf->D1(U, P, V);
|
||||
P.Transform(myTrsf);
|
||||
V.Transform(myTrsf);
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
void BRepAdaptor_Curve::D2(const double U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2) const
|
||||
{
|
||||
if (myConSurf.IsNull())
|
||||
myCurve.D2(U, P, V1, V2);
|
||||
else
|
||||
myConSurf->D2(U, P, V1, V2);
|
||||
P.Transform(myTrsf);
|
||||
V1.Transform(myTrsf);
|
||||
V2.Transform(myTrsf);
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
void BRepAdaptor_Curve::D3(const double U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3) const
|
||||
{
|
||||
if (myConSurf.IsNull())
|
||||
myCurve.D3(U, P, V1, V2, V3);
|
||||
else
|
||||
myConSurf->D3(U, P, V1, V2, V3);
|
||||
P.Transform(myTrsf);
|
||||
V1.Transform(myTrsf);
|
||||
V2.Transform(myTrsf);
|
||||
V3.Transform(myTrsf);
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
gp_Vec BRepAdaptor_Curve::DN(const double U, const int N) const
|
||||
{
|
||||
gp_Vec V;
|
||||
if (myConSurf.IsNull())
|
||||
V = myCurve.DN(U, N);
|
||||
else
|
||||
V = myConSurf->DN(U, N);
|
||||
V.Transform(myTrsf);
|
||||
return V;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
double BRepAdaptor_Curve::Resolution(const double R) const
|
||||
{
|
||||
if (myConSurf.IsNull())
|
||||
{
|
||||
return myCurve.Resolution(R);
|
||||
}
|
||||
else
|
||||
{
|
||||
return myConSurf->Resolution(R);
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
GeomAbs_CurveType BRepAdaptor_Curve::GetType() const
|
||||
{
|
||||
if (myConSurf.IsNull())
|
||||
{
|
||||
return myCurve.GetType();
|
||||
}
|
||||
else
|
||||
{
|
||||
return myConSurf->GetType();
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
gp_Lin BRepAdaptor_Curve::Line() const
|
||||
{
|
||||
gp_Lin L;
|
||||
if (myConSurf.IsNull())
|
||||
L = myCurve.Line();
|
||||
else
|
||||
L = myConSurf->Line();
|
||||
L.Transform(myTrsf);
|
||||
return L;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
gp_Circ BRepAdaptor_Curve::Circle() const
|
||||
{
|
||||
gp_Circ C;
|
||||
if (myConSurf.IsNull())
|
||||
C = myCurve.Circle();
|
||||
else
|
||||
C = myConSurf->Circle();
|
||||
C.Transform(myTrsf);
|
||||
return C;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
gp_Elips BRepAdaptor_Curve::Ellipse() const
|
||||
{
|
||||
gp_Elips E;
|
||||
if (myConSurf.IsNull())
|
||||
E = myCurve.Ellipse();
|
||||
else
|
||||
E = myConSurf->Ellipse();
|
||||
E.Transform(myTrsf);
|
||||
return E;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
gp_Hypr BRepAdaptor_Curve::Hyperbola() const
|
||||
{
|
||||
gp_Hypr H;
|
||||
if (myConSurf.IsNull())
|
||||
H = myCurve.Hyperbola();
|
||||
else
|
||||
H = myConSurf->Hyperbola();
|
||||
H.Transform(myTrsf);
|
||||
return H;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
gp_Parab BRepAdaptor_Curve::Parabola() const
|
||||
{
|
||||
gp_Parab P;
|
||||
if (myConSurf.IsNull())
|
||||
P = myCurve.Parabola();
|
||||
else
|
||||
P = myConSurf->Parabola();
|
||||
P.Transform(myTrsf);
|
||||
return P;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
int BRepAdaptor_Curve::Degree() const
|
||||
{
|
||||
if (myConSurf.IsNull())
|
||||
return myCurve.Degree();
|
||||
else
|
||||
return myConSurf->Degree();
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
bool BRepAdaptor_Curve::IsRational() const
|
||||
{
|
||||
if (myConSurf.IsNull())
|
||||
return myCurve.IsRational();
|
||||
else
|
||||
return myConSurf->IsRational();
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
int BRepAdaptor_Curve::NbPoles() const
|
||||
{
|
||||
if (myConSurf.IsNull())
|
||||
return myCurve.NbPoles();
|
||||
else
|
||||
return myConSurf->NbPoles();
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
int BRepAdaptor_Curve::NbKnots() const
|
||||
{
|
||||
if (myConSurf.IsNull())
|
||||
return myCurve.NbKnots();
|
||||
else
|
||||
return myConSurf->NbKnots();
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
occ::handle<Geom_BezierCurve> BRepAdaptor_Curve::Bezier() const
|
||||
{
|
||||
occ::handle<Geom_BezierCurve> BC;
|
||||
if (myConSurf.IsNull())
|
||||
{
|
||||
BC = myCurve.Bezier();
|
||||
}
|
||||
else
|
||||
{
|
||||
BC = myConSurf->Bezier();
|
||||
}
|
||||
return myTrsf.Form() == gp_Identity ? BC
|
||||
: occ::down_cast<Geom_BezierCurve>(BC->Transformed(myTrsf));
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
occ::handle<Geom_BSplineCurve> BRepAdaptor_Curve::BSpline() const
|
||||
{
|
||||
occ::handle<Geom_BSplineCurve> BS;
|
||||
if (myConSurf.IsNull())
|
||||
{
|
||||
BS = myCurve.BSpline();
|
||||
}
|
||||
else
|
||||
{
|
||||
BS = myConSurf->BSpline();
|
||||
}
|
||||
return myTrsf.Form() == gp_Identity ? BS
|
||||
: occ::down_cast<Geom_BSplineCurve>(BS->Transformed(myTrsf));
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
occ::handle<Geom_OffsetCurve> BRepAdaptor_Curve::OffsetCurve() const
|
||||
{
|
||||
if (!Is3DCurve() || myCurve.GetType() != GeomAbs_OffsetCurve)
|
||||
throw Standard_NoSuchObject("BRepAdaptor_Curve::OffsetCurve");
|
||||
|
||||
occ::handle<Geom_OffsetCurve> anOffC = myCurve.OffsetCurve();
|
||||
return myTrsf.Form() == gp_Identity
|
||||
? anOffC
|
||||
: occ::down_cast<Geom_OffsetCurve>(anOffC->Transformed(myTrsf));
|
||||
}
|
||||
|
||||
@@ -17,29 +17,10 @@
|
||||
#ifndef _BRepAdaptor_Curve_HeaderFile
|
||||
#define _BRepAdaptor_Curve_HeaderFile
|
||||
|
||||
#include <Adaptor3d_CurveOnSurface.hxx>
|
||||
#include <gp_Trsf.hxx>
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
#include <GeomAdaptor_TransformedCurve.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <Adaptor3d_Curve.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <NCollection_Array1.hxx>
|
||||
#include <GeomAbs_CurveType.hxx>
|
||||
|
||||
class TopoDS_Face;
|
||||
class Adaptor3d_CurveOnSurface;
|
||||
class gp_Pnt;
|
||||
class gp_Vec;
|
||||
class gp_Lin;
|
||||
class gp_Circ;
|
||||
class gp_Elips;
|
||||
class gp_Hypr;
|
||||
class gp_Parab;
|
||||
class Geom_BezierCurve;
|
||||
class Geom_BSplineCurve;
|
||||
class Geom_OffsetCurve;
|
||||
|
||||
//! The Curve from BRepAdaptor allows to use an Edge
|
||||
//! of the BRep topology like a 3D curve.
|
||||
@@ -53,9 +34,9 @@ class Geom_OffsetCurve;
|
||||
//! surface is used. It is possible to enforce using a
|
||||
//! curve on surface by creating or initialising with
|
||||
//! an Edge and a Face.
|
||||
class BRepAdaptor_Curve : public Adaptor3d_Curve
|
||||
class BRepAdaptor_Curve : public GeomAdaptor_TransformedCurve
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(BRepAdaptor_Curve, Adaptor3d_Curve)
|
||||
DEFINE_STANDARD_RTTIEXT(BRepAdaptor_Curve, GeomAdaptor_TransformedCurve)
|
||||
public:
|
||||
//! Creates an undefined Curve with no Edge loaded.
|
||||
Standard_EXPORT BRepAdaptor_Curve();
|
||||
@@ -87,136 +68,33 @@ public:
|
||||
//! the face.
|
||||
Standard_EXPORT void Initialize(const TopoDS_Edge& E, const TopoDS_Face& F);
|
||||
|
||||
//! Returns the coordinate system of the curve.
|
||||
Standard_EXPORT const gp_Trsf& Trsf() const;
|
||||
|
||||
//! Returns True if the edge geometry is computed from
|
||||
//! a 3D curve.
|
||||
Standard_EXPORT bool Is3DCurve() const;
|
||||
|
||||
//! Returns True if the edge geometry is computed from
|
||||
//! a pcurve on a surface.
|
||||
Standard_EXPORT bool IsCurveOnSurface() const;
|
||||
|
||||
//! Returns the Curve of the edge.
|
||||
Standard_EXPORT const GeomAdaptor_Curve& Curve() const;
|
||||
|
||||
//! Returns the CurveOnSurface of the edge.
|
||||
Standard_EXPORT const Adaptor3d_CurveOnSurface& CurveOnSurface() const;
|
||||
|
||||
//! Returns the edge.
|
||||
Standard_EXPORT const TopoDS_Edge& Edge() const;
|
||||
|
||||
//! Returns the edge tolerance.
|
||||
Standard_EXPORT double Tolerance() const;
|
||||
|
||||
Standard_EXPORT double FirstParameter() const override;
|
||||
|
||||
Standard_EXPORT double LastParameter() const override;
|
||||
|
||||
Standard_EXPORT GeomAbs_Shape Continuity() const override;
|
||||
|
||||
//! Returns the number of intervals for continuity
|
||||
//! <S>. May be one if Continuity(me) >= <S>
|
||||
Standard_EXPORT int NbIntervals(const GeomAbs_Shape S) const override;
|
||||
|
||||
//! Stores in <T> the parameters bounding the intervals
|
||||
//! of continuity <S>.
|
||||
//!
|
||||
//! The array must provide enough room to accommodate
|
||||
//! for the parameters. i.e. T.Length() > NbIntervals()
|
||||
Standard_EXPORT void Intervals(NCollection_Array1<double>& T,
|
||||
const GeomAbs_Shape S) const override;
|
||||
|
||||
//! Returns a curve equivalent of <me> between
|
||||
//! parameters <First> and <Last>. <Tol> is used to
|
||||
//! test for 3d points confusion.
|
||||
//! If <First> >= <Last>
|
||||
Standard_EXPORT occ::handle<Adaptor3d_Curve> Trim(const double First,
|
||||
const double Last,
|
||||
const double Tol) const override;
|
||||
|
||||
Standard_EXPORT bool IsClosed() const override;
|
||||
|
||||
Standard_EXPORT bool IsPeriodic() const override;
|
||||
|
||||
Standard_EXPORT double Period() const override;
|
||||
|
||||
//! Computes the point of parameter U on the curve
|
||||
Standard_EXPORT gp_Pnt Value(const double U) const override;
|
||||
|
||||
//! Computes the point of parameter U.
|
||||
Standard_EXPORT void D0(const double U, gp_Pnt& P) const override;
|
||||
|
||||
//! Computes the point of parameter U on the curve
|
||||
//! with its first derivative.
|
||||
//! Raised if the continuity of the current interval
|
||||
//! is not C1.
|
||||
Standard_EXPORT void D1(const double U, gp_Pnt& P, gp_Vec& V) const override;
|
||||
|
||||
//! Returns the point P of parameter U, the first and second
|
||||
//! derivatives V1 and V2.
|
||||
//! Raised if the continuity of the current interval
|
||||
//! is not C2.
|
||||
Standard_EXPORT void D2(const double U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2) const override;
|
||||
|
||||
//! Returns the point P of parameter U, the first, the second
|
||||
//! and the third derivative.
|
||||
//! Raised if the continuity of the current interval
|
||||
//! is not C3.
|
||||
Standard_EXPORT void D3(const double U,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& V1,
|
||||
gp_Vec& V2,
|
||||
gp_Vec& V3) const override;
|
||||
|
||||
//! The returned vector gives the value of the derivative for the
|
||||
//! order of derivation N.
|
||||
//! Raised if the continuity of the current interval
|
||||
//! is not CN.
|
||||
//! Raised if N < 1.
|
||||
Standard_EXPORT gp_Vec DN(const double U, const int N) const override;
|
||||
|
||||
//! returns the parametric resolution
|
||||
Standard_EXPORT double Resolution(const double R3d) const override;
|
||||
|
||||
Standard_EXPORT GeomAbs_CurveType GetType() const override;
|
||||
|
||||
Standard_EXPORT gp_Lin Line() const override;
|
||||
|
||||
Standard_EXPORT gp_Circ Circle() const override;
|
||||
|
||||
Standard_EXPORT gp_Elips Ellipse() const override;
|
||||
|
||||
Standard_EXPORT gp_Hypr Hyperbola() const override;
|
||||
|
||||
Standard_EXPORT gp_Parab Parabola() const override;
|
||||
|
||||
Standard_EXPORT int Degree() const override;
|
||||
|
||||
Standard_EXPORT bool IsRational() const override;
|
||||
|
||||
Standard_EXPORT int NbPoles() const override;
|
||||
|
||||
Standard_EXPORT int NbKnots() const override;
|
||||
|
||||
//! Warning:
|
||||
//! This will make a copy of the Bezier Curve since it applies to it myTsrf.
|
||||
//! Be careful when using this method.
|
||||
Standard_EXPORT occ::handle<Geom_BezierCurve> Bezier() const override;
|
||||
|
||||
//! Warning:
|
||||
//! This will make a copy of the BSpline Curve since it applies to it myTsrf.
|
||||
//! Be careful when using this method.
|
||||
Standard_EXPORT occ::handle<Geom_BSplineCurve> BSpline() const override;
|
||||
|
||||
Standard_EXPORT occ::handle<Geom_OffsetCurve> OffsetCurve() const override;
|
||||
// Note: Most methods are inherited from GeomAdaptor_TransformedCurve.
|
||||
// The following methods provide access to the underlying curve/transformation:
|
||||
// - Curve() - returns const GeomAdaptor_Curve&
|
||||
// - ChangeCurve() - returns GeomAdaptor_Curve&
|
||||
// - Trsf() - returns const gp_Trsf&
|
||||
// - Is3DCurve() - returns true if 3D curve is used
|
||||
// - IsCurveOnSurface() - returns true if COS is used
|
||||
// - CurveOnSurface() - returns const Adaptor3d_CurveOnSurface&
|
||||
//
|
||||
// Value, D0, D1, D2, D3, DN methods are inherited and marked as final.
|
||||
// They apply the transformation automatically.
|
||||
|
||||
private:
|
||||
gp_Trsf myTrsf;
|
||||
GeomAdaptor_Curve myCurve;
|
||||
occ::handle<Adaptor3d_CurveOnSurface> myConSurf;
|
||||
TopoDS_Edge myEdge;
|
||||
TopoDS_Edge myEdge;
|
||||
};
|
||||
|
||||
#endif // _BRepAdaptor_Curve_HeaderFile
|
||||
|
||||
Reference in New Issue
Block a user