mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
Coding - Add clang-format configuration #246
New clang-format configuration added to determinate code style. The default version is 16. Extend CMake to copy config file to build root. Method/function separator deprecation: In case if function/method has declaration in header, definition must not have related comment. Only //==== [100 chars] ==== is allowed as a not connected separator. In case if function/method has NOT declaration in header, definition must have related comment in doxygen style: // Descriptions // @param // @return Or just function/method separator: //==== [100 chars] ==== All old separators with no description must be replaced to //==== [100 chars] ====
This commit is contained in:
@@ -22,5 +22,4 @@
|
||||
|
||||
typedef NCollection_Array1<Handle(Adaptor3d_Surface)> Approx_Array1OfAdHSurface;
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -17,10 +17,9 @@
|
||||
#ifndef Approx_Array1OfGTrsf2d_HeaderFile
|
||||
#define Approx_Array1OfGTrsf2d_HeaderFile
|
||||
|
||||
#include <gp_GTrsf2d.hxx>
|
||||
#include <NCollection_Array1.hxx>
|
||||
#include <gp_GTrsf2d.hxx>
|
||||
|
||||
typedef NCollection_Array1<gp_GTrsf2d> Approx_Array1OfGTrsf2d;
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -14,7 +14,6 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Adaptor2d_Curve2d.hxx>
|
||||
#include <AdvApprox_ApproxAFunction.hxx>
|
||||
#include <AdvApprox_PrefAndRec.hxx>
|
||||
@@ -23,150 +22,172 @@
|
||||
#include <Precision.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//class : Approx_Curve2d_Eval
|
||||
//purpose: evaluator class for approximation
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
class Approx_Curve2d_Eval : public AdvApprox_EvaluatorFunction
|
||||
{
|
||||
public:
|
||||
Approx_Curve2d_Eval (const Handle(Adaptor2d_Curve2d)& theFunc,
|
||||
Standard_Real First, Standard_Real Last)
|
||||
: fonct(theFunc) { StartEndSav[0] = First; StartEndSav[1] = Last; }
|
||||
|
||||
virtual void Evaluate (Standard_Integer *Dimension,
|
||||
Standard_Real StartEnd[2],
|
||||
Standard_Real *Parameter,
|
||||
Standard_Integer *DerivativeRequest,
|
||||
Standard_Real *Result, // [Dimension]
|
||||
Standard_Integer *ErrorCode);
|
||||
|
||||
private:
|
||||
public:
|
||||
Approx_Curve2d_Eval(const Handle(Adaptor2d_Curve2d)& theFunc,
|
||||
Standard_Real First,
|
||||
Standard_Real Last)
|
||||
: fonct(theFunc)
|
||||
{
|
||||
StartEndSav[0] = First;
|
||||
StartEndSav[1] = Last;
|
||||
}
|
||||
|
||||
virtual void Evaluate(Standard_Integer* Dimension,
|
||||
Standard_Real StartEnd[2],
|
||||
Standard_Real* Parameter,
|
||||
Standard_Integer* DerivativeRequest,
|
||||
Standard_Real* Result, // [Dimension]
|
||||
Standard_Integer* ErrorCode);
|
||||
|
||||
private:
|
||||
Handle(Adaptor2d_Curve2d) fonct;
|
||||
Standard_Real StartEndSav[2];
|
||||
Standard_Real StartEndSav[2];
|
||||
};
|
||||
|
||||
void Approx_Curve2d_Eval::Evaluate (Standard_Integer *Dimension,
|
||||
Standard_Real StartEnd[2],
|
||||
Standard_Real *Param, // Parameter at which evaluation
|
||||
Standard_Integer *Order, // Derivative Request
|
||||
Standard_Real *Result,// [Dimension]
|
||||
Standard_Integer *ErrorCode)
|
||||
void Approx_Curve2d_Eval::Evaluate(Standard_Integer* Dimension,
|
||||
Standard_Real StartEnd[2],
|
||||
Standard_Real* Param, // Parameter at which evaluation
|
||||
Standard_Integer* Order, // Derivative Request
|
||||
Standard_Real* Result, // [Dimension]
|
||||
Standard_Integer* ErrorCode)
|
||||
{
|
||||
*ErrorCode = 0;
|
||||
*ErrorCode = 0;
|
||||
Standard_Real par = *Param;
|
||||
|
||||
// Dimension is incorrect
|
||||
if (*Dimension!=2) {
|
||||
// Dimension is incorrect
|
||||
if (*Dimension != 2)
|
||||
{
|
||||
*ErrorCode = 1;
|
||||
}
|
||||
// Parameter is incorrect
|
||||
if ( par < StartEnd[0] || par > StartEnd[1] ) {
|
||||
// Parameter is incorrect
|
||||
if (par < StartEnd[0] || par > StartEnd[1])
|
||||
{
|
||||
*ErrorCode = 2;
|
||||
}
|
||||
if(StartEnd[0] != StartEndSav[0] || StartEnd[1]!= StartEndSav[1])
|
||||
{
|
||||
fonct = fonct->Trim(StartEnd[0],StartEnd[1],Precision::PConfusion());
|
||||
StartEndSav[0]=StartEnd[0];
|
||||
StartEndSav[1]=StartEnd[1];
|
||||
}
|
||||
if (StartEnd[0] != StartEndSav[0] || StartEnd[1] != StartEndSav[1])
|
||||
{
|
||||
fonct = fonct->Trim(StartEnd[0], StartEnd[1], Precision::PConfusion());
|
||||
StartEndSav[0] = StartEnd[0];
|
||||
StartEndSav[1] = StartEnd[1];
|
||||
}
|
||||
gp_Pnt2d pnt;
|
||||
gp_Vec2d v1, v2;
|
||||
|
||||
switch (*Order) {
|
||||
case 0:
|
||||
pnt = fonct->Value(par);
|
||||
Result[0] = pnt.X();
|
||||
Result[1] = pnt.Y();
|
||||
break;
|
||||
case 1:
|
||||
fonct->D1(par, pnt, v1);
|
||||
Result[0] = v1.X();
|
||||
Result[1] = v1.Y();
|
||||
break;
|
||||
case 2:
|
||||
fonct->D2(par, pnt, v1, v2);
|
||||
Result[0] = v2.X();
|
||||
Result[1] = v2.Y();
|
||||
break;
|
||||
default:
|
||||
Result[0] = Result[1] = 0.;
|
||||
*ErrorCode = 3;
|
||||
break;
|
||||
switch (*Order)
|
||||
{
|
||||
case 0:
|
||||
pnt = fonct->Value(par);
|
||||
Result[0] = pnt.X();
|
||||
Result[1] = pnt.Y();
|
||||
break;
|
||||
case 1:
|
||||
fonct->D1(par, pnt, v1);
|
||||
Result[0] = v1.X();
|
||||
Result[1] = v1.Y();
|
||||
break;
|
||||
case 2:
|
||||
fonct->D2(par, pnt, v1, v2);
|
||||
Result[0] = v2.X();
|
||||
Result[1] = v2.Y();
|
||||
break;
|
||||
default:
|
||||
Result[0] = Result[1] = 0.;
|
||||
*ErrorCode = 3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Approx_Curve2d::Approx_Curve2d(const Handle(Adaptor2d_Curve2d)& C2D,const Standard_Real First,const Standard_Real Last,const Standard_Real TolU,const Standard_Real TolV,const GeomAbs_Shape Continuity,const Standard_Integer MaxDegree,const Standard_Integer MaxSegments)
|
||||
Approx_Curve2d::Approx_Curve2d(const Handle(Adaptor2d_Curve2d)& C2D,
|
||||
const Standard_Real First,
|
||||
const Standard_Real Last,
|
||||
const Standard_Real TolU,
|
||||
const Standard_Real TolV,
|
||||
const GeomAbs_Shape Continuity,
|
||||
const Standard_Integer MaxDegree,
|
||||
const Standard_Integer MaxSegments)
|
||||
{
|
||||
C2D->Trim(First,Last,Precision::PConfusion());
|
||||
C2D->Trim(First, Last, Precision::PConfusion());
|
||||
|
||||
Standard_Integer Num1DSS=2, Num2DSS=0, Num3DSS=0;
|
||||
Handle(TColStd_HArray1OfReal) TwoDTolNul, ThreeDTolNul;
|
||||
Handle(TColStd_HArray1OfReal) OneDTol = new TColStd_HArray1OfReal(1,Num1DSS);
|
||||
OneDTol->ChangeValue(1) = TolU;
|
||||
OneDTol->ChangeValue(2) = TolV;
|
||||
|
||||
Standard_Integer NbInterv_C2 = C2D->NbIntervals(GeomAbs_C2);
|
||||
TColStd_Array1OfReal CutPnts_C2(1, NbInterv_C2+1);
|
||||
Standard_Integer Num1DSS = 2, Num2DSS = 0, Num3DSS = 0;
|
||||
Handle(TColStd_HArray1OfReal) TwoDTolNul, ThreeDTolNul;
|
||||
Handle(TColStd_HArray1OfReal) OneDTol = new TColStd_HArray1OfReal(1, Num1DSS);
|
||||
OneDTol->ChangeValue(1) = TolU;
|
||||
OneDTol->ChangeValue(2) = TolV;
|
||||
|
||||
Standard_Integer NbInterv_C2 = C2D->NbIntervals(GeomAbs_C2);
|
||||
TColStd_Array1OfReal CutPnts_C2(1, NbInterv_C2 + 1);
|
||||
C2D->Intervals(CutPnts_C2, GeomAbs_C2);
|
||||
Standard_Integer NbInterv_C3 = C2D->NbIntervals(GeomAbs_C3);
|
||||
TColStd_Array1OfReal CutPnts_C3(1, NbInterv_C3+1);
|
||||
Standard_Integer NbInterv_C3 = C2D->NbIntervals(GeomAbs_C3);
|
||||
TColStd_Array1OfReal CutPnts_C3(1, NbInterv_C3 + 1);
|
||||
C2D->Intervals(CutPnts_C3, GeomAbs_C3);
|
||||
|
||||
AdvApprox_PrefAndRec CutTool(CutPnts_C2,CutPnts_C3);
|
||||
AdvApprox_PrefAndRec CutTool(CutPnts_C2, CutPnts_C3);
|
||||
|
||||
myMaxError2dU = 0;
|
||||
myMaxError2dV = 0;
|
||||
|
||||
Approx_Curve2d_Eval ev (C2D, First, Last);
|
||||
AdvApprox_ApproxAFunction aApprox (Num1DSS, Num2DSS, Num3DSS,
|
||||
OneDTol, TwoDTolNul, ThreeDTolNul,
|
||||
First, Last, Continuity,
|
||||
MaxDegree, MaxSegments,
|
||||
ev, CutTool);
|
||||
Approx_Curve2d_Eval ev(C2D, First, Last);
|
||||
AdvApprox_ApproxAFunction aApprox(Num1DSS,
|
||||
Num2DSS,
|
||||
Num3DSS,
|
||||
OneDTol,
|
||||
TwoDTolNul,
|
||||
ThreeDTolNul,
|
||||
First,
|
||||
Last,
|
||||
Continuity,
|
||||
MaxDegree,
|
||||
MaxSegments,
|
||||
ev,
|
||||
CutTool);
|
||||
|
||||
myIsDone = aApprox.IsDone();
|
||||
myIsDone = aApprox.IsDone();
|
||||
myHasResult = aApprox.HasResult();
|
||||
|
||||
if (myHasResult) {
|
||||
TColgp_Array1OfPnt2d Poles2d(1,aApprox.NbPoles());
|
||||
TColStd_Array1OfReal Poles1dU(1,aApprox.NbPoles());
|
||||
|
||||
if (myHasResult)
|
||||
{
|
||||
TColgp_Array1OfPnt2d Poles2d(1, aApprox.NbPoles());
|
||||
TColStd_Array1OfReal Poles1dU(1, aApprox.NbPoles());
|
||||
aApprox.Poles1d(1, Poles1dU);
|
||||
TColStd_Array1OfReal Poles1dV(1,aApprox.NbPoles());
|
||||
TColStd_Array1OfReal Poles1dV(1, aApprox.NbPoles());
|
||||
aApprox.Poles1d(2, Poles1dV);
|
||||
for(Standard_Integer i = 1; i <= aApprox.NbPoles(); i++)
|
||||
for (Standard_Integer i = 1; i <= aApprox.NbPoles(); i++)
|
||||
Poles2d.SetValue(i, gp_Pnt2d(Poles1dU.Value(i), Poles1dV.Value(i)));
|
||||
|
||||
Handle(TColStd_HArray1OfReal) Knots = aApprox.Knots();
|
||||
Handle(TColStd_HArray1OfInteger) Mults = aApprox.Multiplicities();
|
||||
Standard_Integer Degree = aApprox.Degree();
|
||||
myCurve = new Geom2d_BSplineCurve(Poles2d, Knots->Array1(), Mults->Array1(), Degree);
|
||||
Handle(TColStd_HArray1OfReal) Knots = aApprox.Knots();
|
||||
Handle(TColStd_HArray1OfInteger) Mults = aApprox.Multiplicities();
|
||||
Standard_Integer Degree = aApprox.Degree();
|
||||
myCurve = new Geom2d_BSplineCurve(Poles2d, Knots->Array1(), Mults->Array1(), Degree);
|
||||
myMaxError2dU = aApprox.MaxError(1, 1);
|
||||
myMaxError2dV = aApprox.MaxError(1, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean Approx_Curve2d::IsDone() const
|
||||
Standard_Boolean Approx_Curve2d::IsDone() const
|
||||
{
|
||||
return myIsDone;
|
||||
}
|
||||
|
||||
Standard_Boolean Approx_Curve2d::HasResult() const
|
||||
Standard_Boolean Approx_Curve2d::HasResult() const
|
||||
{
|
||||
return myHasResult;
|
||||
}
|
||||
|
||||
Handle(Geom2d_BSplineCurve) Approx_Curve2d::Curve() const
|
||||
Handle(Geom2d_BSplineCurve) Approx_Curve2d::Curve() const
|
||||
{
|
||||
return myCurve;
|
||||
}
|
||||
|
||||
Standard_Real Approx_Curve2d::MaxError2dU() const
|
||||
Standard_Real Approx_Curve2d::MaxError2dU() const
|
||||
{
|
||||
return myMaxError2dU;
|
||||
}
|
||||
|
||||
Standard_Real Approx_Curve2d::MaxError2dV() const
|
||||
Standard_Real Approx_Curve2d::MaxError2dV() const
|
||||
{
|
||||
return myMaxError2dV;
|
||||
}
|
||||
|
@@ -18,37 +18,40 @@
|
||||
#define _Approx_Curve2d_HeaderFile
|
||||
|
||||
#include <Adaptor2d_Curve2d.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
#include <Geom2d_BSplineCurve.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
|
||||
//! Makes an approximation for HCurve2d from Adaptor3d
|
||||
class Approx_Curve2d
|
||||
class Approx_Curve2d
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
Standard_EXPORT Approx_Curve2d(const Handle(Adaptor2d_Curve2d)& C2D, const Standard_Real First, const Standard_Real Last, const Standard_Real TolU, const Standard_Real TolV, const GeomAbs_Shape Continuity, const Standard_Integer MaxDegree, const Standard_Integer MaxSegments);
|
||||
|
||||
Standard_EXPORT Approx_Curve2d(const Handle(Adaptor2d_Curve2d)& C2D,
|
||||
const Standard_Real First,
|
||||
const Standard_Real Last,
|
||||
const Standard_Real TolU,
|
||||
const Standard_Real TolV,
|
||||
const GeomAbs_Shape Continuity,
|
||||
const Standard_Integer MaxDegree,
|
||||
const Standard_Integer MaxSegments);
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsDone() const;
|
||||
|
||||
|
||||
Standard_EXPORT Standard_Boolean HasResult() const;
|
||||
|
||||
|
||||
Standard_EXPORT Handle(Geom2d_BSplineCurve) Curve() const;
|
||||
|
||||
|
||||
Standard_EXPORT Standard_Real MaxError2dU() const;
|
||||
|
||||
|
||||
Standard_EXPORT Standard_Real MaxError2dV() const;
|
||||
|
||||
private:
|
||||
|
||||
Handle(Geom2d_BSplineCurve) myCurve;
|
||||
Standard_Boolean myIsDone;
|
||||
Standard_Boolean myHasResult;
|
||||
Standard_Real myMaxError2dU;
|
||||
Standard_Real myMaxError2dV;
|
||||
|
||||
Standard_Boolean myIsDone;
|
||||
Standard_Boolean myHasResult;
|
||||
Standard_Real myMaxError2dU;
|
||||
Standard_Real myMaxError2dV;
|
||||
};
|
||||
|
||||
#endif // _Approx_Curve2d_HeaderFile
|
||||
|
@@ -19,158 +19,171 @@
|
||||
#include <Adaptor3d_Curve.hxx>
|
||||
#include <AdvApprox_ApproxAFunction.hxx>
|
||||
#include <AdvApprox_PrefAndRec.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//class : Approx_Curve3d_Eval
|
||||
//purpose: evaluator class for approximation
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
class Approx_Curve3d_Eval : public AdvApprox_EvaluatorFunction
|
||||
{
|
||||
public:
|
||||
Approx_Curve3d_Eval (const Handle(Adaptor3d_Curve)& theFunc,
|
||||
Standard_Real First, Standard_Real Last)
|
||||
: fonct(theFunc) { StartEndSav[0] = First; StartEndSav[1] = Last; }
|
||||
|
||||
virtual void Evaluate (Standard_Integer *Dimension,
|
||||
Standard_Real StartEnd[2],
|
||||
Standard_Real *Parameter,
|
||||
Standard_Integer *DerivativeRequest,
|
||||
Standard_Real *Result, // [Dimension]
|
||||
Standard_Integer *ErrorCode);
|
||||
|
||||
private:
|
||||
public:
|
||||
Approx_Curve3d_Eval(const Handle(Adaptor3d_Curve)& theFunc,
|
||||
Standard_Real First,
|
||||
Standard_Real Last)
|
||||
: fonct(theFunc)
|
||||
{
|
||||
StartEndSav[0] = First;
|
||||
StartEndSav[1] = Last;
|
||||
}
|
||||
|
||||
virtual void Evaluate(Standard_Integer* Dimension,
|
||||
Standard_Real StartEnd[2],
|
||||
Standard_Real* Parameter,
|
||||
Standard_Integer* DerivativeRequest,
|
||||
Standard_Real* Result, // [Dimension]
|
||||
Standard_Integer* ErrorCode);
|
||||
|
||||
private:
|
||||
Handle(Adaptor3d_Curve) fonct;
|
||||
Standard_Real StartEndSav[2];
|
||||
Standard_Real StartEndSav[2];
|
||||
};
|
||||
|
||||
void Approx_Curve3d_Eval::Evaluate (Standard_Integer *Dimension,
|
||||
Standard_Real StartEnd[2],
|
||||
Standard_Real *Param, // Parameter at which evaluation
|
||||
Standard_Integer *Order, // Derivative Request
|
||||
Standard_Real *Result,// [Dimension]
|
||||
Standard_Integer *ErrorCode)
|
||||
void Approx_Curve3d_Eval::Evaluate(Standard_Integer* Dimension,
|
||||
Standard_Real StartEnd[2],
|
||||
Standard_Real* Param, // Parameter at which evaluation
|
||||
Standard_Integer* Order, // Derivative Request
|
||||
Standard_Real* Result, // [Dimension]
|
||||
Standard_Integer* ErrorCode)
|
||||
{
|
||||
*ErrorCode = 0;
|
||||
*ErrorCode = 0;
|
||||
Standard_Real par = *Param;
|
||||
|
||||
// Dimension is incorrect
|
||||
if (*Dimension!=3) {
|
||||
// Dimension is incorrect
|
||||
if (*Dimension != 3)
|
||||
{
|
||||
*ErrorCode = 1;
|
||||
}
|
||||
|
||||
if(StartEnd[0] != StartEndSav[0] || StartEnd[1]!= StartEndSav[1])
|
||||
{
|
||||
fonct = fonct->Trim(StartEnd[0],StartEnd[1],Precision::PConfusion());
|
||||
StartEndSav[0]=StartEnd[0];
|
||||
StartEndSav[1]=StartEnd[1];
|
||||
}
|
||||
if (StartEnd[0] != StartEndSav[0] || StartEnd[1] != StartEndSav[1])
|
||||
{
|
||||
fonct = fonct->Trim(StartEnd[0], StartEnd[1], Precision::PConfusion());
|
||||
StartEndSav[0] = StartEnd[0];
|
||||
StartEndSav[1] = StartEnd[1];
|
||||
}
|
||||
|
||||
gp_Pnt pnt;
|
||||
gp_Vec v1, v2;
|
||||
|
||||
switch (*Order) {
|
||||
case 0:
|
||||
pnt = fonct->Value(par);
|
||||
Result[0] = pnt.X();
|
||||
Result[1] = pnt.Y();
|
||||
Result[2] = pnt.Z();
|
||||
break;
|
||||
case 1:
|
||||
fonct->D1(par, pnt, v1);
|
||||
Result[0] = v1.X();
|
||||
Result[1] = v1.Y();
|
||||
Result[2] = v1.Z();
|
||||
break;
|
||||
case 2:
|
||||
fonct->D2(par, pnt, v1, v2);
|
||||
Result[0] = v2.X();
|
||||
Result[1] = v2.Y();
|
||||
Result[2] = v2.Z();
|
||||
break;
|
||||
default:
|
||||
Result[0] = Result[1] = Result[2] = 0.;
|
||||
*ErrorCode = 3;
|
||||
break;
|
||||
switch (*Order)
|
||||
{
|
||||
case 0:
|
||||
pnt = fonct->Value(par);
|
||||
Result[0] = pnt.X();
|
||||
Result[1] = pnt.Y();
|
||||
Result[2] = pnt.Z();
|
||||
break;
|
||||
case 1:
|
||||
fonct->D1(par, pnt, v1);
|
||||
Result[0] = v1.X();
|
||||
Result[1] = v1.Y();
|
||||
Result[2] = v1.Z();
|
||||
break;
|
||||
case 2:
|
||||
fonct->D2(par, pnt, v1, v2);
|
||||
Result[0] = v2.X();
|
||||
Result[1] = v2.Y();
|
||||
Result[2] = v2.Z();
|
||||
break;
|
||||
default:
|
||||
Result[0] = Result[1] = Result[2] = 0.;
|
||||
*ErrorCode = 3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Approx_Curve3d::Approx_Curve3d(const Handle(Adaptor3d_Curve)& Curve,
|
||||
const Standard_Real Tol3d,
|
||||
const GeomAbs_Shape Order,
|
||||
const Standard_Integer MaxSegments,
|
||||
const Standard_Integer MaxDegree)
|
||||
const Standard_Real Tol3d,
|
||||
const GeomAbs_Shape Order,
|
||||
const Standard_Integer MaxSegments,
|
||||
const Standard_Integer MaxDegree)
|
||||
{
|
||||
// Initialisation of input parameters of AdvApprox
|
||||
|
||||
Standard_Integer Num1DSS=0, Num2DSS=0, Num3DSS=1;
|
||||
Handle(TColStd_HArray1OfReal) OneDTolNul, TwoDTolNul;
|
||||
Handle(TColStd_HArray1OfReal) ThreeDTol =
|
||||
new TColStd_HArray1OfReal(1,Num3DSS);
|
||||
ThreeDTol->Init(Tol3d);
|
||||
Standard_Integer Num1DSS = 0, Num2DSS = 0, Num3DSS = 1;
|
||||
Handle(TColStd_HArray1OfReal) OneDTolNul, TwoDTolNul;
|
||||
Handle(TColStd_HArray1OfReal) ThreeDTol = new TColStd_HArray1OfReal(1, Num3DSS);
|
||||
ThreeDTol->Init(Tol3d);
|
||||
|
||||
Standard_Real First = Curve->FirstParameter();
|
||||
Standard_Real Last = Curve->LastParameter();
|
||||
|
||||
Standard_Integer NbInterv_C2 = Curve->NbIntervals(GeomAbs_C2);
|
||||
TColStd_Array1OfReal CutPnts_C2(1, NbInterv_C2+1);
|
||||
Curve->Intervals(CutPnts_C2,GeomAbs_C2);
|
||||
Standard_Integer NbInterv_C3 = Curve->NbIntervals(GeomAbs_C3);
|
||||
TColStd_Array1OfReal CutPnts_C3(1, NbInterv_C3+1);
|
||||
Curve->Intervals(CutPnts_C3,GeomAbs_C3);
|
||||
|
||||
AdvApprox_PrefAndRec CutTool(CutPnts_C2,CutPnts_C3);
|
||||
Standard_Integer NbInterv_C2 = Curve->NbIntervals(GeomAbs_C2);
|
||||
TColStd_Array1OfReal CutPnts_C2(1, NbInterv_C2 + 1);
|
||||
Curve->Intervals(CutPnts_C2, GeomAbs_C2);
|
||||
Standard_Integer NbInterv_C3 = Curve->NbIntervals(GeomAbs_C3);
|
||||
TColStd_Array1OfReal CutPnts_C3(1, NbInterv_C3 + 1);
|
||||
Curve->Intervals(CutPnts_C3, GeomAbs_C3);
|
||||
|
||||
AdvApprox_PrefAndRec CutTool(CutPnts_C2, CutPnts_C3);
|
||||
|
||||
myMaxError = 0;
|
||||
|
||||
Approx_Curve3d_Eval ev (Curve, First, Last);
|
||||
AdvApprox_ApproxAFunction aApprox (Num1DSS, Num2DSS, Num3DSS,
|
||||
OneDTolNul, TwoDTolNul, ThreeDTol,
|
||||
First, Last, Order,
|
||||
MaxDegree, MaxSegments,
|
||||
ev, CutTool);
|
||||
Approx_Curve3d_Eval ev(Curve, First, Last);
|
||||
AdvApprox_ApproxAFunction aApprox(Num1DSS,
|
||||
Num2DSS,
|
||||
Num3DSS,
|
||||
OneDTolNul,
|
||||
TwoDTolNul,
|
||||
ThreeDTol,
|
||||
First,
|
||||
Last,
|
||||
Order,
|
||||
MaxDegree,
|
||||
MaxSegments,
|
||||
ev,
|
||||
CutTool);
|
||||
|
||||
myIsDone = aApprox.IsDone();
|
||||
myIsDone = aApprox.IsDone();
|
||||
myHasResult = aApprox.HasResult();
|
||||
|
||||
if (myHasResult) {
|
||||
TColgp_Array1OfPnt Poles(1,aApprox.NbPoles());
|
||||
aApprox.Poles(1,Poles);
|
||||
Handle(TColStd_HArray1OfReal) Knots = aApprox.Knots();
|
||||
Handle(TColStd_HArray1OfInteger) Mults = aApprox.Multiplicities();
|
||||
Standard_Integer Degree = aApprox.Degree();
|
||||
if (myHasResult)
|
||||
{
|
||||
TColgp_Array1OfPnt Poles(1, aApprox.NbPoles());
|
||||
aApprox.Poles(1, Poles);
|
||||
Handle(TColStd_HArray1OfReal) Knots = aApprox.Knots();
|
||||
Handle(TColStd_HArray1OfInteger) Mults = aApprox.Multiplicities();
|
||||
Standard_Integer Degree = aApprox.Degree();
|
||||
myBSplCurve = new Geom_BSplineCurve(Poles, Knots->Array1(), Mults->Array1(), Degree);
|
||||
myMaxError = aApprox.MaxError(3, 1);
|
||||
}
|
||||
myMaxError = aApprox.MaxError(3, 1);
|
||||
}
|
||||
}
|
||||
|
||||
Handle(Geom_BSplineCurve) Approx_Curve3d::Curve() const
|
||||
Handle(Geom_BSplineCurve) Approx_Curve3d::Curve() const
|
||||
{
|
||||
return myBSplCurve;
|
||||
}
|
||||
|
||||
Standard_Boolean Approx_Curve3d::IsDone() const
|
||||
Standard_Boolean Approx_Curve3d::IsDone() const
|
||||
{
|
||||
return myIsDone;
|
||||
return myIsDone;
|
||||
}
|
||||
|
||||
Standard_Boolean Approx_Curve3d::HasResult() const
|
||||
Standard_Boolean Approx_Curve3d::HasResult() const
|
||||
{
|
||||
return myHasResult;
|
||||
return myHasResult;
|
||||
}
|
||||
|
||||
Standard_Real Approx_Curve3d::MaxError() const
|
||||
Standard_Real Approx_Curve3d::MaxError() const
|
||||
{
|
||||
return myMaxError;
|
||||
}
|
||||
|
||||
void Approx_Curve3d::Dump(Standard_OStream& o) const
|
||||
void Approx_Curve3d::Dump(Standard_OStream& o) const
|
||||
{
|
||||
o << "******* Dump of ApproxCurve *******" << std::endl;
|
||||
o << "*******Degree " << Curve()->Degree() << std::endl;
|
||||
|
@@ -21,42 +21,42 @@
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
|
||||
class Approx_Curve3d
|
||||
class Approx_Curve3d
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Approximation of a curve with respect of the
|
||||
//! required tolerance Tol3D.
|
||||
Standard_EXPORT Approx_Curve3d(const Handle(Adaptor3d_Curve)& Curve, const Standard_Real Tol3d, const GeomAbs_Shape Order, const Standard_Integer MaxSegments, const Standard_Integer MaxDegree);
|
||||
|
||||
Standard_EXPORT Approx_Curve3d(const Handle(Adaptor3d_Curve)& Curve,
|
||||
const Standard_Real Tol3d,
|
||||
const GeomAbs_Shape Order,
|
||||
const Standard_Integer MaxSegments,
|
||||
const Standard_Integer MaxDegree);
|
||||
|
||||
Standard_EXPORT Handle(Geom_BSplineCurve) Curve() const;
|
||||
|
||||
|
||||
//! returns Standard_True if the approximation has
|
||||
//! been done within required tolerance
|
||||
Standard_EXPORT Standard_Boolean IsDone() const;
|
||||
|
||||
|
||||
//! returns Standard_True if the approximation did come out
|
||||
//! with a result that is not NECESSARELY within the required
|
||||
//! tolerance
|
||||
Standard_EXPORT Standard_Boolean HasResult() const;
|
||||
|
||||
|
||||
//! returns the Maximum Error (>0 when an approximation
|
||||
//! has been done, 0 if no approximation)
|
||||
Standard_EXPORT Standard_Real MaxError() const;
|
||||
|
||||
|
||||
//! Print on the stream o information about the object
|
||||
Standard_EXPORT void Dump (Standard_OStream& o) const;
|
||||
Standard_EXPORT void Dump(Standard_OStream& o) const;
|
||||
|
||||
private:
|
||||
|
||||
Standard_Boolean myIsDone;
|
||||
Standard_Boolean myHasResult;
|
||||
Standard_Boolean myIsDone;
|
||||
Standard_Boolean myHasResult;
|
||||
Handle(Geom_BSplineCurve) myBSplCurve;
|
||||
Standard_Real myMaxError;
|
||||
|
||||
Standard_Real myMaxError;
|
||||
};
|
||||
|
||||
#endif // _Approx_Curve3d_HeaderFile
|
||||
|
@@ -24,82 +24,84 @@
|
||||
#include <AdvApprox_ApproxAFunction.hxx>
|
||||
#include <AdvApprox_DichoCutting.hxx>
|
||||
#include <AdvApprox_PrefAndRec.hxx>
|
||||
#include <Geom2d_BezierCurve.hxx>
|
||||
#include <Geom2d_BSplineCurve.hxx>
|
||||
#include <Geom2dAdaptor_Curve.hxx>
|
||||
#include <Geom_RectangularTrimmedSurface.hxx>
|
||||
#include <Geom_TrimmedCurve.hxx>
|
||||
#include <Geom2d_BSplineCurve.hxx>
|
||||
#include <Geom2d_BezierCurve.hxx>
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
#include <GeomAdaptor_Surface.hxx>
|
||||
#include <GeomConvert.hxx>
|
||||
#include <Geom_RectangularTrimmedSurface.hxx>
|
||||
#include <Geom_TrimmedCurve.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <gp_Lin2d.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//class : Approx_CurveOnSurface_Eval
|
||||
//purpose: evaluator class for approximation of both 2d and 3d curves
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
class Approx_CurveOnSurface_Eval : public AdvApprox_EvaluatorFunction
|
||||
{
|
||||
public:
|
||||
Approx_CurveOnSurface_Eval (const Handle(Adaptor3d_Curve)& theFunc,
|
||||
const Handle(Adaptor2d_Curve2d)& theFunc2d,
|
||||
Standard_Real First, Standard_Real Last)
|
||||
: fonct(theFunc), fonct2d(theFunc2d)
|
||||
{ StartEndSav[0] = First; StartEndSav[1] = Last; }
|
||||
|
||||
virtual void Evaluate (Standard_Integer *Dimension,
|
||||
Standard_Real StartEnd[2],
|
||||
Standard_Real *Parameter,
|
||||
Standard_Integer *DerivativeRequest,
|
||||
Standard_Real *Result, // [Dimension]
|
||||
Standard_Integer *ErrorCode);
|
||||
|
||||
private:
|
||||
Handle(Adaptor3d_Curve) fonct;
|
||||
public:
|
||||
Approx_CurveOnSurface_Eval(const Handle(Adaptor3d_Curve)& theFunc,
|
||||
const Handle(Adaptor2d_Curve2d)& theFunc2d,
|
||||
Standard_Real First,
|
||||
Standard_Real Last)
|
||||
: fonct(theFunc),
|
||||
fonct2d(theFunc2d)
|
||||
{
|
||||
StartEndSav[0] = First;
|
||||
StartEndSav[1] = Last;
|
||||
}
|
||||
|
||||
virtual void Evaluate(Standard_Integer* Dimension,
|
||||
Standard_Real StartEnd[2],
|
||||
Standard_Real* Parameter,
|
||||
Standard_Integer* DerivativeRequest,
|
||||
Standard_Real* Result, // [Dimension]
|
||||
Standard_Integer* ErrorCode);
|
||||
|
||||
private:
|
||||
Handle(Adaptor3d_Curve) fonct;
|
||||
Handle(Adaptor2d_Curve2d) fonct2d;
|
||||
Standard_Real StartEndSav[2];
|
||||
Standard_Real StartEndSav[2];
|
||||
};
|
||||
|
||||
void Approx_CurveOnSurface_Eval::Evaluate (Standard_Integer *Dimension,
|
||||
Standard_Real StartEnd[2],
|
||||
Standard_Real *Param, // Parameter at which evaluation
|
||||
Standard_Integer *Order, // Derivative Request
|
||||
Standard_Real *Result,// [Dimension]
|
||||
Standard_Integer *ErrorCode)
|
||||
void Approx_CurveOnSurface_Eval::Evaluate(Standard_Integer* Dimension,
|
||||
Standard_Real StartEnd[2],
|
||||
Standard_Real* Param, // Parameter at which evaluation
|
||||
Standard_Integer* Order, // Derivative Request
|
||||
Standard_Real* Result, // [Dimension]
|
||||
Standard_Integer* ErrorCode)
|
||||
{
|
||||
*ErrorCode = 0;
|
||||
*ErrorCode = 0;
|
||||
Standard_Real par = *Param;
|
||||
|
||||
// Dimension is incorrect
|
||||
if (*Dimension != 5) {
|
||||
// Dimension is incorrect
|
||||
if (*Dimension != 5)
|
||||
{
|
||||
*ErrorCode = 1;
|
||||
}
|
||||
|
||||
// Parameter is incorrect
|
||||
if(StartEnd[0] != StartEndSav[0] || StartEnd[1]!= StartEndSav[1])
|
||||
{
|
||||
fonct = fonct->Trim(StartEnd[0],StartEnd[1],Precision::PConfusion());
|
||||
fonct2d = fonct2d->Trim(StartEnd[0],StartEnd[1],
|
||||
Precision::PConfusion());
|
||||
StartEndSav[0]=StartEnd[0];
|
||||
StartEndSav[1]=StartEnd[1];
|
||||
}
|
||||
// Parameter is incorrect
|
||||
if (StartEnd[0] != StartEndSav[0] || StartEnd[1] != StartEndSav[1])
|
||||
{
|
||||
fonct = fonct->Trim(StartEnd[0], StartEnd[1], Precision::PConfusion());
|
||||
fonct2d = fonct2d->Trim(StartEnd[0], StartEnd[1], Precision::PConfusion());
|
||||
StartEndSav[0] = StartEnd[0];
|
||||
StartEndSav[1] = StartEnd[1];
|
||||
}
|
||||
gp_Pnt pnt;
|
||||
|
||||
|
||||
gp_Pnt2d pnt2d;
|
||||
|
||||
switch (*Order) {
|
||||
case 0:
|
||||
{
|
||||
switch (*Order)
|
||||
{
|
||||
case 0: {
|
||||
fonct2d->D0(par, pnt2d);
|
||||
fonct->D0(par, pnt);
|
||||
Result[0] = pnt2d.X();
|
||||
@@ -109,25 +111,23 @@ void Approx_CurveOnSurface_Eval::Evaluate (Standard_Integer *Dimension,
|
||||
Result[4] = pnt.Z();
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
gp_Vec v1;
|
||||
case 1: {
|
||||
gp_Vec v1;
|
||||
gp_Vec2d v21;
|
||||
fonct2d->D1(par, pnt2d, v21);
|
||||
fonct->D1(par,pnt, v1);
|
||||
fonct->D1(par, pnt, v1);
|
||||
Result[0] = v21.X();
|
||||
Result[1] = v21.Y();
|
||||
Result[2] = v1.X();
|
||||
Result[3] = v1.Y();
|
||||
Result[4] = v1.Z();
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
gp_Vec v1, v2;
|
||||
gp_Vec2d v21, v22;
|
||||
}
|
||||
case 2: {
|
||||
gp_Vec v1, v2;
|
||||
gp_Vec2d v21, v22;
|
||||
fonct2d->D2(par, pnt2d, v21, v22);
|
||||
fonct->D2(par, pnt, v1, v2);
|
||||
fonct->D2(par, pnt, v1, v2);
|
||||
Result[0] = v22.X();
|
||||
Result[1] = v22.Y();
|
||||
Result[2] = v2.X();
|
||||
@@ -135,71 +135,74 @@ void Approx_CurveOnSurface_Eval::Evaluate (Standard_Integer *Dimension,
|
||||
Result[4] = v2.Z();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
Result[0] = Result[1] = Result[2] = Result[3] = Result[4] = 0.;
|
||||
*ErrorCode = 3;
|
||||
break;
|
||||
default:
|
||||
Result[0] = Result[1] = Result[2] = Result[3] = Result[4] = 0.;
|
||||
*ErrorCode = 3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//class : Approx_CurveOnSurface_Eval3d
|
||||
//purpose: evaluator class for approximation of 3d curve
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
class Approx_CurveOnSurface_Eval3d : public AdvApprox_EvaluatorFunction
|
||||
{
|
||||
public:
|
||||
Approx_CurveOnSurface_Eval3d (const Handle(Adaptor3d_Curve)& theFunc,
|
||||
Standard_Real First, Standard_Real Last)
|
||||
: fonct(theFunc) { StartEndSav[0] = First; StartEndSav[1] = Last; }
|
||||
|
||||
virtual void Evaluate (Standard_Integer *Dimension,
|
||||
Standard_Real StartEnd[2],
|
||||
Standard_Real *Parameter,
|
||||
Standard_Integer *DerivativeRequest,
|
||||
Standard_Real *Result, // [Dimension]
|
||||
Standard_Integer *ErrorCode);
|
||||
|
||||
private:
|
||||
public:
|
||||
Approx_CurveOnSurface_Eval3d(const Handle(Adaptor3d_Curve)& theFunc,
|
||||
Standard_Real First,
|
||||
Standard_Real Last)
|
||||
: fonct(theFunc)
|
||||
{
|
||||
StartEndSav[0] = First;
|
||||
StartEndSav[1] = Last;
|
||||
}
|
||||
|
||||
virtual void Evaluate(Standard_Integer* Dimension,
|
||||
Standard_Real StartEnd[2],
|
||||
Standard_Real* Parameter,
|
||||
Standard_Integer* DerivativeRequest,
|
||||
Standard_Real* Result, // [Dimension]
|
||||
Standard_Integer* ErrorCode);
|
||||
|
||||
private:
|
||||
Handle(Adaptor3d_Curve) fonct;
|
||||
Standard_Real StartEndSav[2];
|
||||
Standard_Real StartEndSav[2];
|
||||
};
|
||||
|
||||
void Approx_CurveOnSurface_Eval3d::Evaluate (Standard_Integer *Dimension,
|
||||
Standard_Real StartEnd[2],
|
||||
Standard_Real *Param, // Parameter at which evaluation
|
||||
Standard_Integer *Order, // Derivative Request
|
||||
Standard_Real *Result,// [Dimension]
|
||||
Standard_Integer *ErrorCode)
|
||||
void Approx_CurveOnSurface_Eval3d::Evaluate(Standard_Integer* Dimension,
|
||||
Standard_Real StartEnd[2],
|
||||
Standard_Real* Param, // Parameter at which evaluation
|
||||
Standard_Integer* Order, // Derivative Request
|
||||
Standard_Real* Result, // [Dimension]
|
||||
Standard_Integer* ErrorCode)
|
||||
{
|
||||
*ErrorCode = 0;
|
||||
*ErrorCode = 0;
|
||||
Standard_Real par = *Param;
|
||||
|
||||
// Dimension is incorrect
|
||||
if (*Dimension != 3) {
|
||||
// Dimension is incorrect
|
||||
if (*Dimension != 3)
|
||||
{
|
||||
*ErrorCode = 1;
|
||||
}
|
||||
|
||||
// Parameter is incorrect
|
||||
if(StartEnd[0] != StartEndSav[0] || StartEnd[1]!= StartEndSav[1])
|
||||
{
|
||||
fonct = fonct->Trim(StartEnd[0],StartEnd[1],Precision::PConfusion());
|
||||
StartEndSav[0]=StartEnd[0];
|
||||
StartEndSav[1]=StartEnd[1];
|
||||
}
|
||||
// Parameter is incorrect
|
||||
if (StartEnd[0] != StartEndSav[0] || StartEnd[1] != StartEndSav[1])
|
||||
{
|
||||
fonct = fonct->Trim(StartEnd[0], StartEnd[1], Precision::PConfusion());
|
||||
StartEndSav[0] = StartEnd[0];
|
||||
StartEndSav[1] = StartEnd[1];
|
||||
}
|
||||
|
||||
gp_Pnt pnt;
|
||||
|
||||
switch (*Order) {
|
||||
case 0:
|
||||
pnt = fonct->Value(par);
|
||||
Result[0] = pnt.X();
|
||||
Result[1] = pnt.Y();
|
||||
Result[2] = pnt.Z();
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
switch (*Order)
|
||||
{
|
||||
case 0:
|
||||
pnt = fonct->Value(par);
|
||||
Result[0] = pnt.X();
|
||||
Result[1] = pnt.Y();
|
||||
Result[2] = pnt.Z();
|
||||
break;
|
||||
case 1: {
|
||||
gp_Vec v1;
|
||||
fonct->D1(par, pnt, v1);
|
||||
Result[0] = v1.X();
|
||||
@@ -207,8 +210,7 @@ void Approx_CurveOnSurface_Eval3d::Evaluate (Standard_Integer *Dimension,
|
||||
Result[2] = v1.Z();
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
case 2: {
|
||||
gp_Vec v1, v2;
|
||||
fonct->D2(par, pnt, v1, v2);
|
||||
Result[0] = v2.X();
|
||||
@@ -216,160 +218,156 @@ void Approx_CurveOnSurface_Eval3d::Evaluate (Standard_Integer *Dimension,
|
||||
Result[2] = v2.Z();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
Result[0] = Result[1] = Result[2] = 0.;
|
||||
*ErrorCode = 3;
|
||||
break;
|
||||
default:
|
||||
Result[0] = Result[1] = Result[2] = 0.;
|
||||
*ErrorCode = 3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//class : Approx_CurveOnSurface_Eval2d
|
||||
//purpose: evaluator class for approximation of 2d curve
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
class Approx_CurveOnSurface_Eval2d : public AdvApprox_EvaluatorFunction
|
||||
{
|
||||
public:
|
||||
Approx_CurveOnSurface_Eval2d (const Handle(Adaptor2d_Curve2d)& theFunc2d,
|
||||
Standard_Real First, Standard_Real Last)
|
||||
: fonct2d(theFunc2d) { StartEndSav[0] = First; StartEndSav[1] = Last; }
|
||||
|
||||
virtual void Evaluate (Standard_Integer *Dimension,
|
||||
Standard_Real StartEnd[2],
|
||||
Standard_Real *Parameter,
|
||||
Standard_Integer *DerivativeRequest,
|
||||
Standard_Real *Result, // [Dimension]
|
||||
Standard_Integer *ErrorCode);
|
||||
|
||||
private:
|
||||
public:
|
||||
Approx_CurveOnSurface_Eval2d(const Handle(Adaptor2d_Curve2d)& theFunc2d,
|
||||
Standard_Real First,
|
||||
Standard_Real Last)
|
||||
: fonct2d(theFunc2d)
|
||||
{
|
||||
StartEndSav[0] = First;
|
||||
StartEndSav[1] = Last;
|
||||
}
|
||||
|
||||
virtual void Evaluate(Standard_Integer* Dimension,
|
||||
Standard_Real StartEnd[2],
|
||||
Standard_Real* Parameter,
|
||||
Standard_Integer* DerivativeRequest,
|
||||
Standard_Real* Result, // [Dimension]
|
||||
Standard_Integer* ErrorCode);
|
||||
|
||||
private:
|
||||
Handle(Adaptor2d_Curve2d) fonct2d;
|
||||
Standard_Real StartEndSav[2];
|
||||
Standard_Real StartEndSav[2];
|
||||
};
|
||||
|
||||
void Approx_CurveOnSurface_Eval2d::Evaluate (Standard_Integer *Dimension,
|
||||
Standard_Real StartEnd[2],
|
||||
Standard_Real *Param, // Parameter at which evaluation
|
||||
Standard_Integer *Order, // Derivative Request
|
||||
Standard_Real *Result,// [Dimension]
|
||||
Standard_Integer *ErrorCode)
|
||||
void Approx_CurveOnSurface_Eval2d::Evaluate(Standard_Integer* Dimension,
|
||||
Standard_Real StartEnd[2],
|
||||
Standard_Real* Param, // Parameter at which evaluation
|
||||
Standard_Integer* Order, // Derivative Request
|
||||
Standard_Real* Result, // [Dimension]
|
||||
Standard_Integer* ErrorCode)
|
||||
{
|
||||
*ErrorCode = 0;
|
||||
*ErrorCode = 0;
|
||||
Standard_Real par = *Param;
|
||||
|
||||
// Dimension is incorrect
|
||||
if (*Dimension != 2) {
|
||||
// Dimension is incorrect
|
||||
if (*Dimension != 2)
|
||||
{
|
||||
*ErrorCode = 1;
|
||||
}
|
||||
|
||||
// Parameter is incorrect
|
||||
if(StartEnd[0] != StartEndSav[0] || StartEnd[1]!= StartEndSav[1])
|
||||
{
|
||||
fonct2d = fonct2d->Trim(StartEnd[0],StartEnd[1],Precision::PConfusion());
|
||||
StartEndSav[0]=StartEnd[0];
|
||||
StartEndSav[1]=StartEnd[1];
|
||||
}
|
||||
|
||||
// Parameter is incorrect
|
||||
if (StartEnd[0] != StartEndSav[0] || StartEnd[1] != StartEndSav[1])
|
||||
{
|
||||
fonct2d = fonct2d->Trim(StartEnd[0], StartEnd[1], Precision::PConfusion());
|
||||
StartEndSav[0] = StartEnd[0];
|
||||
StartEndSav[1] = StartEnd[1];
|
||||
}
|
||||
|
||||
gp_Pnt2d pnt;
|
||||
|
||||
switch (*Order) {
|
||||
case 0:
|
||||
{
|
||||
pnt = fonct2d->Value(par);
|
||||
switch (*Order)
|
||||
{
|
||||
case 0: {
|
||||
pnt = fonct2d->Value(par);
|
||||
Result[0] = pnt.X();
|
||||
Result[1] = pnt.Y();
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
case 1: {
|
||||
gp_Vec2d v1;
|
||||
fonct2d->D1(par, pnt, v1);
|
||||
Result[0] = v1.X();
|
||||
Result[1] = v1.Y();
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
case 2: {
|
||||
gp_Vec2d v1, v2;
|
||||
fonct2d->D2(par, pnt, v1, v2);
|
||||
Result[0] = v2.X();
|
||||
Result[1] = v2.Y();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
Result[0] = Result[1] = 0.;
|
||||
*ErrorCode = 3;
|
||||
break;
|
||||
default:
|
||||
Result[0] = Result[1] = 0.;
|
||||
*ErrorCode = 3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : Approx_CurveOnSurface
|
||||
//purpose : Constructor
|
||||
//=============================================================================
|
||||
Approx_CurveOnSurface::Approx_CurveOnSurface(const Handle(Adaptor2d_Curve2d)& C2D,
|
||||
const Handle(Adaptor3d_Surface)& Surf,
|
||||
const Standard_Real First,
|
||||
const Standard_Real Last,
|
||||
const Standard_Real Tol,
|
||||
const GeomAbs_Shape S,
|
||||
const Standard_Integer MaxDegree,
|
||||
const Standard_Integer MaxSegments,
|
||||
const Standard_Boolean only3d,
|
||||
const Standard_Boolean only2d)
|
||||
: myC2D(C2D),
|
||||
mySurf(Surf),
|
||||
myFirst(First),
|
||||
myLast(Last),
|
||||
myTol(Tol),
|
||||
myIsDone(Standard_False),
|
||||
myHasResult(Standard_False),
|
||||
myError3d(0.0),
|
||||
myError2dU(0.0),
|
||||
myError2dV(0.0)
|
||||
{
|
||||
Perform(MaxSegments, MaxDegree, S, only3d, only2d);
|
||||
}
|
||||
//=================================================================================================
|
||||
|
||||
//=============================================================================
|
||||
//function : Approx_CurveOnSurface
|
||||
//purpose : Constructor
|
||||
//=============================================================================
|
||||
Approx_CurveOnSurface::Approx_CurveOnSurface(const Handle(Adaptor2d_Curve2d)& theC2D,
|
||||
const Handle(Adaptor3d_Surface)& theSurf,
|
||||
const Standard_Real theFirst,
|
||||
const Standard_Real theLast,
|
||||
const Standard_Real theTol)
|
||||
: myC2D(theC2D),
|
||||
mySurf(theSurf),
|
||||
myFirst(theFirst),
|
||||
myLast(theLast),
|
||||
myTol(theTol),
|
||||
myIsDone(Standard_False),
|
||||
myHasResult(Standard_False),
|
||||
myError3d(0.0),
|
||||
myError2dU(0.0),
|
||||
myError2dV(0.0)
|
||||
Approx_CurveOnSurface::Approx_CurveOnSurface(const Handle(Adaptor2d_Curve2d)& C2D,
|
||||
const Handle(Adaptor3d_Surface)& Surf,
|
||||
const Standard_Real First,
|
||||
const Standard_Real Last,
|
||||
const Standard_Real Tol,
|
||||
const GeomAbs_Shape S,
|
||||
const Standard_Integer MaxDegree,
|
||||
const Standard_Integer MaxSegments,
|
||||
const Standard_Boolean only3d,
|
||||
const Standard_Boolean only2d)
|
||||
: myC2D(C2D),
|
||||
mySurf(Surf),
|
||||
myFirst(First),
|
||||
myLast(Last),
|
||||
myTol(Tol),
|
||||
myIsDone(Standard_False),
|
||||
myHasResult(Standard_False),
|
||||
myError3d(0.0),
|
||||
myError2dU(0.0),
|
||||
myError2dV(0.0)
|
||||
{
|
||||
Perform(MaxSegments, MaxDegree, S, only3d, only2d);
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
Approx_CurveOnSurface::Approx_CurveOnSurface(const Handle(Adaptor2d_Curve2d)& theC2D,
|
||||
const Handle(Adaptor3d_Surface)& theSurf,
|
||||
const Standard_Real theFirst,
|
||||
const Standard_Real theLast,
|
||||
const Standard_Real theTol)
|
||||
: myC2D(theC2D),
|
||||
mySurf(theSurf),
|
||||
myFirst(theFirst),
|
||||
myLast(theLast),
|
||||
myTol(theTol),
|
||||
myIsDone(Standard_False),
|
||||
myHasResult(Standard_False),
|
||||
myError3d(0.0),
|
||||
myError2dU(0.0),
|
||||
myError2dV(0.0)
|
||||
{
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void Approx_CurveOnSurface::Perform(const Standard_Integer theMaxSegments,
|
||||
const Standard_Integer theMaxDegree,
|
||||
const GeomAbs_Shape theContinuity,
|
||||
const Standard_Boolean theOnly3d,
|
||||
const Standard_Boolean theOnly2d)
|
||||
{
|
||||
myIsDone = Standard_False;
|
||||
myIsDone = Standard_False;
|
||||
myHasResult = Standard_False;
|
||||
myError2dU = 0.0;
|
||||
myError2dV = 0.0;
|
||||
myError3d = 0.0;
|
||||
myError2dU = 0.0;
|
||||
myError2dV = 0.0;
|
||||
myError3d = 0.0;
|
||||
|
||||
if(theOnly3d && theOnly2d) throw Standard_ConstructionError();
|
||||
if (theOnly3d && theOnly2d)
|
||||
throw Standard_ConstructionError();
|
||||
|
||||
GeomAbs_Shape aContinuity = theContinuity;
|
||||
if (aContinuity == GeomAbs_G1)
|
||||
@@ -377,42 +375,46 @@ void Approx_CurveOnSurface::Perform(const Standard_Integer theMaxSegments,
|
||||
else if (aContinuity == GeomAbs_G2)
|
||||
aContinuity = GeomAbs_C2;
|
||||
else if (aContinuity > GeomAbs_C2)
|
||||
aContinuity = GeomAbs_C2; //Restriction of AdvApprox_ApproxAFunction
|
||||
aContinuity = GeomAbs_C2; // Restriction of AdvApprox_ApproxAFunction
|
||||
|
||||
Handle( Adaptor2d_Curve2d ) TrimmedC2D = myC2D->Trim( myFirst, myLast, Precision::PConfusion() );
|
||||
Handle(Adaptor2d_Curve2d) TrimmedC2D = myC2D->Trim(myFirst, myLast, Precision::PConfusion());
|
||||
|
||||
Standard_Boolean isU, isForward;
|
||||
Standard_Real aParam;
|
||||
Standard_Real aParam;
|
||||
if (theOnly3d && isIsoLine(TrimmedC2D, isU, aParam, isForward))
|
||||
{
|
||||
if (buildC3dOnIsoLine(TrimmedC2D, isU, aParam, isForward))
|
||||
{
|
||||
myIsDone = Standard_True;
|
||||
myIsDone = Standard_True;
|
||||
myHasResult = Standard_True;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Handle(Adaptor3d_CurveOnSurface) HCOnS = new Adaptor3d_CurveOnSurface (TrimmedC2D, mySurf);
|
||||
Handle(Adaptor3d_CurveOnSurface) HCOnS = new Adaptor3d_CurveOnSurface(TrimmedC2D, mySurf);
|
||||
|
||||
Standard_Integer Num1DSS = 0, Num2DSS=0, Num3DSS=0;
|
||||
Standard_Integer Num1DSS = 0, Num2DSS = 0, Num3DSS = 0;
|
||||
Handle(TColStd_HArray1OfReal) OneDTol;
|
||||
Handle(TColStd_HArray1OfReal) TwoDTolNul;
|
||||
Handle(TColStd_HArray1OfReal) ThreeDTol;
|
||||
|
||||
// create evaluators and choose appropriate one
|
||||
Approx_CurveOnSurface_Eval3d Eval3dCvOnSurf (HCOnS, myFirst, myLast);
|
||||
Approx_CurveOnSurface_Eval2d Eval2dCvOnSurf ( TrimmedC2D, myFirst, myLast);
|
||||
Approx_CurveOnSurface_Eval EvalCvOnSurf (HCOnS, TrimmedC2D, myFirst, myLast);
|
||||
Approx_CurveOnSurface_Eval3d Eval3dCvOnSurf(HCOnS, myFirst, myLast);
|
||||
Approx_CurveOnSurface_Eval2d Eval2dCvOnSurf(TrimmedC2D, myFirst, myLast);
|
||||
Approx_CurveOnSurface_Eval EvalCvOnSurf(HCOnS, TrimmedC2D, myFirst, myLast);
|
||||
AdvApprox_EvaluatorFunction* EvalPtr;
|
||||
if ( theOnly3d ) EvalPtr = &Eval3dCvOnSurf;
|
||||
else if ( theOnly2d ) EvalPtr = &Eval2dCvOnSurf;
|
||||
else EvalPtr = &EvalCvOnSurf;
|
||||
if (theOnly3d)
|
||||
EvalPtr = &Eval3dCvOnSurf;
|
||||
else if (theOnly2d)
|
||||
EvalPtr = &Eval2dCvOnSurf;
|
||||
else
|
||||
EvalPtr = &EvalCvOnSurf;
|
||||
|
||||
// Initialization for 2d approximation
|
||||
if(!theOnly3d) {
|
||||
if (!theOnly3d)
|
||||
{
|
||||
Num1DSS = 2;
|
||||
OneDTol = new TColStd_HArray1OfReal(1,Num1DSS);
|
||||
OneDTol = new TColStd_HArray1OfReal(1, Num1DSS);
|
||||
|
||||
Standard_Real TolU, TolV;
|
||||
|
||||
@@ -435,144 +437,150 @@ void Approx_CurveOnSurface::Perform(const Standard_Integer theMaxSegments,
|
||||
TolV = Min(1.e-3, 1.e2 * TolV);
|
||||
}
|
||||
|
||||
OneDTol->SetValue(1,TolU);
|
||||
OneDTol->SetValue(2,TolV);
|
||||
OneDTol->SetValue(1, TolU);
|
||||
OneDTol->SetValue(2, TolV);
|
||||
}
|
||||
|
||||
if(!theOnly2d) {
|
||||
Num3DSS=1;
|
||||
ThreeDTol = new TColStd_HArray1OfReal(1,Num3DSS);
|
||||
ThreeDTol->Init(myTol/2);
|
||||
|
||||
if (!theOnly2d)
|
||||
{
|
||||
Num3DSS = 1;
|
||||
ThreeDTol = new TColStd_HArray1OfReal(1, Num3DSS);
|
||||
ThreeDTol->Init(myTol / 2);
|
||||
}
|
||||
|
||||
AdvApprox_Cutting* CutTool;
|
||||
|
||||
if (aContinuity <= myC2D->Continuity() &&
|
||||
aContinuity <= mySurf->UContinuity() &&
|
||||
aContinuity <= mySurf->VContinuity())
|
||||
if (aContinuity <= myC2D->Continuity() && aContinuity <= mySurf->UContinuity()
|
||||
&& aContinuity <= mySurf->VContinuity())
|
||||
{
|
||||
CutTool = new AdvApprox_DichoCutting();
|
||||
}
|
||||
else if (aContinuity == GeomAbs_C1)
|
||||
{
|
||||
Standard_Integer NbInterv_C1 = HCOnS->NbIntervals(GeomAbs_C1);
|
||||
Standard_Integer NbInterv_C1 = HCOnS->NbIntervals(GeomAbs_C1);
|
||||
TColStd_Array1OfReal CutPnts_C1(1, NbInterv_C1 + 1);
|
||||
HCOnS->Intervals(CutPnts_C1, GeomAbs_C1);
|
||||
Standard_Integer NbInterv_C2 = HCOnS->NbIntervals(GeomAbs_C2);
|
||||
Standard_Integer NbInterv_C2 = HCOnS->NbIntervals(GeomAbs_C2);
|
||||
TColStd_Array1OfReal CutPnts_C2(1, NbInterv_C2 + 1);
|
||||
HCOnS->Intervals(CutPnts_C2, GeomAbs_C2);
|
||||
|
||||
CutTool = new AdvApprox_PrefAndRec (CutPnts_C1, CutPnts_C2);
|
||||
|
||||
CutTool = new AdvApprox_PrefAndRec(CutPnts_C1, CutPnts_C2);
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Integer NbInterv_C2 = HCOnS->NbIntervals(GeomAbs_C2);
|
||||
Standard_Integer NbInterv_C2 = HCOnS->NbIntervals(GeomAbs_C2);
|
||||
TColStd_Array1OfReal CutPnts_C2(1, NbInterv_C2 + 1);
|
||||
HCOnS->Intervals(CutPnts_C2, GeomAbs_C2);
|
||||
Standard_Integer NbInterv_C3 = HCOnS->NbIntervals(GeomAbs_C3);
|
||||
Standard_Integer NbInterv_C3 = HCOnS->NbIntervals(GeomAbs_C3);
|
||||
TColStd_Array1OfReal CutPnts_C3(1, NbInterv_C3 + 1);
|
||||
HCOnS->Intervals(CutPnts_C3, GeomAbs_C3);
|
||||
|
||||
CutTool = new AdvApprox_PrefAndRec (CutPnts_C2, CutPnts_C3);
|
||||
|
||||
CutTool = new AdvApprox_PrefAndRec(CutPnts_C2, CutPnts_C3);
|
||||
}
|
||||
|
||||
AdvApprox_ApproxAFunction aApprox (Num1DSS, Num2DSS, Num3DSS,
|
||||
OneDTol, TwoDTolNul, ThreeDTol,
|
||||
myFirst, myLast, aContinuity,
|
||||
theMaxDegree, theMaxSegments,
|
||||
*EvalPtr, *CutTool);
|
||||
AdvApprox_ApproxAFunction aApprox(Num1DSS,
|
||||
Num2DSS,
|
||||
Num3DSS,
|
||||
OneDTol,
|
||||
TwoDTolNul,
|
||||
ThreeDTol,
|
||||
myFirst,
|
||||
myLast,
|
||||
aContinuity,
|
||||
theMaxDegree,
|
||||
theMaxSegments,
|
||||
*EvalPtr,
|
||||
*CutTool);
|
||||
|
||||
delete CutTool;
|
||||
|
||||
myIsDone = aApprox.IsDone();
|
||||
myIsDone = aApprox.IsDone();
|
||||
myHasResult = aApprox.HasResult();
|
||||
|
||||
if (myHasResult) {
|
||||
Handle(TColStd_HArray1OfReal) Knots = aApprox.Knots();
|
||||
Handle(TColStd_HArray1OfInteger) Mults = aApprox.Multiplicities();
|
||||
Standard_Integer Degree = aApprox.Degree();
|
||||
|
||||
if(!theOnly2d)
|
||||
{
|
||||
TColgp_Array1OfPnt Poles(1,aApprox.NbPoles());
|
||||
aApprox.Poles(1,Poles);
|
||||
myCurve3d = new Geom_BSplineCurve(Poles, Knots->Array1(), Mults->Array1(), Degree);
|
||||
myError3d = aApprox.MaxError(3, 1);
|
||||
}
|
||||
if(!theOnly3d)
|
||||
{
|
||||
TColgp_Array1OfPnt2d Poles2d(1,aApprox.NbPoles());
|
||||
TColStd_Array1OfReal Poles1dU(1,aApprox.NbPoles());
|
||||
aApprox.Poles1d(1, Poles1dU);
|
||||
TColStd_Array1OfReal Poles1dV(1,aApprox.NbPoles());
|
||||
aApprox.Poles1d(2, Poles1dV);
|
||||
for(Standard_Integer i = 1; i <= aApprox.NbPoles(); i++)
|
||||
Poles2d.SetValue(i, gp_Pnt2d(Poles1dU.Value(i), Poles1dV.Value(i)));
|
||||
myCurve2d = new Geom2d_BSplineCurve(Poles2d, Knots->Array1(), Mults->Array1(), Degree);
|
||||
|
||||
myError2dU = aApprox.MaxError(1, 1);
|
||||
myError2dV = aApprox.MaxError(1, 2);
|
||||
}
|
||||
if (myHasResult)
|
||||
{
|
||||
Handle(TColStd_HArray1OfReal) Knots = aApprox.Knots();
|
||||
Handle(TColStd_HArray1OfInteger) Mults = aApprox.Multiplicities();
|
||||
Standard_Integer Degree = aApprox.Degree();
|
||||
|
||||
if (!theOnly2d)
|
||||
{
|
||||
TColgp_Array1OfPnt Poles(1, aApprox.NbPoles());
|
||||
aApprox.Poles(1, Poles);
|
||||
myCurve3d = new Geom_BSplineCurve(Poles, Knots->Array1(), Mults->Array1(), Degree);
|
||||
myError3d = aApprox.MaxError(3, 1);
|
||||
}
|
||||
if (!theOnly3d)
|
||||
{
|
||||
TColgp_Array1OfPnt2d Poles2d(1, aApprox.NbPoles());
|
||||
TColStd_Array1OfReal Poles1dU(1, aApprox.NbPoles());
|
||||
aApprox.Poles1d(1, Poles1dU);
|
||||
TColStd_Array1OfReal Poles1dV(1, aApprox.NbPoles());
|
||||
aApprox.Poles1d(2, Poles1dV);
|
||||
for (Standard_Integer i = 1; i <= aApprox.NbPoles(); i++)
|
||||
Poles2d.SetValue(i, gp_Pnt2d(Poles1dU.Value(i), Poles1dV.Value(i)));
|
||||
myCurve2d = new Geom2d_BSplineCurve(Poles2d, Knots->Array1(), Mults->Array1(), Degree);
|
||||
|
||||
myError2dU = aApprox.MaxError(1, 1);
|
||||
myError2dV = aApprox.MaxError(1, 2);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Standard_Boolean Approx_CurveOnSurface::IsDone() const
|
||||
Standard_Boolean Approx_CurveOnSurface::IsDone() const
|
||||
{
|
||||
return myIsDone;
|
||||
}
|
||||
|
||||
Standard_Boolean Approx_CurveOnSurface::HasResult() const
|
||||
Standard_Boolean Approx_CurveOnSurface::HasResult() const
|
||||
{
|
||||
return myHasResult;
|
||||
}
|
||||
|
||||
Handle(Geom_BSplineCurve) Approx_CurveOnSurface::Curve3d() const
|
||||
Handle(Geom_BSplineCurve) Approx_CurveOnSurface::Curve3d() const
|
||||
{
|
||||
return myCurve3d;
|
||||
}
|
||||
|
||||
Handle(Geom2d_BSplineCurve) Approx_CurveOnSurface::Curve2d() const
|
||||
Handle(Geom2d_BSplineCurve) Approx_CurveOnSurface::Curve2d() const
|
||||
{
|
||||
return myCurve2d;
|
||||
}
|
||||
|
||||
Standard_Real Approx_CurveOnSurface::MaxError3d() const
|
||||
Standard_Real Approx_CurveOnSurface::MaxError3d() const
|
||||
{
|
||||
return myError3d;
|
||||
}
|
||||
|
||||
Standard_Real Approx_CurveOnSurface::MaxError2dU() const
|
||||
Standard_Real Approx_CurveOnSurface::MaxError2dU() const
|
||||
{
|
||||
return myError2dU;
|
||||
}
|
||||
|
||||
Standard_Real Approx_CurveOnSurface::MaxError2dV() const
|
||||
Standard_Real Approx_CurveOnSurface::MaxError2dV() const
|
||||
{
|
||||
return myError2dV;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : isIsoLine
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Boolean Approx_CurveOnSurface::isIsoLine(const Handle(Adaptor2d_Curve2d)& theC2D,
|
||||
Standard_Boolean& theIsU,
|
||||
Standard_Real& theParam,
|
||||
Standard_Boolean& theIsForward) const
|
||||
Standard_Boolean& theIsForward) const
|
||||
{
|
||||
// These variables are used to check line state (vertical or horizontal).
|
||||
Standard_Boolean isAppropriateType = Standard_False;
|
||||
gp_Pnt2d aLoc2d;
|
||||
gp_Dir2d aDir2d;
|
||||
gp_Pnt2d aLoc2d;
|
||||
gp_Dir2d aDir2d;
|
||||
|
||||
// Test type.
|
||||
const GeomAbs_CurveType aType = theC2D->GetType();
|
||||
if (aType == GeomAbs_Line)
|
||||
{
|
||||
gp_Lin2d aLin2d = theC2D->Line();
|
||||
aLoc2d = aLin2d.Location();
|
||||
aDir2d = aLin2d.Direction();
|
||||
gp_Lin2d aLin2d = theC2D->Line();
|
||||
aLoc2d = aLin2d.Location();
|
||||
aDir2d = aLin2d.Direction();
|
||||
isAppropriateType = Standard_True;
|
||||
}
|
||||
else if (aType == GeomAbs_BSplineCurve)
|
||||
@@ -615,16 +623,16 @@ Standard_Boolean Approx_CurveOnSurface::isIsoLine(const Handle(Adaptor2d_Curve2d
|
||||
if (aDir2d.IsParallel(gp::DX2d(), Precision::Angular()))
|
||||
{
|
||||
// Horizontal line. V = const.
|
||||
theIsU = Standard_False;
|
||||
theParam = aLoc2d.Y();
|
||||
theIsU = Standard_False;
|
||||
theParam = aLoc2d.Y();
|
||||
theIsForward = aDir2d.Dot(gp::DX2d()) > 0.0;
|
||||
return Standard_True;
|
||||
}
|
||||
else if (aDir2d.IsParallel(gp::DY2d(), Precision::Angular()))
|
||||
{
|
||||
// Vertical line. U = const.
|
||||
theIsU = Standard_True;
|
||||
theParam = aLoc2d.X();
|
||||
theIsU = Standard_True;
|
||||
theParam = aLoc2d.X();
|
||||
theIsForward = aDir2d.Dot(gp::DY2d()) > 0.0;
|
||||
return Standard_True;
|
||||
}
|
||||
@@ -634,14 +642,12 @@ Standard_Boolean Approx_CurveOnSurface::isIsoLine(const Handle(Adaptor2d_Curve2d
|
||||
|
||||
#include <GeomLib.hxx>
|
||||
|
||||
//=============================================================================
|
||||
//function : buildC3dOnIsoLine
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Boolean Approx_CurveOnSurface::buildC3dOnIsoLine(const Handle(Adaptor2d_Curve2d)& theC2D,
|
||||
const Standard_Boolean theIsU,
|
||||
const Standard_Real theParam,
|
||||
const Standard_Boolean theIsForward)
|
||||
const Standard_Boolean theIsForward)
|
||||
{
|
||||
// Convert adapter to the appropriate type.
|
||||
Handle(GeomAdaptor_Surface) aGeomAdapter = Handle(GeomAdaptor_Surface)::DownCast(mySurf);
|
||||
@@ -653,13 +659,13 @@ Standard_Boolean Approx_CurveOnSurface::buildC3dOnIsoLine(const Handle(Adaptor2d
|
||||
|
||||
// Extract isoline
|
||||
Handle(Geom_Surface) aSurf = aGeomAdapter->Surface();
|
||||
Handle(Geom_Curve) aC3d;
|
||||
Handle(Geom_Curve) aC3d;
|
||||
|
||||
gp_Pnt2d aF2d = theC2D->Value(theC2D->FirstParameter());
|
||||
gp_Pnt2d aL2d = theC2D->Value(theC2D->LastParameter());
|
||||
|
||||
Standard_Boolean isToTrim = Standard_True;
|
||||
Standard_Real U1, U2, V1, V2;
|
||||
Standard_Real U1, U2, V1, V2;
|
||||
aSurf->Bounds(U1, U2, V1, V2);
|
||||
|
||||
if (theIsU)
|
||||
@@ -676,7 +682,7 @@ Standard_Boolean Approx_CurveOnSurface::buildC3dOnIsoLine(const Handle(Adaptor2d
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
aSurf = new Geom_RectangularTrimmedSurface(aSurf, U1, U2, aV1Param, aV2Param);
|
||||
aSurf = new Geom_RectangularTrimmedSurface(aSurf, U1, U2, aV1Param, aV2Param);
|
||||
isToTrim = Standard_False;
|
||||
}
|
||||
else
|
||||
@@ -706,7 +712,7 @@ Standard_Boolean Approx_CurveOnSurface::buildC3dOnIsoLine(const Handle(Adaptor2d
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
aSurf = new Geom_RectangularTrimmedSurface(aSurf, aU1Param, aU2Param, V1, V2);
|
||||
aSurf = new Geom_RectangularTrimmedSurface(aSurf, aU1Param, aU2Param, V1, V2);
|
||||
isToTrim = Standard_False;
|
||||
}
|
||||
else
|
||||
@@ -729,7 +735,7 @@ Standard_Boolean Approx_CurveOnSurface::buildC3dOnIsoLine(const Handle(Adaptor2d
|
||||
myCurve3d->Reverse();
|
||||
|
||||
// Rebuild parameterization for the 3d curve to have the same parameterization with
|
||||
// a two-dimensional curve.
|
||||
// a two-dimensional curve.
|
||||
TColStd_Array1OfReal aKnots = myCurve3d->Knots();
|
||||
BSplCLib::Reparametrize(theC2D->FirstParameter(), theC2D->LastParameter(), aKnots);
|
||||
myCurve3d->SetKnots(aKnots);
|
||||
@@ -737,10 +743,10 @@ Standard_Boolean Approx_CurveOnSurface::buildC3dOnIsoLine(const Handle(Adaptor2d
|
||||
// Evaluate error.
|
||||
myError3d = 0.0;
|
||||
|
||||
const Standard_Real aParF = myFirst;
|
||||
const Standard_Real aParL = myLast;
|
||||
const Standard_Real aParF = myFirst;
|
||||
const Standard_Real aParL = myLast;
|
||||
const Standard_Integer aNbPnt = 23;
|
||||
for(Standard_Integer anIdx = 0; anIdx <= aNbPnt; ++anIdx)
|
||||
for (Standard_Integer anIdx = 0; anIdx <= aNbPnt; ++anIdx)
|
||||
{
|
||||
const Standard_Real aPar = aParF + ((aParL - aParF) * anIdx) / aNbPnt;
|
||||
|
||||
@@ -750,7 +756,7 @@ Standard_Boolean Approx_CurveOnSurface::buildC3dOnIsoLine(const Handle(Adaptor2d
|
||||
const gp_Pnt aPntC2D = mySurf->Value(aPnt2d.X(), aPnt2d.Y());
|
||||
|
||||
const Standard_Real aSqDeviation = aPntC3D.SquareDistance(aPntC2D);
|
||||
myError3d = Max(aSqDeviation, myError3d);
|
||||
myError3d = Max(aSqDeviation, myError3d);
|
||||
}
|
||||
|
||||
myError3d = Sqrt(myError3d);
|
||||
@@ -758,7 +764,7 @@ Standard_Boolean Approx_CurveOnSurface::buildC3dOnIsoLine(const Handle(Adaptor2d
|
||||
// Target tolerance is not obtained. This situation happens for isolines on the sphere.
|
||||
// OCCT is unable to convert it keeping original parameterization, while the geometric
|
||||
// form of the result is entirely identical. In that case, it is better to utilize
|
||||
// a general-purpose approach.
|
||||
// a general-purpose approach.
|
||||
if (myError3d > myTol)
|
||||
return Standard_False;
|
||||
|
||||
|
@@ -25,15 +25,24 @@ class Geom_BSplineCurve;
|
||||
class Geom2d_BSplineCurve;
|
||||
|
||||
//! Approximation of curve on surface
|
||||
class Approx_CurveOnSurface
|
||||
class Approx_CurveOnSurface
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! This constructor calls perform method. This constructor is deprecated.
|
||||
Standard_DEPRECATED("This constructor is deprecated. Use other constructor and perform method instead.")
|
||||
Standard_EXPORT Approx_CurveOnSurface(const Handle(Adaptor2d_Curve2d)& C2D, const Handle(Adaptor3d_Surface)& Surf, const Standard_Real First, const Standard_Real Last, const Standard_Real Tol, const GeomAbs_Shape Continuity, const Standard_Integer MaxDegree, const Standard_Integer MaxSegments, const Standard_Boolean Only3d = Standard_False, const Standard_Boolean Only2d = Standard_False);
|
||||
Standard_DEPRECATED(
|
||||
"This constructor is deprecated. Use other constructor and perform method instead.")
|
||||
Standard_EXPORT Approx_CurveOnSurface(const Handle(Adaptor2d_Curve2d)& C2D,
|
||||
const Handle(Adaptor3d_Surface)& Surf,
|
||||
const Standard_Real First,
|
||||
const Standard_Real Last,
|
||||
const Standard_Real Tol,
|
||||
const GeomAbs_Shape Continuity,
|
||||
const Standard_Integer MaxDegree,
|
||||
const Standard_Integer MaxSegments,
|
||||
const Standard_Boolean Only3d = Standard_False,
|
||||
const Standard_Boolean Only2d = Standard_False);
|
||||
|
||||
//! This constructor does not call perform method.
|
||||
//! @param theC2D 2D Curve to be approximated in 3D.
|
||||
@@ -43,22 +52,22 @@ public:
|
||||
//! @param theTol Computation tolerance.
|
||||
Standard_EXPORT Approx_CurveOnSurface(const Handle(Adaptor2d_Curve2d)& theC2D,
|
||||
const Handle(Adaptor3d_Surface)& theSurf,
|
||||
const Standard_Real theFirst,
|
||||
const Standard_Real theLast,
|
||||
const Standard_Real theTol);
|
||||
const Standard_Real theFirst,
|
||||
const Standard_Real theLast,
|
||||
const Standard_Real theTol);
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsDone() const;
|
||||
|
||||
|
||||
Standard_EXPORT Standard_Boolean HasResult() const;
|
||||
|
||||
|
||||
Standard_EXPORT Handle(Geom_BSplineCurve) Curve3d() const;
|
||||
|
||||
|
||||
Standard_EXPORT Standard_Real MaxError3d() const;
|
||||
|
||||
|
||||
Standard_EXPORT Handle(Geom2d_BSplineCurve) Curve2d() const;
|
||||
|
||||
|
||||
Standard_EXPORT Standard_Real MaxError2dU() const;
|
||||
|
||||
|
||||
//! returns the maximum errors relatively to the U component or the V component of the
|
||||
//! 2d Curve
|
||||
Standard_EXPORT Standard_Real MaxError2dV() const;
|
||||
@@ -70,14 +79,13 @@ public:
|
||||
//! @param theContinuity Resulting continuity.
|
||||
//! @param theOnly3d Determines building only 3D curve.
|
||||
//! @param theOnly2d Determines building only 2D curve.
|
||||
Standard_EXPORT void Perform(const Standard_Integer theMaxSegments,
|
||||
const Standard_Integer theMaxDegree,
|
||||
Standard_EXPORT void Perform(const Standard_Integer theMaxSegments,
|
||||
const Standard_Integer theMaxDegree,
|
||||
const GeomAbs_Shape theContinuity,
|
||||
const Standard_Boolean theOnly3d = Standard_False,
|
||||
const Standard_Boolean theOnly2d = Standard_False);
|
||||
|
||||
protected:
|
||||
|
||||
//! Checks whether the 2d curve is a isoline. It can be represented by b-spline, bezier,
|
||||
//! or geometric line. This line should have natural parameterization.
|
||||
//! @param theC2D Trimmed curve to be checked.
|
||||
@@ -103,10 +111,9 @@ protected:
|
||||
const Standard_Boolean theIsForward);
|
||||
|
||||
private:
|
||||
Approx_CurveOnSurface& operator= (const Approx_CurveOnSurface&);
|
||||
Approx_CurveOnSurface& operator=(const Approx_CurveOnSurface&);
|
||||
|
||||
private:
|
||||
|
||||
//! Input curve.
|
||||
const Handle(Adaptor2d_Curve2d) myC2D;
|
||||
|
||||
@@ -123,13 +130,12 @@ private:
|
||||
Standard_Real myTol;
|
||||
|
||||
Handle(Geom2d_BSplineCurve) myCurve2d;
|
||||
Handle(Geom_BSplineCurve) myCurve3d;
|
||||
Standard_Boolean myIsDone;
|
||||
Standard_Boolean myHasResult;
|
||||
Standard_Real myError3d;
|
||||
Standard_Real myError2dU;
|
||||
Standard_Real myError2dV;
|
||||
|
||||
Handle(Geom_BSplineCurve) myCurve3d;
|
||||
Standard_Boolean myIsDone;
|
||||
Standard_Boolean myHasResult;
|
||||
Standard_Real myError3d;
|
||||
Standard_Real myError2dU;
|
||||
Standard_Real myError2dV;
|
||||
};
|
||||
|
||||
#endif // _Approx_CurveOnSurface_HeaderFile
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -33,65 +33,81 @@
|
||||
//! @code
|
||||
//! 1/2(S1(C2D1(u) + S2(C2D2(u)))
|
||||
//! @endcode
|
||||
class Approx_CurvilinearParameter
|
||||
class Approx_CurvilinearParameter
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! case of a free 3D curve
|
||||
Standard_EXPORT Approx_CurvilinearParameter(const Handle(Adaptor3d_Curve)& C3D, const Standard_Real Tol, const GeomAbs_Shape Order, const Standard_Integer MaxDegree, const Standard_Integer MaxSegments);
|
||||
|
||||
Standard_EXPORT Approx_CurvilinearParameter(const Handle(Adaptor3d_Curve)& C3D,
|
||||
const Standard_Real Tol,
|
||||
const GeomAbs_Shape Order,
|
||||
const Standard_Integer MaxDegree,
|
||||
const Standard_Integer MaxSegments);
|
||||
|
||||
//! case of a curve on one surface
|
||||
Standard_EXPORT Approx_CurvilinearParameter(const Handle(Adaptor2d_Curve2d)& C2D, const Handle(Adaptor3d_Surface)& Surf, const Standard_Real Tol, const GeomAbs_Shape Order, const Standard_Integer MaxDegree, const Standard_Integer MaxSegments);
|
||||
|
||||
Standard_EXPORT Approx_CurvilinearParameter(const Handle(Adaptor2d_Curve2d)& C2D,
|
||||
const Handle(Adaptor3d_Surface)& Surf,
|
||||
const Standard_Real Tol,
|
||||
const GeomAbs_Shape Order,
|
||||
const Standard_Integer MaxDegree,
|
||||
const Standard_Integer MaxSegments);
|
||||
|
||||
//! case of a curve on two surfaces
|
||||
Standard_EXPORT Approx_CurvilinearParameter(const Handle(Adaptor2d_Curve2d)& C2D1, const Handle(Adaptor3d_Surface)& Surf1, const Handle(Adaptor2d_Curve2d)& C2D2, const Handle(Adaptor3d_Surface)& Surf2, const Standard_Real Tol, const GeomAbs_Shape Order, const Standard_Integer MaxDegree, const Standard_Integer MaxSegments);
|
||||
|
||||
Standard_EXPORT Approx_CurvilinearParameter(const Handle(Adaptor2d_Curve2d)& C2D1,
|
||||
const Handle(Adaptor3d_Surface)& Surf1,
|
||||
const Handle(Adaptor2d_Curve2d)& C2D2,
|
||||
const Handle(Adaptor3d_Surface)& Surf2,
|
||||
const Standard_Real Tol,
|
||||
const GeomAbs_Shape Order,
|
||||
const Standard_Integer MaxDegree,
|
||||
const Standard_Integer MaxSegments);
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsDone() const;
|
||||
|
||||
|
||||
Standard_EXPORT Standard_Boolean HasResult() const;
|
||||
|
||||
|
||||
//! returns the Bspline curve corresponding to the reparametrized 3D curve
|
||||
Standard_EXPORT Handle(Geom_BSplineCurve) Curve3d() const;
|
||||
|
||||
|
||||
//! returns the maximum error on the reparametrized 3D curve
|
||||
Standard_EXPORT Standard_Real MaxError3d() const;
|
||||
|
||||
|
||||
//! returns the BsplineCurve representing the reparametrized 2D curve on the
|
||||
//! first surface (case of a curve on one or two surfaces)
|
||||
Standard_EXPORT Handle(Geom2d_BSplineCurve) Curve2d1() const;
|
||||
|
||||
|
||||
//! returns the maximum error on the first reparametrized 2D curve
|
||||
Standard_EXPORT Standard_Real MaxError2d1() const;
|
||||
|
||||
|
||||
//! returns the BsplineCurve representing the reparametrized 2D curve on the
|
||||
//! second surface (case of a curve on two surfaces)
|
||||
Standard_EXPORT Handle(Geom2d_BSplineCurve) Curve2d2() const;
|
||||
|
||||
|
||||
//! returns the maximum error on the second reparametrized 2D curve
|
||||
Standard_EXPORT Standard_Real MaxError2d2() const;
|
||||
|
||||
|
||||
//! print the maximum errors(s)
|
||||
Standard_EXPORT void Dump (Standard_OStream& o) const;
|
||||
Standard_EXPORT void Dump(Standard_OStream& o) const;
|
||||
|
||||
private:
|
||||
|
||||
Standard_EXPORT static void ToleranceComputation (const Handle(Adaptor2d_Curve2d)& C2D, const Handle(Adaptor3d_Surface)& S, const Standard_Integer MaxNumber, const Standard_Real Tol, Standard_Real& TolV, Standard_Real& TolW);
|
||||
Standard_EXPORT static void ToleranceComputation(const Handle(Adaptor2d_Curve2d)& C2D,
|
||||
const Handle(Adaptor3d_Surface)& S,
|
||||
const Standard_Integer MaxNumber,
|
||||
const Standard_Real Tol,
|
||||
Standard_Real& TolV,
|
||||
Standard_Real& TolW);
|
||||
|
||||
private:
|
||||
|
||||
Standard_Integer myCase;
|
||||
Standard_Boolean myDone;
|
||||
Standard_Boolean myHasResult;
|
||||
Handle(Geom_BSplineCurve) myCurve3d;
|
||||
Standard_Real myMaxError3d;
|
||||
Standard_Integer myCase;
|
||||
Standard_Boolean myDone;
|
||||
Standard_Boolean myHasResult;
|
||||
Handle(Geom_BSplineCurve) myCurve3d;
|
||||
Standard_Real myMaxError3d;
|
||||
Handle(Geom2d_BSplineCurve) myCurve2d1;
|
||||
Standard_Real myMaxError2d1;
|
||||
Standard_Real myMaxError2d1;
|
||||
Handle(Geom2d_BSplineCurve) myCurve2d2;
|
||||
Standard_Real myMaxError2d2;
|
||||
|
||||
Standard_Real myMaxError2d2;
|
||||
};
|
||||
|
||||
#endif // _Approx_CurvilinearParameter_HeaderFile
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -31,112 +31,118 @@ class Approx_CurvlinFunc : public Standard_Transient
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Standard_EXPORT Approx_CurvlinFunc(const Handle(Adaptor3d_Curve)& C, const Standard_Real Tol);
|
||||
|
||||
Standard_EXPORT Approx_CurvlinFunc(const Handle(Adaptor2d_Curve2d)& C2D, const Handle(Adaptor3d_Surface)& S, const Standard_Real Tol);
|
||||
|
||||
Standard_EXPORT Approx_CurvlinFunc(const Handle(Adaptor2d_Curve2d)& C2D1, const Handle(Adaptor2d_Curve2d)& C2D2, const Handle(Adaptor3d_Surface)& S1, const Handle(Adaptor3d_Surface)& S2, const Standard_Real Tol);
|
||||
|
||||
|
||||
Standard_EXPORT Approx_CurvlinFunc(const Handle(Adaptor2d_Curve2d)& C2D,
|
||||
const Handle(Adaptor3d_Surface)& S,
|
||||
const Standard_Real Tol);
|
||||
|
||||
Standard_EXPORT Approx_CurvlinFunc(const Handle(Adaptor2d_Curve2d)& C2D1,
|
||||
const Handle(Adaptor2d_Curve2d)& C2D2,
|
||||
const Handle(Adaptor3d_Surface)& S1,
|
||||
const Handle(Adaptor3d_Surface)& S2,
|
||||
const Standard_Real Tol);
|
||||
|
||||
//! ---Purpose Update the tolerance to used
|
||||
Standard_EXPORT void SetTol (const Standard_Real Tol);
|
||||
|
||||
Standard_EXPORT void SetTol(const Standard_Real Tol);
|
||||
|
||||
Standard_EXPORT Standard_Real FirstParameter() const;
|
||||
|
||||
|
||||
Standard_EXPORT Standard_Real LastParameter() const;
|
||||
|
||||
|
||||
//! Returns the number of intervals for continuity
|
||||
//! <S>. May be one if Continuity(me) >= <S>
|
||||
Standard_EXPORT Standard_Integer NbIntervals (const GeomAbs_Shape S) const;
|
||||
|
||||
Standard_EXPORT Standard_Integer NbIntervals(const GeomAbs_Shape S) const;
|
||||
|
||||
//! 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 (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const;
|
||||
|
||||
Standard_EXPORT void Intervals(TColStd_Array1OfReal& T, const GeomAbs_Shape S) const;
|
||||
|
||||
//! if First < 0 or Last > 1
|
||||
Standard_EXPORT void Trim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol);
|
||||
|
||||
Standard_EXPORT void Trim(const Standard_Real First,
|
||||
const Standard_Real Last,
|
||||
const Standard_Real Tol);
|
||||
|
||||
//! Computes length of the curve.
|
||||
Standard_EXPORT void Length();
|
||||
|
||||
|
||||
//! Computes length of the curve segment.
|
||||
Standard_EXPORT Standard_Real Length (Adaptor3d_Curve& C, const Standard_Real FirstU, const Standard_Real LasrU) const;
|
||||
|
||||
Standard_EXPORT Standard_Real Length(Adaptor3d_Curve& C,
|
||||
const Standard_Real FirstU,
|
||||
const Standard_Real LasrU) const;
|
||||
|
||||
Standard_EXPORT Standard_Real GetLength() const;
|
||||
|
||||
|
||||
//! returns original parameter corresponding S. if
|
||||
//! Case == 1 computation is performed on myC2D1 and mySurf1,
|
||||
//! otherwise it is done on myC2D2 and mySurf2.
|
||||
Standard_EXPORT Standard_Real GetUParameter (Adaptor3d_Curve& C, const Standard_Real S, const Standard_Integer NumberOfCurve) const;
|
||||
|
||||
Standard_EXPORT Standard_Real GetUParameter(Adaptor3d_Curve& C,
|
||||
const Standard_Real S,
|
||||
const Standard_Integer NumberOfCurve) const;
|
||||
|
||||
//! returns original parameter corresponding S.
|
||||
Standard_EXPORT Standard_Real GetSParameter (const Standard_Real U) const;
|
||||
|
||||
Standard_EXPORT Standard_Real GetSParameter(const Standard_Real U) const;
|
||||
|
||||
//! if myCase != 1
|
||||
Standard_EXPORT Standard_Boolean EvalCase1 (const Standard_Real S, const Standard_Integer Order, TColStd_Array1OfReal& Result) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean EvalCase1(const Standard_Real S,
|
||||
const Standard_Integer Order,
|
||||
TColStd_Array1OfReal& Result) const;
|
||||
|
||||
//! if myCase != 2
|
||||
Standard_EXPORT Standard_Boolean EvalCase2 (const Standard_Real S, const Standard_Integer Order, TColStd_Array1OfReal& Result) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean EvalCase2(const Standard_Real S,
|
||||
const Standard_Integer Order,
|
||||
TColStd_Array1OfReal& Result) const;
|
||||
|
||||
//! if myCase != 3
|
||||
Standard_EXPORT Standard_Boolean EvalCase3 (const Standard_Real S, const Standard_Integer Order, TColStd_Array1OfReal& Result);
|
||||
Standard_EXPORT Standard_Boolean EvalCase3(const Standard_Real S,
|
||||
const Standard_Integer Order,
|
||||
TColStd_Array1OfReal& Result);
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Approx_CurvlinFunc,Standard_Transient)
|
||||
DEFINE_STANDARD_RTTIEXT(Approx_CurvlinFunc, Standard_Transient)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Standard_EXPORT void Init();
|
||||
|
||||
Standard_EXPORT void Init (Adaptor3d_Curve& C, Handle(TColStd_HArray1OfReal)& Si, Handle(TColStd_HArray1OfReal)& Ui) const;
|
||||
|
||||
//! returns curvilinear parameter corresponding U.
|
||||
Standard_EXPORT Standard_Real GetSParameter (Adaptor3d_Curve& C, const Standard_Real U, const Standard_Real Length) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean EvalCurOnSur (const Standard_Real S, const Standard_Integer Order, TColStd_Array1OfReal& Result, const Standard_Integer NumberOfCurve) const;
|
||||
|
||||
Handle(Adaptor3d_Curve) myC3D;
|
||||
Handle(Adaptor2d_Curve2d) myC2D1;
|
||||
Handle(Adaptor2d_Curve2d) myC2D2;
|
||||
Handle(Adaptor3d_Surface) mySurf1;
|
||||
Handle(Adaptor3d_Surface) mySurf2;
|
||||
Standard_Integer myCase;
|
||||
Standard_Real myFirstS;
|
||||
Standard_Real myLastS;
|
||||
Standard_Real myFirstU1;
|
||||
Standard_Real myLastU1;
|
||||
Standard_Real myFirstU2;
|
||||
Standard_Real myLastU2;
|
||||
Standard_Real myLength;
|
||||
Standard_Real myLength1;
|
||||
Standard_Real myLength2;
|
||||
Standard_Real myTolLen;
|
||||
Standard_Real myPrevS;
|
||||
Standard_Real myPrevU;
|
||||
Standard_EXPORT void Init(Adaptor3d_Curve& C,
|
||||
Handle(TColStd_HArray1OfReal)& Si,
|
||||
Handle(TColStd_HArray1OfReal)& Ui) const;
|
||||
|
||||
//! returns curvilinear parameter corresponding U.
|
||||
Standard_EXPORT Standard_Real GetSParameter(Adaptor3d_Curve& C,
|
||||
const Standard_Real U,
|
||||
const Standard_Real Length) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean EvalCurOnSur(const Standard_Real S,
|
||||
const Standard_Integer Order,
|
||||
TColStd_Array1OfReal& Result,
|
||||
const Standard_Integer NumberOfCurve) const;
|
||||
|
||||
Handle(Adaptor3d_Curve) myC3D;
|
||||
Handle(Adaptor2d_Curve2d) myC2D1;
|
||||
Handle(Adaptor2d_Curve2d) myC2D2;
|
||||
Handle(Adaptor3d_Surface) mySurf1;
|
||||
Handle(Adaptor3d_Surface) mySurf2;
|
||||
Standard_Integer myCase;
|
||||
Standard_Real myFirstS;
|
||||
Standard_Real myLastS;
|
||||
Standard_Real myFirstU1;
|
||||
Standard_Real myLastU1;
|
||||
Standard_Real myFirstU2;
|
||||
Standard_Real myLastU2;
|
||||
Standard_Real myLength;
|
||||
Standard_Real myLength1;
|
||||
Standard_Real myLength2;
|
||||
Standard_Real myTolLen;
|
||||
Standard_Real myPrevS;
|
||||
Standard_Real myPrevU;
|
||||
Handle(TColStd_HArray1OfReal) myUi_1;
|
||||
Handle(TColStd_HArray1OfReal) mySi_1;
|
||||
Handle(TColStd_HArray1OfReal) myUi_2;
|
||||
Handle(TColStd_HArray1OfReal) mySi_2;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _Approx_CurvlinFunc_HeaderFile
|
||||
|
@@ -20,47 +20,61 @@
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
|
||||
#include <AppParCurves_SequenceOfMultiCurve.hxx>
|
||||
#include <TColStd_SequenceOfReal.hxx>
|
||||
#include <AppParCurves_MultiCurve.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <AppParCurves_Constraint.hxx>
|
||||
#include <AppCont_Function.hxx>
|
||||
#include <AppParCurves_Constraint.hxx>
|
||||
#include <AppParCurves_MultiCurve.hxx>
|
||||
#include <AppParCurves_SequenceOfMultiCurve.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <TColStd_SequenceOfReal.hxx>
|
||||
class AppParCurves_MultiCurve;
|
||||
|
||||
|
||||
|
||||
class Approx_FitAndDivide
|
||||
class Approx_FitAndDivide
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! The MultiLine <Line> will be approximated until tolerances
|
||||
//! will be reached.
|
||||
//! The approximation will be done from degreemin to degreemax
|
||||
//! with a cutting if the corresponding boolean is True.
|
||||
Standard_EXPORT Approx_FitAndDivide(const AppCont_Function& Line, const Standard_Integer degreemin = 3, const Standard_Integer degreemax = 8, const Standard_Real Tolerance3d = 1.0e-5, const Standard_Real Tolerance2d = 1.0e-5, const Standard_Boolean cutting = Standard_False, const AppParCurves_Constraint FirstC = AppParCurves_TangencyPoint, const AppParCurves_Constraint LastC = AppParCurves_TangencyPoint);
|
||||
|
||||
Standard_EXPORT Approx_FitAndDivide(
|
||||
const AppCont_Function& Line,
|
||||
const Standard_Integer degreemin = 3,
|
||||
const Standard_Integer degreemax = 8,
|
||||
const Standard_Real Tolerance3d = 1.0e-5,
|
||||
const Standard_Real Tolerance2d = 1.0e-5,
|
||||
const Standard_Boolean cutting = Standard_False,
|
||||
const AppParCurves_Constraint FirstC = AppParCurves_TangencyPoint,
|
||||
const AppParCurves_Constraint LastC = AppParCurves_TangencyPoint);
|
||||
|
||||
//! Initializes the fields of the algorithm.
|
||||
Standard_EXPORT Approx_FitAndDivide(const Standard_Integer degreemin = 3, const Standard_Integer degreemax = 8, const Standard_Real Tolerance3d = 1.0e-05, const Standard_Real Tolerance2d = 1.0e-05, const Standard_Boolean cutting = Standard_False, const AppParCurves_Constraint FirstC = AppParCurves_TangencyPoint, const AppParCurves_Constraint LastC = AppParCurves_TangencyPoint);
|
||||
|
||||
Standard_EXPORT Approx_FitAndDivide(
|
||||
const Standard_Integer degreemin = 3,
|
||||
const Standard_Integer degreemax = 8,
|
||||
const Standard_Real Tolerance3d = 1.0e-05,
|
||||
const Standard_Real Tolerance2d = 1.0e-05,
|
||||
const Standard_Boolean cutting = Standard_False,
|
||||
const AppParCurves_Constraint FirstC = AppParCurves_TangencyPoint,
|
||||
const AppParCurves_Constraint LastC = AppParCurves_TangencyPoint);
|
||||
|
||||
//! runs the algorithm after having initialized the fields.
|
||||
Standard_EXPORT void Perform (const AppCont_Function& Line);
|
||||
|
||||
Standard_EXPORT void Perform(const AppCont_Function& Line);
|
||||
|
||||
//! changes the degrees of the approximation.
|
||||
Standard_EXPORT void SetDegrees (const Standard_Integer degreemin, const Standard_Integer degreemax);
|
||||
|
||||
Standard_EXPORT void SetDegrees(const Standard_Integer degreemin,
|
||||
const Standard_Integer degreemax);
|
||||
|
||||
//! Changes the tolerances of the approximation.
|
||||
Standard_EXPORT void SetTolerances (const Standard_Real Tolerance3d, const Standard_Real Tolerance2d);
|
||||
|
||||
Standard_EXPORT void SetTolerances(const Standard_Real Tolerance3d,
|
||||
const Standard_Real Tolerance2d);
|
||||
|
||||
//! Changes the constraints of the approximation.
|
||||
Standard_EXPORT void SetConstraints (const AppParCurves_Constraint FirstC, const AppParCurves_Constraint LastC);
|
||||
Standard_EXPORT void SetConstraints(const AppParCurves_Constraint FirstC,
|
||||
const AppParCurves_Constraint LastC);
|
||||
|
||||
//! Changes the max number of segments, which is allowed for cutting.
|
||||
Standard_EXPORT void SetMaxSegments (const Standard_Integer theMaxSegments);
|
||||
|
||||
Standard_EXPORT void SetMaxSegments(const Standard_Integer theMaxSegments);
|
||||
|
||||
//! Set inverse order of degree selection:
|
||||
//! if theInvOrdr = true, current degree is chosen by inverse order -
|
||||
//! from maxdegree to mindegree.
|
||||
@@ -77,66 +91,55 @@ public:
|
||||
//! the status NoApproximation has been sent by the user
|
||||
//! when more points were needed.
|
||||
Standard_EXPORT Standard_Boolean IsAllApproximated() const;
|
||||
|
||||
|
||||
//! returns False if the status NoPointsAdded has been sent.
|
||||
Standard_EXPORT Standard_Boolean IsToleranceReached() const;
|
||||
|
||||
|
||||
//! returns the tolerances 2d and 3d of the <Index> MultiCurve.
|
||||
Standard_EXPORT void Error (const Standard_Integer Index, Standard_Real& tol3d, Standard_Real& tol2d) const;
|
||||
|
||||
Standard_EXPORT void Error(const Standard_Integer Index,
|
||||
Standard_Real& tol3d,
|
||||
Standard_Real& tol2d) const;
|
||||
|
||||
//! Returns the number of MultiCurve doing the approximation
|
||||
//! of the MultiLine.
|
||||
Standard_EXPORT Standard_Integer NbMultiCurves() const;
|
||||
|
||||
|
||||
//! returns the approximation MultiCurve of range <Index>.
|
||||
Standard_EXPORT AppParCurves_MultiCurve Value (const Standard_Integer Index = 1) const;
|
||||
|
||||
Standard_EXPORT void Parameters (const Standard_Integer Index, Standard_Real& firstp, Standard_Real& lastp) const;
|
||||
|
||||
|
||||
Standard_EXPORT AppParCurves_MultiCurve Value(const Standard_Integer Index = 1) const;
|
||||
|
||||
Standard_EXPORT void Parameters(const Standard_Integer Index,
|
||||
Standard_Real& firstp,
|
||||
Standard_Real& lastp) const;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
//! is internally used by the algorithms.
|
||||
Standard_EXPORT Standard_Boolean Compute (const AppCont_Function& Line, const Standard_Real Ufirst, const Standard_Real Ulast, Standard_Real& TheTol3d, Standard_Real& TheTol2d);
|
||||
|
||||
Standard_EXPORT Standard_Boolean Compute(const AppCont_Function& Line,
|
||||
const Standard_Real Ufirst,
|
||||
const Standard_Real Ulast,
|
||||
Standard_Real& TheTol3d,
|
||||
Standard_Real& TheTol2d);
|
||||
|
||||
AppParCurves_SequenceOfMultiCurve myMultiCurves;
|
||||
TColStd_SequenceOfReal myfirstparam;
|
||||
TColStd_SequenceOfReal mylastparam;
|
||||
AppParCurves_MultiCurve TheMultiCurve;
|
||||
Standard_Boolean alldone;
|
||||
Standard_Boolean tolreached;
|
||||
TColStd_SequenceOfReal Tolers3d;
|
||||
TColStd_SequenceOfReal Tolers2d;
|
||||
Standard_Integer mydegremin;
|
||||
Standard_Integer mydegremax;
|
||||
Standard_Real mytol3d;
|
||||
Standard_Real mytol2d;
|
||||
Standard_Real currenttol3d;
|
||||
Standard_Real currenttol2d;
|
||||
Standard_Boolean mycut;
|
||||
AppParCurves_Constraint myfirstC;
|
||||
AppParCurves_Constraint mylastC;
|
||||
Standard_Integer myMaxSegments;
|
||||
Standard_Boolean myInvOrder;
|
||||
Standard_Boolean myHangChecking;
|
||||
|
||||
|
||||
TColStd_SequenceOfReal myfirstparam;
|
||||
TColStd_SequenceOfReal mylastparam;
|
||||
AppParCurves_MultiCurve TheMultiCurve;
|
||||
Standard_Boolean alldone;
|
||||
Standard_Boolean tolreached;
|
||||
TColStd_SequenceOfReal Tolers3d;
|
||||
TColStd_SequenceOfReal Tolers2d;
|
||||
Standard_Integer mydegremin;
|
||||
Standard_Integer mydegremax;
|
||||
Standard_Real mytol3d;
|
||||
Standard_Real mytol2d;
|
||||
Standard_Real currenttol3d;
|
||||
Standard_Real currenttol2d;
|
||||
Standard_Boolean mycut;
|
||||
AppParCurves_Constraint myfirstC;
|
||||
AppParCurves_Constraint mylastC;
|
||||
Standard_Integer myMaxSegments;
|
||||
Standard_Boolean myInvOrder;
|
||||
Standard_Boolean myHangChecking;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _Approx_FitAndDivide_HeaderFile
|
||||
|
@@ -20,47 +20,61 @@
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
|
||||
#include <AppParCurves_SequenceOfMultiCurve.hxx>
|
||||
#include <TColStd_SequenceOfReal.hxx>
|
||||
#include <AppParCurves_MultiCurve.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <AppParCurves_Constraint.hxx>
|
||||
#include <AppCont_Function.hxx>
|
||||
#include <AppParCurves_Constraint.hxx>
|
||||
#include <AppParCurves_MultiCurve.hxx>
|
||||
#include <AppParCurves_SequenceOfMultiCurve.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <TColStd_SequenceOfReal.hxx>
|
||||
class AppParCurves_MultiCurve;
|
||||
|
||||
|
||||
|
||||
class Approx_FitAndDivide2d
|
||||
class Approx_FitAndDivide2d
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! The MultiLine <Line> will be approximated until tolerances
|
||||
//! will be reached.
|
||||
//! The approximation will be done from degreemin to degreemax
|
||||
//! with a cutting if the corresponding boolean is True.
|
||||
Standard_EXPORT Approx_FitAndDivide2d(const AppCont_Function& Line, const Standard_Integer degreemin = 3, const Standard_Integer degreemax = 8, const Standard_Real Tolerance3d = 1.0e-5, const Standard_Real Tolerance2d = 1.0e-5, const Standard_Boolean cutting = Standard_False, const AppParCurves_Constraint FirstC = AppParCurves_TangencyPoint, const AppParCurves_Constraint LastC = AppParCurves_TangencyPoint);
|
||||
|
||||
Standard_EXPORT Approx_FitAndDivide2d(
|
||||
const AppCont_Function& Line,
|
||||
const Standard_Integer degreemin = 3,
|
||||
const Standard_Integer degreemax = 8,
|
||||
const Standard_Real Tolerance3d = 1.0e-5,
|
||||
const Standard_Real Tolerance2d = 1.0e-5,
|
||||
const Standard_Boolean cutting = Standard_False,
|
||||
const AppParCurves_Constraint FirstC = AppParCurves_TangencyPoint,
|
||||
const AppParCurves_Constraint LastC = AppParCurves_TangencyPoint);
|
||||
|
||||
//! Initializes the fields of the algorithm.
|
||||
Standard_EXPORT Approx_FitAndDivide2d(const Standard_Integer degreemin = 3, const Standard_Integer degreemax = 8, const Standard_Real Tolerance3d = 1.0e-05, const Standard_Real Tolerance2d = 1.0e-05, const Standard_Boolean cutting = Standard_False, const AppParCurves_Constraint FirstC = AppParCurves_TangencyPoint, const AppParCurves_Constraint LastC = AppParCurves_TangencyPoint);
|
||||
|
||||
Standard_EXPORT Approx_FitAndDivide2d(
|
||||
const Standard_Integer degreemin = 3,
|
||||
const Standard_Integer degreemax = 8,
|
||||
const Standard_Real Tolerance3d = 1.0e-05,
|
||||
const Standard_Real Tolerance2d = 1.0e-05,
|
||||
const Standard_Boolean cutting = Standard_False,
|
||||
const AppParCurves_Constraint FirstC = AppParCurves_TangencyPoint,
|
||||
const AppParCurves_Constraint LastC = AppParCurves_TangencyPoint);
|
||||
|
||||
//! runs the algorithm after having initialized the fields.
|
||||
Standard_EXPORT void Perform (const AppCont_Function& Line);
|
||||
|
||||
Standard_EXPORT void Perform(const AppCont_Function& Line);
|
||||
|
||||
//! changes the degrees of the approximation.
|
||||
Standard_EXPORT void SetDegrees (const Standard_Integer degreemin, const Standard_Integer degreemax);
|
||||
|
||||
Standard_EXPORT void SetDegrees(const Standard_Integer degreemin,
|
||||
const Standard_Integer degreemax);
|
||||
|
||||
//! Changes the tolerances of the approximation.
|
||||
Standard_EXPORT void SetTolerances (const Standard_Real Tolerance3d, const Standard_Real Tolerance2d);
|
||||
|
||||
Standard_EXPORT void SetTolerances(const Standard_Real Tolerance3d,
|
||||
const Standard_Real Tolerance2d);
|
||||
|
||||
//! Changes the constraints of the approximation.
|
||||
Standard_EXPORT void SetConstraints (const AppParCurves_Constraint FirstC, const AppParCurves_Constraint LastC);
|
||||
Standard_EXPORT void SetConstraints(const AppParCurves_Constraint FirstC,
|
||||
const AppParCurves_Constraint LastC);
|
||||
|
||||
//! Changes the max number of segments, which is allowed for cutting.
|
||||
Standard_EXPORT void SetMaxSegments (const Standard_Integer theMaxSegments);
|
||||
|
||||
Standard_EXPORT void SetMaxSegments(const Standard_Integer theMaxSegments);
|
||||
|
||||
//! Set inverse order of degree selection:
|
||||
//! if theInvOrdr = true, current degree is chosen by inverse order -
|
||||
//! from maxdegree to mindegree.
|
||||
@@ -72,70 +86,60 @@ public:
|
||||
//! and algorithm is forced to stop.
|
||||
//! By default hang checking is used.
|
||||
Standard_EXPORT void SetHangChecking(const Standard_Boolean theHangChecking);
|
||||
|
||||
|
||||
//! returns False if at a moment of the approximation,
|
||||
//! the status NoApproximation has been sent by the user
|
||||
//! when more points were needed.
|
||||
Standard_EXPORT Standard_Boolean IsAllApproximated() const;
|
||||
|
||||
|
||||
//! returns False if the status NoPointsAdded has been sent.
|
||||
Standard_EXPORT Standard_Boolean IsToleranceReached() const;
|
||||
|
||||
|
||||
//! returns the tolerances 2d and 3d of the <Index> MultiCurve.
|
||||
Standard_EXPORT void Error (const Standard_Integer Index, Standard_Real& tol3d, Standard_Real& tol2d) const;
|
||||
|
||||
Standard_EXPORT void Error(const Standard_Integer Index,
|
||||
Standard_Real& tol3d,
|
||||
Standard_Real& tol2d) const;
|
||||
|
||||
//! Returns the number of MultiCurve doing the approximation
|
||||
//! of the MultiLine.
|
||||
Standard_EXPORT Standard_Integer NbMultiCurves() const;
|
||||
|
||||
|
||||
//! returns the approximation MultiCurve of range <Index>.
|
||||
Standard_EXPORT AppParCurves_MultiCurve Value (const Standard_Integer Index = 1) const;
|
||||
|
||||
Standard_EXPORT void Parameters (const Standard_Integer Index, Standard_Real& firstp, Standard_Real& lastp) const;
|
||||
|
||||
|
||||
Standard_EXPORT AppParCurves_MultiCurve Value(const Standard_Integer Index = 1) const;
|
||||
|
||||
Standard_EXPORT void Parameters(const Standard_Integer Index,
|
||||
Standard_Real& firstp,
|
||||
Standard_Real& lastp) const;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
//! is internally used by the algorithms.
|
||||
Standard_EXPORT Standard_Boolean Compute (const AppCont_Function& Line, const Standard_Real Ufirst, const Standard_Real Ulast, Standard_Real& TheTol3d, Standard_Real& TheTol2d);
|
||||
|
||||
Standard_EXPORT Standard_Boolean Compute(const AppCont_Function& Line,
|
||||
const Standard_Real Ufirst,
|
||||
const Standard_Real Ulast,
|
||||
Standard_Real& TheTol3d,
|
||||
Standard_Real& TheTol2d);
|
||||
|
||||
AppParCurves_SequenceOfMultiCurve myMultiCurves;
|
||||
TColStd_SequenceOfReal myfirstparam;
|
||||
TColStd_SequenceOfReal mylastparam;
|
||||
AppParCurves_MultiCurve TheMultiCurve;
|
||||
Standard_Boolean alldone;
|
||||
Standard_Boolean tolreached;
|
||||
TColStd_SequenceOfReal Tolers3d;
|
||||
TColStd_SequenceOfReal Tolers2d;
|
||||
Standard_Integer mydegremin;
|
||||
Standard_Integer mydegremax;
|
||||
Standard_Real mytol3d;
|
||||
Standard_Real mytol2d;
|
||||
Standard_Real currenttol3d;
|
||||
Standard_Real currenttol2d;
|
||||
Standard_Boolean mycut;
|
||||
AppParCurves_Constraint myfirstC;
|
||||
AppParCurves_Constraint mylastC;
|
||||
Standard_Integer myMaxSegments;
|
||||
Standard_Boolean myInvOrder;
|
||||
Standard_Boolean myHangChecking;
|
||||
|
||||
TColStd_SequenceOfReal myfirstparam;
|
||||
TColStd_SequenceOfReal mylastparam;
|
||||
AppParCurves_MultiCurve TheMultiCurve;
|
||||
Standard_Boolean alldone;
|
||||
Standard_Boolean tolreached;
|
||||
TColStd_SequenceOfReal Tolers3d;
|
||||
TColStd_SequenceOfReal Tolers2d;
|
||||
Standard_Integer mydegremin;
|
||||
Standard_Integer mydegremax;
|
||||
Standard_Real mytol3d;
|
||||
Standard_Real mytol2d;
|
||||
Standard_Real currenttol3d;
|
||||
Standard_Real currenttol2d;
|
||||
Standard_Boolean mycut;
|
||||
AppParCurves_Constraint myfirstC;
|
||||
AppParCurves_Constraint mylastC;
|
||||
Standard_Integer myMaxSegments;
|
||||
Standard_Boolean myInvOrder;
|
||||
Standard_Boolean myHangChecking;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _Approx_FitAndDivide2d_HeaderFile
|
||||
|
@@ -17,11 +17,9 @@
|
||||
#include <Approx_FitAndDivide2d.hxx>
|
||||
|
||||
#include <AppParCurves_MultiCurve.hxx>
|
||||
|
||||
|
||||
#define MultiLine AppCont_Function
|
||||
#define MultiLine_hxx <AppCont_Function.hxx>
|
||||
#define Approx_ComputeCLine Approx_FitAndDivide2d
|
||||
#define Approx_ComputeCLine_hxx <Approx_FitAndDivide2d.hxx>
|
||||
#include "../Approx/Approx_ComputeCLine.gxx"
|
||||
|
||||
|
@@ -17,11 +17,9 @@
|
||||
#include <Approx_FitAndDivide.hxx>
|
||||
|
||||
#include <AppParCurves_MultiCurve.hxx>
|
||||
|
||||
|
||||
#define MultiLine AppCont_Function
|
||||
#define MultiLine_hxx <AppCont_Function.hxx>
|
||||
#define Approx_ComputeCLine Approx_FitAndDivide
|
||||
#define Approx_ComputeCLine_hxx <Approx_FitAndDivide.hxx>
|
||||
#include "../Approx/Approx_ComputeCLine.gxx"
|
||||
|
||||
|
@@ -23,5 +23,4 @@
|
||||
|
||||
DEFINE_HARRAY1(Approx_HArray1OfAdHSurface, Approx_Array1OfAdHSurface)
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -22,5 +22,4 @@
|
||||
|
||||
DEFINE_HARRAY1(Approx_HArray1OfGTrsf2d, Approx_Array1OfGTrsf2d)
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -12,46 +12,49 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <AppParCurves_MultiPoint.hxx>
|
||||
#include <Approx_MCurvesToBSpCurve.hxx>
|
||||
#include <BSplCLib.hxx>
|
||||
#include <Convert_CompBezierCurves2dToBSplineCurve2d.hxx>
|
||||
#include <Convert_CompBezierCurvesToBSplineCurve.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
|
||||
#ifdef OCCT_DEBUG
|
||||
static void DEBUG(const AppParCurves_MultiCurve& MC) {
|
||||
Standard_Integer i, j;
|
||||
Standard_Integer nbcu = MC.NbCurves();
|
||||
Standard_Integer nbpoles = MC.NbPoles();
|
||||
TColgp_Array1OfPnt Poles(1, nbpoles);
|
||||
static void DEBUG(const AppParCurves_MultiCurve& MC)
|
||||
{
|
||||
Standard_Integer i, j;
|
||||
Standard_Integer nbcu = MC.NbCurves();
|
||||
Standard_Integer nbpoles = MC.NbPoles();
|
||||
TColgp_Array1OfPnt Poles(1, nbpoles);
|
||||
TColgp_Array1OfPnt2d Poles2d(1, nbpoles);
|
||||
|
||||
for (i = 1; i <= nbcu; i++) {
|
||||
for (i = 1; i <= nbcu; i++)
|
||||
{
|
||||
std::cout << " Curve No. " << i << std::endl;
|
||||
if (MC.Dimension(i) == 3) {
|
||||
if (MC.Dimension(i) == 3)
|
||||
{
|
||||
MC.Curve(i, Poles);
|
||||
for (j = 1; j <= nbpoles; j++) {
|
||||
std::cout<< " Pole = " << Poles(j).X() <<" "<<Poles(j).Y()<<" "<<Poles(j).Z()<< std::endl;
|
||||
for (j = 1; j <= nbpoles; j++)
|
||||
{
|
||||
std::cout << " Pole = " << Poles(j).X() << " " << Poles(j).Y() << " " << Poles(j).Z()
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
MC.Curve(i, Poles2d);
|
||||
for (j = 1; j <= nbpoles; j++) {
|
||||
std::cout<< " Pole = " << Poles2d(j).X() <<" "<<Poles2d(j).Y()<< std::endl;
|
||||
for (j = 1; j <= nbpoles; j++)
|
||||
{
|
||||
std::cout << " Pole = " << Poles2d(j).X() << " " << Poles2d(j).Y() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
Approx_MCurvesToBSpCurve::Approx_MCurvesToBSpCurve()
|
||||
{
|
||||
myDone = Standard_False;
|
||||
@@ -68,181 +71,210 @@ void Approx_MCurvesToBSpCurve::Append(const AppParCurves_MultiCurve& MC)
|
||||
myCurves.Append(MC);
|
||||
}
|
||||
|
||||
|
||||
void Approx_MCurvesToBSpCurve::Perform()
|
||||
{
|
||||
Perform(myCurves);
|
||||
}
|
||||
|
||||
void Approx_MCurvesToBSpCurve::Perform
|
||||
(const AppParCurves_SequenceOfMultiCurve& TheSeq)
|
||||
void Approx_MCurvesToBSpCurve::Perform(const AppParCurves_SequenceOfMultiCurve& TheSeq)
|
||||
{
|
||||
|
||||
Standard_Integer i, j, deg=0;
|
||||
Standard_Integer nbcu = TheSeq.Length();
|
||||
Standard_Integer i, j, deg = 0;
|
||||
Standard_Integer nbcu = TheSeq.Length();
|
||||
AppParCurves_MultiCurve CU;
|
||||
Standard_Integer nbpolesspl=0, nbknots=0;
|
||||
Standard_Integer nbpolesspl = 0, nbknots = 0;
|
||||
#ifdef OCCT_DEBUG
|
||||
Standard_Boolean debug = Standard_False;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (nbcu == 1) {
|
||||
CU = TheSeq.Value(1);
|
||||
if (nbcu == 1)
|
||||
{
|
||||
CU = TheSeq.Value(1);
|
||||
deg = CU.Degree();
|
||||
TColStd_Array1OfReal Knots(1, 2);
|
||||
TColStd_Array1OfReal Knots(1, 2);
|
||||
TColStd_Array1OfInteger Mults(1, 2);
|
||||
Knots(1) = 0.0;
|
||||
Knots(2) = 1.0;
|
||||
Mults(1) = Mults(2) = deg+1;
|
||||
mySpline = AppParCurves_MultiBSpCurve (CU, Knots, Mults);
|
||||
Mults(1) = Mults(2) = deg + 1;
|
||||
mySpline = AppParCurves_MultiBSpCurve(CU, Knots, Mults);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
|
||||
AppParCurves_MultiPoint P = TheSeq.Value(nbcu).Value(1);
|
||||
Standard_Integer nb3d = P.NbPoints();
|
||||
Standard_Integer nb2d = P.NbPoints2d();
|
||||
AppParCurves_MultiPoint P = TheSeq.Value(nbcu).Value(1);
|
||||
Standard_Integer nb3d = P.NbPoints();
|
||||
Standard_Integer nb2d = P.NbPoints2d();
|
||||
|
||||
Convert_CompBezierCurvesToBSplineCurve conv;
|
||||
Convert_CompBezierCurvesToBSplineCurve conv;
|
||||
Convert_CompBezierCurves2dToBSplineCurve2d conv2d;
|
||||
|
||||
if (nb3d != 0) {
|
||||
for (i = 1; i <= nbcu; i++) {
|
||||
CU = TheSeq.Value(i);
|
||||
TColgp_Array1OfPnt ThePoles3d(1, CU.NbPoles());
|
||||
CU.Curve(1, ThePoles3d);
|
||||
conv.AddCurve(ThePoles3d);
|
||||
if (nb3d != 0)
|
||||
{
|
||||
for (i = 1; i <= nbcu; i++)
|
||||
{
|
||||
CU = TheSeq.Value(i);
|
||||
TColgp_Array1OfPnt ThePoles3d(1, CU.NbPoles());
|
||||
CU.Curve(1, ThePoles3d);
|
||||
conv.AddCurve(ThePoles3d);
|
||||
}
|
||||
conv.Perform();
|
||||
}
|
||||
|
||||
|
||||
else if (nb2d != 0) {
|
||||
for (i = 1; i <= nbcu; i++) {
|
||||
CU = TheSeq.Value(i);
|
||||
TColgp_Array1OfPnt2d ThePoles2d(1, CU.NbPoles());
|
||||
CU.Curve(1+nb3d, ThePoles2d);
|
||||
conv2d.AddCurve(ThePoles2d);
|
||||
else if (nb2d != 0)
|
||||
{
|
||||
for (i = 1; i <= nbcu; i++)
|
||||
{
|
||||
CU = TheSeq.Value(i);
|
||||
TColgp_Array1OfPnt2d ThePoles2d(1, CU.NbPoles());
|
||||
CU.Curve(1 + nb3d, ThePoles2d);
|
||||
conv2d.AddCurve(ThePoles2d);
|
||||
}
|
||||
conv2d.Perform();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Recuperation:
|
||||
if (nb3d != 0) {
|
||||
if (nb3d != 0)
|
||||
{
|
||||
nbpolesspl = conv.NbPoles();
|
||||
nbknots = conv.NbKnots();
|
||||
nbknots = conv.NbKnots();
|
||||
}
|
||||
else if (nb2d != 0) {
|
||||
else if (nb2d != 0)
|
||||
{
|
||||
nbpolesspl = conv2d.NbPoles();
|
||||
nbknots = conv2d.NbKnots();
|
||||
}
|
||||
|
||||
nbknots = conv2d.NbKnots();
|
||||
}
|
||||
|
||||
AppParCurves_Array1OfMultiPoint tabMU(1, nbpolesspl);
|
||||
TColgp_Array1OfPnt PolesSpl(1, nbpolesspl);
|
||||
TColgp_Array1OfPnt2d PolesSpl2d(1, nbpolesspl);
|
||||
TColStd_Array1OfInteger TheMults(1, nbknots);
|
||||
TColStd_Array1OfReal TheKnots(1, nbknots);
|
||||
|
||||
if (nb3d != 0) {
|
||||
TColgp_Array1OfPnt PolesSpl(1, nbpolesspl);
|
||||
TColgp_Array1OfPnt2d PolesSpl2d(1, nbpolesspl);
|
||||
TColStd_Array1OfInteger TheMults(1, nbknots);
|
||||
TColStd_Array1OfReal TheKnots(1, nbknots);
|
||||
|
||||
if (nb3d != 0)
|
||||
{
|
||||
conv.KnotsAndMults(TheKnots, TheMults);
|
||||
conv.Poles(PolesSpl);
|
||||
deg = conv.Degree();
|
||||
}
|
||||
else if (nb2d != 0) {
|
||||
else if (nb2d != 0)
|
||||
{
|
||||
conv2d.KnotsAndMults(TheKnots, TheMults);
|
||||
conv2d.Poles(PolesSpl2d);
|
||||
deg = conv2d.Degree();
|
||||
}
|
||||
|
||||
|
||||
for (j = 1; j <= nbpolesspl; j++) {
|
||||
for (j = 1; j <= nbpolesspl; j++)
|
||||
{
|
||||
AppParCurves_MultiPoint MP(nb3d, nb2d);
|
||||
if (nb3d!=0) {
|
||||
MP.SetPoint(1, PolesSpl(j));
|
||||
if (nb3d != 0)
|
||||
{
|
||||
MP.SetPoint(1, PolesSpl(j));
|
||||
}
|
||||
else if (nb2d!=0) {
|
||||
MP.SetPoint2d(1+nb3d, PolesSpl2d(j));
|
||||
else if (nb2d != 0)
|
||||
{
|
||||
MP.SetPoint2d(1 + nb3d, PolesSpl2d(j));
|
||||
}
|
||||
tabMU.SetValue(j, MP);
|
||||
}
|
||||
|
||||
Standard_Integer kpol = 1, kpoles3d=1, kpoles2d=1;
|
||||
Standard_Integer kpol = 1, kpoles3d = 1, kpoles2d = 1;
|
||||
Standard_Integer mydegre, k;
|
||||
Standard_Integer first, last, Inc, thefirst;
|
||||
if (nb3d != 0) thefirst = 1;
|
||||
else thefirst = 2;
|
||||
if (nb3d != 0)
|
||||
thefirst = 1;
|
||||
else
|
||||
thefirst = 2;
|
||||
|
||||
for (i = 1; i <= nbcu; i++) {
|
||||
CU = TheSeq.Value(i);
|
||||
for (i = 1; i <= nbcu; i++)
|
||||
{
|
||||
CU = TheSeq.Value(i);
|
||||
mydegre = CU.Degree();
|
||||
if (TheMults(i+1) == deg) last = deg+1; // Continuite C0
|
||||
else last = deg; // Continuite C1
|
||||
if (i==nbcu) {last = deg+1;}
|
||||
if (TheMults(i + 1) == deg)
|
||||
last = deg + 1; // Continuite C0
|
||||
else
|
||||
last = deg; // Continuite C1
|
||||
if (i == nbcu)
|
||||
{
|
||||
last = deg + 1;
|
||||
}
|
||||
first = 1;
|
||||
if (i==1) first = 1;
|
||||
else if ((TheMults(i)== deg-1) || (TheMults(i)==deg)) first = 2;
|
||||
if (i == 1)
|
||||
first = 1;
|
||||
else if ((TheMults(i) == deg - 1) || (TheMults(i) == deg))
|
||||
first = 2;
|
||||
|
||||
for (j = 2; j <= nb3d; j++) {
|
||||
kpol = kpoles3d;
|
||||
TColgp_Array1OfPnt ThePoles(1, CU.NbPoles());
|
||||
CU.Curve(j, ThePoles);
|
||||
for (j = 2; j <= nb3d; j++)
|
||||
{
|
||||
kpol = kpoles3d;
|
||||
TColgp_Array1OfPnt ThePoles(1, CU.NbPoles());
|
||||
CU.Curve(j, ThePoles);
|
||||
|
||||
Inc = deg-mydegre;
|
||||
TColgp_Array1OfPnt Points(1, deg+1);
|
||||
if (Inc > 0) {
|
||||
BSplCLib::IncreaseDegree(deg, ThePoles, BSplCLib::NoWeights(),
|
||||
Points, BSplCLib::NoWeights());
|
||||
}
|
||||
else {
|
||||
Points = ThePoles;
|
||||
}
|
||||
Inc = deg - mydegre;
|
||||
TColgp_Array1OfPnt Points(1, deg + 1);
|
||||
if (Inc > 0)
|
||||
{
|
||||
BSplCLib::IncreaseDegree(deg,
|
||||
ThePoles,
|
||||
BSplCLib::NoWeights(),
|
||||
Points,
|
||||
BSplCLib::NoWeights());
|
||||
}
|
||||
else
|
||||
{
|
||||
Points = ThePoles;
|
||||
}
|
||||
|
||||
for (k = first; k <= last; k++) {
|
||||
tabMU.ChangeValue(kpol++).SetPoint(j, Points(k));
|
||||
}
|
||||
for (k = first; k <= last; k++)
|
||||
{
|
||||
tabMU.ChangeValue(kpol++).SetPoint(j, Points(k));
|
||||
}
|
||||
}
|
||||
kpoles3d = kpol;
|
||||
|
||||
for (j = thefirst; j <= nb2d; j++) {
|
||||
kpol = kpoles2d;
|
||||
TColgp_Array1OfPnt2d ThePoles2d(1, CU.NbPoles());
|
||||
CU.Curve(j+nb3d, ThePoles2d);
|
||||
|
||||
Inc = deg-mydegre;
|
||||
TColgp_Array1OfPnt2d Points2d(1, deg+1);
|
||||
if (Inc > 0) {
|
||||
BSplCLib::IncreaseDegree(deg, ThePoles2d, BSplCLib::NoWeights(),
|
||||
Points2d, BSplCLib::NoWeights());
|
||||
}
|
||||
else {
|
||||
Points2d = ThePoles2d;
|
||||
}
|
||||
for (k = first; k <= last; k++) {
|
||||
tabMU.ChangeValue(kpol++).SetPoint2d(j+nb3d, Points2d(k));
|
||||
}
|
||||
for (j = thefirst; j <= nb2d; j++)
|
||||
{
|
||||
kpol = kpoles2d;
|
||||
TColgp_Array1OfPnt2d ThePoles2d(1, CU.NbPoles());
|
||||
CU.Curve(j + nb3d, ThePoles2d);
|
||||
|
||||
Inc = deg - mydegre;
|
||||
TColgp_Array1OfPnt2d Points2d(1, deg + 1);
|
||||
if (Inc > 0)
|
||||
{
|
||||
BSplCLib::IncreaseDegree(deg,
|
||||
ThePoles2d,
|
||||
BSplCLib::NoWeights(),
|
||||
Points2d,
|
||||
BSplCLib::NoWeights());
|
||||
}
|
||||
else
|
||||
{
|
||||
Points2d = ThePoles2d;
|
||||
}
|
||||
for (k = first; k <= last; k++)
|
||||
{
|
||||
tabMU.ChangeValue(kpol++).SetPoint2d(j + nb3d, Points2d(k));
|
||||
}
|
||||
}
|
||||
kpoles2d = kpol;
|
||||
}
|
||||
|
||||
|
||||
mySpline = AppParCurves_MultiBSpCurve(tabMU, TheKnots, TheMults);
|
||||
}
|
||||
#ifdef OCCT_DEBUG
|
||||
if(debug) DEBUG(mySpline);
|
||||
if (debug)
|
||||
DEBUG(mySpline);
|
||||
#endif
|
||||
|
||||
myDone = Standard_True;
|
||||
}
|
||||
|
||||
|
||||
const AppParCurves_MultiBSpCurve& Approx_MCurvesToBSpCurve::Value() const
|
||||
{
|
||||
return mySpline;
|
||||
}
|
||||
|
||||
|
||||
const AppParCurves_MultiBSpCurve& Approx_MCurvesToBSpCurve::ChangeValue()
|
||||
{
|
||||
return mySpline;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -24,55 +24,32 @@
|
||||
#include <AppParCurves_SequenceOfMultiCurve.hxx>
|
||||
class AppParCurves_MultiCurve;
|
||||
|
||||
|
||||
|
||||
class Approx_MCurvesToBSpCurve
|
||||
class Approx_MCurvesToBSpCurve
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
Standard_EXPORT Approx_MCurvesToBSpCurve();
|
||||
|
||||
|
||||
Standard_EXPORT void Reset();
|
||||
|
||||
Standard_EXPORT void Append (const AppParCurves_MultiCurve& MC);
|
||||
|
||||
|
||||
Standard_EXPORT void Append(const AppParCurves_MultiCurve& MC);
|
||||
|
||||
Standard_EXPORT void Perform();
|
||||
|
||||
Standard_EXPORT void Perform (const AppParCurves_SequenceOfMultiCurve& TheSeq);
|
||||
|
||||
|
||||
Standard_EXPORT void Perform(const AppParCurves_SequenceOfMultiCurve& TheSeq);
|
||||
|
||||
//! return the composite MultiCurves as a MultiBSpCurve.
|
||||
Standard_EXPORT const AppParCurves_MultiBSpCurve& Value() const;
|
||||
|
||||
|
||||
//! return the composite MultiCurves as a MultiBSpCurve.
|
||||
Standard_EXPORT const AppParCurves_MultiBSpCurve& ChangeValue();
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
AppParCurves_MultiBSpCurve mySpline;
|
||||
Standard_Boolean myDone;
|
||||
AppParCurves_MultiBSpCurve mySpline;
|
||||
Standard_Boolean myDone;
|
||||
AppParCurves_SequenceOfMultiCurve myCurves;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _Approx_MCurvesToBSpCurve_HeaderFile
|
||||
|
@@ -17,11 +17,11 @@
|
||||
#ifndef _Approx_ParametrizationType_HeaderFile
|
||||
#define _Approx_ParametrizationType_HeaderFile
|
||||
|
||||
|
||||
enum Approx_ParametrizationType
|
||||
{
|
||||
Approx_ChordLength, //!< parameters of points are proportionate to distances between them
|
||||
Approx_Centripetal, //!< parameters of points are proportionate to square roots of distances between them
|
||||
Approx_ChordLength, //!< parameters of points are proportionate to distances between them
|
||||
Approx_Centripetal, //!< parameters of points are proportionate to square roots of distances
|
||||
//!< between them
|
||||
Approx_IsoParametric //!< parameters of points are distributed uniformly
|
||||
};
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -27,90 +27,70 @@ class Geom_Surface;
|
||||
//! Approximation of a PCurve on a surface to make its
|
||||
//! parameter be the same that the parameter of a given 3d
|
||||
//! reference curve.
|
||||
class Approx_SameParameter
|
||||
class Approx_SameParameter
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Warning: the C3D and C2D must have the same parametric domain.
|
||||
Standard_EXPORT Approx_SameParameter(const Handle(Geom_Curve)& C3D,
|
||||
Standard_EXPORT Approx_SameParameter(const Handle(Geom_Curve)& C3D,
|
||||
const Handle(Geom2d_Curve)& C2D,
|
||||
const Handle(Geom_Surface)& S,
|
||||
const Standard_Real Tol);
|
||||
const Standard_Real Tol);
|
||||
|
||||
//! Warning: the C3D and C2D must have the same parametric domain.
|
||||
Standard_EXPORT Approx_SameParameter(const Handle(Adaptor3d_Curve)& C3D,
|
||||
const Handle(Geom2d_Curve)& C2D,
|
||||
Standard_EXPORT Approx_SameParameter(const Handle(Adaptor3d_Curve)& C3D,
|
||||
const Handle(Geom2d_Curve)& C2D,
|
||||
const Handle(Adaptor3d_Surface)& S,
|
||||
const Standard_Real Tol);
|
||||
const Standard_Real Tol);
|
||||
|
||||
//! Warning: the C3D and C2D must have the same parametric domain.
|
||||
Standard_EXPORT Approx_SameParameter(const Handle(Adaptor3d_Curve)& C3D,
|
||||
Standard_EXPORT Approx_SameParameter(const Handle(Adaptor3d_Curve)& C3D,
|
||||
const Handle(Adaptor2d_Curve2d)& C2D,
|
||||
const Handle(Adaptor3d_Surface)& S,
|
||||
const Standard_Real Tol);
|
||||
const Standard_Real Tol);
|
||||
|
||||
//!@Returns .false. if calculations failed,
|
||||
//! .true. if calculations succeed
|
||||
Standard_Boolean IsDone() const
|
||||
{
|
||||
return myDone;
|
||||
}
|
||||
Standard_Boolean IsDone() const { return myDone; }
|
||||
|
||||
//!@Returns tolerance (maximal distance) between 3d curve
|
||||
//! and curve on surface, generated by 2d curve and surface.
|
||||
Standard_Real TolReached() const
|
||||
{
|
||||
return myTolReached;
|
||||
}
|
||||
//! and curve on surface, generated by 2d curve and surface.
|
||||
Standard_Real TolReached() const { return myTolReached; }
|
||||
|
||||
//! Tells whether the original data had already the same
|
||||
//! parameter up to the tolerance : in that case nothing
|
||||
//! is done.
|
||||
Standard_Boolean IsSameParameter() const
|
||||
{
|
||||
return mySameParameter;
|
||||
}
|
||||
Standard_Boolean IsSameParameter() const { return mySameParameter; }
|
||||
|
||||
//! Returns the 2D curve that has the same parameter as
|
||||
//! the 3D curve once evaluated on the surface up to the
|
||||
//! specified tolerance.
|
||||
Handle(Geom2d_Curve) Curve2d() const
|
||||
{
|
||||
return myCurve2d;
|
||||
}
|
||||
Handle(Geom2d_Curve) Curve2d() const { return myCurve2d; }
|
||||
|
||||
//! Returns the 3D curve that has the same parameter as
|
||||
//! the 3D curve once evaluated on the surface up to the
|
||||
//! specified tolerance.
|
||||
Handle(Adaptor3d_Curve) Curve3d() const
|
||||
{
|
||||
return myC3d;
|
||||
}
|
||||
Handle(Adaptor3d_Curve) Curve3d() const { return myC3d; }
|
||||
|
||||
//! Returns the 3D curve on surface that has the same parameter as
|
||||
//! the 3D curve up to the specified tolerance.
|
||||
Handle(Adaptor3d_CurveOnSurface) CurveOnSurface() const
|
||||
{
|
||||
return myCurveOnSurface;
|
||||
}
|
||||
Handle(Adaptor3d_CurveOnSurface) CurveOnSurface() const { return myCurveOnSurface; }
|
||||
|
||||
private:
|
||||
|
||||
//! Internal data structure to unify access to the most actively used data.
|
||||
//! This structure is not intended to be class field since
|
||||
//! a lot of memory is used in intermediate computations.
|
||||
struct Approx_SameParameter_Data
|
||||
{
|
||||
Adaptor3d_CurveOnSurface myCOnS; // Curve on surface.
|
||||
Standard_Integer myNbPnt; // Number of points.
|
||||
Standard_Real *myPC3d; // Parameters on 3d curve.
|
||||
Standard_Real *myPC2d; // Parameters on 2d curve.
|
||||
Adaptor3d_CurveOnSurface myCOnS; // Curve on surface.
|
||||
Standard_Integer myNbPnt; // Number of points.
|
||||
Standard_Real* myPC3d; // Parameters on 3d curve.
|
||||
Standard_Real* myPC2d; // Parameters on 2d curve.
|
||||
|
||||
// Second data arrays. Used in loop over poles.
|
||||
Standard_Real *myNewPC3d; // Parameters on 3d curve.
|
||||
Standard_Real *myNewPC2d; // Parameters on 2d curve.
|
||||
Standard_Real* myNewPC3d; // Parameters on 3d curve.
|
||||
Standard_Real* myNewPC2d; // Parameters on 2d curve.
|
||||
|
||||
// Parameters ranges.
|
||||
Standard_Real myC3dPF; // Curve 3d Parameter First.
|
||||
@@ -124,73 +104,72 @@ private:
|
||||
void Swap(const Standard_Integer theNewNbPoints)
|
||||
{
|
||||
myNbPnt = theNewNbPoints;
|
||||
Standard_Real * temp;
|
||||
Standard_Real* temp;
|
||||
|
||||
// 3-D
|
||||
temp = myPC3d;
|
||||
myPC3d = myNewPC3d;
|
||||
temp = myPC3d;
|
||||
myPC3d = myNewPC3d;
|
||||
myNewPC3d = temp;
|
||||
|
||||
// 2-D
|
||||
temp = myPC2d;
|
||||
myPC2d = myNewPC2d;
|
||||
temp = myPC2d;
|
||||
myPC2d = myNewPC2d;
|
||||
myNewPC2d = temp;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Approx_SameParameter(const Approx_SameParameter &);
|
||||
Approx_SameParameter& operator=(const Approx_SameParameter &);
|
||||
Approx_SameParameter(const Approx_SameParameter&);
|
||||
Approx_SameParameter& operator=(const Approx_SameParameter&);
|
||||
|
||||
//! Computes the pcurve (internal use only).
|
||||
Standard_EXPORT void Build (const Standard_Real Tol);
|
||||
Standard_EXPORT void Build(const Standard_Real Tol);
|
||||
|
||||
//! Computes initial point distribution.
|
||||
Standard_Boolean BuildInitialDistribution(Approx_SameParameter_Data &theData) const;
|
||||
Standard_Boolean BuildInitialDistribution(Approx_SameParameter_Data& theData) const;
|
||||
|
||||
//! Increases initial number of samples in case of the C0 continuity.
|
||||
//! Return new number of points and corresponding data arrays.
|
||||
//@return true if new number of samples is good and false otherwise.
|
||||
Standard_Boolean IncreaseInitialNbSamples(Approx_SameParameter_Data &theData) const;
|
||||
Standard_Boolean IncreaseInitialNbSamples(Approx_SameParameter_Data& theData) const;
|
||||
|
||||
//! Computes tangents on boundary points.
|
||||
//@return true if tangents are not null and false otherwise.
|
||||
Standard_Boolean ComputeTangents(const Adaptor3d_CurveOnSurface & theCOnS,
|
||||
Standard_Real &theFirstTangent,
|
||||
Standard_Real &theLastTangent) const;
|
||||
Standard_Boolean ComputeTangents(const Adaptor3d_CurveOnSurface& theCOnS,
|
||||
Standard_Real& theFirstTangent,
|
||||
Standard_Real& theLastTangent) const;
|
||||
|
||||
//! Method to check same parameter state
|
||||
//! and build dependency between 2d and 3d curves.
|
||||
//@return true if 2d and 3d curves have same parameter state and false otherwise.
|
||||
Standard_Boolean CheckSameParameter(Approx_SameParameter_Data &theData,
|
||||
Standard_Real &theSqDist) const;
|
||||
Standard_Boolean CheckSameParameter(Approx_SameParameter_Data& theData,
|
||||
Standard_Real& theSqDist) const;
|
||||
|
||||
//! Computes interpolated values.
|
||||
//!@Returns .false. if computations failed;
|
||||
Standard_Boolean Interpolate(const Approx_SameParameter_Data & theData,
|
||||
const Standard_Real aTangFirst,
|
||||
const Standard_Real aTangLast,
|
||||
TColStd_Array1OfReal & thePoles,
|
||||
TColStd_Array1OfReal & theFlatKnots) const;
|
||||
Standard_Boolean Interpolate(const Approx_SameParameter_Data& theData,
|
||||
const Standard_Real aTangFirst,
|
||||
const Standard_Real aTangLast,
|
||||
TColStd_Array1OfReal& thePoles,
|
||||
TColStd_Array1OfReal& theFlatKnots) const;
|
||||
|
||||
//! Increases number of poles in poles loop.
|
||||
//@return true if poles is changed and false otherwise.
|
||||
Standard_Boolean IncreaseNbPoles(const TColStd_Array1OfReal & thePoles,
|
||||
const TColStd_Array1OfReal & theFlatKnots,
|
||||
Approx_SameParameter_Data & theData,
|
||||
Standard_Real &theBestSqTol) const;
|
||||
Standard_Boolean IncreaseNbPoles(const TColStd_Array1OfReal& thePoles,
|
||||
const TColStd_Array1OfReal& theFlatKnots,
|
||||
Approx_SameParameter_Data& theData,
|
||||
Standard_Real& theBestSqTol) const;
|
||||
|
||||
static const Standard_Integer myNbSamples = 22; // To be consistent with "checkshape".
|
||||
static const Standard_Integer myNbSamples = 22; // To be consistent with "checkshape".
|
||||
static const Standard_Integer myMaxArraySize = 1000;
|
||||
const Standard_Real myDeltaMin; // Initialization is allowed only for integral types.
|
||||
const Standard_Real myDeltaMin; // Initialization is allowed only for integral types.
|
||||
|
||||
Standard_Boolean mySameParameter;
|
||||
Standard_Boolean myDone;
|
||||
Standard_Real myTolReached;
|
||||
Handle(Geom2d_Curve) myCurve2d;
|
||||
Handle(Adaptor2d_Curve2d) myHCurve2d;
|
||||
Handle(Adaptor3d_Curve) myC3d;
|
||||
Handle(Adaptor3d_Surface) mySurf;
|
||||
Standard_Boolean mySameParameter;
|
||||
Standard_Boolean myDone;
|
||||
Standard_Real myTolReached;
|
||||
Handle(Geom2d_Curve) myCurve2d;
|
||||
Handle(Adaptor2d_Curve2d) myHCurve2d;
|
||||
Handle(Adaptor3d_Curve) myC3d;
|
||||
Handle(Adaptor3d_Surface) mySurf;
|
||||
Handle(Adaptor3d_CurveOnSurface) myCurveOnSurface;
|
||||
};
|
||||
|
||||
|
@@ -17,10 +17,9 @@
|
||||
#ifndef Approx_SequenceOfHArray1OfReal_HeaderFile
|
||||
#define Approx_SequenceOfHArray1OfReal_HeaderFile
|
||||
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <NCollection_Sequence.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
|
||||
typedef NCollection_Sequence<Handle(TColStd_HArray1OfReal)> Approx_SequenceOfHArray1OfReal;
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -20,9 +20,9 @@
|
||||
//! It is an auxiliary flag being used in inner computations
|
||||
enum Approx_Status
|
||||
{
|
||||
Approx_PointsAdded,
|
||||
Approx_NoPointsAdded,
|
||||
Approx_NoApproximation
|
||||
Approx_PointsAdded,
|
||||
Approx_NoPointsAdded,
|
||||
Approx_NoApproximation
|
||||
};
|
||||
|
||||
#endif // _Approx_Status_HeaderFile
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -21,30 +21,29 @@
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <TColgp_HArray2OfPnt.hxx>
|
||||
#include <TColStd_HArray2OfReal.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
#include <TColgp_SequenceOfArray1OfPnt2d.hxx>
|
||||
#include <AdvApprox_EvaluatorFunction.hxx>
|
||||
#include <Approx_HArray1OfGTrsf2d.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_OStream.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TColStd_Array2OfReal.hxx>
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <TColStd_HArray2OfReal.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <TColgp_Array2OfPnt.hxx>
|
||||
#include <TColgp_HArray1OfPnt.hxx>
|
||||
#include <TColgp_HArray1OfPnt2d.hxx>
|
||||
#include <TColgp_HArray1OfVec.hxx>
|
||||
#include <TColgp_HArray1OfVec2d.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
#include <AdvApprox_EvaluatorFunction.hxx>
|
||||
#include <TColgp_Array2OfPnt.hxx>
|
||||
#include <TColStd_Array2OfReal.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <Standard_OStream.hxx>
|
||||
#include <TColgp_HArray2OfPnt.hxx>
|
||||
#include <TColgp_SequenceOfArray1OfPnt2d.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
class Approx_SweepFunction;
|
||||
class AdvApprox_Cutting;
|
||||
|
||||
|
||||
//! Approximation of an Surface S(u,v)
|
||||
//! (and eventually associate 2d Curves) defined
|
||||
//! by section's law.
|
||||
@@ -54,15 +53,13 @@ class AdvApprox_Cutting;
|
||||
//! To use this algorithme, you have to implement Ft(u)
|
||||
//! as a derivative class of Approx_SweepFunction.
|
||||
//! This algorithm can be used by blending, sweeping...
|
||||
class Approx_SweepApproximation
|
||||
class Approx_SweepApproximation
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
Standard_EXPORT Approx_SweepApproximation(const Handle(Approx_SweepFunction)& Func);
|
||||
|
||||
|
||||
//! Perform the Approximation
|
||||
//! [First, Last] : Approx_SweepApproximation.cdl
|
||||
//! Tol3d : Tolerance to surface approximation
|
||||
@@ -78,138 +75,166 @@ public:
|
||||
//! Segmax : The maximum number of span in v required on
|
||||
//! the surface
|
||||
//! Warning : The continuity ci can be obtained only if Ft is Ci
|
||||
Standard_EXPORT void Perform (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol3d, const Standard_Real BoundTol, const Standard_Real Tol2d, const Standard_Real TolAngular, const GeomAbs_Shape Continuity = GeomAbs_C0, const Standard_Integer Degmax = 11, const Standard_Integer Segmax = 50);
|
||||
|
||||
Standard_EXPORT void Perform(const Standard_Real First,
|
||||
const Standard_Real Last,
|
||||
const Standard_Real Tol3d,
|
||||
const Standard_Real BoundTol,
|
||||
const Standard_Real Tol2d,
|
||||
const Standard_Real TolAngular,
|
||||
const GeomAbs_Shape Continuity = GeomAbs_C0,
|
||||
const Standard_Integer Degmax = 11,
|
||||
const Standard_Integer Segmax = 50);
|
||||
|
||||
//! The EvaluatorFunction from AdvApprox;
|
||||
Standard_EXPORT Standard_Integer Eval (const Standard_Real Parameter, const Standard_Integer DerivativeRequest, const Standard_Real First, const Standard_Real Last, Standard_Real& Result);
|
||||
|
||||
Standard_EXPORT Standard_Integer Eval(const Standard_Real Parameter,
|
||||
const Standard_Integer DerivativeRequest,
|
||||
const Standard_Real First,
|
||||
const Standard_Real Last,
|
||||
Standard_Real& Result);
|
||||
|
||||
//! returns if we have an result
|
||||
Standard_Boolean IsDone() const;
|
||||
|
||||
Standard_EXPORT void SurfShape (Standard_Integer& UDegree, Standard_Integer& VDegree, Standard_Integer& NbUPoles, Standard_Integer& NbVPoles, Standard_Integer& NbUKnots, Standard_Integer& NbVKnots) const;
|
||||
|
||||
Standard_EXPORT void Surface (TColgp_Array2OfPnt& TPoles, TColStd_Array2OfReal& TWeights, TColStd_Array1OfReal& TUKnots, TColStd_Array1OfReal& TVKnots, TColStd_Array1OfInteger& TUMults, TColStd_Array1OfInteger& TVMults) const;
|
||||
|
||||
Standard_Integer UDegree() const;
|
||||
|
||||
Standard_Integer VDegree() const;
|
||||
|
||||
const TColgp_Array2OfPnt& SurfPoles() const;
|
||||
|
||||
const TColStd_Array2OfReal& SurfWeights() const;
|
||||
|
||||
const TColStd_Array1OfReal& SurfUKnots() const;
|
||||
|
||||
const TColStd_Array1OfReal& SurfVKnots() const;
|
||||
|
||||
const TColStd_Array1OfInteger& SurfUMults() const;
|
||||
|
||||
const TColStd_Array1OfInteger& SurfVMults() const;
|
||||
|
||||
Standard_Boolean IsDone() const;
|
||||
|
||||
Standard_EXPORT void SurfShape(Standard_Integer& UDegree,
|
||||
Standard_Integer& VDegree,
|
||||
Standard_Integer& NbUPoles,
|
||||
Standard_Integer& NbVPoles,
|
||||
Standard_Integer& NbUKnots,
|
||||
Standard_Integer& NbVKnots) const;
|
||||
|
||||
Standard_EXPORT void Surface(TColgp_Array2OfPnt& TPoles,
|
||||
TColStd_Array2OfReal& TWeights,
|
||||
TColStd_Array1OfReal& TUKnots,
|
||||
TColStd_Array1OfReal& TVKnots,
|
||||
TColStd_Array1OfInteger& TUMults,
|
||||
TColStd_Array1OfInteger& TVMults) const;
|
||||
|
||||
Standard_Integer UDegree() const;
|
||||
|
||||
Standard_Integer VDegree() const;
|
||||
|
||||
const TColgp_Array2OfPnt& SurfPoles() const;
|
||||
|
||||
const TColStd_Array2OfReal& SurfWeights() const;
|
||||
|
||||
const TColStd_Array1OfReal& SurfUKnots() const;
|
||||
|
||||
const TColStd_Array1OfReal& SurfVKnots() const;
|
||||
|
||||
const TColStd_Array1OfInteger& SurfUMults() const;
|
||||
|
||||
const TColStd_Array1OfInteger& SurfVMults() const;
|
||||
|
||||
//! returns the maximum error in the surface approximation.
|
||||
Standard_EXPORT Standard_Real MaxErrorOnSurf() const;
|
||||
|
||||
|
||||
//! returns the average error in the surface approximation.
|
||||
Standard_EXPORT Standard_Real AverageErrorOnSurf() const;
|
||||
|
||||
Standard_Integer NbCurves2d() const;
|
||||
|
||||
Standard_EXPORT void Curves2dShape (Standard_Integer& Degree, Standard_Integer& NbPoles, Standard_Integer& NbKnots) const;
|
||||
|
||||
Standard_EXPORT void Curve2d (const Standard_Integer Index, TColgp_Array1OfPnt2d& TPoles, TColStd_Array1OfReal& TKnots, TColStd_Array1OfInteger& TMults) const;
|
||||
|
||||
Standard_Integer Curves2dDegree() const;
|
||||
|
||||
const TColgp_Array1OfPnt2d& Curve2dPoles (const Standard_Integer Index) const;
|
||||
|
||||
const TColStd_Array1OfReal& Curves2dKnots() const;
|
||||
|
||||
const TColStd_Array1OfInteger& Curves2dMults() const;
|
||||
|
||||
|
||||
Standard_Integer NbCurves2d() const;
|
||||
|
||||
Standard_EXPORT void Curves2dShape(Standard_Integer& Degree,
|
||||
Standard_Integer& NbPoles,
|
||||
Standard_Integer& NbKnots) const;
|
||||
|
||||
Standard_EXPORT void Curve2d(const Standard_Integer Index,
|
||||
TColgp_Array1OfPnt2d& TPoles,
|
||||
TColStd_Array1OfReal& TKnots,
|
||||
TColStd_Array1OfInteger& TMults) const;
|
||||
|
||||
Standard_Integer Curves2dDegree() const;
|
||||
|
||||
const TColgp_Array1OfPnt2d& Curve2dPoles(const Standard_Integer Index) const;
|
||||
|
||||
const TColStd_Array1OfReal& Curves2dKnots() const;
|
||||
|
||||
const TColStd_Array1OfInteger& Curves2dMults() const;
|
||||
|
||||
//! returns the maximum error of the <Index>
|
||||
//! 2d curve approximation.
|
||||
Standard_EXPORT Standard_Real Max2dError (const Standard_Integer Index) const;
|
||||
|
||||
Standard_EXPORT Standard_Real Max2dError(const Standard_Integer Index) const;
|
||||
|
||||
//! returns the average error of the <Index>
|
||||
//! 2d curve approximation.
|
||||
Standard_EXPORT Standard_Real Average2dError (const Standard_Integer Index) const;
|
||||
|
||||
Standard_EXPORT Standard_Real Average2dError(const Standard_Integer Index) const;
|
||||
|
||||
//! returns the maximum 3d error of the <Index>
|
||||
//! 2d curve approximation on the Surface.
|
||||
Standard_EXPORT Standard_Real TolCurveOnSurf (const Standard_Integer Index) const;
|
||||
|
||||
Standard_EXPORT Standard_Real TolCurveOnSurf(const Standard_Integer Index) const;
|
||||
|
||||
//! display information on approximation.
|
||||
Standard_EXPORT void Dump (Standard_OStream& o) const;
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT void Dump(Standard_OStream& o) const;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
Standard_EXPORT void Approximation(const Handle(TColStd_HArray1OfReal)& OneDTol,
|
||||
const Handle(TColStd_HArray1OfReal)& TwoDTol,
|
||||
const Handle(TColStd_HArray1OfReal)& ThreeDTol,
|
||||
const Standard_Real BounTol,
|
||||
const Standard_Real First,
|
||||
const Standard_Real Last,
|
||||
const GeomAbs_Shape Continuity,
|
||||
const Standard_Integer Degmax,
|
||||
const Standard_Integer Segmax,
|
||||
const AdvApprox_EvaluatorFunction& TheApproxFunction,
|
||||
const AdvApprox_Cutting& TheCuttingTool);
|
||||
|
||||
|
||||
Standard_EXPORT void Approximation (const Handle(TColStd_HArray1OfReal)& OneDTol, const Handle(TColStd_HArray1OfReal)& TwoDTol, const Handle(TColStd_HArray1OfReal)& ThreeDTol, const Standard_Real BounTol, const Standard_Real First, const Standard_Real Last, const GeomAbs_Shape Continuity, const Standard_Integer Degmax, const Standard_Integer Segmax, const AdvApprox_EvaluatorFunction& TheApproxFunction, const AdvApprox_Cutting& TheCuttingTool);
|
||||
|
||||
Standard_EXPORT Standard_Boolean D0 (const Standard_Real Param, const Standard_Real First, const Standard_Real Last, Standard_Real& Result);
|
||||
|
||||
Standard_EXPORT Standard_Boolean D1 (const Standard_Real Param, const Standard_Real First, const Standard_Real Last, Standard_Real& Result);
|
||||
|
||||
Standard_EXPORT Standard_Boolean D2 (const Standard_Real Param, const Standard_Real First, const Standard_Real Last, Standard_Real& Result);
|
||||
Standard_EXPORT Standard_Boolean D0(const Standard_Real Param,
|
||||
const Standard_Real First,
|
||||
const Standard_Real Last,
|
||||
Standard_Real& Result);
|
||||
|
||||
Standard_EXPORT Standard_Boolean D1(const Standard_Real Param,
|
||||
const Standard_Real First,
|
||||
const Standard_Real Last,
|
||||
Standard_Real& Result);
|
||||
|
||||
Handle(Approx_SweepFunction) myFunc;
|
||||
Standard_Boolean done;
|
||||
Standard_Integer Num1DSS;
|
||||
Standard_Integer Num2DSS;
|
||||
Standard_Integer Num3DSS;
|
||||
Standard_Integer udeg;
|
||||
Standard_Integer vdeg;
|
||||
Standard_Integer deg2d;
|
||||
Handle(TColgp_HArray2OfPnt) tabPoles;
|
||||
Handle(TColStd_HArray2OfReal) tabWeights;
|
||||
Handle(TColStd_HArray1OfReal) tabUKnots;
|
||||
Handle(TColStd_HArray1OfReal) tabVKnots;
|
||||
Handle(TColStd_HArray1OfReal) tab2dKnots;
|
||||
Standard_EXPORT Standard_Boolean D2(const Standard_Real Param,
|
||||
const Standard_Real First,
|
||||
const Standard_Real Last,
|
||||
Standard_Real& Result);
|
||||
|
||||
Handle(Approx_SweepFunction) myFunc;
|
||||
Standard_Boolean done;
|
||||
Standard_Integer Num1DSS;
|
||||
Standard_Integer Num2DSS;
|
||||
Standard_Integer Num3DSS;
|
||||
Standard_Integer udeg;
|
||||
Standard_Integer vdeg;
|
||||
Standard_Integer deg2d;
|
||||
Handle(TColgp_HArray2OfPnt) tabPoles;
|
||||
Handle(TColStd_HArray2OfReal) tabWeights;
|
||||
Handle(TColStd_HArray1OfReal) tabUKnots;
|
||||
Handle(TColStd_HArray1OfReal) tabVKnots;
|
||||
Handle(TColStd_HArray1OfReal) tab2dKnots;
|
||||
Handle(TColStd_HArray1OfInteger) tabUMults;
|
||||
Handle(TColStd_HArray1OfInteger) tabVMults;
|
||||
Handle(TColStd_HArray1OfInteger) tab2dMults;
|
||||
TColgp_SequenceOfArray1OfPnt2d seqPoles2d;
|
||||
Handle(TColStd_HArray1OfReal) MError1d;
|
||||
Handle(TColStd_HArray1OfReal) tab2dError;
|
||||
Handle(TColStd_HArray1OfReal) MError3d;
|
||||
Handle(TColStd_HArray1OfReal) AError1d;
|
||||
Handle(TColStd_HArray1OfReal) Ave2dError;
|
||||
Handle(TColStd_HArray1OfReal) AError3d;
|
||||
Handle(Approx_HArray1OfGTrsf2d) AAffin;
|
||||
Handle(TColStd_HArray1OfReal) COnSurfErr;
|
||||
gp_Vec Translation;
|
||||
Handle(TColgp_HArray1OfPnt) myPoles;
|
||||
Handle(TColgp_HArray1OfPnt2d) myPoles2d;
|
||||
Handle(TColStd_HArray1OfReal) myWeigths;
|
||||
Handle(TColgp_HArray1OfVec) myDPoles;
|
||||
Handle(TColgp_HArray1OfVec) myD2Poles;
|
||||
Handle(TColgp_HArray1OfVec2d) myDPoles2d;
|
||||
Handle(TColgp_HArray1OfVec2d) myD2Poles2d;
|
||||
Handle(TColStd_HArray1OfReal) myDWeigths;
|
||||
Handle(TColStd_HArray1OfReal) myD2Weigths;
|
||||
Standard_Integer myOrder;
|
||||
Standard_Real myParam;
|
||||
Standard_Real first;
|
||||
Standard_Real last;
|
||||
|
||||
|
||||
TColgp_SequenceOfArray1OfPnt2d seqPoles2d;
|
||||
Handle(TColStd_HArray1OfReal) MError1d;
|
||||
Handle(TColStd_HArray1OfReal) tab2dError;
|
||||
Handle(TColStd_HArray1OfReal) MError3d;
|
||||
Handle(TColStd_HArray1OfReal) AError1d;
|
||||
Handle(TColStd_HArray1OfReal) Ave2dError;
|
||||
Handle(TColStd_HArray1OfReal) AError3d;
|
||||
Handle(Approx_HArray1OfGTrsf2d) AAffin;
|
||||
Handle(TColStd_HArray1OfReal) COnSurfErr;
|
||||
gp_Vec Translation;
|
||||
Handle(TColgp_HArray1OfPnt) myPoles;
|
||||
Handle(TColgp_HArray1OfPnt2d) myPoles2d;
|
||||
Handle(TColStd_HArray1OfReal) myWeigths;
|
||||
Handle(TColgp_HArray1OfVec) myDPoles;
|
||||
Handle(TColgp_HArray1OfVec) myD2Poles;
|
||||
Handle(TColgp_HArray1OfVec2d) myDPoles2d;
|
||||
Handle(TColgp_HArray1OfVec2d) myD2Poles2d;
|
||||
Handle(TColStd_HArray1OfReal) myDWeigths;
|
||||
Handle(TColStd_HArray1OfReal) myD2Weigths;
|
||||
Standard_Integer myOrder;
|
||||
Standard_Real myParam;
|
||||
Standard_Real first;
|
||||
Standard_Real last;
|
||||
};
|
||||
|
||||
|
||||
#include <Approx_SweepApproximation.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _Approx_SweepApproximation_HeaderFile
|
||||
|
@@ -15,113 +15,152 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <TColgp_HArray2OfPnt.hxx>
|
||||
#include <TColgp_HArray1OfPnt2d.hxx>
|
||||
#include <TColStd_HArray2OfReal.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <TColStd_HArray2OfReal.hxx>
|
||||
#include <TColgp_HArray1OfPnt2d.hxx>
|
||||
#include <TColgp_HArray2OfPnt.hxx>
|
||||
|
||||
inline Standard_Boolean Approx_SweepApproximation::IsDone() const
|
||||
inline Standard_Boolean Approx_SweepApproximation::IsDone() const
|
||||
{
|
||||
return done;
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Integer Approx_SweepApproximation::UDegree() const
|
||||
inline Standard_Integer Approx_SweepApproximation::UDegree() const
|
||||
{
|
||||
if (!done) {throw StdFail_NotDone(" Approx_SweepApproximation");}
|
||||
if (!done)
|
||||
{
|
||||
throw StdFail_NotDone(" Approx_SweepApproximation");
|
||||
}
|
||||
return udeg;
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Integer Approx_SweepApproximation::VDegree() const
|
||||
inline Standard_Integer Approx_SweepApproximation::VDegree() const
|
||||
{
|
||||
if (!done) {throw StdFail_NotDone(" Approx_SweepApproximation");}
|
||||
if (!done)
|
||||
{
|
||||
throw StdFail_NotDone(" Approx_SweepApproximation");
|
||||
}
|
||||
return vdeg;
|
||||
}
|
||||
|
||||
|
||||
inline const TColgp_Array2OfPnt& Approx_SweepApproximation::SurfPoles() const
|
||||
{
|
||||
if (!done) {throw StdFail_NotDone(" Approx_SweepApproximation");}
|
||||
if (!done)
|
||||
{
|
||||
throw StdFail_NotDone(" Approx_SweepApproximation");
|
||||
}
|
||||
return tabPoles->Array2();
|
||||
}
|
||||
|
||||
|
||||
inline const TColStd_Array2OfReal& Approx_SweepApproximation::SurfWeights() const
|
||||
{
|
||||
if (!done) {throw StdFail_NotDone(" Approx_SweepApproximation");}
|
||||
if (!done)
|
||||
{
|
||||
throw StdFail_NotDone(" Approx_SweepApproximation");
|
||||
}
|
||||
return tabWeights->Array2();
|
||||
}
|
||||
|
||||
|
||||
inline const TColStd_Array1OfReal& Approx_SweepApproximation::SurfUKnots() const
|
||||
{
|
||||
if (!done) {throw StdFail_NotDone(" Approx_SweepApproximation");}
|
||||
if (!done)
|
||||
{
|
||||
throw StdFail_NotDone(" Approx_SweepApproximation");
|
||||
}
|
||||
return tabUKnots->Array1();
|
||||
}
|
||||
|
||||
|
||||
inline const TColStd_Array1OfReal& Approx_SweepApproximation::SurfVKnots() const
|
||||
{
|
||||
if (!done) {throw StdFail_NotDone(" Approx_SweepApproximation");}
|
||||
if (!done)
|
||||
{
|
||||
throw StdFail_NotDone(" Approx_SweepApproximation");
|
||||
}
|
||||
return tabVKnots->Array1();
|
||||
}
|
||||
|
||||
|
||||
inline const TColStd_Array1OfInteger& Approx_SweepApproximation::SurfUMults() const
|
||||
{
|
||||
if (!done) {throw StdFail_NotDone(" Approx_SweepApproximation");}
|
||||
if (!done)
|
||||
{
|
||||
throw StdFail_NotDone(" Approx_SweepApproximation");
|
||||
}
|
||||
return tabUMults->Array1();
|
||||
}
|
||||
|
||||
|
||||
inline const TColStd_Array1OfInteger& Approx_SweepApproximation::SurfVMults() const
|
||||
{
|
||||
if (!done) {throw StdFail_NotDone(" Approx_SweepApproximation");}
|
||||
if (!done)
|
||||
{
|
||||
throw StdFail_NotDone(" Approx_SweepApproximation");
|
||||
}
|
||||
return tabVMults->Array1();
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Integer Approx_SweepApproximation::NbCurves2d() const
|
||||
inline Standard_Integer Approx_SweepApproximation::NbCurves2d() const
|
||||
{
|
||||
if (!done) {throw StdFail_NotDone(" Approx_SweepApproximation");}
|
||||
if (!done)
|
||||
{
|
||||
throw StdFail_NotDone(" Approx_SweepApproximation");
|
||||
}
|
||||
return Num2DSS;
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Integer Approx_SweepApproximation::Curves2dDegree() const
|
||||
inline Standard_Integer Approx_SweepApproximation::Curves2dDegree() const
|
||||
{
|
||||
if (!done) {throw StdFail_NotDone(" Approx_SweepApproximation");}
|
||||
if (seqPoles2d.Length() == 0) {throw Standard_DomainError();}
|
||||
if (!done)
|
||||
{
|
||||
throw StdFail_NotDone(" Approx_SweepApproximation");
|
||||
}
|
||||
if (seqPoles2d.Length() == 0)
|
||||
{
|
||||
throw Standard_DomainError();
|
||||
}
|
||||
return deg2d;
|
||||
}
|
||||
|
||||
|
||||
inline const TColgp_Array1OfPnt2d& Approx_SweepApproximation::Curve2dPoles(const Standard_Integer Index) const
|
||||
inline const TColgp_Array1OfPnt2d& Approx_SweepApproximation::Curve2dPoles(
|
||||
const Standard_Integer Index) const
|
||||
{
|
||||
if (!done) {throw StdFail_NotDone(" Approx_SweepApproximation");}
|
||||
if (seqPoles2d.Length() == 0) {throw Standard_DomainError();}
|
||||
if (!done)
|
||||
{
|
||||
throw StdFail_NotDone(" Approx_SweepApproximation");
|
||||
}
|
||||
if (seqPoles2d.Length() == 0)
|
||||
{
|
||||
throw Standard_DomainError();
|
||||
}
|
||||
return seqPoles2d(Index)->Array1();
|
||||
}
|
||||
|
||||
|
||||
inline const TColStd_Array1OfReal& Approx_SweepApproximation::Curves2dKnots() const
|
||||
{
|
||||
if (!done) {throw StdFail_NotDone(" Approx_SweepApproximation");}
|
||||
if (seqPoles2d.Length() == 0) {throw Standard_DomainError();}
|
||||
if (!done)
|
||||
{
|
||||
throw StdFail_NotDone(" Approx_SweepApproximation");
|
||||
}
|
||||
if (seqPoles2d.Length() == 0)
|
||||
{
|
||||
throw Standard_DomainError();
|
||||
}
|
||||
return tab2dKnots->Array1();
|
||||
}
|
||||
|
||||
|
||||
inline const TColStd_Array1OfInteger& Approx_SweepApproximation::Curves2dMults() const
|
||||
{
|
||||
if (!done) {throw StdFail_NotDone(" Approx_SweepApproximation");}
|
||||
if (seqPoles2d.Length() == 0) {throw Standard_DomainError();}
|
||||
if (!done)
|
||||
{
|
||||
throw StdFail_NotDone(" Approx_SweepApproximation");
|
||||
}
|
||||
if (seqPoles2d.Length() == 0)
|
||||
{
|
||||
throw Standard_DomainError();
|
||||
}
|
||||
return tab2dMults->Array1();
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
inline void Approx_SweepApproximation::TolReached(Standard_Real& Tol3d,Standard_Real& Tol2d) const
|
||||
{
|
||||
|
||||
|
@@ -14,44 +14,73 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Approx_SweepFunction.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Approx_SweepFunction,Standard_Transient)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Approx_SweepFunction, Standard_Transient)
|
||||
|
||||
// Standard_Boolean Approx_SweepFunction::D1(const Standard_Real Param,const Standard_Real First,const Standard_Real Last,TColgp_Array1OfPnt& Poles,TColgp_Array1OfVec& DPoles,TColgp_Array1OfPnt2d& Poles2d,TColgp_Array1OfVec2d& DPoles2d,TColStd_Array1OfReal& Weigths,TColStd_Array1OfReal& DWeigths)
|
||||
Standard_Boolean Approx_SweepFunction::D1(const Standard_Real ,const Standard_Real ,const Standard_Real ,TColgp_Array1OfPnt& ,TColgp_Array1OfVec& ,TColgp_Array1OfPnt2d& ,TColgp_Array1OfVec2d& ,TColStd_Array1OfReal& ,TColStd_Array1OfReal& )
|
||||
// Standard_Boolean Approx_SweepFunction::D1(const Standard_Real Param,const Standard_Real
|
||||
// First,const Standard_Real Last,TColgp_Array1OfPnt& Poles,TColgp_Array1OfVec&
|
||||
// DPoles,TColgp_Array1OfPnt2d& Poles2d,TColgp_Array1OfVec2d& DPoles2d,TColStd_Array1OfReal&
|
||||
// Weigths,TColStd_Array1OfReal& DWeigths)
|
||||
Standard_Boolean Approx_SweepFunction::D1(const Standard_Real,
|
||||
const Standard_Real,
|
||||
const Standard_Real,
|
||||
TColgp_Array1OfPnt&,
|
||||
TColgp_Array1OfVec&,
|
||||
TColgp_Array1OfPnt2d&,
|
||||
TColgp_Array1OfVec2d&,
|
||||
TColStd_Array1OfReal&,
|
||||
TColStd_Array1OfReal&)
|
||||
{
|
||||
throw Standard_NotImplemented("Approx_SweepFunction::D1");
|
||||
throw Standard_NotImplemented("Approx_SweepFunction::D1");
|
||||
}
|
||||
|
||||
// Standard_Boolean Approx_SweepFunction::D2(const Standard_Real Param,const Standard_Real First,const Standard_Real Last,TColgp_Array1OfPnt& Poles,TColgp_Array1OfVec& DPoles,TColgp_Array1OfVec& D2Poles,TColgp_Array1OfPnt2d& Poles2d,TColgp_Array1OfVec2d& DPoles2d,TColgp_Array1OfVec2d& D2Poles2d,TColStd_Array1OfReal& Weigths,TColStd_Array1OfReal& DWeigths,TColStd_Array1OfReal& D2Weigths)
|
||||
Standard_Boolean Approx_SweepFunction::D2(const Standard_Real ,const Standard_Real ,const Standard_Real ,TColgp_Array1OfPnt& ,TColgp_Array1OfVec& ,TColgp_Array1OfVec& ,TColgp_Array1OfPnt2d& ,TColgp_Array1OfVec2d& ,TColgp_Array1OfVec2d& ,TColStd_Array1OfReal& ,TColStd_Array1OfReal& ,TColStd_Array1OfReal& )
|
||||
// Standard_Boolean Approx_SweepFunction::D2(const Standard_Real Param,const Standard_Real
|
||||
// First,const Standard_Real Last,TColgp_Array1OfPnt& Poles,TColgp_Array1OfVec&
|
||||
// DPoles,TColgp_Array1OfVec& D2Poles,TColgp_Array1OfPnt2d& Poles2d,TColgp_Array1OfVec2d&
|
||||
// DPoles2d,TColgp_Array1OfVec2d& D2Poles2d,TColStd_Array1OfReal& Weigths,TColStd_Array1OfReal&
|
||||
// DWeigths,TColStd_Array1OfReal& D2Weigths)
|
||||
Standard_Boolean Approx_SweepFunction::D2(const Standard_Real,
|
||||
const Standard_Real,
|
||||
const Standard_Real,
|
||||
TColgp_Array1OfPnt&,
|
||||
TColgp_Array1OfVec&,
|
||||
TColgp_Array1OfVec&,
|
||||
TColgp_Array1OfPnt2d&,
|
||||
TColgp_Array1OfVec2d&,
|
||||
TColgp_Array1OfVec2d&,
|
||||
TColStd_Array1OfReal&,
|
||||
TColStd_Array1OfReal&,
|
||||
TColStd_Array1OfReal&)
|
||||
{
|
||||
throw Standard_NotImplemented("Approx_SweepFunction::D2");
|
||||
throw Standard_NotImplemented("Approx_SweepFunction::D2");
|
||||
}
|
||||
|
||||
// void Approx_SweepFunction::Resolution(const Standard_Integer Index,const Standard_Real Tol,Standard_Real& TolU,Standard_Real& TolV) const
|
||||
void Approx_SweepFunction::Resolution(const Standard_Integer ,const Standard_Real ,Standard_Real& ,Standard_Real& ) const
|
||||
// void Approx_SweepFunction::Resolution(const Standard_Integer Index,const Standard_Real
|
||||
// Tol,Standard_Real& TolU,Standard_Real& TolV) const
|
||||
void Approx_SweepFunction::Resolution(const Standard_Integer,
|
||||
const Standard_Real,
|
||||
Standard_Real&,
|
||||
Standard_Real&) const
|
||||
{
|
||||
throw Standard_NotImplemented("Approx_SweepFunction::Resolution");
|
||||
throw Standard_NotImplemented("Approx_SweepFunction::Resolution");
|
||||
}
|
||||
|
||||
gp_Pnt Approx_SweepFunction::BarycentreOfSurf() const
|
||||
gp_Pnt Approx_SweepFunction::BarycentreOfSurf() const
|
||||
{
|
||||
throw Standard_NotImplemented("Approx_SweepFunction::BarycentreOfSurf");
|
||||
throw Standard_NotImplemented("Approx_SweepFunction::BarycentreOfSurf");
|
||||
}
|
||||
|
||||
Standard_Real Approx_SweepFunction::MaximalSection() const
|
||||
Standard_Real Approx_SweepFunction::MaximalSection() const
|
||||
{
|
||||
throw Standard_NotImplemented("Approx_SweepFunction::MaximalSection()");
|
||||
}
|
||||
|
||||
// void Approx_SweepFunction::GetMinimalWeight(TColStd_Array1OfReal& Weigths) const
|
||||
void Approx_SweepFunction::GetMinimalWeight(TColStd_Array1OfReal& ) const
|
||||
void Approx_SweepFunction::GetMinimalWeight(TColStd_Array1OfReal&) const
|
||||
{
|
||||
throw Standard_NotImplemented("Approx_SweepFunction::GetMinimalWeight");
|
||||
throw Standard_NotImplemented("Approx_SweepFunction::GetMinimalWeight");
|
||||
}
|
||||
|
@@ -19,19 +19,18 @@
|
||||
|
||||
#include <Standard.hxx>
|
||||
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TColgp_Array1OfVec.hxx>
|
||||
#include <TColgp_Array1OfVec2d.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
class gp_Pnt;
|
||||
|
||||
|
||||
class Approx_SweepFunction;
|
||||
DEFINE_STANDARD_HANDLE(Approx_SweepFunction, Standard_Transient)
|
||||
|
||||
@@ -41,106 +40,120 @@ class Approx_SweepFunction : public Standard_Transient
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
//! compute the section for v = param
|
||||
Standard_EXPORT virtual Standard_Boolean D0 (const Standard_Real Param, const Standard_Real First, const Standard_Real Last, TColgp_Array1OfPnt& Poles, TColgp_Array1OfPnt2d& Poles2d, TColStd_Array1OfReal& Weigths) = 0;
|
||||
|
||||
Standard_EXPORT virtual Standard_Boolean D0(const Standard_Real Param,
|
||||
const Standard_Real First,
|
||||
const Standard_Real Last,
|
||||
TColgp_Array1OfPnt& Poles,
|
||||
TColgp_Array1OfPnt2d& Poles2d,
|
||||
TColStd_Array1OfReal& Weigths) = 0;
|
||||
|
||||
//! compute the first derivative in v direction of the
|
||||
//! section for v = param
|
||||
//! Warning : It used only for C1 or C2 approximation
|
||||
Standard_EXPORT virtual Standard_Boolean D1 (const Standard_Real Param, const Standard_Real First, const Standard_Real Last, TColgp_Array1OfPnt& Poles, TColgp_Array1OfVec& DPoles, TColgp_Array1OfPnt2d& Poles2d, TColgp_Array1OfVec2d& DPoles2d, TColStd_Array1OfReal& Weigths, TColStd_Array1OfReal& DWeigths);
|
||||
|
||||
Standard_EXPORT virtual Standard_Boolean D1(const Standard_Real Param,
|
||||
const Standard_Real First,
|
||||
const Standard_Real Last,
|
||||
TColgp_Array1OfPnt& Poles,
|
||||
TColgp_Array1OfVec& DPoles,
|
||||
TColgp_Array1OfPnt2d& Poles2d,
|
||||
TColgp_Array1OfVec2d& DPoles2d,
|
||||
TColStd_Array1OfReal& Weigths,
|
||||
TColStd_Array1OfReal& DWeigths);
|
||||
|
||||
//! compute the second derivative in v direction of the
|
||||
//! section for v = param
|
||||
//! Warning : It used only for C2 approximation
|
||||
Standard_EXPORT virtual Standard_Boolean D2 (const Standard_Real Param, const Standard_Real First, const Standard_Real Last, TColgp_Array1OfPnt& Poles, TColgp_Array1OfVec& DPoles, TColgp_Array1OfVec& D2Poles, TColgp_Array1OfPnt2d& Poles2d, TColgp_Array1OfVec2d& DPoles2d, TColgp_Array1OfVec2d& D2Poles2d, TColStd_Array1OfReal& Weigths, TColStd_Array1OfReal& DWeigths, TColStd_Array1OfReal& D2Weigths);
|
||||
|
||||
Standard_EXPORT virtual Standard_Boolean D2(const Standard_Real Param,
|
||||
const Standard_Real First,
|
||||
const Standard_Real Last,
|
||||
TColgp_Array1OfPnt& Poles,
|
||||
TColgp_Array1OfVec& DPoles,
|
||||
TColgp_Array1OfVec& D2Poles,
|
||||
TColgp_Array1OfPnt2d& Poles2d,
|
||||
TColgp_Array1OfVec2d& DPoles2d,
|
||||
TColgp_Array1OfVec2d& D2Poles2d,
|
||||
TColStd_Array1OfReal& Weigths,
|
||||
TColStd_Array1OfReal& DWeigths,
|
||||
TColStd_Array1OfReal& D2Weigths);
|
||||
|
||||
//! get the number of 2d curves to approximate.
|
||||
Standard_EXPORT virtual Standard_Integer Nb2dCurves() const = 0;
|
||||
|
||||
|
||||
//! get the format of an section
|
||||
Standard_EXPORT virtual void SectionShape (Standard_Integer& NbPoles, Standard_Integer& NbKnots, Standard_Integer& Degree) const = 0;
|
||||
|
||||
Standard_EXPORT virtual void SectionShape(Standard_Integer& NbPoles,
|
||||
Standard_Integer& NbKnots,
|
||||
Standard_Integer& Degree) const = 0;
|
||||
|
||||
//! get the Knots of the section
|
||||
Standard_EXPORT virtual void Knots (TColStd_Array1OfReal& TKnots) const = 0;
|
||||
|
||||
Standard_EXPORT virtual void Knots(TColStd_Array1OfReal& TKnots) const = 0;
|
||||
|
||||
//! get the Multplicities of the section
|
||||
Standard_EXPORT virtual void Mults (TColStd_Array1OfInteger& TMults) const = 0;
|
||||
|
||||
Standard_EXPORT virtual void Mults(TColStd_Array1OfInteger& TMults) const = 0;
|
||||
|
||||
//! Returns if the sections are rational or not
|
||||
Standard_EXPORT virtual Standard_Boolean IsRational() const = 0;
|
||||
|
||||
|
||||
//! Returns the number of intervals for continuity
|
||||
//! <S>.
|
||||
//! May be one if Continuity(me) >= <S>
|
||||
Standard_EXPORT virtual Standard_Integer NbIntervals (const GeomAbs_Shape S) const = 0;
|
||||
|
||||
Standard_EXPORT virtual Standard_Integer NbIntervals(const GeomAbs_Shape S) const = 0;
|
||||
|
||||
//! 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 virtual void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const = 0;
|
||||
|
||||
Standard_EXPORT virtual void Intervals(TColStd_Array1OfReal& T, const GeomAbs_Shape S) const = 0;
|
||||
|
||||
//! Sets the bounds of the parametric interval on
|
||||
//! the fonction
|
||||
//! This determines the derivatives in these values if the
|
||||
//! function is not Cn.
|
||||
Standard_EXPORT virtual void SetInterval (const Standard_Real First, const Standard_Real Last) = 0;
|
||||
|
||||
Standard_EXPORT virtual void SetInterval(const Standard_Real First, const Standard_Real Last) = 0;
|
||||
|
||||
//! Returns the resolutions in the sub-space 2d <Index>
|
||||
//! This information is usfull to find an good tolerance in
|
||||
//! 2d approximation.
|
||||
Standard_EXPORT virtual void Resolution (const Standard_Integer Index, const Standard_Real Tol, Standard_Real& TolU, Standard_Real& TolV) const;
|
||||
|
||||
Standard_EXPORT virtual void Resolution(const Standard_Integer Index,
|
||||
const Standard_Real Tol,
|
||||
Standard_Real& TolU,
|
||||
Standard_Real& TolV) const;
|
||||
|
||||
//! Returns the tolerance to reach in approximation
|
||||
//! to satisfy.
|
||||
//! BoundTol error at the Boundary
|
||||
//! AngleTol tangent error at the Boundary (in radian)
|
||||
//! SurfTol error inside the surface.
|
||||
Standard_EXPORT virtual void GetTolerance (const Standard_Real BoundTol, const Standard_Real SurfTol, const Standard_Real AngleTol, TColStd_Array1OfReal& Tol3d) const = 0;
|
||||
|
||||
Standard_EXPORT virtual void GetTolerance(const Standard_Real BoundTol,
|
||||
const Standard_Real SurfTol,
|
||||
const Standard_Real AngleTol,
|
||||
TColStd_Array1OfReal& Tol3d) const = 0;
|
||||
|
||||
//! Is useful, if (me) have to run numerical algorithm to perform D0, D1 or D2
|
||||
Standard_EXPORT virtual void SetTolerance (const Standard_Real Tol3d, const Standard_Real Tol2d) = 0;
|
||||
|
||||
Standard_EXPORT virtual void SetTolerance(const Standard_Real Tol3d,
|
||||
const Standard_Real Tol2d) = 0;
|
||||
|
||||
//! Get the barycentre of Surface.
|
||||
//! An very poor estimation is sufficient.
|
||||
//! This information is useful to perform well conditioned rational approximation.
|
||||
//! Warning: Used only if <me> IsRational
|
||||
Standard_EXPORT virtual gp_Pnt BarycentreOfSurf() const;
|
||||
|
||||
|
||||
//! Returns the length of the greater section.
|
||||
//! Thisinformation is useful to G1's control.
|
||||
//! Warning: With an little value, approximation can be slower.
|
||||
Standard_EXPORT virtual Standard_Real MaximalSection() const;
|
||||
|
||||
|
||||
//! Compute the minimal value of weight for each poles in all sections.
|
||||
//! This information is useful to control error in rational approximation.
|
||||
//! Warning: Used only if <me> IsRational
|
||||
Standard_EXPORT virtual void GetMinimalWeight (TColStd_Array1OfReal& Weigths) const;
|
||||
Standard_EXPORT virtual void GetMinimalWeight(TColStd_Array1OfReal& Weigths) const;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Approx_SweepFunction,Standard_Transient)
|
||||
DEFINE_STANDARD_RTTIEXT(Approx_SweepFunction, Standard_Transient)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _Approx_SweepFunction_HeaderFile
|
||||
|
Reference in New Issue
Block a user