mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-06-02 09:46:43 +08:00
Coding - Applying formatting to gxx files (#730)
- Updated GitHub Action for ASCII Check and Clang-Format - Formatted all gxx files in the src directory
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -164,17 +164,17 @@ void ApproxInt_Approx::Parameters(const ApproxInt_TheMultiLine& Line,
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
ApproxInt_Approx::ApproxInt_Approx() :
|
||||
myComputeLine(4, 8, 0.001, 0.001, 5),
|
||||
myComputeLineBezier(4, 8, 0.001, 0.001, 5),
|
||||
myWithTangency(Standard_True),
|
||||
myTol3d(0.001),
|
||||
myTol2d(0.001),
|
||||
myDegMin(4),
|
||||
myDegMax(8),
|
||||
myNbIterMax(5),
|
||||
myTolReached3d(0.0),
|
||||
myTolReached2d(0.0)
|
||||
ApproxInt_Approx::ApproxInt_Approx()
|
||||
: myComputeLine(4, 8, 0.001, 0.001, 5),
|
||||
myComputeLineBezier(4, 8, 0.001, 0.001, 5),
|
||||
myWithTangency(Standard_True),
|
||||
myTol3d(0.001),
|
||||
myTol2d(0.001),
|
||||
myDegMin(4),
|
||||
myDegMax(8),
|
||||
myNbIterMax(5),
|
||||
myTolReached3d(0.0),
|
||||
myTolReached2d(0.0)
|
||||
{
|
||||
myComputeLine.SetContinuity(2);
|
||||
// myComputeLineBezier.SetContinuity(2);
|
||||
@@ -240,9 +240,9 @@ void ApproxInt_Approx::Perform(const ThePSurface& Surf1,
|
||||
const GeomAbs_SurfaceType typeS2 = ThePSurfaceTool::GetType(Surf2);
|
||||
|
||||
const Standard_Boolean isQuadric =
|
||||
((typeS1 == GeomAbs_Plane) || (typeS1 == GeomAbs_Cylinder) || (typeS1 == GeomAbs_Sphere) ||
|
||||
(typeS1 == GeomAbs_Cone) || (typeS2 == GeomAbs_Plane) || (typeS2 == GeomAbs_Cylinder) ||
|
||||
(typeS2 == GeomAbs_Sphere) || (typeS2 == GeomAbs_Cone));
|
||||
((typeS1 == GeomAbs_Plane) || (typeS1 == GeomAbs_Cylinder) || (typeS1 == GeomAbs_Sphere)
|
||||
|| (typeS1 == GeomAbs_Cone) || (typeS2 == GeomAbs_Plane) || (typeS2 == GeomAbs_Cylinder)
|
||||
|| (typeS2 == GeomAbs_Sphere) || (typeS2 == GeomAbs_Cone));
|
||||
|
||||
if (isQuadric)
|
||||
{
|
||||
@@ -551,8 +551,8 @@ void ApproxInt_Approx::buildKnots(const Handle(TheWLine)& theline,
|
||||
const ApproxInt_TheMultiLine aTestLine(theline,
|
||||
thePtrSVSurf,
|
||||
((myData.ApproxXYZ) ? 1 : 0),
|
||||
((myData.ApproxU1V1) ? 1 : 0) +
|
||||
((myData.ApproxU2V2) ? 1 : 0),
|
||||
((myData.ApproxU1V1) ? 1 : 0)
|
||||
+ ((myData.ApproxU2V2) ? 1 : 0),
|
||||
myData.ApproxU1V1,
|
||||
myData.ApproxU2V2,
|
||||
myData.Xo,
|
||||
@@ -642,8 +642,8 @@ void ApproxInt_Approx::buildCurve(const Handle(TheWLine)& theline,
|
||||
ApproxInt_TheMultiLine myMultiLine(theline,
|
||||
thePtrSVSurf,
|
||||
((myData.ApproxXYZ) ? 1 : 0),
|
||||
((myData.ApproxU1V1) ? 1 : 0) +
|
||||
((myData.ApproxU2V2) ? 1 : 0),
|
||||
((myData.ApproxU1V1) ? 1 : 0)
|
||||
+ ((myData.ApproxU2V2) ? 1 : 0),
|
||||
myData.ApproxU1V1,
|
||||
myData.ApproxU2V2,
|
||||
myData.Xo,
|
||||
|
||||
@@ -323,13 +323,13 @@ static Standard_Boolean NonSingularProcessing(const gp_Vec& theDU,
|
||||
//=================================================================================================
|
||||
|
||||
ApproxInt_ImpPrmSvSurfaces::ApproxInt_ImpPrmSvSurfaces(const TheISurface& ISurf,
|
||||
const ThePSurface& PSurf) :
|
||||
MyIsTangent(Standard_False),
|
||||
MyHasBeenComputed(Standard_False),
|
||||
MyIsTangentbis(Standard_False),
|
||||
MyHasBeenComputedbis(Standard_False),
|
||||
MyImplicitFirst(Standard_True),
|
||||
MyZerImpFunc(PSurf, ISurf)
|
||||
const ThePSurface& PSurf)
|
||||
: MyIsTangent(Standard_False),
|
||||
MyHasBeenComputed(Standard_False),
|
||||
MyIsTangentbis(Standard_False),
|
||||
MyHasBeenComputedbis(Standard_False),
|
||||
MyImplicitFirst(Standard_True),
|
||||
MyZerImpFunc(PSurf, ISurf)
|
||||
{
|
||||
SetUseSolver(Standard_True);
|
||||
}
|
||||
@@ -337,13 +337,13 @@ ApproxInt_ImpPrmSvSurfaces::ApproxInt_ImpPrmSvSurfaces(const TheISurface& ISurf,
|
||||
//=================================================================================================
|
||||
|
||||
ApproxInt_ImpPrmSvSurfaces::ApproxInt_ImpPrmSvSurfaces(const ThePSurface& PSurf,
|
||||
const TheISurface& ISurf) :
|
||||
MyIsTangent(Standard_False),
|
||||
MyHasBeenComputed(Standard_False),
|
||||
MyIsTangentbis(Standard_False),
|
||||
MyHasBeenComputedbis(Standard_False),
|
||||
MyImplicitFirst(Standard_False),
|
||||
MyZerImpFunc(PSurf, ISurf)
|
||||
const TheISurface& ISurf)
|
||||
: MyIsTangent(Standard_False),
|
||||
MyHasBeenComputed(Standard_False),
|
||||
MyIsTangentbis(Standard_False),
|
||||
MyHasBeenComputedbis(Standard_False),
|
||||
MyImplicitFirst(Standard_False),
|
||||
MyZerImpFunc(PSurf, ISurf)
|
||||
{
|
||||
SetUseSolver(Standard_True);
|
||||
}
|
||||
@@ -458,8 +458,8 @@ Standard_Boolean ApproxInt_ImpPrmSvSurfaces::Compute(Standard_Real& u1,
|
||||
|
||||
if (MyHasBeenComputed)
|
||||
{
|
||||
if ((MyParOnS1.X() == u1) && (MyParOnS1.Y() == v1) && (MyParOnS2.X() == u2) &&
|
||||
(MyParOnS2.Y() == v2))
|
||||
if ((MyParOnS1.X() == u1) && (MyParOnS1.Y() == v1) && (MyParOnS2.X() == u2)
|
||||
&& (MyParOnS2.Y() == v2))
|
||||
{
|
||||
return (MyIsTangent);
|
||||
}
|
||||
@@ -478,8 +478,8 @@ Standard_Boolean ApproxInt_ImpPrmSvSurfaces::Compute(Standard_Real& u1,
|
||||
|
||||
if (MyHasBeenComputedbis)
|
||||
{
|
||||
if ((MyParOnS1bis.X() == u1) && (MyParOnS1bis.Y() == v1) && (MyParOnS2bis.X() == u2) &&
|
||||
(MyParOnS2bis.Y() == v2))
|
||||
if ((MyParOnS1bis.X() == u1) && (MyParOnS1bis.Y() == v1) && (MyParOnS2bis.X() == u2)
|
||||
&& (MyParOnS2bis.Y() == v2))
|
||||
{
|
||||
|
||||
gp_Vec TV(MyTg);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -16,73 +16,78 @@
|
||||
|
||||
#define TOLTANGENCY 0.0000000001
|
||||
|
||||
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <math_FunctionSetRoot.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
#define Debug(expr) std::cout<<" expr :"<<expr;
|
||||
#define Debug(expr) std::cout << " expr :" << expr;
|
||||
#define MySurf1 MyIntersectionOn2S.Function().AuxillarSurface1()
|
||||
#define MySurf2 MyIntersectionOn2S.Function().AuxillarSurface2()
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
ApproxInt_PrmPrmSvSurfaces::ApproxInt_PrmPrmSvSurfaces( const ThePSurface& Surf1
|
||||
,const ThePSurface& Surf2):
|
||||
MyIsTangent(Standard_False),
|
||||
MyHasBeenComputed(Standard_False),
|
||||
MyIsTangentbis(Standard_False),
|
||||
MyHasBeenComputedbis(Standard_False),
|
||||
MyIntersectionOn2S(Surf1,Surf2,TOLTANGENCY)
|
||||
{
|
||||
ApproxInt_PrmPrmSvSurfaces::ApproxInt_PrmPrmSvSurfaces(const ThePSurface& Surf1,
|
||||
const ThePSurface& Surf2)
|
||||
: MyIsTangent(Standard_False),
|
||||
MyHasBeenComputed(Standard_False),
|
||||
MyIsTangentbis(Standard_False),
|
||||
MyHasBeenComputedbis(Standard_False),
|
||||
MyIntersectionOn2S(Surf1, Surf2, TOLTANGENCY)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose : Computes point on curve, 3D and 2D-tangents of a curve and
|
||||
// function : Compute
|
||||
// purpose : Computes point on curve, 3D and 2D-tangents of a curve and
|
||||
// parameters on the surfaces.
|
||||
//=======================================================================
|
||||
Standard_Boolean ApproxInt_PrmPrmSvSurfaces::Compute( Standard_Real& u1
|
||||
,Standard_Real& v1
|
||||
,Standard_Real& u2
|
||||
,Standard_Real& v2
|
||||
,gp_Pnt& P
|
||||
,gp_Vec& Tg
|
||||
,gp_Vec2d& Tguv1
|
||||
,gp_Vec2d& Tguv2) {
|
||||
|
||||
Standard_Real tu1=u1;
|
||||
Standard_Real tu2=u2;
|
||||
Standard_Real tv1=v1;
|
||||
Standard_Real tv2=v2;
|
||||
|
||||
if(MyHasBeenComputed) {
|
||||
if( (MyParOnS1.X()==u1)&&(MyParOnS1.Y()==v1)
|
||||
&&(MyParOnS2.X()==u2)&&(MyParOnS2.Y()==v2)) {
|
||||
return(MyIsTangent);
|
||||
Standard_Boolean ApproxInt_PrmPrmSvSurfaces::Compute(Standard_Real& u1,
|
||||
Standard_Real& v1,
|
||||
Standard_Real& u2,
|
||||
Standard_Real& v2,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& Tg,
|
||||
gp_Vec2d& Tguv1,
|
||||
gp_Vec2d& Tguv2)
|
||||
{
|
||||
|
||||
Standard_Real tu1 = u1;
|
||||
Standard_Real tu2 = u2;
|
||||
Standard_Real tv1 = v1;
|
||||
Standard_Real tv2 = v2;
|
||||
|
||||
if (MyHasBeenComputed)
|
||||
{
|
||||
if ((MyParOnS1.X() == u1) && (MyParOnS1.Y() == v1) && (MyParOnS2.X() == u2)
|
||||
&& (MyParOnS2.Y() == v2))
|
||||
{
|
||||
return (MyIsTangent);
|
||||
}
|
||||
else if(MyHasBeenComputedbis == Standard_False) {
|
||||
MyTgbis = MyTg;
|
||||
MyTguv1bis = MyTguv1;
|
||||
MyTguv2bis = MyTguv2;
|
||||
MyPntbis = MyPnt;
|
||||
MyParOnS1bis = MyParOnS1;
|
||||
MyParOnS2bis = MyParOnS2;
|
||||
MyIsTangentbis = MyIsTangent;
|
||||
MyHasBeenComputedbis = MyHasBeenComputed;
|
||||
else if (MyHasBeenComputedbis == Standard_False)
|
||||
{
|
||||
MyTgbis = MyTg;
|
||||
MyTguv1bis = MyTguv1;
|
||||
MyTguv2bis = MyTguv2;
|
||||
MyPntbis = MyPnt;
|
||||
MyParOnS1bis = MyParOnS1;
|
||||
MyParOnS2bis = MyParOnS2;
|
||||
MyIsTangentbis = MyIsTangent;
|
||||
MyHasBeenComputedbis = MyHasBeenComputed;
|
||||
}
|
||||
}
|
||||
if(MyHasBeenComputedbis) {
|
||||
if( (MyParOnS1bis.X()==u1)&&(MyParOnS1bis.Y()==v1)
|
||||
&&(MyParOnS2bis.X()==u2)&&(MyParOnS2bis.Y()==v2)) {
|
||||
if (MyHasBeenComputedbis)
|
||||
{
|
||||
if ((MyParOnS1bis.X() == u1) && (MyParOnS1bis.Y() == v1) && (MyParOnS2bis.X() == u2)
|
||||
&& (MyParOnS2bis.Y() == v2))
|
||||
{
|
||||
|
||||
gp_Vec TV(MyTg);
|
||||
gp_Vec2d TV1(MyTguv1);
|
||||
gp_Vec2d TV2(MyTguv2);
|
||||
gp_Pnt TP(MyPnt);
|
||||
gp_Pnt2d TP1(MyParOnS1);
|
||||
gp_Pnt2d TP2(MyParOnS2);
|
||||
Standard_Boolean TB=MyIsTangent;
|
||||
gp_Vec TV(MyTg);
|
||||
gp_Vec2d TV1(MyTguv1);
|
||||
gp_Vec2d TV2(MyTguv2);
|
||||
gp_Pnt TP(MyPnt);
|
||||
gp_Pnt2d TP1(MyParOnS1);
|
||||
gp_Pnt2d TP2(MyParOnS2);
|
||||
Standard_Boolean TB = MyIsTangent;
|
||||
|
||||
MyTg = MyTgbis;
|
||||
MyTguv1 = MyTguv1bis;
|
||||
@@ -92,106 +97,113 @@ Standard_Boolean ApproxInt_PrmPrmSvSurfaces::Compute( Standard_Real& u1
|
||||
MyParOnS2 = MyParOnS2bis;
|
||||
MyIsTangent = MyIsTangentbis;
|
||||
|
||||
MyTgbis = TV;
|
||||
MyTguv1bis = TV1;
|
||||
MyTguv2bis = TV2;
|
||||
MyPntbis = TP;
|
||||
MyParOnS1bis = TP1;
|
||||
MyParOnS2bis = TP2;
|
||||
MyIsTangentbis = TB;
|
||||
MyTgbis = TV;
|
||||
MyTguv1bis = TV1;
|
||||
MyTguv2bis = TV2;
|
||||
MyPntbis = TP;
|
||||
MyParOnS1bis = TP1;
|
||||
MyParOnS2bis = TP2;
|
||||
MyIsTangentbis = TB;
|
||||
|
||||
return(MyIsTangent);
|
||||
return (MyIsTangent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MyIsTangent = Standard_True;
|
||||
|
||||
Standard_Real aParam[4];//stack vs heap allocation
|
||||
TColStd_Array1OfReal Param (aParam[0],1,4);
|
||||
Param(1) = u1; Param(2) = v1;
|
||||
Param(3) = u2; Param(4) = v2;
|
||||
math_FunctionSetRoot Rsnld(MyIntersectionOn2S.Function());
|
||||
MyIntersectionOn2S.Perform(Param,Rsnld);
|
||||
if (!MyIntersectionOn2S.IsDone()) {
|
||||
Standard_Real aParam[4]; // stack vs heap allocation
|
||||
TColStd_Array1OfReal Param(aParam[0], 1, 4);
|
||||
Param(1) = u1;
|
||||
Param(2) = v1;
|
||||
Param(3) = u2;
|
||||
Param(4) = v2;
|
||||
math_FunctionSetRoot Rsnld(MyIntersectionOn2S.Function());
|
||||
MyIntersectionOn2S.Perform(Param, Rsnld);
|
||||
if (!MyIntersectionOn2S.IsDone())
|
||||
{
|
||||
MyHasBeenComputed = MyHasBeenComputedbis = Standard_False;
|
||||
return(Standard_False);
|
||||
return (Standard_False);
|
||||
}
|
||||
if (MyIntersectionOn2S.IsEmpty()) {
|
||||
MyIsTangent=Standard_False;
|
||||
//cout<<"\n----- Parametree Parametree : IsEmpty ds Compute "<<endl;
|
||||
//Debug(u1); Debug(u2); Debug(v1); Debug(v2); cout<<endl;
|
||||
if (MyIntersectionOn2S.IsEmpty())
|
||||
{
|
||||
MyIsTangent = Standard_False;
|
||||
// cout<<"\n----- Parametree Parametree : IsEmpty ds Compute "<<endl;
|
||||
// Debug(u1); Debug(u2); Debug(v1); Debug(v2); cout<<endl;
|
||||
MyHasBeenComputed = MyHasBeenComputedbis = Standard_False;
|
||||
return(Standard_False);
|
||||
return (Standard_False);
|
||||
}
|
||||
MyHasBeenComputed = Standard_True;
|
||||
MyPnt = P = MyIntersectionOn2S.Point().Value();
|
||||
|
||||
MyIntersectionOn2S.Point().Parameters(u1,v1,u2,v2);
|
||||
MyParOnS1.SetCoord(tu1,tv1);
|
||||
MyParOnS2.SetCoord(tu2,tv2);
|
||||
|
||||
if(MyIntersectionOn2S.IsTangent()) {
|
||||
MyIsTangent=Standard_False;
|
||||
|
||||
MyIntersectionOn2S.Point().Parameters(u1, v1, u2, v2);
|
||||
MyParOnS1.SetCoord(tu1, tv1);
|
||||
MyParOnS2.SetCoord(tu2, tv2);
|
||||
|
||||
if (MyIntersectionOn2S.IsTangent())
|
||||
{
|
||||
MyIsTangent = Standard_False;
|
||||
MyHasBeenComputed = MyHasBeenComputedbis = Standard_False;
|
||||
return(Standard_False);
|
||||
return (Standard_False);
|
||||
}
|
||||
MyTg = Tg = MyIntersectionOn2S.Direction();
|
||||
MyTg = Tg = MyIntersectionOn2S.Direction();
|
||||
MyTguv1 = Tguv1 = MyIntersectionOn2S.DirectionOnS1();
|
||||
MyTguv2 = Tguv2 = MyIntersectionOn2S.DirectionOnS2();
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//-- Si ( Tg ) TU et TV sont normes
|
||||
//--
|
||||
//-- Si ( Tg ) TU et TV sont normes
|
||||
//--
|
||||
//-- On a Tg = DeltaU * TU + DeltaV * TV
|
||||
//--
|
||||
//--
|
||||
//-- soit : Tg.TU = DeltaU TU.TU + DeltaV TU.TV
|
||||
//-- Tg.TV = DeltaU TV.TU + DeltaV TV.TV
|
||||
//--
|
||||
//-- Donc :
|
||||
//-- Tg.TV = DeltaU TV.TU + DeltaV TV.TV
|
||||
//--
|
||||
//-- Donc :
|
||||
//--
|
||||
//-- Tg.TU TV.TV - Tg.TV * TU.TV
|
||||
//-- DeltaU = -------------------------------
|
||||
//-- TU.TU TV.TV - (TU.TV)**2
|
||||
//--
|
||||
//--
|
||||
//-- Tg.TV TU.TU - Tg.TU * TU.TV
|
||||
//-- DeltaV = -------------------------------
|
||||
//-- TU.TU TV.TV - (TU.TV)**2
|
||||
//--
|
||||
//--
|
||||
|
||||
Tg.Normalize(); MyTg = Tg;
|
||||
Tg.Normalize();
|
||||
MyTg = Tg;
|
||||
|
||||
Standard_Real DeltaU,DeltaV;
|
||||
gp_Vec TU,TV;
|
||||
gp_Pnt Pbid;
|
||||
Standard_Real TUTV,TgTU,TgTV,TUTU,TVTV,DIS;
|
||||
Standard_Real DeltaU, DeltaV;
|
||||
gp_Vec TU, TV;
|
||||
gp_Pnt Pbid;
|
||||
Standard_Real TUTV, TgTU, TgTV, TUTU, TVTV, DIS;
|
||||
//------------------------------------------------------------
|
||||
//-- Calcul de Tguv1
|
||||
//--
|
||||
ThePSurfaceTool::D1(MySurf1,u1,v1,Pbid,TU,TV);
|
||||
|
||||
ThePSurfaceTool::D1(MySurf1, u1, v1, Pbid, TU, TV);
|
||||
|
||||
TUTU = TU.Dot(TU);
|
||||
TVTV = TV.Dot(TV);
|
||||
TUTV = TU.Dot(TV);
|
||||
TgTU = Tg.Dot(TU);
|
||||
TgTV = Tg.Dot(TV);
|
||||
DIS = TUTU * TVTV - TUTV * TUTV;
|
||||
if(fabs(DIS)<Precision::Angular()) {
|
||||
MyIsTangent=Standard_False;
|
||||
if (fabs(DIS) < Precision::Angular())
|
||||
{
|
||||
MyIsTangent = Standard_False;
|
||||
MyHasBeenComputed = MyHasBeenComputedbis = Standard_False;
|
||||
return(Standard_False);
|
||||
return (Standard_False);
|
||||
}
|
||||
|
||||
DeltaU = (TgTU * TVTV - TgTV * TUTV ) / DIS ;
|
||||
DeltaV = (TgTV * TUTU - TgTU * TUTV ) / DIS ;
|
||||
|
||||
Tguv1.SetCoord(DeltaU,DeltaV); MyTguv1 = Tguv1;
|
||||
DeltaU = (TgTU * TVTV - TgTV * TUTV) / DIS;
|
||||
DeltaV = (TgTV * TUTU - TgTU * TUTV) / DIS;
|
||||
|
||||
Tguv1.SetCoord(DeltaU, DeltaV);
|
||||
MyTguv1 = Tguv1;
|
||||
|
||||
//------------------------------------------------------------
|
||||
//-- Calcul de Tguv2
|
||||
//--
|
||||
ThePSurfaceTool::D1(MySurf2,u2,v2,Pbid,TU,TV);
|
||||
//--
|
||||
ThePSurfaceTool::D1(MySurf2, u2, v2, Pbid, TU, TV);
|
||||
|
||||
TUTU = TU.Dot(TU);
|
||||
TVTV = TV.Dot(TV);
|
||||
@@ -199,116 +211,128 @@ Standard_Boolean ApproxInt_PrmPrmSvSurfaces::Compute( Standard_Real& u1
|
||||
TgTU = Tg.Dot(TU);
|
||||
TgTV = Tg.Dot(TV);
|
||||
DIS = TUTU * TVTV - TUTV * TUTV;
|
||||
if(fabs(DIS)<Precision::Angular()) {
|
||||
MyIsTangent=Standard_False;
|
||||
if (fabs(DIS) < Precision::Angular())
|
||||
{
|
||||
MyIsTangent = Standard_False;
|
||||
MyHasBeenComputed = MyHasBeenComputedbis = Standard_False;
|
||||
return(Standard_False);
|
||||
return (Standard_False);
|
||||
}
|
||||
|
||||
DeltaU = (TgTU * TVTV - TgTV * TUTV ) / DIS ;
|
||||
DeltaV = (TgTV * TUTU - TgTU * TUTV ) / DIS ;
|
||||
|
||||
Tguv2.SetCoord(DeltaU,DeltaV); MyTguv2 = Tguv2;
|
||||
DeltaU = (TgTU * TVTV - TgTV * TUTV) / DIS;
|
||||
DeltaV = (TgTV * TUTU - TgTU * TUTV) / DIS;
|
||||
|
||||
return(Standard_True);
|
||||
Tguv2.SetCoord(DeltaU, DeltaV);
|
||||
MyTguv2 = Tguv2;
|
||||
|
||||
return (Standard_True);
|
||||
}
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
void ApproxInt_PrmPrmSvSurfaces::Pnt(const Standard_Real u1,
|
||||
const Standard_Real v1,
|
||||
const Standard_Real u2,
|
||||
const Standard_Real v2,
|
||||
gp_Pnt& P) {
|
||||
gp_Pnt aP;
|
||||
gp_Vec aT;
|
||||
gp_Vec2d aTS1,aTS2;
|
||||
Standard_Real tu1=u1;
|
||||
Standard_Real tu2=u2;
|
||||
Standard_Real tv1=v1;
|
||||
Standard_Real tv2=v2;
|
||||
this->Compute(tu1,tv1,tu2,tv2,aP,aT,aTS1,aTS2);
|
||||
P=MyPnt;
|
||||
const Standard_Real v1,
|
||||
const Standard_Real u2,
|
||||
const Standard_Real v2,
|
||||
gp_Pnt& P)
|
||||
{
|
||||
gp_Pnt aP;
|
||||
gp_Vec aT;
|
||||
gp_Vec2d aTS1, aTS2;
|
||||
Standard_Real tu1 = u1;
|
||||
Standard_Real tu2 = u2;
|
||||
Standard_Real tv1 = v1;
|
||||
Standard_Real tv2 = v2;
|
||||
this->Compute(tu1, tv1, tu2, tv2, aP, aT, aTS1, aTS2);
|
||||
P = MyPnt;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SeekPoint
|
||||
//purpose : Computes point on curve and
|
||||
// function : SeekPoint
|
||||
// purpose : Computes point on curve and
|
||||
// parameters on the surfaces.
|
||||
//=======================================================================
|
||||
Standard_Boolean ApproxInt_PrmPrmSvSurfaces::SeekPoint(const Standard_Real u1,
|
||||
const Standard_Real v1,
|
||||
const Standard_Real u2,
|
||||
const Standard_Real v2,
|
||||
IntSurf_PntOn2S& Point)
|
||||
IntSurf_PntOn2S& Point)
|
||||
{
|
||||
gp_Pnt aP;
|
||||
gp_Vec aT;
|
||||
gp_Vec2d aTS1,aTS2;
|
||||
Standard_Real tu1=u1;
|
||||
Standard_Real tu2=u2;
|
||||
Standard_Real tv1=v1;
|
||||
Standard_Real tv2=v2;
|
||||
if (!Compute(tu1,tv1,tu2,tv2,aP,aT,aTS1,aTS2))
|
||||
gp_Pnt aP;
|
||||
gp_Vec aT;
|
||||
gp_Vec2d aTS1, aTS2;
|
||||
Standard_Real tu1 = u1;
|
||||
Standard_Real tu2 = u2;
|
||||
Standard_Real tv1 = v1;
|
||||
Standard_Real tv2 = v2;
|
||||
if (!Compute(tu1, tv1, tu2, tv2, aP, aT, aTS1, aTS2))
|
||||
return Standard_False;
|
||||
|
||||
Point.SetValue(aP, tu1,tv1,tu2,tv2);
|
||||
|
||||
Point.SetValue(aP, tu1, tv1, tu2, tv2);
|
||||
return Standard_True;
|
||||
}
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Boolean ApproxInt_PrmPrmSvSurfaces::Tangency(const Standard_Real u1,
|
||||
const Standard_Real v1,
|
||||
const Standard_Real u2,
|
||||
const Standard_Real v2,
|
||||
gp_Vec& T) {
|
||||
gp_Pnt aP;
|
||||
gp_Vec aT;
|
||||
gp_Vec2d aTS1,aTS2;
|
||||
Standard_Real tu1=u1;
|
||||
Standard_Real tu2=u2;
|
||||
Standard_Real tv1=v1;
|
||||
Standard_Real tv2=v2;
|
||||
Standard_Boolean t=this->Compute(tu1,tv1,tu2,tv2,aP,aT,aTS1,aTS2);
|
||||
T=MyTg;
|
||||
return(t);
|
||||
const Standard_Real v1,
|
||||
const Standard_Real u2,
|
||||
const Standard_Real v2,
|
||||
gp_Vec& T)
|
||||
{
|
||||
gp_Pnt aP;
|
||||
gp_Vec aT;
|
||||
gp_Vec2d aTS1, aTS2;
|
||||
Standard_Real tu1 = u1;
|
||||
Standard_Real tu2 = u2;
|
||||
Standard_Real tv1 = v1;
|
||||
Standard_Real tv2 = v2;
|
||||
Standard_Boolean t = this->Compute(tu1, tv1, tu2, tv2, aP, aT, aTS1, aTS2);
|
||||
T = MyTg;
|
||||
return (t);
|
||||
}
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Boolean ApproxInt_PrmPrmSvSurfaces::TangencyOnSurf1(const Standard_Real u1,
|
||||
const Standard_Real v1,
|
||||
const Standard_Real u2,
|
||||
const Standard_Real v2,
|
||||
gp_Vec2d& T) {
|
||||
gp_Pnt aP;
|
||||
gp_Vec aT;
|
||||
gp_Vec2d aTS1,aTS2;
|
||||
Standard_Real tu1=u1;
|
||||
Standard_Real tu2=u2;
|
||||
Standard_Real tv1=v1;
|
||||
Standard_Real tv2=v2;
|
||||
Standard_Boolean t=this->Compute(tu1,tv1,tu2,tv2,aP,aT,aTS1,aTS2);
|
||||
T=MyTguv1;
|
||||
return(t);
|
||||
const Standard_Real v1,
|
||||
const Standard_Real u2,
|
||||
const Standard_Real v2,
|
||||
gp_Vec2d& T)
|
||||
{
|
||||
gp_Pnt aP;
|
||||
gp_Vec aT;
|
||||
gp_Vec2d aTS1, aTS2;
|
||||
Standard_Real tu1 = u1;
|
||||
Standard_Real tu2 = u2;
|
||||
Standard_Real tv1 = v1;
|
||||
Standard_Real tv2 = v2;
|
||||
Standard_Boolean t = this->Compute(tu1, tv1, tu2, tv2, aP, aT, aTS1, aTS2);
|
||||
T = MyTguv1;
|
||||
return (t);
|
||||
}
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Boolean ApproxInt_PrmPrmSvSurfaces::TangencyOnSurf2(const Standard_Real u1,
|
||||
const Standard_Real v1,
|
||||
const Standard_Real u2,
|
||||
const Standard_Real v2,
|
||||
gp_Vec2d& T) {
|
||||
gp_Pnt aP;
|
||||
gp_Vec aT;
|
||||
gp_Vec2d aTS1,aTS2;
|
||||
Standard_Real tu1=u1;
|
||||
Standard_Real tu2=u2;
|
||||
Standard_Real tv1=v1;
|
||||
Standard_Real tv2=v2;
|
||||
Standard_Boolean t=this->Compute(tu1,tv1,tu2,tv2,aP,aT,aTS1,aTS2);
|
||||
T=MyTguv2;
|
||||
return(t);
|
||||
const Standard_Real v1,
|
||||
const Standard_Real u2,
|
||||
const Standard_Real v2,
|
||||
gp_Vec2d& T)
|
||||
{
|
||||
gp_Pnt aP;
|
||||
gp_Vec aT;
|
||||
gp_Vec2d aTS1, aTS2;
|
||||
Standard_Real tu1 = u1;
|
||||
Standard_Real tu2 = u2;
|
||||
Standard_Real tv1 = v1;
|
||||
Standard_Real tv2 = v2;
|
||||
Standard_Boolean t = this->Compute(tu1, tv1, tu2, tv2, aP, aT, aTS1, aTS2);
|
||||
T = MyTguv2;
|
||||
return (t);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
//------------------------------------------------------------
|
||||
//-- Calcul de Tguv1
|
||||
@@ -347,7 +371,3 @@ Standard_Boolean ApproxInt_PrmPrmSvSurfaces::TangencyOnSurf2(const Standard_Real
|
||||
return(Standard_True);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -15,87 +15,93 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef OCCT_DEBUG
|
||||
#define No_Standard_RangeError
|
||||
#define No_Standard_OutOfRange
|
||||
#define No_Standard_RangeError
|
||||
#define No_Standard_OutOfRange
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#include <math_Vector.hxx>
|
||||
#include <math_Matrix.hxx>
|
||||
|
||||
#include <gp_Vec2d.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
|
||||
#define THECURVE1 (*((TheCurve*)thecurve1))
|
||||
#define THECURVE2 (*((TheCurve*)thecurve2))
|
||||
|
||||
#define THECURVE1 (*((TheCurve *)thecurve1))
|
||||
#define THECURVE2 (*((TheCurve *)thecurve2))
|
||||
//=================================================================================================
|
||||
|
||||
//======================================================================
|
||||
IntCurve_DistBetweenPCurvesGen::IntCurve_DistBetweenPCurvesGen( const TheCurve& C1
|
||||
,const TheCurve& C2) {
|
||||
thecurve1 = (Standard_Address) (&C1);
|
||||
thecurve2 = (Standard_Address )(&C2);
|
||||
}
|
||||
//======================================================================
|
||||
Standard_Integer IntCurve_DistBetweenPCurvesGen::NbVariables(void) const {
|
||||
return(2);
|
||||
}
|
||||
//======================================================================
|
||||
Standard_Integer IntCurve_DistBetweenPCurvesGen::NbEquations(void) const {
|
||||
return(2);
|
||||
}
|
||||
//======================================================================
|
||||
Standard_Boolean IntCurve_DistBetweenPCurvesGen::Value
|
||||
(const math_Vector& X
|
||||
,math_Vector& F)
|
||||
IntCurve_DistBetweenPCurvesGen::IntCurve_DistBetweenPCurvesGen(const TheCurve& C1,
|
||||
const TheCurve& C2)
|
||||
{
|
||||
gp_Pnt2d P1,P2;
|
||||
TheCurveTool::D0(THECURVE1,X(1),P1);
|
||||
TheCurveTool::D0(THECURVE2,X(2),P2);
|
||||
thecurve1 = (Standard_Address)(&C1);
|
||||
thecurve2 = (Standard_Address)(&C2);
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Integer IntCurve_DistBetweenPCurvesGen::NbVariables(void) const
|
||||
{
|
||||
return (2);
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Integer IntCurve_DistBetweenPCurvesGen::NbEquations(void) const
|
||||
{
|
||||
return (2);
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Boolean IntCurve_DistBetweenPCurvesGen::Value(const math_Vector& X, math_Vector& F)
|
||||
{
|
||||
gp_Pnt2d P1, P2;
|
||||
TheCurveTool::D0(THECURVE1, X(1), P1);
|
||||
TheCurveTool::D0(THECURVE2, X(2), P2);
|
||||
F(1) = P1.X() - P2.X();
|
||||
F(2) = P1.Y() - P2.Y();
|
||||
return(Standard_True);
|
||||
return (Standard_True);
|
||||
}
|
||||
//======================================================================
|
||||
Standard_Boolean IntCurve_DistBetweenPCurvesGen::Derivatives
|
||||
(const math_Vector& X
|
||||
,math_Matrix& D)
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Boolean IntCurve_DistBetweenPCurvesGen::Derivatives(const math_Vector& X, math_Matrix& D)
|
||||
{
|
||||
gp_Vec2d T;
|
||||
gp_Pnt2d P;
|
||||
TheCurveTool::D1(THECURVE1,X(1),P,T);
|
||||
D.Value(1,1) = T.X();
|
||||
D.Value(2,1) = T.Y();
|
||||
|
||||
TheCurveTool::D1(THECURVE2,X(2),P,T);
|
||||
D.Value(1,2) = -(T.X());
|
||||
D.Value(2,2) = -(T.Y());
|
||||
TheCurveTool::D1(THECURVE1, X(1), P, T);
|
||||
D.Value(1, 1) = T.X();
|
||||
D.Value(2, 1) = T.Y();
|
||||
|
||||
return(Standard_True);
|
||||
TheCurveTool::D1(THECURVE2, X(2), P, T);
|
||||
D.Value(1, 2) = -(T.X());
|
||||
D.Value(2, 2) = -(T.Y());
|
||||
|
||||
return (Standard_True);
|
||||
}
|
||||
//======================================================================
|
||||
Standard_Boolean IntCurve_DistBetweenPCurvesGen::Values
|
||||
(const math_Vector& X
|
||||
,math_Vector& F
|
||||
,math_Matrix& D)
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Boolean IntCurve_DistBetweenPCurvesGen::Values(const math_Vector& X,
|
||||
math_Vector& F,
|
||||
math_Matrix& D)
|
||||
{
|
||||
|
||||
gp_Vec2d T;
|
||||
gp_Pnt2d P1,P2;
|
||||
|
||||
TheCurveTool::D1(THECURVE1,X(1),P1,T);
|
||||
D.Value(1,1) = T.X();
|
||||
D.Value(2,1) = T.Y();
|
||||
|
||||
TheCurveTool::D1(THECURVE2,X(2),P2,T);
|
||||
D.Value(1,2) = -(T.X());
|
||||
D.Value(2,2) = -(T.Y());
|
||||
gp_Pnt2d P1, P2;
|
||||
|
||||
TheCurveTool::D1(THECURVE1, X(1), P1, T);
|
||||
D.Value(1, 1) = T.X();
|
||||
D.Value(2, 1) = T.Y();
|
||||
|
||||
TheCurveTool::D1(THECURVE2, X(2), P2, T);
|
||||
D.Value(1, 2) = -(T.X());
|
||||
D.Value(2, 2) = -(T.Y());
|
||||
|
||||
F.Value(1) = P1.X() - P2.X();
|
||||
F.Value(2) = P1.Y() - P2.Y();
|
||||
|
||||
return(Standard_True);
|
||||
return (Standard_True);
|
||||
}
|
||||
//======================================================================
|
||||
|
||||
|
||||
//======================================================================
|
||||
|
||||
@@ -19,205 +19,252 @@
|
||||
#include <math_NewtonFunctionSetRoot.hxx>
|
||||
#include <gp_Vec2d.hxx>
|
||||
|
||||
|
||||
|
||||
//======================================================================
|
||||
//===
|
||||
//===
|
||||
//======================================================================
|
||||
IntCurve_ExactIntersectionPoint::IntCurve_ExactIntersectionPoint(const TheCurve& C1,const TheCurve& C2,const Standard_Real Tol)
|
||||
IntCurve_ExactIntersectionPoint::IntCurve_ExactIntersectionPoint(const TheCurve& C1,
|
||||
const TheCurve& C2,
|
||||
const Standard_Real Tol)
|
||||
: done(Standard_False),
|
||||
nbroots(0),
|
||||
myTol(Tol*Tol),
|
||||
FctDist(C1,C2),
|
||||
ToleranceVector(1,2),
|
||||
BInfVector(1,2),
|
||||
BSupVector(1,2),
|
||||
StartingPoint(1,2),
|
||||
Root(1,2),
|
||||
myTol(Tol * Tol),
|
||||
FctDist(C1, C2),
|
||||
ToleranceVector(1, 2),
|
||||
BInfVector(1, 2),
|
||||
BSupVector(1, 2),
|
||||
StartingPoint(1, 2),
|
||||
Root(1, 2),
|
||||
anErrorOccurred(Standard_False)
|
||||
{
|
||||
ToleranceVector.Value(1) = TheCurveTool::EpsX(C1);
|
||||
ToleranceVector.Value(2) = TheCurveTool::EpsX(C2);
|
||||
}
|
||||
//----------------------------------------------------------------------
|
||||
void IntCurve_ExactIntersectionPoint::Perform( const IntCurve_ThePolygon2d& Poly1
|
||||
,const IntCurve_ThePolygon2d& Poly2
|
||||
,Standard_Integer& NumSegOn1
|
||||
,Standard_Integer& NumSegOn2
|
||||
,Standard_Real& ParamOnSeg1
|
||||
,Standard_Real& ParamOnSeg2)
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
void IntCurve_ExactIntersectionPoint::Perform(const IntCurve_ThePolygon2d& Poly1,
|
||||
const IntCurve_ThePolygon2d& Poly2,
|
||||
Standard_Integer& NumSegOn1,
|
||||
Standard_Integer& NumSegOn2,
|
||||
Standard_Real& ParamOnSeg1,
|
||||
Standard_Real& ParamOnSeg2)
|
||||
{
|
||||
//----------------------------------------------------------------------
|
||||
//-- On prend comme bornes de recherches :
|
||||
//-- On prend comme bornes de recherches :
|
||||
//--
|
||||
//-- Segment : i-1 i i+1 i+2
|
||||
//-- Segment : i-1 i i+1 i+2
|
||||
//--
|
||||
//-- |---------|-----X-------|---------|----------|
|
||||
//-- Inf Sup
|
||||
//--
|
||||
if(NumSegOn1 >= Poly1.NbSegments() && ParamOnSeg1==0.0) {
|
||||
NumSegOn1--; ParamOnSeg1 = 1.0;
|
||||
//--
|
||||
if (NumSegOn1 >= Poly1.NbSegments() && ParamOnSeg1 == 0.0)
|
||||
{
|
||||
NumSegOn1--;
|
||||
ParamOnSeg1 = 1.0;
|
||||
}
|
||||
if(NumSegOn2 >= Poly2.NbSegments() && ParamOnSeg2==0.0) {
|
||||
NumSegOn2--; ParamOnSeg2 = 1.0;
|
||||
if (NumSegOn2 >= Poly2.NbSegments() && ParamOnSeg2 == 0.0)
|
||||
{
|
||||
NumSegOn2--;
|
||||
ParamOnSeg2 = 1.0;
|
||||
}
|
||||
if(NumSegOn1 <=0) {
|
||||
NumSegOn1=1; ParamOnSeg1 = 0.0;
|
||||
if (NumSegOn1 <= 0)
|
||||
{
|
||||
NumSegOn1 = 1;
|
||||
ParamOnSeg1 = 0.0;
|
||||
}
|
||||
if(NumSegOn2 <=0) {
|
||||
NumSegOn2=1; ParamOnSeg2 = 0.0;
|
||||
if (NumSegOn2 <= 0)
|
||||
{
|
||||
NumSegOn2 = 1;
|
||||
ParamOnSeg2 = 0.0;
|
||||
}
|
||||
|
||||
StartingPoint.Value(1) = Poly1.ApproxParamOnCurve(NumSegOn1,ParamOnSeg1);
|
||||
if(NumSegOn1<=2) BInfVector.Value(1)= Poly1.InfParameter();
|
||||
else BInfVector.Value(1)= Poly1.ApproxParamOnCurve(NumSegOn1-1,(Standard_Real)0.0);
|
||||
if(NumSegOn1 >= (Poly1.NbSegments() -2)) BSupVector.Value(1)= Poly1.SupParameter();
|
||||
else BSupVector.Value(1)= Poly1.ApproxParamOnCurve(NumSegOn1+2,(Standard_Real)0.0);
|
||||
|
||||
StartingPoint.Value(2) = Poly2.ApproxParamOnCurve(NumSegOn2,ParamOnSeg2);
|
||||
if(NumSegOn2<=2) BInfVector.Value(2)= Poly2.InfParameter();
|
||||
else BInfVector.Value(2)= Poly2.ApproxParamOnCurve(NumSegOn2-1,(Standard_Real)0.0);
|
||||
if(NumSegOn2 >= (Poly2.NbSegments() -2)) BSupVector.Value(2)= Poly2.SupParameter();
|
||||
else BSupVector.Value(2)= Poly2.ApproxParamOnCurve(NumSegOn2+2,(Standard_Real)0.0);
|
||||
StartingPoint.Value(1) = Poly1.ApproxParamOnCurve(NumSegOn1, ParamOnSeg1);
|
||||
if (NumSegOn1 <= 2)
|
||||
BInfVector.Value(1) = Poly1.InfParameter();
|
||||
else
|
||||
BInfVector.Value(1) = Poly1.ApproxParamOnCurve(NumSegOn1 - 1, (Standard_Real)0.0);
|
||||
if (NumSegOn1 >= (Poly1.NbSegments() - 2))
|
||||
BSupVector.Value(1) = Poly1.SupParameter();
|
||||
else
|
||||
BSupVector.Value(1) = Poly1.ApproxParamOnCurve(NumSegOn1 + 2, (Standard_Real)0.0);
|
||||
|
||||
StartingPoint.Value(2) = Poly2.ApproxParamOnCurve(NumSegOn2, ParamOnSeg2);
|
||||
if (NumSegOn2 <= 2)
|
||||
BInfVector.Value(2) = Poly2.InfParameter();
|
||||
else
|
||||
BInfVector.Value(2) = Poly2.ApproxParamOnCurve(NumSegOn2 - 1, (Standard_Real)0.0);
|
||||
if (NumSegOn2 >= (Poly2.NbSegments() - 2))
|
||||
BSupVector.Value(2) = Poly2.SupParameter();
|
||||
else
|
||||
BSupVector.Value(2) = Poly2.ApproxParamOnCurve(NumSegOn2 + 2, (Standard_Real)0.0);
|
||||
|
||||
IntCurve_ExactIntersectionPoint::MathPerform();
|
||||
if(nbroots == 0) {
|
||||
if (nbroots == 0)
|
||||
{
|
||||
// Standard_Real DeflectionOn1 = Poly1.DeflectionOverEstimation();
|
||||
Poly1.DeflectionOverEstimation();
|
||||
// Standard_Real DeflectionOn2 = Poly2.DeflectionOverEstimation();
|
||||
Poly2.DeflectionOverEstimation();
|
||||
// if(DeflectionOn2 > Poly1.BeginOfSeg(NumSegOn1).Distance(Poly1.EndOfSeg(NumSegOn1))) {
|
||||
{
|
||||
//-- On risque de donner des bornes sur la courbe 1 trop etroites.
|
||||
Standard_Integer diff=1;
|
||||
Standard_Real AnBinfVector = BInfVector.Value(1);
|
||||
Standard_Real AnBsupVector = BSupVector.Value(1);
|
||||
//-- On risque de donner des bornes sur la courbe 1 trop etroites.
|
||||
Standard_Integer diff = 1;
|
||||
Standard_Real AnBinfVector = BInfVector.Value(1);
|
||||
Standard_Real AnBsupVector = BSupVector.Value(1);
|
||||
//---------------- On elargit les bornes par la gauche --------------------
|
||||
do {
|
||||
do
|
||||
{
|
||||
diff++;
|
||||
if((NumSegOn1-diff)<=1) {
|
||||
BInfVector.Value(1)= Poly1.InfParameter();
|
||||
diff=0;
|
||||
if ((NumSegOn1 - diff) <= 1)
|
||||
{
|
||||
BInfVector.Value(1) = Poly1.InfParameter();
|
||||
diff = 0;
|
||||
}
|
||||
else BInfVector.Value(1)= Poly1.ApproxParamOnCurve(NumSegOn1-diff,(Standard_Real)0.0);
|
||||
else
|
||||
BInfVector.Value(1) = Poly1.ApproxParamOnCurve(NumSegOn1 - diff, (Standard_Real)0.0);
|
||||
IntCurve_ExactIntersectionPoint::MathPerform();
|
||||
//-- le 18 nov 97
|
||||
if(diff>3) diff+=NumSegOn1/2;
|
||||
}
|
||||
while( nbroots==0 && diff!=0);
|
||||
//---------------- On elargit les bornes par la droite --------------------
|
||||
if(nbroots==0) {
|
||||
//-- le 18 nov 97
|
||||
if (diff > 3)
|
||||
diff += NumSegOn1 / 2;
|
||||
} while (nbroots == 0 && diff != 0);
|
||||
//---------------- On elargit les bornes par la droite --------------------
|
||||
if (nbroots == 0)
|
||||
{
|
||||
BInfVector.Value(1) = AnBinfVector;
|
||||
diff=1;
|
||||
do {
|
||||
diff = 1;
|
||||
do
|
||||
{
|
||||
diff++;
|
||||
if((NumSegOn1+diff) >= (Poly1.NbSegments() -1)) {
|
||||
BSupVector.Value(1)= Poly1.SupParameter();
|
||||
diff=0;
|
||||
if ((NumSegOn1 + diff) >= (Poly1.NbSegments() - 1))
|
||||
{
|
||||
BSupVector.Value(1) = Poly1.SupParameter();
|
||||
diff = 0;
|
||||
}
|
||||
else BSupVector.Value(1)= Poly1.ApproxParamOnCurve(NumSegOn1+1+diff,(Standard_Real)0.0);
|
||||
else
|
||||
BSupVector.Value(1) =
|
||||
Poly1.ApproxParamOnCurve(NumSegOn1 + 1 + diff, (Standard_Real)0.0);
|
||||
IntCurve_ExactIntersectionPoint::MathPerform();
|
||||
//-- le 18 nov 97
|
||||
if(diff>3) diff+=1+(Poly1.NbSegments()-NumSegOn1)/2;
|
||||
}
|
||||
while( nbroots==0 && diff!=0);
|
||||
//-- le 18 nov 97
|
||||
if (diff > 3)
|
||||
diff += 1 + (Poly1.NbSegments() - NumSegOn1) / 2;
|
||||
} while (nbroots == 0 && diff != 0);
|
||||
}
|
||||
BSupVector.Value(1) = AnBsupVector;
|
||||
}
|
||||
|
||||
if(nbroots==0) {
|
||||
//-- On risque de donner des bornes sur la courbe 1 trop etroites.
|
||||
Standard_Integer diff=1;
|
||||
Standard_Real AnBinfVector = BInfVector.Value(2);
|
||||
Standard_Real AnBsupVector = BSupVector.Value(2);
|
||||
if (nbroots == 0)
|
||||
{
|
||||
//-- On risque de donner des bornes sur la courbe 1 trop etroites.
|
||||
Standard_Integer diff = 1;
|
||||
Standard_Real AnBinfVector = BInfVector.Value(2);
|
||||
Standard_Real AnBsupVector = BSupVector.Value(2);
|
||||
//---------------- On elargit les bornes par la gauche --------------------
|
||||
do {
|
||||
do
|
||||
{
|
||||
diff++;
|
||||
if((NumSegOn2-diff)<=1) {
|
||||
BInfVector.Value(2)= Poly2.InfParameter();
|
||||
diff=0;
|
||||
if ((NumSegOn2 - diff) <= 1)
|
||||
{
|
||||
BInfVector.Value(2) = Poly2.InfParameter();
|
||||
diff = 0;
|
||||
}
|
||||
else BInfVector.Value(2)= Poly2.ApproxParamOnCurve(NumSegOn2-diff,(Standard_Real)0.0);
|
||||
else
|
||||
BInfVector.Value(2) = Poly2.ApproxParamOnCurve(NumSegOn2 - diff, (Standard_Real)0.0);
|
||||
IntCurve_ExactIntersectionPoint::MathPerform();
|
||||
//-- le 18 nov 97
|
||||
if(diff>3) diff+=NumSegOn2/2;
|
||||
}
|
||||
while( nbroots==0 && diff!=0);
|
||||
//---------------- On elargit les bornes par la droite --------------------
|
||||
if(nbroots==0)
|
||||
{
|
||||
//-- le 18 nov 97
|
||||
if (diff > 3)
|
||||
diff += NumSegOn2 / 2;
|
||||
} while (nbroots == 0 && diff != 0);
|
||||
//---------------- On elargit les bornes par la droite --------------------
|
||||
if (nbroots == 0)
|
||||
{
|
||||
BInfVector.Value(2) = AnBinfVector;
|
||||
diff=1;
|
||||
do {
|
||||
diff = 1;
|
||||
do
|
||||
{
|
||||
diff++;
|
||||
if((NumSegOn2+diff) >= (Poly2.NbSegments() -1)) {
|
||||
BSupVector.Value(2)= Poly2.SupParameter();
|
||||
diff=0;
|
||||
if ((NumSegOn2 + diff) >= (Poly2.NbSegments() - 1))
|
||||
{
|
||||
BSupVector.Value(2) = Poly2.SupParameter();
|
||||
diff = 0;
|
||||
}
|
||||
else BSupVector.Value(2)= Poly2.ApproxParamOnCurve(NumSegOn2+1+diff,(Standard_Real)0.0);
|
||||
else
|
||||
BSupVector.Value(2) =
|
||||
Poly2.ApproxParamOnCurve(NumSegOn2 + 1 + diff, (Standard_Real)0.0);
|
||||
IntCurve_ExactIntersectionPoint::MathPerform();
|
||||
//-- le 18 nov 97
|
||||
if(diff>3) diff+=1+(Poly2.NbSegments()-NumSegOn2)/2;
|
||||
}
|
||||
while( nbroots==0 && diff!=0);
|
||||
//-- le 18 nov 97
|
||||
if (diff > 3)
|
||||
diff += 1 + (Poly2.NbSegments() - NumSegOn2) / 2;
|
||||
} while (nbroots == 0 && diff != 0);
|
||||
}
|
||||
BSupVector.Value(2) = AnBsupVector;
|
||||
}
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------
|
||||
void IntCurve_ExactIntersectionPoint::Perform( const Standard_Real Uo
|
||||
,const Standard_Real Vo
|
||||
,const Standard_Real UInf
|
||||
,const Standard_Real VInf
|
||||
,const Standard_Real USup
|
||||
,const Standard_Real VSup) {
|
||||
|
||||
done = Standard_True;
|
||||
|
||||
BInfVector.Value(1) = UInf;
|
||||
BInfVector.Value(2) = VInf;
|
||||
BSupVector.Value(1) = USup;
|
||||
BSupVector.Value(2) = VSup;
|
||||
StartingPoint.Value(1) = Uo;
|
||||
StartingPoint.Value(2) = Vo;
|
||||
|
||||
IntCurve_ExactIntersectionPoint::MathPerform();
|
||||
|
||||
}
|
||||
//----------------------------------------------------------------------
|
||||
Standard_Integer IntCurve_ExactIntersectionPoint::NbRoots() const { return(nbroots); }
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
void IntCurve_ExactIntersectionPoint::Roots(Standard_Real& U,Standard_Real& V) {
|
||||
U=Root.Value(1);
|
||||
V=Root.Value(2);
|
||||
}
|
||||
//----------------------------------------------------------------------
|
||||
//=================================================================================================
|
||||
|
||||
void IntCurve_ExactIntersectionPoint::Perform(const Standard_Real Uo,
|
||||
const Standard_Real Vo,
|
||||
const Standard_Real UInf,
|
||||
const Standard_Real VInf,
|
||||
const Standard_Real USup,
|
||||
const Standard_Real VSup)
|
||||
{
|
||||
|
||||
done = Standard_True;
|
||||
|
||||
BInfVector.Value(1) = UInf;
|
||||
BInfVector.Value(2) = VInf;
|
||||
BSupVector.Value(1) = USup;
|
||||
BSupVector.Value(2) = VSup;
|
||||
StartingPoint.Value(1) = Uo;
|
||||
StartingPoint.Value(2) = Vo;
|
||||
|
||||
IntCurve_ExactIntersectionPoint::MathPerform();
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Integer IntCurve_ExactIntersectionPoint::NbRoots() const
|
||||
{
|
||||
return (nbroots);
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
void IntCurve_ExactIntersectionPoint::Roots(Standard_Real& U, Standard_Real& V)
|
||||
{
|
||||
U = Root.Value(1);
|
||||
V = Root.Value(2);
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
void IntCurve_ExactIntersectionPoint::MathPerform(void)
|
||||
{
|
||||
math_FunctionSetRoot Fct(FctDist, ToleranceVector, 60);
|
||||
Fct.Perform(FctDist, StartingPoint, BInfVector, BSupVector);
|
||||
|
||||
if(Fct.IsDone()) {
|
||||
Fct.Root(Root); nbroots = 1;
|
||||
math_Vector XY(1,2);
|
||||
FctDist.Value(Root,XY);
|
||||
Standard_Real dist2 = ((XY(1)*XY(1)+XY(2)*XY(2)));
|
||||
if (Fct.IsDone())
|
||||
{
|
||||
Fct.Root(Root);
|
||||
nbroots = 1;
|
||||
math_Vector XY(1, 2);
|
||||
FctDist.Value(Root, XY);
|
||||
Standard_Real dist2 = ((XY(1) * XY(1) + XY(2) * XY(2)));
|
||||
|
||||
if(dist2 > myTol)
|
||||
if (dist2 > myTol)
|
||||
{
|
||||
nbroots = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
anErrorOccurred = Standard_True;
|
||||
nbroots = 0;
|
||||
nbroots = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//======================================================================
|
||||
|
||||
Standard_Boolean IntCurve_ExactIntersectionPoint::AnErrorOccurred() const
|
||||
|
||||
@@ -19,60 +19,74 @@
|
||||
#include <IntRes2d_Domain.hxx>
|
||||
#include <IntCurve_IConicTool.hxx>
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
IntCurve_IntConicCurveGen::IntCurve_IntConicCurveGen (const gp_Circ2d& C,
|
||||
const IntRes2d_Domain& D1,
|
||||
const ThePCurve& PCurve,
|
||||
const IntRes2d_Domain& D2,
|
||||
const Standard_Real TolConf,
|
||||
const Standard_Real Tol) {
|
||||
if(!D1.IsClosed()) {
|
||||
//=================================================================================================
|
||||
|
||||
IntCurve_IntConicCurveGen::IntCurve_IntConicCurveGen(const gp_Circ2d& C,
|
||||
const IntRes2d_Domain& D1,
|
||||
const ThePCurve& PCurve,
|
||||
const IntRes2d_Domain& D2,
|
||||
const Standard_Real TolConf,
|
||||
const Standard_Real Tol)
|
||||
{
|
||||
if (!D1.IsClosed())
|
||||
{
|
||||
IntRes2d_Domain D(D1);
|
||||
D.SetEquivalentParameters(D1.FirstParameter(),D1.FirstParameter()+M_PI+M_PI);
|
||||
Perform(IntCurve_IConicTool(C),D,PCurve,D2,TolConf,Tol);
|
||||
D.SetEquivalentParameters(D1.FirstParameter(), D1.FirstParameter() + M_PI + M_PI);
|
||||
Perform(IntCurve_IConicTool(C), D, PCurve, D2, TolConf, Tol);
|
||||
//-- throw Standard_ConstructionError("Domaine incorrect");
|
||||
}
|
||||
else {
|
||||
Perform(IntCurve_IConicTool(C),D1,PCurve,D2,TolConf,Tol);
|
||||
else
|
||||
{
|
||||
Perform(IntCurve_IConicTool(C), D1, PCurve, D2, TolConf, Tol);
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------------------------
|
||||
IntCurve_IntConicCurveGen::IntCurve_IntConicCurveGen (const gp_Elips2d& E,
|
||||
const IntRes2d_Domain& D1,
|
||||
const ThePCurve& PCurve,
|
||||
const IntRes2d_Domain& D2,
|
||||
const Standard_Real TolConf,
|
||||
const Standard_Real Tol) {
|
||||
if(!D1.IsClosed()) {
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
IntCurve_IntConicCurveGen::IntCurve_IntConicCurveGen(const gp_Elips2d& E,
|
||||
const IntRes2d_Domain& D1,
|
||||
const ThePCurve& PCurve,
|
||||
const IntRes2d_Domain& D2,
|
||||
const Standard_Real TolConf,
|
||||
const Standard_Real Tol)
|
||||
{
|
||||
if (!D1.IsClosed())
|
||||
{
|
||||
IntRes2d_Domain D(D1);
|
||||
D.SetEquivalentParameters(D1.FirstParameter(),D1.FirstParameter()+M_PI+M_PI);
|
||||
Perform(IntCurve_IConicTool(E),D,PCurve,D2,TolConf,Tol);
|
||||
D.SetEquivalentParameters(D1.FirstParameter(), D1.FirstParameter() + M_PI + M_PI);
|
||||
Perform(IntCurve_IConicTool(E), D, PCurve, D2, TolConf, Tol);
|
||||
//-- throw Standard_ConstructionError("Domaine incorrect");
|
||||
}
|
||||
else {
|
||||
Perform(IntCurve_IConicTool(E),D1,PCurve,D2,TolConf,Tol);
|
||||
else
|
||||
{
|
||||
Perform(IntCurve_IConicTool(E), D1, PCurve, D2, TolConf, Tol);
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------------------------
|
||||
IntCurve_IntConicCurveGen::IntCurve_IntConicCurveGen (const gp_Parab2d& Prb,
|
||||
const IntRes2d_Domain& D1,
|
||||
const ThePCurve& PCurve,
|
||||
const IntRes2d_Domain& D2,
|
||||
const Standard_Real TolConf,
|
||||
const Standard_Real Tol) {
|
||||
|
||||
Perform(IntCurve_IConicTool(Prb),D1,PCurve,D2,TolConf,Tol);
|
||||
}
|
||||
//--------------------------------------------------------------------------------
|
||||
IntCurve_IntConicCurveGen::IntCurve_IntConicCurveGen (const gp_Hypr2d& H,
|
||||
const IntRes2d_Domain& D1,
|
||||
const ThePCurve& PCurve,
|
||||
const IntRes2d_Domain& D2,
|
||||
const Standard_Real TolConf,
|
||||
const Standard_Real Tol) {
|
||||
|
||||
Perform(IntCurve_IConicTool(H),D1,PCurve,D2,TolConf,Tol);
|
||||
}
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
IntCurve_IntConicCurveGen::IntCurve_IntConicCurveGen(const gp_Parab2d& Prb,
|
||||
const IntRes2d_Domain& D1,
|
||||
const ThePCurve& PCurve,
|
||||
const IntRes2d_Domain& D2,
|
||||
const Standard_Real TolConf,
|
||||
const Standard_Real Tol)
|
||||
{
|
||||
|
||||
Perform(IntCurve_IConicTool(Prb), D1, PCurve, D2, TolConf, Tol);
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
IntCurve_IntConicCurveGen::IntCurve_IntConicCurveGen(const gp_Hypr2d& H,
|
||||
const IntRes2d_Domain& D1,
|
||||
const ThePCurve& PCurve,
|
||||
const IntRes2d_Domain& D2,
|
||||
const Standard_Real TolConf,
|
||||
const Standard_Real Tol)
|
||||
{
|
||||
|
||||
Perform(IntCurve_IConicTool(H), D1, PCurve, D2, TolConf, Tol);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -23,31 +23,31 @@
|
||||
#include <gp_Vec2d.hxx>
|
||||
#include <gp_Dir2d.hxx>
|
||||
|
||||
|
||||
#define MAJORATION_DEFLECTION 1.5
|
||||
|
||||
//======================================================================
|
||||
//== We take samples on the Domain of the Curve NbPts Points
|
||||
//== We take samples on the Domain of the Curve NbPts Points
|
||||
//== with constant parameters.
|
||||
//==
|
||||
//==
|
||||
//== We estimate the maximum deflection taking the max distance between the
|
||||
//== right Curve.Value(X(i))-->Curve.Value(X(i+1))
|
||||
//== right Curve.Value(X(i))-->Curve.Value(X(i+1))
|
||||
//== and the point Curve.Value(X(i+1/2))
|
||||
//======================================================================
|
||||
// Modified by Sergey KHROMOV - Mon Mar 24 12:02:43 2003 Begin
|
||||
IntCurve_Polygon2dGen::IntCurve_Polygon2dGen(const TheCurve& C,
|
||||
const Standard_Integer tNbPts,
|
||||
const IntRes2d_Domain& D,
|
||||
const Standard_Real Tol):
|
||||
// Modified by Sergey KHROMOV - Mon Mar 24 12:02:45 2003 End
|
||||
ThePnts(1,(tNbPts<3)? 6 : (tNbPts+tNbPts)),
|
||||
TheParams(1,(tNbPts<3)? 6 : (tNbPts+tNbPts)),
|
||||
TheIndex(1,(tNbPts<3)? 6 : (tNbPts+tNbPts))
|
||||
{
|
||||
|
||||
Standard_Integer NbPts = (tNbPts<3)? 3 : tNbPts;
|
||||
TheMaxNbPoints = NbPts+NbPts;
|
||||
NbPntIn = NbPts;
|
||||
//-----------------------------------------------------
|
||||
const Standard_Integer tNbPts,
|
||||
const IntRes2d_Domain& D,
|
||||
const Standard_Real Tol)
|
||||
: // Modified by Sergey KHROMOV - Mon Mar 24 12:02:45 2003 End
|
||||
ThePnts(1, (tNbPts < 3) ? 6 : (tNbPts + tNbPts)),
|
||||
TheParams(1, (tNbPts < 3) ? 6 : (tNbPts + tNbPts)),
|
||||
TheIndex(1, (tNbPts < 3) ? 6 : (tNbPts + tNbPts))
|
||||
{
|
||||
|
||||
Standard_Integer NbPts = (tNbPts < 3) ? 3 : tNbPts;
|
||||
TheMaxNbPoints = NbPts + NbPts;
|
||||
NbPntIn = NbPts;
|
||||
//-----------------------------------------------------
|
||||
//--- Initialization of the breaking with d_Parametre constant
|
||||
//---
|
||||
Binf = D.FirstParameter();
|
||||
@@ -55,287 +55,330 @@ IntCurve_Polygon2dGen::IntCurve_Polygon2dGen(const TheCurve& C,
|
||||
//-----------------------------------------------------
|
||||
//-- IntRes2d Raise if HasFirst returns False
|
||||
//-- and accesses First Parameter
|
||||
//--
|
||||
Standard_Real u=Binf;
|
||||
Standard_Real u1=Bsup;
|
||||
Standard_Real du=(u1-u)/(Standard_Real)(NbPts-1);
|
||||
// Standard_Integer ip1,i=1;
|
||||
Standard_Integer i=1;
|
||||
|
||||
do {
|
||||
gp_Pnt2d P=TheCurveTool::Value(C,u);
|
||||
myBox.Add(P);
|
||||
TheIndex.SetValue(i,i);
|
||||
ThePnts.SetValue(i,P);
|
||||
TheParams.SetValue(i,u);
|
||||
u+=du;
|
||||
i++;
|
||||
}
|
||||
while(i<=NbPts);
|
||||
//--
|
||||
Standard_Real u = Binf;
|
||||
Standard_Real u1 = Bsup;
|
||||
Standard_Real du = (u1 - u) / (Standard_Real)(NbPts - 1);
|
||||
// Standard_Integer ip1,i=1;
|
||||
Standard_Integer i = 1;
|
||||
|
||||
do
|
||||
{
|
||||
gp_Pnt2d P = TheCurveTool::Value(C, u);
|
||||
myBox.Add(P);
|
||||
TheIndex.SetValue(i, i);
|
||||
ThePnts.SetValue(i, P);
|
||||
TheParams.SetValue(i, u);
|
||||
u += du;
|
||||
i++;
|
||||
} while (i <= NbPts);
|
||||
|
||||
//-----------------------------------------------------
|
||||
//--- Calculate a maximal deflection
|
||||
//---
|
||||
// Modified by Sergey KHROMOV - Mon Mar 24 12:03:05 2003 Begin
|
||||
// TheDeflection = 0.000000001;
|
||||
TheDeflection = Min(0.000000001, Tol/100.);
|
||||
// Modified by Sergey KHROMOV - Mon Mar 24 12:03:05 2003 End
|
||||
i=1;
|
||||
u=D.FirstParameter();
|
||||
u+=du * 0.5;
|
||||
|
||||
do {
|
||||
gp_Pnt2d Pm = TheCurveTool::Value(C,u);
|
||||
const gp_Pnt2d& P1 = ThePnts.Value(i);
|
||||
const gp_Pnt2d& P2 = ThePnts.Value(i+1);
|
||||
// Modified by Sergey KHROMOV - Mon Mar 24 12:03:05 2003 Begin
|
||||
// TheDeflection = 0.000000001;
|
||||
TheDeflection = Min(0.000000001, Tol / 100.);
|
||||
// Modified by Sergey KHROMOV - Mon Mar 24 12:03:05 2003 End
|
||||
i = 1;
|
||||
u = D.FirstParameter();
|
||||
u += du * 0.5;
|
||||
|
||||
u+=du;
|
||||
do
|
||||
{
|
||||
gp_Pnt2d Pm = TheCurveTool::Value(C, u);
|
||||
const gp_Pnt2d& P1 = ThePnts.Value(i);
|
||||
const gp_Pnt2d& P2 = ThePnts.Value(i + 1);
|
||||
|
||||
u += du;
|
||||
i++;
|
||||
|
||||
|
||||
Standard_Real dx,dy,t=0;
|
||||
dx=P1.X()-P2.X(); if(dx<0) dx=-dx;
|
||||
dy=P1.Y()-P2.Y(); if(dy<0) dy=-dy;
|
||||
if(dx+dy>1e-12) {
|
||||
gp_Lin2d L(P1,gp_Dir2d(gp_Vec2d(P1,P2)));
|
||||
Standard_Real dx, dy, t = 0;
|
||||
dx = P1.X() - P2.X();
|
||||
if (dx < 0)
|
||||
dx = -dx;
|
||||
dy = P1.Y() - P2.Y();
|
||||
if (dy < 0)
|
||||
dy = -dy;
|
||||
if (dx + dy > 1e-12)
|
||||
{
|
||||
gp_Lin2d L(P1, gp_Dir2d(gp_Vec2d(P1, P2)));
|
||||
t = L.Distance(Pm);
|
||||
if(t>TheDeflection) {
|
||||
TheDeflection = t;
|
||||
if (t > TheDeflection)
|
||||
{
|
||||
TheDeflection = t;
|
||||
}
|
||||
}
|
||||
}
|
||||
while(i<NbPts);
|
||||
} while (i < NbPts);
|
||||
|
||||
myBox.Enlarge(TheDeflection*MAJORATION_DEFLECTION);
|
||||
myBox.Enlarge(TheDeflection * MAJORATION_DEFLECTION);
|
||||
ClosedPolygon = Standard_False;
|
||||
}
|
||||
//======================================================================
|
||||
void IntCurve_Polygon2dGen::ComputeWithBox(const TheCurve& C,
|
||||
const Bnd_Box2d& BoxOtherPolygon) {
|
||||
if(myBox.IsOut(BoxOtherPolygon)) {
|
||||
NbPntIn=2;
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
void IntCurve_Polygon2dGen::ComputeWithBox(const TheCurve& C, const Bnd_Box2d& BoxOtherPolygon)
|
||||
{
|
||||
if (myBox.IsOut(BoxOtherPolygon))
|
||||
{
|
||||
NbPntIn = 2;
|
||||
myBox.SetVoid();
|
||||
}
|
||||
else {
|
||||
Standard_Real bx0,bx1,by0,by1;
|
||||
BoxOtherPolygon.Get(bx0,by0,bx1,by1);
|
||||
else
|
||||
{
|
||||
Standard_Real bx0, bx1, by0, by1;
|
||||
BoxOtherPolygon.Get(bx0, by0, bx1, by1);
|
||||
|
||||
bx0-=TheDeflection;
|
||||
by0-=TheDeflection;
|
||||
bx1+=TheDeflection;
|
||||
by1+=TheDeflection;
|
||||
bx0 -= TheDeflection;
|
||||
by0 -= TheDeflection;
|
||||
bx1 += TheDeflection;
|
||||
by1 += TheDeflection;
|
||||
Standard_Integer MaxIndexUsed = 1;
|
||||
Standard_Integer i,nbp;
|
||||
Standard_Integer Rprec,Ri;
|
||||
Standard_Real x,y;
|
||||
|
||||
Standard_Integer i, nbp;
|
||||
Standard_Integer Rprec, Ri;
|
||||
Standard_Real x, y;
|
||||
|
||||
nbp = 0;
|
||||
x = ThePnts.Value(TheIndex.Value(1)).X();
|
||||
y = ThePnts.Value(TheIndex.Value(1)).Y();
|
||||
|
||||
Rprec = CalculRegion(x,y,bx0,bx1,by0,by1);
|
||||
for(i = 2; i<=NbPntIn; i++) {
|
||||
x = ThePnts.Value(TheIndex.Value(1)).X();
|
||||
y = ThePnts.Value(TheIndex.Value(1)).Y();
|
||||
|
||||
Rprec = CalculRegion(x, y, bx0, bx1, by0, by1);
|
||||
for (i = 2; i <= NbPntIn; i++)
|
||||
{
|
||||
const gp_Pnt2d& P2d = ThePnts.Value(TheIndex.Value(i));
|
||||
Ri = CalculRegion(P2d.X(),P2d.Y(),bx0,bx1,by0,by1);
|
||||
if((Ri & Rprec)==0) {
|
||||
if(nbp) {
|
||||
if(TheIndex.Value(nbp) != TheIndex.Value(i-1)) {
|
||||
Ri = CalculRegion(P2d.X(), P2d.Y(), bx0, bx1, by0, by1);
|
||||
if ((Ri & Rprec) == 0)
|
||||
{
|
||||
if (nbp)
|
||||
{
|
||||
if (TheIndex.Value(nbp) != TheIndex.Value(i - 1))
|
||||
{
|
||||
nbp++;
|
||||
TheIndex.SetValue(nbp,TheIndex.Value(i-1));
|
||||
TheIndex.SetValue(nbp, TheIndex.Value(i - 1));
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
nbp++;
|
||||
TheIndex.SetValue(nbp,TheIndex.Value(i-1));
|
||||
TheIndex.SetValue(nbp, TheIndex.Value(i - 1));
|
||||
}
|
||||
nbp++;
|
||||
TheIndex.SetValue(nbp,TheIndex.Value(i));
|
||||
if(TheIndex.Value(i) > MaxIndexUsed) MaxIndexUsed = TheIndex.Value(i);
|
||||
TheIndex.SetValue(nbp, TheIndex.Value(i));
|
||||
if (TheIndex.Value(i) > MaxIndexUsed)
|
||||
MaxIndexUsed = TheIndex.Value(i);
|
||||
|
||||
Rprec = Ri;
|
||||
}//if((Ri & Rprec)==0) condition
|
||||
} // if((Ri & Rprec)==0) condition
|
||||
|
||||
Rprec = Ri;
|
||||
}
|
||||
if(nbp==1) {
|
||||
NbPntIn=2;
|
||||
if (nbp == 1)
|
||||
{
|
||||
NbPntIn = 2;
|
||||
myBox.SetVoid();
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
myBox.SetVoid();
|
||||
if(nbp) {
|
||||
myBox.Add(ThePnts.Value(TheIndex.Value(1)));
|
||||
if (nbp)
|
||||
{
|
||||
myBox.Add(ThePnts.Value(TheIndex.Value(1)));
|
||||
}
|
||||
Standard_Real RatioDeflection;
|
||||
Standard_Integer nbpassagedeflection = 0;
|
||||
// Standard_Integer PointHasBeenAdded = 0;
|
||||
do {
|
||||
nbpassagedeflection++;
|
||||
// Modified by Sergey KHROMOV - Mon Mar 24 12:05:28 2003 Begin
|
||||
// Standard_Real NewDeflection = 0.0000001;
|
||||
Standard_Real NewDeflection = TheDeflection;
|
||||
// Modified by Sergey KHROMOV - Mon Mar 24 12:05:29 2003 End
|
||||
for(i=2; i<=nbp; i++) {
|
||||
Standard_Integer Ii = TheIndex.Value(i);
|
||||
Standard_Integer Iim1= TheIndex.Value(i-1);
|
||||
const gp_Pnt2d& Pi = ThePnts.Value(Ii);
|
||||
const gp_Pnt2d& Pim1 = ThePnts.Value(Iim1);
|
||||
myBox.Add(Pi);
|
||||
Standard_Integer Regi = CalculRegion(Pi.X(),Pi.Y(),bx0,bx1,by0,by1);
|
||||
Standard_Integer Regim1 = CalculRegion(Pim1.X(),Pim1.Y(),bx0,bx1,by0,by1);
|
||||
if((Regi & Regim1) == 0) {
|
||||
Standard_Real u = 0.5*( TheParams.Value(Ii)
|
||||
+TheParams.Value(Iim1));
|
||||
gp_Pnt2d Pm = TheCurveTool::Value(C,u);
|
||||
Standard_Real dx,dy,t=0;
|
||||
dx=Pim1.X()-Pi.X(); if(dx<0) dx=-dx;
|
||||
dy=Pim1.Y()-Pi.Y(); if(dy<0) dy=-dy;
|
||||
if(dx+dy>1e-12) {
|
||||
gp_Lin2d L(Pim1,gp_Dir2d(gp_Vec2d(Pim1,Pi)));
|
||||
t = L.Distance(Pm);
|
||||
if((MaxIndexUsed<(TheMaxNbPoints-1)) && (t>(TheDeflection * 0.5))) {
|
||||
const gp_Pnt2d& P1=Pim1;
|
||||
nbp++;
|
||||
for(Standard_Integer j=nbp; j>=i+1; j--) {
|
||||
TheIndex.SetValue(j,TheIndex.Value(j-1));
|
||||
}
|
||||
MaxIndexUsed++;
|
||||
TheIndex.SetValue(i,MaxIndexUsed);
|
||||
ThePnts.SetValue(MaxIndexUsed,Pm);
|
||||
TheParams.SetValue(MaxIndexUsed,u);
|
||||
|
||||
Standard_Real u1m = 0.5*(u+TheParams.Value(TheIndex.Value(i-1)));
|
||||
gp_Pnt2d P1m = TheCurveTool::Value(C,u1m);
|
||||
gp_Lin2d L1m(P1,gp_Dir2d(gp_Vec2d(P1,Pm)));
|
||||
t = L1m.Distance(P1m);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(t>NewDeflection) {
|
||||
NewDeflection = t;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(NewDeflection)
|
||||
RatioDeflection = TheDeflection / NewDeflection;
|
||||
else RatioDeflection = 10.0;
|
||||
TheDeflection = NewDeflection;
|
||||
NbPntIn = nbp;
|
||||
}
|
||||
while((RatioDeflection<3.0)
|
||||
&& (nbpassagedeflection < 3)
|
||||
&& (MaxIndexUsed<(TheMaxNbPoints-2)));
|
||||
// Standard_Integer PointHasBeenAdded = 0;
|
||||
do
|
||||
{
|
||||
nbpassagedeflection++;
|
||||
// Modified by Sergey KHROMOV - Mon Mar 24 12:05:28 2003 Begin
|
||||
// Standard_Real NewDeflection = 0.0000001;
|
||||
Standard_Real NewDeflection = TheDeflection;
|
||||
// Modified by Sergey KHROMOV - Mon Mar 24 12:05:29 2003 End
|
||||
for (i = 2; i <= nbp; i++)
|
||||
{
|
||||
Standard_Integer Ii = TheIndex.Value(i);
|
||||
Standard_Integer Iim1 = TheIndex.Value(i - 1);
|
||||
const gp_Pnt2d& Pi = ThePnts.Value(Ii);
|
||||
const gp_Pnt2d& Pim1 = ThePnts.Value(Iim1);
|
||||
myBox.Add(Pi);
|
||||
Standard_Integer Regi = CalculRegion(Pi.X(), Pi.Y(), bx0, bx1, by0, by1);
|
||||
Standard_Integer Regim1 = CalculRegion(Pim1.X(), Pim1.Y(), bx0, bx1, by0, by1);
|
||||
if ((Regi & Regim1) == 0)
|
||||
{
|
||||
Standard_Real u = 0.5 * (TheParams.Value(Ii) + TheParams.Value(Iim1));
|
||||
gp_Pnt2d Pm = TheCurveTool::Value(C, u);
|
||||
Standard_Real dx, dy, t = 0;
|
||||
dx = Pim1.X() - Pi.X();
|
||||
if (dx < 0)
|
||||
dx = -dx;
|
||||
dy = Pim1.Y() - Pi.Y();
|
||||
if (dy < 0)
|
||||
dy = -dy;
|
||||
if (dx + dy > 1e-12)
|
||||
{
|
||||
gp_Lin2d L(Pim1, gp_Dir2d(gp_Vec2d(Pim1, Pi)));
|
||||
t = L.Distance(Pm);
|
||||
if ((MaxIndexUsed < (TheMaxNbPoints - 1)) && (t > (TheDeflection * 0.5)))
|
||||
{
|
||||
const gp_Pnt2d& P1 = Pim1;
|
||||
nbp++;
|
||||
for (Standard_Integer j = nbp; j >= i + 1; j--)
|
||||
{
|
||||
TheIndex.SetValue(j, TheIndex.Value(j - 1));
|
||||
}
|
||||
MaxIndexUsed++;
|
||||
TheIndex.SetValue(i, MaxIndexUsed);
|
||||
ThePnts.SetValue(MaxIndexUsed, Pm);
|
||||
TheParams.SetValue(MaxIndexUsed, u);
|
||||
|
||||
Standard_Real u1m = 0.5 * (u + TheParams.Value(TheIndex.Value(i - 1)));
|
||||
gp_Pnt2d P1m = TheCurveTool::Value(C, u1m);
|
||||
gp_Lin2d L1m(P1, gp_Dir2d(gp_Vec2d(P1, Pm)));
|
||||
t = L1m.Distance(P1m);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (t > NewDeflection)
|
||||
{
|
||||
NewDeflection = t;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (NewDeflection)
|
||||
RatioDeflection = TheDeflection / NewDeflection;
|
||||
else
|
||||
RatioDeflection = 10.0;
|
||||
TheDeflection = NewDeflection;
|
||||
NbPntIn = nbp;
|
||||
} while ((RatioDeflection < 3.0) && (nbpassagedeflection < 3)
|
||||
&& (MaxIndexUsed < (TheMaxNbPoints - 2)));
|
||||
}
|
||||
|
||||
TheDeflection*=MAJORATION_DEFLECTION;
|
||||
TheDeflection *= MAJORATION_DEFLECTION;
|
||||
myBox.Enlarge(TheDeflection);
|
||||
}
|
||||
ClosedPolygon = Standard_False;
|
||||
Dump();
|
||||
}
|
||||
|
||||
Standard_Boolean IntCurve_Polygon2dGen::AutoIntersectionIsPossible() const
|
||||
{
|
||||
|
||||
Standard_Boolean IntCurve_Polygon2dGen::AutoIntersectionIsPossible() const {
|
||||
|
||||
gp_Vec2d VRef(ThePnts.Value(TheIndex.Value(1)),
|
||||
ThePnts.Value(TheIndex.Value(2)));
|
||||
for(Standard_Integer i=3; i<=NbPntIn; i++) {
|
||||
gp_Vec2d V(ThePnts.Value(TheIndex.Value(i-1)),
|
||||
ThePnts.Value(TheIndex.Value(i)));
|
||||
if(V.Dot(VRef)<0.0) {
|
||||
return(Standard_True);
|
||||
gp_Vec2d VRef(ThePnts.Value(TheIndex.Value(1)), ThePnts.Value(TheIndex.Value(2)));
|
||||
for (Standard_Integer i = 3; i <= NbPntIn; i++)
|
||||
{
|
||||
gp_Vec2d V(ThePnts.Value(TheIndex.Value(i - 1)), ThePnts.Value(TheIndex.Value(i)));
|
||||
if (V.Dot(VRef) < 0.0)
|
||||
{
|
||||
return (Standard_True);
|
||||
}
|
||||
}
|
||||
return(Standard_False);
|
||||
return (Standard_False);
|
||||
}
|
||||
|
||||
//======================================================================
|
||||
Standard_Real IntCurve_Polygon2dGen::ApproxParamOnCurve( const Standard_Integer Aindex
|
||||
,const Standard_Real TheParamOnLine)
|
||||
const
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Real IntCurve_Polygon2dGen::ApproxParamOnCurve(const Standard_Integer Aindex,
|
||||
const Standard_Real TheParamOnLine) const
|
||||
{
|
||||
Standard_Integer Indexp1,Index = Aindex;
|
||||
Standard_Integer Indexp1, Index = Aindex;
|
||||
Standard_Real ParamOnLine = TheParamOnLine;
|
||||
if (Index > NbPntIn) {
|
||||
std::cout << "OutOfRange Polygon2d::ApproxParamOnCurve " <<std::endl;
|
||||
if (Index > NbPntIn)
|
||||
{
|
||||
std::cout << "OutOfRange Polygon2d::ApproxParamOnCurve " << std::endl;
|
||||
}
|
||||
if((Index == NbPntIn) && (ParamOnLine == 0.0)) {
|
||||
Index--; ParamOnLine=1.0;
|
||||
if ((Index == NbPntIn) && (ParamOnLine == 0.0))
|
||||
{
|
||||
Index--;
|
||||
ParamOnLine = 1.0;
|
||||
}
|
||||
if(Index==0) {
|
||||
Index=1;
|
||||
if (Index == 0)
|
||||
{
|
||||
Index = 1;
|
||||
ParamOnLine = 0.0;
|
||||
}
|
||||
Indexp1 = TheIndex.Value(Index+1);
|
||||
Indexp1 = TheIndex.Value(Index + 1);
|
||||
Index = TheIndex.Value(Index);
|
||||
|
||||
Standard_Real du = TheParams.Value(Indexp1)-TheParams.Value(Index);
|
||||
Standard_Real du = TheParams.Value(Indexp1) - TheParams.Value(Index);
|
||||
Standard_Real u = TheParams.Value(Index) + ParamOnLine * du;
|
||||
return(u);
|
||||
return (u);
|
||||
}
|
||||
|
||||
|
||||
//======================================================================
|
||||
#if TEST
|
||||
|
||||
extern Standard_Boolean DebugPolygon2d;
|
||||
extern void DrawSegmentBlanc(const gp_Pnt2d& _P1,const gp_Pnt2d& _P2);
|
||||
extern void DrawSegment(const gp_Pnt2d& _P1,const gp_Pnt2d& _P2);
|
||||
extern void DrawSegmentBlanc(const gp_Pnt2d& _P1, const gp_Pnt2d& _P2);
|
||||
extern void DrawSegment(const gp_Pnt2d& _P1, const gp_Pnt2d& _P2);
|
||||
|
||||
void IntCurve_Polygon2dGen::Dump(void) const {
|
||||
if(!DebugPolygon2d) return;
|
||||
Standard_Real bx0,bx1,by0,by1;
|
||||
if(myBox.IsVoid()) return;
|
||||
myBox.Get(bx0,by0,bx1,by1);
|
||||
DrawSegment(gp_Pnt2d(bx0,by0),gp_Pnt2d(bx1,by0));
|
||||
DrawSegment(gp_Pnt2d(bx1,by0),gp_Pnt2d(bx1,by1));
|
||||
DrawSegment(gp_Pnt2d(bx1,by1),gp_Pnt2d(bx0,by1));
|
||||
DrawSegment(gp_Pnt2d(bx0,by1),gp_Pnt2d(bx0,by0));
|
||||
void IntCurve_Polygon2dGen::Dump(void) const
|
||||
{
|
||||
if (!DebugPolygon2d)
|
||||
return;
|
||||
Standard_Real bx0, bx1, by0, by1;
|
||||
if (myBox.IsVoid())
|
||||
return;
|
||||
myBox.Get(bx0, by0, bx1, by1);
|
||||
DrawSegment(gp_Pnt2d(bx0, by0), gp_Pnt2d(bx1, by0));
|
||||
DrawSegment(gp_Pnt2d(bx1, by0), gp_Pnt2d(bx1, by1));
|
||||
DrawSegment(gp_Pnt2d(bx1, by1), gp_Pnt2d(bx0, by1));
|
||||
DrawSegment(gp_Pnt2d(bx0, by1), gp_Pnt2d(bx0, by0));
|
||||
Standard_Integer i;
|
||||
if(NbPntIn<=1) return;
|
||||
for(i=2;i<=NbPntIn; i++) {
|
||||
DrawSegmentBlanc(ThePnts.Value(TheIndex.Value(i-1)),ThePnts.Value(TheIndex.Value(i)));
|
||||
if (NbPntIn <= 1)
|
||||
return;
|
||||
for (i = 2; i <= NbPntIn; i++)
|
||||
{
|
||||
DrawSegmentBlanc(ThePnts.Value(TheIndex.Value(i - 1)), ThePnts.Value(TheIndex.Value(i)));
|
||||
}
|
||||
}
|
||||
#else
|
||||
void IntCurve_Polygon2dGen::Dump(void) const {
|
||||
void IntCurve_Polygon2dGen::Dump(void) const
|
||||
{
|
||||
static int debug = 0;
|
||||
if(debug) {
|
||||
Standard_Real bx0,bx1,by0,by1;
|
||||
|
||||
std::cout<<"\n ----- Dump of IntCurve_Polygon2dGen -----"<<std::endl;
|
||||
if(myBox.IsVoid()) {
|
||||
std::cout<<" Polygone Vide "<<std::endl;
|
||||
if (debug)
|
||||
{
|
||||
Standard_Real bx0, bx1, by0, by1;
|
||||
|
||||
std::cout << "\n ----- Dump of IntCurve_Polygon2dGen -----" << std::endl;
|
||||
if (myBox.IsVoid())
|
||||
{
|
||||
std::cout << " Polygone Vide " << std::endl;
|
||||
return;
|
||||
}
|
||||
myBox.Get(bx0,by0,bx1,by1);
|
||||
std::cout<<" bx0:"<<bx0 <<std::endl;
|
||||
std::cout<<" by0:"<<by0<<std::endl;
|
||||
std::cout<<" bx1:"<<bx1<<std::endl;
|
||||
std::cout<<" by1:"<<by1<<std::endl;
|
||||
|
||||
myBox.Get(bx0, by0, bx1, by1);
|
||||
std::cout << " bx0:" << bx0 << std::endl;
|
||||
std::cout << " by0:" << by0 << std::endl;
|
||||
std::cout << " bx1:" << bx1 << std::endl;
|
||||
std::cout << " by1:" << by1 << std::endl;
|
||||
|
||||
Standard_Integer i;
|
||||
for(i=1;i<=NbPntIn; i++) {
|
||||
for (i = 1; i <= NbPntIn; i++)
|
||||
{
|
||||
const gp_Pnt2d& P = ThePnts(TheIndex(i));
|
||||
std::cout<<" ("<<i<<") u:"<<TheParams.Value(TheIndex(i))<<" X:"<<P.X()<<" Y:"<<P.Y()<<std::endl;
|
||||
std::cout << " (" << i << ") u:" << TheParams.Value(TheIndex(i)) << " X:" << P.X()
|
||||
<< " Y:" << P.Y() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
//======================================================================
|
||||
void IntCurve_Polygon2dGen::Segment(const Standard_Integer theIndex,
|
||||
gp_Pnt2d &theBegin, gp_Pnt2d &theEnd) const
|
||||
gp_Pnt2d& theBegin,
|
||||
gp_Pnt2d& theEnd) const
|
||||
{
|
||||
Standard_Integer ind = theIndex;
|
||||
theBegin = ThePnts(TheIndex(theIndex));
|
||||
if (theIndex >= NbPntIn) {
|
||||
theBegin = ThePnts(TheIndex(theIndex));
|
||||
if (theIndex >= NbPntIn)
|
||||
{
|
||||
if (!ClosedPolygon)
|
||||
throw Standard_OutOfRange("IntCurve_Polygon2dGen::Segment!");
|
||||
ind = 0;
|
||||
}
|
||||
theEnd = ThePnts(TheIndex(ind+1));
|
||||
theEnd = ThePnts(TheIndex(ind + 1));
|
||||
}
|
||||
|
||||
//======================================================================
|
||||
|
||||
@@ -16,54 +16,48 @@
|
||||
|
||||
#include <Extrema_POnCurv2d.hxx>
|
||||
|
||||
Standard_Real IntCurve_ProjPCurGen::FindParameter
|
||||
(const TheCurve& C,
|
||||
const gp_Pnt2d& P,
|
||||
const Standard_Real LowParameter,
|
||||
const Standard_Real HighParameter,
|
||||
const Standard_Real)
|
||||
Standard_Real IntCurve_ProjPCurGen::FindParameter(const TheCurve& C,
|
||||
const gp_Pnt2d& P,
|
||||
const Standard_Real LowParameter,
|
||||
const Standard_Real HighParameter,
|
||||
const Standard_Real)
|
||||
{
|
||||
Standard_Real theparam,defaultparam;
|
||||
Standard_Integer NbPts = TheCurveTool::NbSamples(C);
|
||||
Standard_Real theEpsX = TheCurveTool::EpsX(C);
|
||||
Standard_Real theparam, defaultparam;
|
||||
Standard_Integer NbPts = TheCurveTool::NbSamples(C);
|
||||
Standard_Real theEpsX = TheCurveTool::EpsX(C);
|
||||
Extrema_POnCurv2d POnC;
|
||||
|
||||
IntCurve_TheCurveLocator::Locate(P,C,NbPts,LowParameter,HighParameter,POnC);
|
||||
defaultparam = POnC.Parameter();
|
||||
IntCurve_TheLocateExtPC Loc(P,C,defaultparam,theEpsX);
|
||||
|
||||
if(Loc.IsDone() == Standard_False) {
|
||||
IntCurve_TheCurveLocator::Locate(P, C, NbPts, LowParameter, HighParameter, POnC);
|
||||
defaultparam = POnC.Parameter();
|
||||
IntCurve_TheLocateExtPC Loc(P, C, defaultparam, theEpsX);
|
||||
|
||||
if (Loc.IsDone() == Standard_False)
|
||||
{
|
||||
//-- cout<<"\n Erreur dans LocateExtPC "<<endl;
|
||||
theparam = defaultparam;
|
||||
}
|
||||
else {
|
||||
if(Loc.IsMin() == Standard_False) {
|
||||
else
|
||||
{
|
||||
if (Loc.IsMin() == Standard_False)
|
||||
{
|
||||
//-- cout<<"\n Erreur dans LocateExtPC (Maximum trouve) "<<endl;
|
||||
theparam = defaultparam;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
theparam = Loc.Point().Parameter();
|
||||
}
|
||||
}
|
||||
return theparam;
|
||||
}
|
||||
|
||||
|
||||
Standard_Real IntCurve_ProjPCurGen::FindParameter
|
||||
(const TheCurve& C,
|
||||
const gp_Pnt2d& P,
|
||||
const Standard_Real Tol)
|
||||
Standard_Real IntCurve_ProjPCurGen::FindParameter(const TheCurve& C,
|
||||
const gp_Pnt2d& P,
|
||||
const Standard_Real Tol)
|
||||
{
|
||||
|
||||
Standard_Real theParam;
|
||||
theParam = FindParameter( C
|
||||
,P
|
||||
,TheCurveTool::FirstParameter(C)
|
||||
,TheCurveTool::LastParameter(C)
|
||||
,Tol);
|
||||
theParam =
|
||||
FindParameter(C, P, TheCurveTool::FirstParameter(C), TheCurveTool::LastParameter(C), Tol);
|
||||
return theParam;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -21,103 +21,103 @@
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
|
||||
|
||||
//======================================================================
|
||||
//== On echantillonne sur le Domain de la Curve NbPts Points
|
||||
//== On echantillonne sur le Domain de la Curve NbPts Points
|
||||
//== a parametres constants.
|
||||
//==
|
||||
//== On estime la fleche maximum en prenant la distance maxi entre la
|
||||
//== droite Curve.Value(X(i))-->Curve.Value(X(i+1))
|
||||
//==
|
||||
//== On estime la fleche maximum en prenant la distance maxi entre la
|
||||
//== droite Curve.Value(X(i))-->Curve.Value(X(i+1))
|
||||
//== et le point Curve.Value(X(i+1/2))
|
||||
//======================================================================
|
||||
IntCurveSurface_Polygon::IntCurveSurface_Polygon(const TheCurve& C,
|
||||
const Standard_Integer tNbPts):
|
||||
ThePnts(1,(tNbPts<5)? 5 : tNbPts)
|
||||
{
|
||||
Standard_Integer NbPts = (tNbPts<5)? 5 : tNbPts;
|
||||
NbPntIn = NbPts;
|
||||
Binf = TheCurveTool::FirstParameter(C);
|
||||
Bsup = TheCurveTool::LastParameter(C);
|
||||
Init(C);
|
||||
IntCurveSurface_Polygon::IntCurveSurface_Polygon(const TheCurve& C, const Standard_Integer tNbPts)
|
||||
: ThePnts(1, (tNbPts < 5) ? 5 : tNbPts)
|
||||
{
|
||||
Standard_Integer NbPts = (tNbPts < 5) ? 5 : tNbPts;
|
||||
NbPntIn = NbPts;
|
||||
Binf = TheCurveTool::FirstParameter(C);
|
||||
Bsup = TheCurveTool::LastParameter(C);
|
||||
Init(C);
|
||||
}
|
||||
|
||||
|
||||
|
||||
IntCurveSurface_Polygon::IntCurveSurface_Polygon(const TheCurve& C,
|
||||
const Standard_Real U1,
|
||||
const Standard_Real U2,
|
||||
const Standard_Integer tNbPts):
|
||||
ThePnts(1,(tNbPts<5)? 5 : tNbPts) , Binf(U1) , Bsup(U2)
|
||||
{
|
||||
|
||||
|
||||
Standard_Integer NbPts = (tNbPts<5)? 5 : tNbPts;
|
||||
NbPntIn = NbPts;
|
||||
const Standard_Real U1,
|
||||
const Standard_Real U2,
|
||||
const Standard_Integer tNbPts)
|
||||
: ThePnts(1, (tNbPts < 5) ? 5 : tNbPts),
|
||||
Binf(U1),
|
||||
Bsup(U2)
|
||||
{
|
||||
|
||||
Standard_Integer NbPts = (tNbPts < 5) ? 5 : tNbPts;
|
||||
NbPntIn = NbPts;
|
||||
Init(C);
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
IntCurveSurface_Polygon::IntCurveSurface_Polygon(const TheCurve& C,
|
||||
const TColStd_Array1OfReal& Upars)
|
||||
: ThePnts(1, Upars.Length()),
|
||||
Binf(Upars(Upars.Lower())),
|
||||
Bsup(Upars(Upars.Upper()))
|
||||
{
|
||||
|
||||
IntCurveSurface_Polygon::IntCurveSurface_Polygon(const TheCurve& C,
|
||||
const TColStd_Array1OfReal& Upars):
|
||||
ThePnts(1,Upars.Length()) , Binf(Upars(Upars.Lower())) , Bsup(Upars(Upars.Upper()))
|
||||
{
|
||||
|
||||
//ddout << "IntCurveSurface_Polygon::IntCurveSurface_Polygon" << endl;
|
||||
// ddout << "IntCurveSurface_Polygon::IntCurveSurface_Polygon" << endl;
|
||||
Standard_Integer NbPts = Upars.Length();
|
||||
//ddout << "NbPts :" << NbPts << endl;
|
||||
// ddout << "NbPts :" << NbPts << endl;
|
||||
NbPntIn = NbPts;
|
||||
Init(C, Upars);
|
||||
}
|
||||
|
||||
void IntCurveSurface_Polygon::Init(const TheCurve& C)
|
||||
{
|
||||
|
||||
void IntCurveSurface_Polygon::Init(const TheCurve& C) {
|
||||
|
||||
Standard_Real u=Binf;
|
||||
Standard_Real u1=Bsup;
|
||||
Standard_Real du=(u1-u)/(Standard_Real)(NbPntIn-1);
|
||||
Standard_Integer i=1;
|
||||
gp_Pnt P;
|
||||
do {
|
||||
TheCurveTool::D0(C,u,P);
|
||||
Standard_Real u = Binf;
|
||||
Standard_Real u1 = Bsup;
|
||||
Standard_Real du = (u1 - u) / (Standard_Real)(NbPntIn - 1);
|
||||
Standard_Integer i = 1;
|
||||
gp_Pnt P;
|
||||
do
|
||||
{
|
||||
TheCurveTool::D0(C, u, P);
|
||||
TheBnd.Add(P);
|
||||
ThePnts.SetValue(i,P);
|
||||
u+=du;
|
||||
ThePnts.SetValue(i, P);
|
||||
u += du;
|
||||
i++;
|
||||
}
|
||||
while(i<=NbPntIn);
|
||||
|
||||
} while (i <= NbPntIn);
|
||||
|
||||
//-----------------------------------------------------
|
||||
//--- Calcul d un majorant de fleche approche
|
||||
//---
|
||||
TheDeflection = 0.0;
|
||||
|
||||
if(NbPntIn>3) {
|
||||
|
||||
i=1;
|
||||
u=Binf;
|
||||
u+=du * 0.5;
|
||||
|
||||
do {
|
||||
gp_Pnt Pm=TheCurveTool::Value(C,u);
|
||||
gp_Pnt P1=ThePnts.Value(i);
|
||||
gp_Pnt P2=ThePnts.Value(i+1);
|
||||
gp_Lin L(P1,gp_Dir(gp_Vec(P1,P2)));
|
||||
Standard_Real t=L.Distance(Pm);
|
||||
|
||||
if(t>TheDeflection) {
|
||||
TheDeflection = t;
|
||||
if (NbPntIn > 3)
|
||||
{
|
||||
|
||||
i = 1;
|
||||
u = Binf;
|
||||
u += du * 0.5;
|
||||
|
||||
do
|
||||
{
|
||||
gp_Pnt Pm = TheCurveTool::Value(C, u);
|
||||
gp_Pnt P1 = ThePnts.Value(i);
|
||||
gp_Pnt P2 = ThePnts.Value(i + 1);
|
||||
gp_Lin L(P1, gp_Dir(gp_Vec(P1, P2)));
|
||||
Standard_Real t = L.Distance(Pm);
|
||||
|
||||
if (t > TheDeflection)
|
||||
{
|
||||
TheDeflection = t;
|
||||
}
|
||||
u+=du;
|
||||
u += du;
|
||||
i++;
|
||||
}
|
||||
while(i<NbPntIn);
|
||||
|
||||
TheBnd.Enlarge(1.5*TheDeflection);
|
||||
} while (i < NbPntIn);
|
||||
|
||||
TheBnd.Enlarge(1.5 * TheDeflection);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
TheBnd.Enlarge(1e-10);
|
||||
}
|
||||
ClosedPolygon = Standard_False;
|
||||
@@ -125,108 +125,114 @@ void IntCurveSurface_Polygon::Init(const TheCurve& C) {
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
void IntCurveSurface_Polygon::Init(const TheCurve& C, const TColStd_Array1OfReal& Upars)
|
||||
{
|
||||
|
||||
void IntCurveSurface_Polygon::Init(const TheCurve& C,
|
||||
const TColStd_Array1OfReal& Upars) {
|
||||
|
||||
//ddout << "IntCurveSurface_Polygon::Init" << endl;
|
||||
Standard_Real u=Binf;
|
||||
Standard_Integer i=1, i0 = Upars.Lower()-1;
|
||||
gp_Pnt P;
|
||||
// ddout << "IntCurveSurface_Polygon::Init" << endl;
|
||||
Standard_Real u = Binf;
|
||||
Standard_Integer i = 1, i0 = Upars.Lower() - 1;
|
||||
gp_Pnt P;
|
||||
|
||||
myParams = new TColStd_HArray1OfReal(1, Upars.Length());
|
||||
do {
|
||||
//ddout << "-------------Parameter : " << i << " " << Upars(i+i0) << endl;
|
||||
myParams->SetValue(i, Upars(i+i0));
|
||||
TheCurveTool::D0(C,Upars(i+i0),P);
|
||||
//ddout << "P : " << P.X() << " " << P.Y() << " " << P.Z() << endl;
|
||||
do
|
||||
{
|
||||
// ddout << "-------------Parameter : " << i << " " << Upars(i+i0) << endl;
|
||||
myParams->SetValue(i, Upars(i + i0));
|
||||
TheCurveTool::D0(C, Upars(i + i0), P);
|
||||
// ddout << "P : " << P.X() << " " << P.Y() << " " << P.Z() << endl;
|
||||
TheBnd.Add(P);
|
||||
ThePnts.SetValue(i,P);
|
||||
ThePnts.SetValue(i, P);
|
||||
i++;
|
||||
}
|
||||
while(i<=NbPntIn);
|
||||
|
||||
} while (i <= NbPntIn);
|
||||
|
||||
//-----------------------------------------------------
|
||||
//--- Calcul d un majorant de fleche approche
|
||||
//---
|
||||
TheDeflection = 0.0;
|
||||
|
||||
if(NbPntIn>3) {
|
||||
|
||||
i=1;
|
||||
//ddout << "Deflection estimation" << endl;
|
||||
do {
|
||||
u = 0.5*(Upars(i0+i)+Upars(i0+i+1));
|
||||
//ddout << "===========Parameter : " << i << " " << u << endl;
|
||||
gp_Pnt Pm=TheCurveTool::Value(C,u);
|
||||
//ddout << "Pm : " << Pm.X() << " " << Pm.Y() << " " << Pm.Z() << endl;
|
||||
gp_Pnt P1=ThePnts.Value(i);
|
||||
//ddout << "P1 : " << P1.X() << " " << P1.Y() << " " << P1.Z() << endl;
|
||||
gp_Pnt P2=ThePnts.Value(i+1);
|
||||
//ddout << "P2 : " << P2.X() << " " << P2.Y() << " " << P2.Z() << endl;
|
||||
gp_Lin L(P1,gp_Dir(gp_Vec(P1,P2)));
|
||||
Standard_Real t=L.Distance(Pm);
|
||||
//ddout << "Distance " << t << endl;
|
||||
if(t>TheDeflection) {
|
||||
TheDeflection = t;
|
||||
if (NbPntIn > 3)
|
||||
{
|
||||
|
||||
i = 1;
|
||||
// ddout << "Deflection estimation" << endl;
|
||||
do
|
||||
{
|
||||
u = 0.5 * (Upars(i0 + i) + Upars(i0 + i + 1));
|
||||
// ddout << "===========Parameter : " << i << " " << u << endl;
|
||||
gp_Pnt Pm = TheCurveTool::Value(C, u);
|
||||
// ddout << "Pm : " << Pm.X() << " " << Pm.Y() << " " << Pm.Z() << endl;
|
||||
gp_Pnt P1 = ThePnts.Value(i);
|
||||
// ddout << "P1 : " << P1.X() << " " << P1.Y() << " " << P1.Z() << endl;
|
||||
gp_Pnt P2 = ThePnts.Value(i + 1);
|
||||
// ddout << "P2 : " << P2.X() << " " << P2.Y() << " " << P2.Z() << endl;
|
||||
gp_Lin L(P1, gp_Dir(gp_Vec(P1, P2)));
|
||||
Standard_Real t = L.Distance(Pm);
|
||||
// ddout << "Distance " << t << endl;
|
||||
if (t > TheDeflection)
|
||||
{
|
||||
TheDeflection = t;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
while(i<NbPntIn);
|
||||
//ddout << " TheDeflection = " << TheDeflection << endl;
|
||||
TheBnd.Enlarge(1.5*TheDeflection);
|
||||
} while (i < NbPntIn);
|
||||
// ddout << " TheDeflection = " << TheDeflection << endl;
|
||||
TheBnd.Enlarge(1.5 * TheDeflection);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
TheBnd.Enlarge(1e-10);
|
||||
}
|
||||
ClosedPolygon = Standard_False;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
//======================================================================
|
||||
Standard_Real IntCurveSurface_Polygon::ApproxParamOnCurve(const Standard_Integer TheIndex,
|
||||
const Standard_Real TheParamOnLine) const
|
||||
const Standard_Real TheParamOnLine) const
|
||||
{
|
||||
//ddout << "IntCurveSurface_Polygon::ApproxParamOnCurve" << endl;
|
||||
if(TheParamOnLine < 0.0 || TheParamOnLine >1.0) {
|
||||
// ddout << "IntCurveSurface_Polygon::ApproxParamOnCurve" << endl;
|
||||
if (TheParamOnLine < 0.0 || TheParamOnLine > 1.0)
|
||||
{
|
||||
#ifdef OCCT_DEBUG
|
||||
std::cout<<" ParamOnLine = "<<TheParamOnLine<<" avec Index = "
|
||||
<<TheIndex<<" dans IntCurveSurface_Polygon::ApproxParamOnCurve"<<std::endl;
|
||||
std::cout << " ParamOnLine = " << TheParamOnLine << " avec Index = " << TheIndex
|
||||
<< " dans IntCurveSurface_Polygon::ApproxParamOnCurve" << std::endl;
|
||||
#endif
|
||||
return(Binf+(TheParamOnLine*(Bsup-Binf))/(Standard_Real)(NbPntIn-1));
|
||||
return (Binf + (TheParamOnLine * (Bsup - Binf)) / (Standard_Real)(NbPntIn - 1));
|
||||
}
|
||||
|
||||
Standard_Integer Index = TheIndex;
|
||||
Standard_Integer Index = TheIndex;
|
||||
Standard_Real ParamOnLine = TheParamOnLine;
|
||||
#ifdef OCCT_DEBUG
|
||||
if (Index > NbPntIn) {
|
||||
std::cout << "OutOfRange Polygon::ApproxParamOnCurve " <<std::endl;
|
||||
if (Index > NbPntIn)
|
||||
{
|
||||
std::cout << "OutOfRange Polygon::ApproxParamOnCurve " << std::endl;
|
||||
}
|
||||
#endif
|
||||
if((Index == NbPntIn) && (ParamOnLine == 0.0)) {
|
||||
Index--; ParamOnLine=1.0;
|
||||
if ((Index == NbPntIn) && (ParamOnLine == 0.0))
|
||||
{
|
||||
Index--;
|
||||
ParamOnLine = 1.0;
|
||||
}
|
||||
|
||||
Standard_Real du, u;
|
||||
if (myParams.IsNull())
|
||||
{
|
||||
du = (Bsup-Binf)/(Standard_Real)(NbPntIn-1);
|
||||
u = Binf + du * (Standard_Real)(Index-1);
|
||||
}
|
||||
{
|
||||
du = (Bsup - Binf) / (Standard_Real)(NbPntIn - 1);
|
||||
u = Binf + du * (Standard_Real)(Index - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
du = myParams->Value(Index+1) - myParams->Value(Index);
|
||||
u = myParams->Value(Index);
|
||||
}
|
||||
{
|
||||
du = myParams->Value(Index + 1) - myParams->Value(Index);
|
||||
u = myParams->Value(Index);
|
||||
}
|
||||
|
||||
u += du * ParamOnLine;
|
||||
return (u);
|
||||
}
|
||||
|
||||
|
||||
//======================================================================
|
||||
void IntCurveSurface_Polygon::Dump(void) const {
|
||||
//=================================================================================================
|
||||
|
||||
void IntCurveSurface_Polygon::Dump(void) const
|
||||
{
|
||||
#if 0
|
||||
static Standard_Integer Compteur=0;
|
||||
char tamp[100];
|
||||
@@ -252,5 +258,6 @@ void IntCurveSurface_Polygon::Dump(void) const {
|
||||
fclose(fp);
|
||||
#endif
|
||||
}
|
||||
|
||||
//======================================================================
|
||||
//======================================================================
|
||||
|
||||
@@ -14,20 +14,23 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
void IntCurveSurface_PolygonTool::Dump(const ThePolygon& L) {
|
||||
void IntCurveSurface_PolygonTool::Dump(const ThePolygon& L)
|
||||
{
|
||||
|
||||
static Standard_Integer num=0;
|
||||
static Standard_Integer num = 0;
|
||||
num++;
|
||||
Standard_Integer nbs = IntCurveSurface_PolygonTool::NbSegments(L);
|
||||
std::cout<<"\npol2d "<<num<<" "<<nbs<<std::endl;
|
||||
std::cout<<"Deflection "<<IntCurveSurface_PolygonTool::DeflectionOverEstimation(L)<<std::endl;
|
||||
|
||||
for(Standard_Integer i=1;i<=nbs;i++) {
|
||||
gp_Pnt P(IntCurveSurface_PolygonTool::BeginOfSeg(L,i));
|
||||
std::cout<<"pnt "<<num<<" "<<i<<" "<<P.X()<<" "<<P.Y()<<" "<<P.Z()<<std::endl;
|
||||
std::cout << "\npol2d " << num << " " << nbs << std::endl;
|
||||
std::cout << "Deflection " << IntCurveSurface_PolygonTool::DeflectionOverEstimation(L)
|
||||
<< std::endl;
|
||||
|
||||
for (Standard_Integer i = 1; i <= nbs; i++)
|
||||
{
|
||||
gp_Pnt P(IntCurveSurface_PolygonTool::BeginOfSeg(L, i));
|
||||
std::cout << "pnt " << num << " " << i << " " << P.X() << " " << P.Y() << " " << P.Z()
|
||||
<< std::endl;
|
||||
}
|
||||
gp_Pnt PF(IntCurveSurface_PolygonTool::EndOfSeg(L,nbs));
|
||||
std::cout<<"pnt "<<num<<" "<<nbs<<" "<< PF.X()<<" "<<PF.Y()<<" "<<PF.Z()<<std::endl;
|
||||
gp_Pnt PF(IntCurveSurface_PolygonTool::EndOfSeg(L, nbs));
|
||||
std::cout << "pnt " << num << " " << nbs << " " << PF.X() << " " << PF.Y() << " " << PF.Z()
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -12,6 +12,7 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
void IntCurveSurface_PolyhedronTool::Dump(const ThePolyhedron& polyh) {
|
||||
void IntCurveSurface_PolyhedronTool::Dump(const ThePolyhedron& polyh)
|
||||
{
|
||||
polyh.Dump();
|
||||
}
|
||||
|
||||
@@ -22,27 +22,42 @@
|
||||
#include <IntSurf_Quadric.hxx>
|
||||
#include <GeomAbs_SurfaceType.hxx>
|
||||
|
||||
|
||||
#define EPSX 0.00000000000001
|
||||
#define EPSX 0.00000000000001
|
||||
#define EPSDIST 0.00000001
|
||||
#define EPSNUL 0.00000001
|
||||
#define EPSNUL 0.00000001
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
//================================================================================
|
||||
IntCurveSurface_QuadricCurveExactInter::IntCurveSurface_QuadricCurveExactInter(const TheSurface& S,
|
||||
const TheCurve& C)
|
||||
: nbpnts(-1),nbintv(-1)
|
||||
{
|
||||
const TheCurve& C)
|
||||
: nbpnts(-1),
|
||||
nbintv(-1)
|
||||
{
|
||||
GeomAbs_SurfaceType QuadricType = TheSurfaceTool::GetType(S);
|
||||
IntSurf_Quadric Quadric;
|
||||
switch(QuadricType) {
|
||||
case GeomAbs_Plane: { Quadric.SetValue(TheSurfaceTool::Plane(S)); break; }
|
||||
case GeomAbs_Cylinder: { Quadric.SetValue(TheSurfaceTool::Cylinder(S)); break; }
|
||||
case GeomAbs_Cone: { Quadric.SetValue(TheSurfaceTool::Cone(S)); break; }
|
||||
case GeomAbs_Sphere: { Quadric.SetValue(TheSurfaceTool::Sphere(S)); break; }
|
||||
default: {
|
||||
//cout<<" Probleme Sur le Type de Surface dans IntCurveSurface_Inter::InternalPerform "<<endl;
|
||||
break;
|
||||
}
|
||||
IntSurf_Quadric Quadric;
|
||||
switch (QuadricType)
|
||||
{
|
||||
case GeomAbs_Plane: {
|
||||
Quadric.SetValue(TheSurfaceTool::Plane(S));
|
||||
break;
|
||||
}
|
||||
case GeomAbs_Cylinder: {
|
||||
Quadric.SetValue(TheSurfaceTool::Cylinder(S));
|
||||
break;
|
||||
}
|
||||
case GeomAbs_Cone: {
|
||||
Quadric.SetValue(TheSurfaceTool::Cone(S));
|
||||
break;
|
||||
}
|
||||
case GeomAbs_Sphere: {
|
||||
Quadric.SetValue(TheSurfaceTool::Sphere(S));
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
// cout<<" Probleme Sur le Type de Surface dans IntCurveSurface_Inter::InternalPerform
|
||||
// "<<endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Modified by skv - Wed Jun 16 17:36:47 2004 OCC6001 Begin
|
||||
@@ -52,70 +67,84 @@ IntCurveSurface_QuadricCurveExactInter::IntCurveSurface_QuadricCurveExactInter(c
|
||||
|
||||
TheCurveTool::Intervals(C, anIntervals, GeomAbs_C1);
|
||||
|
||||
for (ii = 1; ii <= nbIntervals; ii++) {
|
||||
for (ii = 1; ii <= nbIntervals; ii++)
|
||||
{
|
||||
Standard_Real U1 = anIntervals.Value(ii);
|
||||
Standard_Real U2 = anIntervals.Value(ii + 1);
|
||||
|
||||
math_FunctionSample Sample(U1,U2,TheCurveTool::NbSamples(C,U1,U2));
|
||||
IntCurveSurface_TheQuadCurvFunc Function(Quadric,C);
|
||||
math_FunctionAllRoots Roots(Function,Sample,EPSX,EPSDIST,EPSNUL);
|
||||
|
||||
if(Roots.IsDone()) {
|
||||
Standard_Integer nbp = Roots.NbPoints();
|
||||
Standard_Integer nbi = Roots.NbIntervals();
|
||||
math_FunctionSample Sample(U1, U2, TheCurveTool::NbSamples(C, U1, U2));
|
||||
IntCurveSurface_TheQuadCurvFunc Function(Quadric, C);
|
||||
math_FunctionAllRoots Roots(Function, Sample, EPSX, EPSDIST, EPSNUL);
|
||||
|
||||
if (Roots.IsDone())
|
||||
{
|
||||
Standard_Integer nbp = Roots.NbPoints();
|
||||
Standard_Integer nbi = Roots.NbIntervals();
|
||||
Standard_Integer i;
|
||||
for( i = 1; i<=nbp; i++) {
|
||||
pnts.Append(Roots.GetPoint(i));
|
||||
//-- cout<<" QuadricCurveExactInter : Roots("<<i<<") = "<<Roots.GetPoint(i)<<endl;
|
||||
for (i = 1; i <= nbp; i++)
|
||||
{
|
||||
pnts.Append(Roots.GetPoint(i));
|
||||
//-- cout<<" QuadricCurveExactInter : Roots("<<i<<") = "<<Roots.GetPoint(i)<<endl;
|
||||
}
|
||||
|
||||
Standard_Real a,b;
|
||||
for(i = 1; i<=nbi; i++) {
|
||||
Roots.GetInterval(i,a,b);
|
||||
//cout<<" QuadricCurveExactInter : RootsSeg("<<i<<") = "<<a<<" , "<<b<<endl;
|
||||
intv.Append(a);
|
||||
intv.Append(b);
|
||||
Standard_Real a, b;
|
||||
for (i = 1; i <= nbi; i++)
|
||||
{
|
||||
Roots.GetInterval(i, a, b);
|
||||
// cout<<" QuadricCurveExactInter : RootsSeg("<<i<<") = "<<a<<" , "<<b<<endl;
|
||||
intv.Append(a);
|
||||
intv.Append(b);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ii > nbIntervals) {
|
||||
if (ii > nbIntervals)
|
||||
{
|
||||
nbpnts = pnts.Length();
|
||||
nbintv = intv.Length()/2;
|
||||
nbintv = intv.Length() / 2;
|
||||
}
|
||||
// Modified by skv - Wed Jun 16 17:36:47 2004 OCC6001 End
|
||||
// Modified by skv - Wed Jun 16 17:36:47 2004 OCC6001 End
|
||||
}
|
||||
//================================================================================
|
||||
Standard_Boolean IntCurveSurface_QuadricCurveExactInter::IsDone() const {
|
||||
return(nbpnts!=-1);
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Boolean IntCurveSurface_QuadricCurveExactInter::IsDone() const
|
||||
{
|
||||
return (nbpnts != -1);
|
||||
}
|
||||
//================================================================================
|
||||
Standard_Integer IntCurveSurface_QuadricCurveExactInter::NbRoots() const {
|
||||
return(nbpnts);
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Integer IntCurveSurface_QuadricCurveExactInter::NbRoots() const
|
||||
{
|
||||
return (nbpnts);
|
||||
}
|
||||
//================================================================================
|
||||
Standard_Integer IntCurveSurface_QuadricCurveExactInter::NbIntervals() const {
|
||||
return(nbintv);
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Integer IntCurveSurface_QuadricCurveExactInter::NbIntervals() const
|
||||
{
|
||||
return (nbintv);
|
||||
}
|
||||
//================================================================================
|
||||
Standard_Real IntCurveSurface_QuadricCurveExactInter::Root(const Standard_Integer Index) const {
|
||||
return(pnts(Index));
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Real IntCurveSurface_QuadricCurveExactInter::Root(const Standard_Integer Index) const
|
||||
{
|
||||
return (pnts(Index));
|
||||
}
|
||||
//================================================================================
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
void IntCurveSurface_QuadricCurveExactInter::Intervals(const Standard_Integer Index,
|
||||
Standard_Real& a,
|
||||
Standard_Real& b) const
|
||||
{
|
||||
Standard_Integer Index2 = Index+Index-1;
|
||||
a = intv(Index2);
|
||||
b = intv(Index2+1);
|
||||
Standard_Real& a,
|
||||
Standard_Real& b) const
|
||||
{
|
||||
Standard_Integer Index2 = Index + Index - 1;
|
||||
a = intv(Index2);
|
||||
b = intv(Index2 + 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -16,39 +16,42 @@
|
||||
|
||||
#include <gp_Vec.hxx>
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
//================================================================================
|
||||
IntCurveSurface_QuadricCurveFunc::IntCurveSurface_QuadricCurveFunc(const TheQuadric& Q,
|
||||
const TheCurve& C)
|
||||
: myQuadric(Q), myCurve(C)
|
||||
{
|
||||
}
|
||||
//================================================================================
|
||||
const TheCurve& C)
|
||||
: myQuadric(Q),
|
||||
myCurve(C)
|
||||
{
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Boolean IntCurveSurface_QuadricCurveFunc::Value(const Standard_Real Param,
|
||||
Standard_Real& F) {
|
||||
F = myQuadric.Distance(TheCurveTool::Value(myCurve,Param));
|
||||
return(Standard_True);
|
||||
Standard_Real& F)
|
||||
{
|
||||
F = myQuadric.Distance(TheCurveTool::Value(myCurve, Param));
|
||||
return (Standard_True);
|
||||
}
|
||||
|
||||
Standard_Boolean IntCurveSurface_QuadricCurveFunc::Derivative(const Standard_Real Param,
|
||||
Standard_Real& D) {
|
||||
Standard_Real& D)
|
||||
{
|
||||
gp_Pnt P;
|
||||
gp_Vec T;
|
||||
TheCurveTool::D1(myCurve,Param,P,T);
|
||||
TheCurveTool::D1(myCurve, Param, P, T);
|
||||
D = T.Dot(myQuadric.Gradient(P));
|
||||
return(Standard_True);
|
||||
return (Standard_True);
|
||||
}
|
||||
|
||||
Standard_Boolean IntCurveSurface_QuadricCurveFunc::Values(const Standard_Real Param,
|
||||
Standard_Real& F,
|
||||
Standard_Real& D) {
|
||||
Standard_Real& F,
|
||||
Standard_Real& D)
|
||||
{
|
||||
gp_Pnt P;
|
||||
gp_Vec T,Grad;
|
||||
TheCurveTool::D1(myCurve,Param,P,T);
|
||||
myQuadric.ValAndGrad(P,F,Grad);
|
||||
gp_Vec T, Grad;
|
||||
TheCurveTool::D1(myCurve, Param, P, T);
|
||||
myQuadric.ValAndGrad(P, F, Grad);
|
||||
D = T.Dot(Grad);
|
||||
return(Standard_True);
|
||||
return (Standard_True);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -13,11 +13,10 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef OCCT_DEBUG
|
||||
#define No_Standard_RangeError
|
||||
#define No_Standard_OutOfRange
|
||||
#define No_Standard_RangeError
|
||||
#define No_Standard_OutOfRange
|
||||
#endif
|
||||
|
||||
|
||||
#include <IntImp_ComputeTangence.hxx>
|
||||
#include <math_FunctionSetRoot.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
@@ -25,14 +24,14 @@
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
IntImp_Int2S::IntImp_Int2S(const ThePSurface& surf1,
|
||||
const ThePSurface& surf2,
|
||||
const Standard_Real TolTangency ) :
|
||||
done(Standard_True),
|
||||
empty(Standard_True),
|
||||
tangent(Standard_False),
|
||||
myZerParFunc(surf1,surf2),
|
||||
tol(TolTangency*TolTangency)
|
||||
IntImp_Int2S::IntImp_Int2S(const ThePSurface& surf1,
|
||||
const ThePSurface& surf2,
|
||||
const Standard_Real TolTangency)
|
||||
: done(Standard_True),
|
||||
empty(Standard_True),
|
||||
tangent(Standard_False),
|
||||
myZerParFunc(surf1, surf2),
|
||||
tol(TolTangency * TolTangency)
|
||||
{
|
||||
ua0 = ThePSurfaceTool::FirstUParameter(surf1); //-- ThePSurfaceTool::UIntervalFirst(surf1);
|
||||
va0 = ThePSurfaceTool::FirstVParameter(surf1); //-- ThePSurfaceTool::VIntervalFirst(surf1);
|
||||
@@ -44,24 +43,23 @@ tol(TolTangency*TolTangency)
|
||||
ub1 = ThePSurfaceTool::LastUParameter(surf2); //-- ThePSurfaceTool::UIntervalLast(surf2);
|
||||
vb1 = ThePSurfaceTool::LastVParameter(surf2); //-- ThePSurfaceTool::VIntervalLast(surf2);
|
||||
|
||||
ures1 = ThePSurfaceTool::UResolution(surf1,Precision::Confusion());
|
||||
vres1 = ThePSurfaceTool::VResolution(surf1,Precision::Confusion());
|
||||
ures1 = ThePSurfaceTool::UResolution(surf1, Precision::Confusion());
|
||||
vres1 = ThePSurfaceTool::VResolution(surf1, Precision::Confusion());
|
||||
|
||||
ures2 = ThePSurfaceTool::UResolution(surf2,Precision::Confusion());
|
||||
vres2 = ThePSurfaceTool::VResolution(surf2,Precision::Confusion());
|
||||
ures2 = ThePSurfaceTool::UResolution(surf2, Precision::Confusion());
|
||||
vres2 = ThePSurfaceTool::VResolution(surf2, Precision::Confusion());
|
||||
}
|
||||
|
||||
|
||||
IntImp_Int2S::IntImp_Int2S(const TColStd_Array1OfReal& Param,
|
||||
const ThePSurface& surf1,
|
||||
const ThePSurface& surf2,
|
||||
const Standard_Real TolTangency ) :
|
||||
done(Standard_True),
|
||||
empty(Standard_True),
|
||||
myZerParFunc(surf1,surf2),
|
||||
tol(TolTangency*TolTangency)
|
||||
const ThePSurface& surf1,
|
||||
const ThePSurface& surf2,
|
||||
const Standard_Real TolTangency)
|
||||
: done(Standard_True),
|
||||
empty(Standard_True),
|
||||
myZerParFunc(surf1, surf2),
|
||||
tol(TolTangency * TolTangency)
|
||||
{
|
||||
math_FunctionSetRoot Rsnld(myZerParFunc,15); //-- Modif lbr 18 MAI ?????????????
|
||||
math_FunctionSetRoot Rsnld(myZerParFunc, 15); //-- Modif lbr 18 MAI ?????????????
|
||||
ua0 = ThePSurfaceTool::FirstUParameter(surf1); //-- ThePSurfaceTool::UIntervalFirst(surf1);
|
||||
va0 = ThePSurfaceTool::FirstVParameter(surf1); //-- ThePSurfaceTool::VIntervalFirst(surf1);
|
||||
ua1 = ThePSurfaceTool::LastUParameter(surf1); //-- ThePSurfaceTool::UIntervalLast(surf1);
|
||||
@@ -72,98 +70,105 @@ tol(TolTangency*TolTangency)
|
||||
ub1 = ThePSurfaceTool::LastUParameter(surf2); //-- ThePSurfaceTool::UIntervalLast(surf2);
|
||||
vb1 = ThePSurfaceTool::LastVParameter(surf2); //-- ThePSurfaceTool::VIntervalLast(surf2);
|
||||
|
||||
ures1 = ThePSurfaceTool::UResolution(surf1,Precision::Confusion());
|
||||
vres1 = ThePSurfaceTool::VResolution(surf1,Precision::Confusion());
|
||||
ures1 = ThePSurfaceTool::UResolution(surf1, Precision::Confusion());
|
||||
vres1 = ThePSurfaceTool::VResolution(surf1, Precision::Confusion());
|
||||
|
||||
ures2 = ThePSurfaceTool::UResolution(surf2,Precision::Confusion());
|
||||
vres2 = ThePSurfaceTool::VResolution(surf2,Precision::Confusion());
|
||||
Perform(Param,Rsnld);
|
||||
}
|
||||
ures2 = ThePSurfaceTool::UResolution(surf2, Precision::Confusion());
|
||||
vres2 = ThePSurfaceTool::VResolution(surf2, Precision::Confusion());
|
||||
Perform(Param, Rsnld);
|
||||
}
|
||||
|
||||
IntImp_ConstIsoparametric IntImp_Int2S:: Perform(const TColStd_Array1OfReal& Param,
|
||||
math_FunctionSetRoot& Rsnld,
|
||||
const IntImp_ConstIsoparametric ChoixIso)
|
||||
IntImp_ConstIsoparametric IntImp_Int2S::Perform(const TColStd_Array1OfReal& Param,
|
||||
math_FunctionSetRoot& Rsnld,
|
||||
const IntImp_ConstIsoparametric ChoixIso)
|
||||
{
|
||||
Standard_Real BornInfBuf[3] = {}, BornSupBuf[3] = {}, ToleranceBuf[3] = {}, UVapBuf[3] = {};
|
||||
Standard_Real UvresBuf[4] = {};
|
||||
math_Vector BornInf (BornInfBuf, 1, 3), BornSup (BornSupBuf, 1, 3),
|
||||
Tolerance (ToleranceBuf, 1, 3), UVap (UVapBuf, 1, 3);
|
||||
TColStd_Array1OfReal Uvres (UvresBuf[0], 1, 4);
|
||||
math_Vector BornInf(BornInfBuf, 1, 3), BornSup(BornSupBuf, 1, 3), Tolerance(ToleranceBuf, 1, 3),
|
||||
UVap(UVapBuf, 1, 3);
|
||||
TColStd_Array1OfReal Uvres(UvresBuf[0], 1, 4);
|
||||
|
||||
IntImp_ConstIsoparametric BestChoix;
|
||||
|
||||
myZerParFunc.ComputeParameters(ChoixIso,Param,UVap,BornInf,BornSup,Tolerance);
|
||||
myZerParFunc.ComputeParameters(ChoixIso, Param, UVap, BornInf, BornSup, Tolerance);
|
||||
Rsnld.SetTolerance(Tolerance);
|
||||
Rsnld.Perform(myZerParFunc,UVap,BornInf,BornSup);
|
||||
Rsnld.Perform(myZerParFunc, UVap, BornInf, BornSup);
|
||||
BestChoix = ChoixIso;
|
||||
if (Rsnld.IsDone()) {
|
||||
if (Abs(myZerParFunc.Root()) <= tol) { //distance des 2 points
|
||||
if (Rsnld.IsDone())
|
||||
{
|
||||
if (Abs(myZerParFunc.Root()) <= tol)
|
||||
{ // distance des 2 points
|
||||
// dans la tolerance
|
||||
Rsnld.Root(UVap);
|
||||
empty = Standard_False;
|
||||
tangent = myZerParFunc.IsTangent(UVap,Uvres,BestChoix);
|
||||
pint.SetValue(myZerParFunc.Point(),Uvres(1),Uvres(2),Uvres(3),Uvres(4));
|
||||
if (!tangent) {
|
||||
empty = Standard_False;
|
||||
tangent = myZerParFunc.IsTangent(UVap, Uvres, BestChoix);
|
||||
pint.SetValue(myZerParFunc.Point(), Uvres(1), Uvres(2), Uvres(3), Uvres(4));
|
||||
if (!tangent)
|
||||
{
|
||||
d3d = myZerParFunc.Direction();
|
||||
d2d1 = myZerParFunc.DirectionOnS1();
|
||||
d2d2 = myZerParFunc.DirectionOnS2();
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
empty = Standard_True;
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
empty = Standard_True;
|
||||
}
|
||||
return BestChoix;
|
||||
}
|
||||
|
||||
IntImp_ConstIsoparametric IntImp_Int2S:: Perform(const TColStd_Array1OfReal& Param,
|
||||
math_FunctionSetRoot& Rsnld)
|
||||
IntImp_ConstIsoparametric IntImp_Int2S::Perform(const TColStd_Array1OfReal& Param,
|
||||
math_FunctionSetRoot& Rsnld)
|
||||
{
|
||||
gp_Vec DPUV[4];
|
||||
gp_Pnt P1,P2;
|
||||
Standard_Real Epsuv[4];
|
||||
Standard_Real DuvBuf[4];
|
||||
TColStd_Array1OfReal Duv (DuvBuf[0], 1, 4);
|
||||
Standard_Real UVd[4],UVf[4];
|
||||
gp_Vec DPUV[4];
|
||||
gp_Pnt P1, P2;
|
||||
Standard_Real Epsuv[4];
|
||||
Standard_Real DuvBuf[4];
|
||||
TColStd_Array1OfReal Duv(DuvBuf[0], 1, 4);
|
||||
Standard_Real UVd[4], UVf[4];
|
||||
IntImp_ConstIsoparametric ChoixIso[4];
|
||||
IntImp_ConstIsoparametric BestChoix = ChoixRef(0);
|
||||
const ThePSurface& Caro1 = myZerParFunc.AuxillarSurface1();
|
||||
const ThePSurface& Caro2 = myZerParFunc.AuxillarSurface2();
|
||||
const ThePSurface& Caro1 = myZerParFunc.AuxillarSurface1();
|
||||
const ThePSurface& Caro2 = myZerParFunc.AuxillarSurface2();
|
||||
|
||||
ThePSurfaceTool::D1(Caro1, Param(1),Param(2),P1,DPUV[0],DPUV[1]);
|
||||
ThePSurfaceTool::D1(Caro2, Param(3),Param(4),P2,DPUV[2],DPUV[3]);
|
||||
ThePSurfaceTool::D1(Caro1, Param(1), Param(2), P1, DPUV[0], DPUV[1]);
|
||||
ThePSurfaceTool::D1(Caro2, Param(3), Param(4), P2, DPUV[2], DPUV[3]);
|
||||
|
||||
Epsuv[0] = ThePSurfaceTool::UResolution(Caro1,Precision::Confusion());
|
||||
Epsuv[1] = ThePSurfaceTool::VResolution(Caro1,Precision::Confusion());
|
||||
Epsuv[0] = ThePSurfaceTool::UResolution(Caro1, Precision::Confusion());
|
||||
Epsuv[1] = ThePSurfaceTool::VResolution(Caro1, Precision::Confusion());
|
||||
|
||||
Epsuv[2] = ThePSurfaceTool::UResolution(Caro2,Precision::Confusion());
|
||||
Epsuv[3] = ThePSurfaceTool::VResolution(Caro2,Precision::Confusion());
|
||||
Epsuv[2] = ThePSurfaceTool::UResolution(Caro2, Precision::Confusion());
|
||||
Epsuv[3] = ThePSurfaceTool::VResolution(Caro2, Precision::Confusion());
|
||||
|
||||
for (Standard_Integer j=0;j<=3;j++)
|
||||
UVd[j] = Param(j+1);
|
||||
for (Standard_Integer j = 0; j <= 3; j++)
|
||||
UVd[j] = Param(j + 1);
|
||||
|
||||
empty = Standard_True;
|
||||
|
||||
Standard_Boolean Tangent = IntImp_ComputeTangence(DPUV,Epsuv,UVd,ChoixIso);
|
||||
Standard_Boolean Tangent = IntImp_ComputeTangence(DPUV, Epsuv, UVd, ChoixIso);
|
||||
if (Tangent)
|
||||
return BestChoix;
|
||||
|
||||
Standard_Integer i=0;
|
||||
IntImp_ConstIsoparametric CurrentChoix = BestChoix; //-- Modif 17 Mai 93
|
||||
Standard_Integer i = 0;
|
||||
IntImp_ConstIsoparametric CurrentChoix = BestChoix; //-- Modif 17 Mai 93
|
||||
|
||||
while (empty && i<= 3)
|
||||
while (empty && i <= 3)
|
||||
{
|
||||
CurrentChoix = Perform(Param,Rsnld,ChoixIso[i]);
|
||||
if(!empty) {
|
||||
BestChoix = CurrentChoix;
|
||||
CurrentChoix = Perform(Param, Rsnld, ChoixIso[i]);
|
||||
if (!empty)
|
||||
{
|
||||
BestChoix = CurrentChoix;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (!empty) { // verifier que l on ne deborde pas les frontieres
|
||||
pint.Parameters(Duv(1),Duv(2),Duv(3),Duv(4));
|
||||
if (!empty)
|
||||
{ // verifier que l on ne deborde pas les frontieres
|
||||
pint.Parameters(Duv(1), Duv(2), Duv(3), Duv(4));
|
||||
|
||||
UVd[0] = ua0; //-- ThePSurfaceTool::UIntervalFirst(Caro1);
|
||||
UVd[1] = va0; //-- ThePSurfaceTool::VIntervalFirst(Caro1);
|
||||
@@ -175,79 +180,89 @@ IntImp_ConstIsoparametric IntImp_Int2S:: Perform(const TColStd_Array1OfReal& Par
|
||||
UVf[2] = ub1; //-- ThePSurfaceTool::UIntervalLast(Caro2);
|
||||
UVf[3] = vb1; //-- ThePSurfaceTool::VIntervalLast(Caro2);
|
||||
|
||||
Standard_Integer Nc,Iiso;
|
||||
if (Duv(1) <= UVd[0]-Epsuv[0]) {
|
||||
Standard_Integer Nc, Iiso;
|
||||
if (Duv(1) <= UVd[0] - Epsuv[0])
|
||||
{
|
||||
Duv(1) = UVd[0];
|
||||
Nc =0;
|
||||
Iiso=0;
|
||||
Nc = 0;
|
||||
Iiso = 0;
|
||||
}
|
||||
else if (Duv(1) >= UVf[0]+ Epsuv[0]) {
|
||||
else if (Duv(1) >= UVf[0] + Epsuv[0])
|
||||
{
|
||||
Duv(1) = UVf[0];
|
||||
Nc =0;
|
||||
Iiso=0;
|
||||
Nc = 0;
|
||||
Iiso = 0;
|
||||
}
|
||||
else if (Duv(2) <= UVd[1] -Epsuv[1]) {
|
||||
else if (Duv(2) <= UVd[1] - Epsuv[1])
|
||||
{
|
||||
Duv(2) = UVd[1];
|
||||
Nc =0;
|
||||
Iiso=1;
|
||||
Nc = 0;
|
||||
Iiso = 1;
|
||||
}
|
||||
else if (Duv(2) >= UVf[1]+Epsuv[1]) {
|
||||
else if (Duv(2) >= UVf[1] + Epsuv[1])
|
||||
{
|
||||
Duv(2) = UVf[1];
|
||||
Nc =0;
|
||||
Iiso=1;
|
||||
Nc = 0;
|
||||
Iiso = 1;
|
||||
}
|
||||
else if (Duv(3) <= UVd[2]-Epsuv[2]) {
|
||||
else if (Duv(3) <= UVd[2] - Epsuv[2])
|
||||
{
|
||||
Duv(3) = UVd[2];
|
||||
Nc =2;
|
||||
Iiso = 2;
|
||||
Nc = 2;
|
||||
Iiso = 2;
|
||||
}
|
||||
else if (Duv(3) >= UVf[2]+Epsuv[2]) {
|
||||
else if (Duv(3) >= UVf[2] + Epsuv[2])
|
||||
{
|
||||
Duv(3) = UVf[2];
|
||||
Nc =2;
|
||||
Iiso = 2;
|
||||
Nc = 2;
|
||||
Iiso = 2;
|
||||
}
|
||||
else if (Duv(4) <= UVd[3]-Epsuv[3]) {
|
||||
else if (Duv(4) <= UVd[3] - Epsuv[3])
|
||||
{
|
||||
Duv(4) = UVd[3];
|
||||
Nc =2;
|
||||
Iiso = 3;
|
||||
Nc = 2;
|
||||
Iiso = 3;
|
||||
}
|
||||
else if (Duv(4) >= UVf[3]+Epsuv[3]) {
|
||||
else if (Duv(4) >= UVf[3] + Epsuv[3])
|
||||
{
|
||||
Duv(4) = UVf[3];
|
||||
Nc =2;
|
||||
Iiso =3;
|
||||
Nc = 2;
|
||||
Iiso = 3;
|
||||
}
|
||||
else return BestChoix; // on a gagne
|
||||
empty = Standard_True;
|
||||
BestChoix = ChoixRef(Iiso); //en attendant
|
||||
BestChoix = Perform(Duv,Rsnld,BestChoix);
|
||||
if (!empty) { // verification si l on ne deborde pas sur le carreau
|
||||
else
|
||||
return BestChoix; // on a gagne
|
||||
empty = Standard_True;
|
||||
BestChoix = ChoixRef(Iiso); // en attendant
|
||||
BestChoix = Perform(Duv, Rsnld, BestChoix);
|
||||
if (!empty)
|
||||
{ // verification si l on ne deborde pas sur le carreau
|
||||
// reciproque
|
||||
Nc =3-Nc;
|
||||
if (Duv(Nc) <= UVd[Nc-1]-Epsuv[Nc-1])
|
||||
Duv(Nc)=UVd[Nc-1];
|
||||
else if (Duv(Nc) >=UVf[Nc-1]+Epsuv[Nc-1])
|
||||
Duv(Nc)=UVf[Nc-1];
|
||||
else if (Duv(Nc+1) <= UVd[Nc])
|
||||
Nc = 3 - Nc;
|
||||
if (Duv(Nc) <= UVd[Nc - 1] - Epsuv[Nc - 1])
|
||||
Duv(Nc) = UVd[Nc - 1];
|
||||
else if (Duv(Nc) >= UVf[Nc - 1] + Epsuv[Nc - 1])
|
||||
Duv(Nc) = UVf[Nc - 1];
|
||||
else if (Duv(Nc + 1) <= UVd[Nc])
|
||||
{
|
||||
Nc = Nc + 1;
|
||||
Duv(Nc)=UVd[Nc-1];
|
||||
Nc = Nc + 1;
|
||||
Duv(Nc) = UVd[Nc - 1];
|
||||
}
|
||||
else if (Duv(Nc+1) >=UVf[Nc])
|
||||
else if (Duv(Nc + 1) >= UVf[Nc])
|
||||
{
|
||||
Nc = Nc + 1;
|
||||
Duv(Nc)=UVf[Nc-1];
|
||||
}
|
||||
Nc = Nc + 1;
|
||||
Duv(Nc) = UVf[Nc - 1];
|
||||
}
|
||||
else
|
||||
return BestChoix;
|
||||
|
||||
|
||||
empty = Standard_True;
|
||||
|
||||
if(Nc == 4)
|
||||
|
||||
if (Nc == 4)
|
||||
Nc = 0;
|
||||
|
||||
BestChoix = ChoixRef(Nc); //en attendant
|
||||
BestChoix = Perform(Duv,Rsnld,BestChoix);
|
||||
|
||||
BestChoix = ChoixRef(Nc); // en attendant
|
||||
BestChoix = Perform(Duv, Rsnld, BestChoix);
|
||||
}
|
||||
}
|
||||
return BestChoix;
|
||||
return BestChoix;
|
||||
}
|
||||
|
||||
@@ -13,11 +13,10 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef OCCT_DEBUG
|
||||
#define No_Standard_RangeError
|
||||
#define No_Standard_OutOfRange
|
||||
#define No_Standard_RangeError
|
||||
#define No_Standard_OutOfRange
|
||||
#endif
|
||||
|
||||
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <IntImp_ComputeTangence.hxx>
|
||||
@@ -25,139 +24,171 @@
|
||||
#include <Precision.hxx>
|
||||
|
||||
IntImp_IntCS::IntImp_IntCS(const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
const Standard_Real W,
|
||||
const TheFunction& F,
|
||||
const Standard_Real TolTangency,
|
||||
const Standard_Real MarginCoef) :
|
||||
done(Standard_True),
|
||||
empty(Standard_True),
|
||||
myFunction(F),
|
||||
w(0.0),
|
||||
u(0.0),
|
||||
v(0.0),
|
||||
tol(TolTangency*TolTangency)
|
||||
const Standard_Real V,
|
||||
const Standard_Real W,
|
||||
const TheFunction& F,
|
||||
const Standard_Real TolTangency,
|
||||
const Standard_Real MarginCoef)
|
||||
: done(Standard_True),
|
||||
empty(Standard_True),
|
||||
myFunction(F),
|
||||
w(0.0),
|
||||
u(0.0),
|
||||
v(0.0),
|
||||
tol(TolTangency * TolTangency)
|
||||
{
|
||||
if (tol < 1e-13)
|
||||
{
|
||||
if(tol<1e-13) { tol=1e-13; }
|
||||
math_FunctionSetRoot Rsnld(myFunction);
|
||||
Standard_Real u0,u1,v0,v1,w0,w1;
|
||||
const ThePSurface& S = myFunction.AuxillarSurface();
|
||||
const TheCurve& C = myFunction.AuxillarCurve();
|
||||
|
||||
w0 = TheCurveTool::FirstParameter(C);
|
||||
w1 = TheCurveTool::LastParameter(C);
|
||||
|
||||
u0 = ThePSurfaceTool::FirstUParameter(S);
|
||||
v0 = ThePSurfaceTool::FirstVParameter(S);
|
||||
u1 = ThePSurfaceTool::LastUParameter(S);
|
||||
v1 = ThePSurfaceTool::LastVParameter(S);
|
||||
tol = 1e-13;
|
||||
}
|
||||
math_FunctionSetRoot Rsnld(myFunction);
|
||||
Standard_Real u0, u1, v0, v1, w0, w1;
|
||||
const ThePSurface& S = myFunction.AuxillarSurface();
|
||||
const TheCurve& C = myFunction.AuxillarCurve();
|
||||
|
||||
if (MarginCoef > 0.) {
|
||||
if (!Precision::IsInfinite(u0) && !Precision::IsInfinite(u1)) {
|
||||
Standard_Real marg = (u1-u0)*MarginCoef;
|
||||
if (u0 > u1) marg = -marg;
|
||||
u0 -= marg; u1 += marg;
|
||||
}
|
||||
if (!Precision::IsInfinite(v0) && !Precision::IsInfinite(v1)) {
|
||||
Standard_Real marg = (v1-v0)*MarginCoef;
|
||||
if (v0 > v1) marg = -marg;
|
||||
v0 -= marg; v1 += marg;
|
||||
}
|
||||
w0 = TheCurveTool::FirstParameter(C);
|
||||
w1 = TheCurveTool::LastParameter(C);
|
||||
|
||||
u0 = ThePSurfaceTool::FirstUParameter(S);
|
||||
v0 = ThePSurfaceTool::FirstVParameter(S);
|
||||
u1 = ThePSurfaceTool::LastUParameter(S);
|
||||
v1 = ThePSurfaceTool::LastVParameter(S);
|
||||
|
||||
if (MarginCoef > 0.)
|
||||
{
|
||||
if (!Precision::IsInfinite(u0) && !Precision::IsInfinite(u1))
|
||||
{
|
||||
Standard_Real marg = (u1 - u0) * MarginCoef;
|
||||
if (u0 > u1)
|
||||
marg = -marg;
|
||||
u0 -= marg;
|
||||
u1 += marg;
|
||||
}
|
||||
if (!Precision::IsInfinite(v0) && !Precision::IsInfinite(v1))
|
||||
{
|
||||
Standard_Real marg = (v1 - v0) * MarginCoef;
|
||||
if (v0 > v1)
|
||||
marg = -marg;
|
||||
v0 -= marg;
|
||||
v1 += marg;
|
||||
}
|
||||
|
||||
Perform(U,V,W,Rsnld,u0,u1,v0,v1,w0,w1);
|
||||
}
|
||||
|
||||
IntImp_IntCS::IntImp_IntCS(const TheFunction& F,
|
||||
const Standard_Real TolTangency) :
|
||||
done(Standard_True),
|
||||
empty(Standard_True),
|
||||
myFunction(F),
|
||||
tol(TolTangency*TolTangency)
|
||||
Perform(U, V, W, Rsnld, u0, u1, v0, v1, w0, w1);
|
||||
}
|
||||
|
||||
IntImp_IntCS::IntImp_IntCS(const TheFunction& F, const Standard_Real TolTangency)
|
||||
: done(Standard_True),
|
||||
empty(Standard_True),
|
||||
myFunction(F),
|
||||
tol(TolTangency * TolTangency)
|
||||
{
|
||||
}
|
||||
|
||||
void IntImp_IntCS::Perform(const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
const Standard_Real W,
|
||||
math_FunctionSetRoot& Rsnld,
|
||||
const Standard_Real u0,
|
||||
const Standard_Real u1,
|
||||
const Standard_Real v0,
|
||||
const Standard_Real v1,
|
||||
const Standard_Real w0,
|
||||
const Standard_Real w1) {
|
||||
void IntImp_IntCS::Perform(const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
const Standard_Real W,
|
||||
math_FunctionSetRoot& Rsnld,
|
||||
const Standard_Real u0,
|
||||
const Standard_Real u1,
|
||||
const Standard_Real v0,
|
||||
const Standard_Real v1,
|
||||
const Standard_Real w0,
|
||||
const Standard_Real w1)
|
||||
{
|
||||
done = Standard_True;
|
||||
Standard_Real BornInfBuf[3], BornSupBuf[3], ToleranceBuf[3], UVapBuf[3];
|
||||
math_Vector BornInf (BornInfBuf, 1, 3), BornSup (BornSupBuf, 1, 3), Tolerance (ToleranceBuf, 1, 3), UVap (UVapBuf, 1, 3);
|
||||
UVap(1) = U;
|
||||
UVap(2) = V;
|
||||
UVap(3) = W;
|
||||
math_Vector BornInf(BornInfBuf, 1, 3), BornSup(BornSupBuf, 1, 3), Tolerance(ToleranceBuf, 1, 3),
|
||||
UVap(UVapBuf, 1, 3);
|
||||
UVap(1) = U;
|
||||
UVap(2) = V;
|
||||
UVap(3) = W;
|
||||
const ThePSurface& S = myFunction.AuxillarSurface();
|
||||
const TheCurve& C = myFunction.AuxillarCurve();
|
||||
|
||||
BornInf(1) = u0; BornInf(2) = v0;
|
||||
BornSup(1) = u1; BornSup(2) = v1;
|
||||
BornInf(1) = u0;
|
||||
BornInf(2) = v0;
|
||||
BornSup(1) = u1;
|
||||
BornSup(2) = v1;
|
||||
|
||||
BornInf(3) = w0; BornSup(3) = w1;
|
||||
BornInf(3) = w0;
|
||||
BornSup(3) = w1;
|
||||
|
||||
Tolerance(1) = ThePSurfaceTool::UResolution(S,Precision::Confusion());
|
||||
Tolerance(2) = ThePSurfaceTool::VResolution(S,Precision::Confusion());
|
||||
Tolerance(3) = TheCurveTool::Resolution(C,Precision::Confusion());
|
||||
Tolerance(1) = ThePSurfaceTool::UResolution(S, Precision::Confusion());
|
||||
Tolerance(2) = ThePSurfaceTool::VResolution(S, Precision::Confusion());
|
||||
Tolerance(3) = TheCurveTool::Resolution(C, Precision::Confusion());
|
||||
Rsnld.SetTolerance(Tolerance);
|
||||
Standard_Integer autretentative=0;
|
||||
done=Standard_False;
|
||||
do {
|
||||
if(autretentative==1) {
|
||||
UVap(3)=w0;
|
||||
Standard_Integer autretentative = 0;
|
||||
done = Standard_False;
|
||||
do
|
||||
{
|
||||
if (autretentative == 1)
|
||||
{
|
||||
UVap(3) = w0;
|
||||
}
|
||||
else if(autretentative==2) {
|
||||
UVap(3)=w1;
|
||||
else if (autretentative == 2)
|
||||
{
|
||||
UVap(3) = w1;
|
||||
}
|
||||
autretentative++;
|
||||
Rsnld.Perform(myFunction,UVap,BornInf,BornSup);
|
||||
if (Rsnld.IsDone()) {
|
||||
Rsnld.Perform(myFunction, UVap, BornInf, BornSup);
|
||||
if (Rsnld.IsDone())
|
||||
{
|
||||
Standard_Real AbsmyFunctionRoot = Abs(myFunction.Root());
|
||||
if (AbsmyFunctionRoot <= tol) {
|
||||
Rsnld.Root(UVap);
|
||||
u = UVap(1);
|
||||
v = UVap(2);
|
||||
w = UVap(3);
|
||||
empty = Standard_False;
|
||||
done=Standard_True;
|
||||
if (AbsmyFunctionRoot <= tol)
|
||||
{
|
||||
Rsnld.Root(UVap);
|
||||
u = UVap(1);
|
||||
v = UVap(2);
|
||||
w = UVap(3);
|
||||
empty = Standard_False;
|
||||
done = Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
while(done==Standard_False && autretentative<3);
|
||||
} while (done == Standard_False && autretentative < 3);
|
||||
}
|
||||
|
||||
Standard_Boolean IntImp_IntCS::IsDone() const { return done;}
|
||||
Standard_Boolean IntImp_IntCS::IsDone() const
|
||||
{
|
||||
return done;
|
||||
}
|
||||
|
||||
Standard_Boolean IntImp_IntCS::IsEmpty()const {
|
||||
if (!done) throw StdFail_NotDone();
|
||||
Standard_Boolean IntImp_IntCS::IsEmpty() const
|
||||
{
|
||||
if (!done)
|
||||
throw StdFail_NotDone();
|
||||
return empty;
|
||||
}
|
||||
|
||||
const gp_Pnt& IntImp_IntCS::Point() const
|
||||
{
|
||||
if (!done) throw StdFail_NotDone();
|
||||
if (empty) throw Standard_DomainError();
|
||||
{
|
||||
if (!done)
|
||||
throw StdFail_NotDone();
|
||||
if (empty)
|
||||
throw Standard_DomainError();
|
||||
return myFunction.Point();
|
||||
}
|
||||
|
||||
void IntImp_IntCS::ParameterOnSurface(Standard_Real& U,
|
||||
Standard_Real& V) const
|
||||
{
|
||||
if (!done) throw StdFail_NotDone();
|
||||
if (empty) throw Standard_DomainError();
|
||||
U=u;
|
||||
V=v;
|
||||
void IntImp_IntCS::ParameterOnSurface(Standard_Real& U, Standard_Real& V) const
|
||||
{
|
||||
if (!done)
|
||||
throw StdFail_NotDone();
|
||||
if (empty)
|
||||
throw Standard_DomainError();
|
||||
U = u;
|
||||
V = v;
|
||||
}
|
||||
Standard_Real IntImp_IntCS::ParameterOnCurve() const
|
||||
{
|
||||
if (!done) throw StdFail_NotDone();
|
||||
if (empty) throw Standard_DomainError();
|
||||
|
||||
Standard_Real IntImp_IntCS::ParameterOnCurve() const
|
||||
{
|
||||
if (!done)
|
||||
throw StdFail_NotDone();
|
||||
if (empty)
|
||||
throw Standard_DomainError();
|
||||
return w;
|
||||
}
|
||||
|
||||
TheFunction& IntImp_IntCS::Function() {return myFunction;}
|
||||
TheFunction& IntImp_IntCS::Function()
|
||||
{
|
||||
return myFunction;
|
||||
}
|
||||
|
||||
@@ -16,87 +16,101 @@
|
||||
#include <gp_Vec.hxx>
|
||||
|
||||
#ifndef OCCT_DEBUG
|
||||
#define No_Standard_RangeError
|
||||
#define No_Standard_OutOfRange
|
||||
#define No_Standard_RangeError
|
||||
#define No_Standard_OutOfRange
|
||||
#endif
|
||||
|
||||
|
||||
IntImp_ZerCSParFunc::IntImp_ZerCSParFunc(const ThePSurface& S,
|
||||
const TheCurve& C) {
|
||||
IntImp_ZerCSParFunc::IntImp_ZerCSParFunc(const ThePSurface& S, const TheCurve& C)
|
||||
{
|
||||
surface = S;
|
||||
curve = C;
|
||||
p = gp_Pnt(0.0,0.0,0.0);
|
||||
f = 0.0;
|
||||
curve = C;
|
||||
p = gp_Pnt(0.0, 0.0, 0.0);
|
||||
f = 0.0;
|
||||
}
|
||||
|
||||
Standard_Integer IntImp_ZerCSParFunc::NbVariables()const { return 3;}
|
||||
Standard_Integer IntImp_ZerCSParFunc::NbVariables() const
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
Standard_Integer IntImp_ZerCSParFunc::NbEquations()const { return 3;}
|
||||
Standard_Integer IntImp_ZerCSParFunc::NbEquations() const
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
Standard_Boolean IntImp_ZerCSParFunc::Value(const math_Vector& X,
|
||||
math_Vector& F){
|
||||
Standard_Boolean IntImp_ZerCSParFunc::Value(const math_Vector& X, math_Vector& F)
|
||||
{
|
||||
|
||||
gp_Pnt Psurf = ThePSurfaceTool::Value(surface,X(1),X(2));
|
||||
gp_Pnt Pcurv = TheCurveTool::Value(curve,X(3));
|
||||
Standard_Real f1,f2,f3;
|
||||
F(1) = f1 = Psurf.X()-Pcurv.X();
|
||||
F(2) = f2 = Psurf.Y()-Pcurv.Y();
|
||||
F(3) = f3 = Psurf.Z()-Pcurv.Z();
|
||||
f = f1*f1 + f2*f2 + f3*f3;
|
||||
p = gp_Pnt((Psurf.XYZ()+Pcurv.XYZ())*0.5);
|
||||
gp_Pnt Psurf = ThePSurfaceTool::Value(surface, X(1), X(2));
|
||||
gp_Pnt Pcurv = TheCurveTool::Value(curve, X(3));
|
||||
Standard_Real f1, f2, f3;
|
||||
F(1) = f1 = Psurf.X() - Pcurv.X();
|
||||
F(2) = f2 = Psurf.Y() - Pcurv.Y();
|
||||
F(3) = f3 = Psurf.Z() - Pcurv.Z();
|
||||
f = f1 * f1 + f2 * f2 + f3 * f3;
|
||||
p = gp_Pnt((Psurf.XYZ() + Pcurv.XYZ()) * 0.5);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean IntImp_ZerCSParFunc::Derivatives ( const math_Vector& X,
|
||||
math_Matrix& D) {
|
||||
gp_Pnt Psurf,Pcurv;
|
||||
gp_Vec D1u,D1v,D1w;
|
||||
ThePSurfaceTool::D1(surface,X(1),X(2),Psurf,D1u,D1v);
|
||||
TheCurveTool::D1(curve,X(3),Pcurv,D1w);
|
||||
D(1,1) = D1u.X();
|
||||
D(1,2) = D1v.X();
|
||||
D(1,3) = -D1w.X();
|
||||
D(2,1) = D1u.Y();
|
||||
D(2,2) = D1v.Y();
|
||||
D(2,3) = -D1w.Y();
|
||||
D(3,1) = D1u.Z();
|
||||
D(3,2) = D1v.Z();
|
||||
D(3,3) = -D1w.Z();
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean IntImp_ZerCSParFunc::Values( const math_Vector& X,
|
||||
math_Vector& F,
|
||||
math_Matrix& D) {
|
||||
gp_Pnt Psurf,Pcurv;
|
||||
gp_Vec D1u,D1v,D1w;
|
||||
ThePSurfaceTool::D1(surface,X(1),X(2),Psurf,D1u,D1v);
|
||||
TheCurveTool::D1(curve,X(3),Pcurv,D1w);
|
||||
D(1,1) = D1u.X();
|
||||
D(1,2) = D1v.X();
|
||||
D(1,3) = -D1w.X();
|
||||
D(2,1) = D1u.Y();
|
||||
D(2,2) = D1v.Y();
|
||||
D(2,3) = -D1w.Y();
|
||||
D(3,1) = D1u.Z();
|
||||
D(3,2) = D1v.Z();
|
||||
D(3,3) = -D1w.Z();
|
||||
|
||||
Standard_Real f1,f2,f3;
|
||||
F(1) = f1 = Psurf.X()-Pcurv.X();
|
||||
F(2) = f2 = Psurf.Y()-Pcurv.Y();
|
||||
F(3) = f3 = Psurf.Z()-Pcurv.Z();
|
||||
f = f1*f1 + f2*f2 + f3*f3;
|
||||
p = gp_Pnt((Psurf.XYZ()+Pcurv.XYZ())*0.5);
|
||||
Standard_Boolean IntImp_ZerCSParFunc::Derivatives(const math_Vector& X, math_Matrix& D)
|
||||
{
|
||||
gp_Pnt Psurf, Pcurv;
|
||||
gp_Vec D1u, D1v, D1w;
|
||||
ThePSurfaceTool::D1(surface, X(1), X(2), Psurf, D1u, D1v);
|
||||
TheCurveTool::D1(curve, X(3), Pcurv, D1w);
|
||||
D(1, 1) = D1u.X();
|
||||
D(1, 2) = D1v.X();
|
||||
D(1, 3) = -D1w.X();
|
||||
D(2, 1) = D1u.Y();
|
||||
D(2, 2) = D1v.Y();
|
||||
D(2, 3) = -D1w.Y();
|
||||
D(3, 1) = D1u.Z();
|
||||
D(3, 2) = D1v.Z();
|
||||
D(3, 3) = -D1w.Z();
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
const gp_Pnt& IntImp_ZerCSParFunc::Point() const { return p;}
|
||||
Standard_Boolean IntImp_ZerCSParFunc::Values(const math_Vector& X, math_Vector& F, math_Matrix& D)
|
||||
{
|
||||
gp_Pnt Psurf, Pcurv;
|
||||
gp_Vec D1u, D1v, D1w;
|
||||
ThePSurfaceTool::D1(surface, X(1), X(2), Psurf, D1u, D1v);
|
||||
TheCurveTool::D1(curve, X(3), Pcurv, D1w);
|
||||
D(1, 1) = D1u.X();
|
||||
D(1, 2) = D1v.X();
|
||||
D(1, 3) = -D1w.X();
|
||||
D(2, 1) = D1u.Y();
|
||||
D(2, 2) = D1v.Y();
|
||||
D(2, 3) = -D1w.Y();
|
||||
D(3, 1) = D1u.Z();
|
||||
D(3, 2) = D1v.Z();
|
||||
D(3, 3) = -D1w.Z();
|
||||
|
||||
Standard_Real IntImp_ZerCSParFunc::Root() const { return f;}
|
||||
Standard_Real f1, f2, f3;
|
||||
F(1) = f1 = Psurf.X() - Pcurv.X();
|
||||
F(2) = f2 = Psurf.Y() - Pcurv.Y();
|
||||
F(3) = f3 = Psurf.Z() - Pcurv.Z();
|
||||
f = f1 * f1 + f2 * f2 + f3 * f3;
|
||||
p = gp_Pnt((Psurf.XYZ() + Pcurv.XYZ()) * 0.5);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
const ThePSurface& IntImp_ZerCSParFunc::AuxillarSurface() const {
|
||||
return surface;}
|
||||
const gp_Pnt& IntImp_ZerCSParFunc::Point() const
|
||||
{
|
||||
return p;
|
||||
}
|
||||
|
||||
const TheCurve& IntImp_ZerCSParFunc::AuxillarCurve() const {
|
||||
return curve;}
|
||||
Standard_Real IntImp_ZerCSParFunc::Root() const
|
||||
{
|
||||
return f;
|
||||
}
|
||||
|
||||
const ThePSurface& IntImp_ZerCSParFunc::AuxillarSurface() const
|
||||
{
|
||||
return surface;
|
||||
}
|
||||
|
||||
const TheCurve& IntImp_ZerCSParFunc::AuxillarCurve() const
|
||||
{
|
||||
return curve;
|
||||
}
|
||||
|
||||
@@ -12,143 +12,139 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#define EpsAng 1.e-8
|
||||
#define EpsAng 1.e-8
|
||||
#define EpsAng2 1.e-16
|
||||
#define Tolpetit 1.e-16
|
||||
|
||||
#ifndef OCCT_DEBUG
|
||||
#define No_Standard_RangeError
|
||||
#define No_Standard_OutOfRange
|
||||
#define No_Standard_RangeError
|
||||
#define No_Standard_OutOfRange
|
||||
#endif
|
||||
|
||||
#define SURF (*((ThePSurface *)(surf)))
|
||||
#define FUNC (*((TheISurface *)(func)))
|
||||
#define SURF (*((ThePSurface*)(surf)))
|
||||
#define FUNC (*((TheISurface*)(func)))
|
||||
|
||||
|
||||
IntImp_ZerImpFunc::IntImp_ZerImpFunc() :
|
||||
surf(NULL),
|
||||
func(NULL),
|
||||
u(0.0),
|
||||
v(0.0),
|
||||
tol(0.0),
|
||||
valf(0.0),
|
||||
computed(Standard_False),
|
||||
tangent(Standard_False),
|
||||
tgdu(0.0),
|
||||
tgdv(0.0),
|
||||
derived(Standard_False)
|
||||
{
|
||||
IntImp_ZerImpFunc::IntImp_ZerImpFunc()
|
||||
: surf(NULL),
|
||||
func(NULL),
|
||||
u(0.0),
|
||||
v(0.0),
|
||||
tol(0.0),
|
||||
valf(0.0),
|
||||
computed(Standard_False),
|
||||
tangent(Standard_False),
|
||||
tgdu(0.0),
|
||||
tgdv(0.0),
|
||||
derived(Standard_False)
|
||||
{
|
||||
}
|
||||
|
||||
IntImp_ZerImpFunc::IntImp_ZerImpFunc(const ThePSurface& PS ,
|
||||
const TheISurface& IS) :
|
||||
u(0.0),
|
||||
v(0.0),
|
||||
tol(0.0),
|
||||
valf(0.0),
|
||||
computed(Standard_False),
|
||||
tangent(Standard_False),
|
||||
tgdu(0.0),
|
||||
tgdv(0.0),
|
||||
derived(Standard_False)
|
||||
{
|
||||
IntImp_ZerImpFunc::IntImp_ZerImpFunc(const ThePSurface& PS, const TheISurface& IS)
|
||||
: u(0.0),
|
||||
v(0.0),
|
||||
tol(0.0),
|
||||
valf(0.0),
|
||||
computed(Standard_False),
|
||||
tangent(Standard_False),
|
||||
tgdu(0.0),
|
||||
tgdv(0.0),
|
||||
derived(Standard_False)
|
||||
{
|
||||
surf = (Standard_Address)(&PS);
|
||||
func = (Standard_Address)(&IS);
|
||||
}
|
||||
|
||||
IntImp_ZerImpFunc::IntImp_ZerImpFunc(const TheISurface& IS) :
|
||||
surf(NULL),
|
||||
u(0.0),
|
||||
v(0.0),
|
||||
tol(0.0),
|
||||
valf(0.0),
|
||||
computed(Standard_False),
|
||||
tangent(Standard_False),
|
||||
tgdu(0.0),
|
||||
tgdv(0.0),
|
||||
derived(Standard_False)
|
||||
{
|
||||
IntImp_ZerImpFunc::IntImp_ZerImpFunc(const TheISurface& IS)
|
||||
: surf(NULL),
|
||||
u(0.0),
|
||||
v(0.0),
|
||||
tol(0.0),
|
||||
valf(0.0),
|
||||
computed(Standard_False),
|
||||
tangent(Standard_False),
|
||||
tgdu(0.0),
|
||||
tgdv(0.0),
|
||||
derived(Standard_False)
|
||||
{
|
||||
func = (Standard_Address)(&IS);
|
||||
}
|
||||
|
||||
Standard_Integer IntImp_ZerImpFunc::NbVariables() const
|
||||
{
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
Standard_Integer IntImp_ZerImpFunc::NbEquations() const
|
||||
Standard_Integer IntImp_ZerImpFunc::NbEquations() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
Standard_Boolean IntImp_ZerImpFunc::Value(const math_Vector& X,
|
||||
math_Vector& F)
|
||||
Standard_Boolean IntImp_ZerImpFunc::Value(const math_Vector& X, math_Vector& F)
|
||||
{
|
||||
u = X(1);
|
||||
v = X(2);
|
||||
pntsol = ThePSurfaceTool::Value(SURF, u, v);
|
||||
valf = TheISurfaceTool::Value(FUNC, pntsol.X(), pntsol.Y(), pntsol.Z());
|
||||
F(1) = valf;
|
||||
u = X(1);
|
||||
v = X(2);
|
||||
pntsol = ThePSurfaceTool::Value(SURF, u, v);
|
||||
valf = TheISurfaceTool::Value(FUNC, pntsol.X(), pntsol.Y(), pntsol.Z());
|
||||
F(1) = valf;
|
||||
computed = Standard_False;
|
||||
derived = Standard_False;
|
||||
derived = Standard_False;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean IntImp_ZerImpFunc::Derivatives(const math_Vector& X,
|
||||
math_Matrix& D)
|
||||
Standard_Boolean IntImp_ZerImpFunc::Derivatives(const math_Vector& X, math_Matrix& D)
|
||||
{
|
||||
u = X(1);
|
||||
v = X(2);
|
||||
ThePSurfaceTool::D1(SURF, u, v, pntsol, d1u, d1v);
|
||||
TheISurfaceTool::Gradient(FUNC, pntsol.X(), pntsol.Y(), pntsol.Z(),gradient);
|
||||
D(1,1) = d1u.Dot(gradient);
|
||||
D(1,2) = d1v.Dot(gradient);
|
||||
TheISurfaceTool::Gradient(FUNC, pntsol.X(), pntsol.Y(), pntsol.Z(), gradient);
|
||||
D(1, 1) = d1u.Dot(gradient);
|
||||
D(1, 2) = d1v.Dot(gradient);
|
||||
computed = Standard_False;
|
||||
derived = Standard_True;
|
||||
derived = Standard_True;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean IntImp_ZerImpFunc::Values(const math_Vector& X,
|
||||
math_Vector& F,
|
||||
math_Matrix& D)
|
||||
Standard_Boolean IntImp_ZerImpFunc::Values(const math_Vector& X, math_Vector& F, math_Matrix& D)
|
||||
{
|
||||
u = X(1);
|
||||
v = X(2);
|
||||
ThePSurfaceTool::D1(SURF, u, v, pntsol, d1u, d1v);
|
||||
TheISurfaceTool::ValueAndGradient(FUNC, pntsol.X(), pntsol.Y(), pntsol.Z(),
|
||||
valf, gradient);
|
||||
F(1) = valf;
|
||||
D(1,1) = d1u.Dot(gradient);
|
||||
D(1,2) = d1v.Dot(gradient);
|
||||
TheISurfaceTool::ValueAndGradient(FUNC, pntsol.X(), pntsol.Y(), pntsol.Z(), valf, gradient);
|
||||
F(1) = valf;
|
||||
D(1, 1) = d1u.Dot(gradient);
|
||||
D(1, 2) = d1v.Dot(gradient);
|
||||
computed = Standard_False;
|
||||
derived = Standard_True;
|
||||
derived = Standard_True;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean IntImp_ZerImpFunc::IsTangent()
|
||||
{
|
||||
if (!computed) {
|
||||
if (!computed)
|
||||
{
|
||||
computed = Standard_True;
|
||||
if(!derived) {
|
||||
if (!derived)
|
||||
{
|
||||
ThePSurfaceTool::D1(SURF, u, v, pntsol, d1u, d1v);
|
||||
derived = Standard_True;
|
||||
}
|
||||
|
||||
tgdu = gradient.Dot(d1v);
|
||||
tgdv = -gradient.Dot(d1u);
|
||||
Standard_Real N2grad = gradient.SquareMagnitude();
|
||||
tgdu = gradient.Dot(d1v);
|
||||
tgdv = -gradient.Dot(d1u);
|
||||
Standard_Real N2grad = gradient.SquareMagnitude();
|
||||
Standard_Real N2grad_EpsAng2 = N2grad * EpsAng2;
|
||||
Standard_Real N2d1u = d1u.SquareMagnitude();
|
||||
Standard_Real N2d1v = d1v.SquareMagnitude();
|
||||
tangent =(tgdu * tgdu <= N2grad_EpsAng2 * N2d1v) &&
|
||||
(tgdv * tgdv <= N2grad_EpsAng2 * N2d1u);
|
||||
if(!tangent) {
|
||||
d3d.SetLinearForm(tgdu,d1u,tgdv,d1v);
|
||||
Standard_Real N2d1u = d1u.SquareMagnitude();
|
||||
Standard_Real N2d1v = d1v.SquareMagnitude();
|
||||
tangent = (tgdu * tgdu <= N2grad_EpsAng2 * N2d1v) && (tgdv * tgdv <= N2grad_EpsAng2 * N2d1u);
|
||||
if (!tangent)
|
||||
{
|
||||
d3d.SetLinearForm(tgdu, d1u, tgdv, d1v);
|
||||
d2d = gp_Dir2d(tgdu, tgdv);
|
||||
if (d3d.Magnitude() <= Tolpetit) { // jag
|
||||
if (d3d.Magnitude() <= Tolpetit)
|
||||
{ // jag
|
||||
tangent = Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return tangent;
|
||||
}
|
||||
|
||||
@@ -13,78 +13,78 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef OCCT_DEBUG
|
||||
#define No_Standard_RangeError
|
||||
#define No_Standard_OutOfRange
|
||||
#define No_Standard_RangeError
|
||||
#define No_Standard_OutOfRange
|
||||
#endif
|
||||
|
||||
|
||||
#include <IntImp_ComputeTangence.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
#define SURF1 (*((ThePSurface *)(surf1)))
|
||||
#define SURF2 (*((ThePSurface *)(surf2)))
|
||||
#define SURF1 (*((ThePSurface*)(surf1)))
|
||||
#define SURF2 (*((ThePSurface*)(surf2)))
|
||||
|
||||
|
||||
IntImp_ZerParFunc::IntImp_ZerParFunc(const ThePSurface& S1 ,
|
||||
const ThePSurface& S2)
|
||||
: compute(Standard_False),
|
||||
tangent(Standard_False),
|
||||
paramConst(0.0)
|
||||
IntImp_ZerParFunc::IntImp_ZerParFunc(const ThePSurface& S1, const ThePSurface& S2)
|
||||
: compute(Standard_False),
|
||||
tangent(Standard_False),
|
||||
paramConst(0.0)
|
||||
{
|
||||
surf1 = (Standard_Address)(&S1);
|
||||
surf2 = (Standard_Address)(&S2);
|
||||
surf1 = (Standard_Address)(&S1);
|
||||
surf2 = (Standard_Address)(&S2);
|
||||
|
||||
ua0 = ThePSurfaceTool::FirstUParameter(SURF1); //-- ThePSurfaceTool::UIntervalFirst(surf1);
|
||||
va0 = ThePSurfaceTool::FirstVParameter(SURF1); //-- ThePSurfaceTool::VIntervalFirst(surf1);
|
||||
ua1 = ThePSurfaceTool::LastUParameter(SURF1); //-- ThePSurfaceTool::UIntervalLast(surf1);
|
||||
va1 = ThePSurfaceTool::LastVParameter(SURF1); //-- ThePSurfaceTool::VIntervalLast(surf1);
|
||||
ua0 = ThePSurfaceTool::FirstUParameter(SURF1); //-- ThePSurfaceTool::UIntervalFirst(surf1);
|
||||
va0 = ThePSurfaceTool::FirstVParameter(SURF1); //-- ThePSurfaceTool::VIntervalFirst(surf1);
|
||||
ua1 = ThePSurfaceTool::LastUParameter(SURF1); //-- ThePSurfaceTool::UIntervalLast(surf1);
|
||||
va1 = ThePSurfaceTool::LastVParameter(SURF1); //-- ThePSurfaceTool::VIntervalLast(surf1);
|
||||
|
||||
ub0 = ThePSurfaceTool::FirstUParameter(SURF2); //-- ThePSurfaceTool::UIntervalFirst(SURF2);
|
||||
vb0 = ThePSurfaceTool::FirstVParameter(SURF2); //-- ThePSurfaceTool::VIntervalFirst(surf2);
|
||||
ub1 = ThePSurfaceTool::LastUParameter(SURF2); //-- ThePSurfaceTool::UIntervalLast(surf2);
|
||||
vb1 = ThePSurfaceTool::LastVParameter(SURF2); //-- ThePSurfaceTool::VIntervalLast(surf2);
|
||||
ub0 = ThePSurfaceTool::FirstUParameter(SURF2); //-- ThePSurfaceTool::UIntervalFirst(SURF2);
|
||||
vb0 = ThePSurfaceTool::FirstVParameter(SURF2); //-- ThePSurfaceTool::VIntervalFirst(surf2);
|
||||
ub1 = ThePSurfaceTool::LastUParameter(SURF2); //-- ThePSurfaceTool::UIntervalLast(surf2);
|
||||
vb1 = ThePSurfaceTool::LastVParameter(SURF2); //-- ThePSurfaceTool::VIntervalLast(surf2);
|
||||
|
||||
ures1 = ThePSurfaceTool::UResolution(SURF1,Precision::Confusion());
|
||||
vres1 = ThePSurfaceTool::VResolution(SURF1,Precision::Confusion());
|
||||
ures1 = ThePSurfaceTool::UResolution(SURF1, Precision::Confusion());
|
||||
vres1 = ThePSurfaceTool::VResolution(SURF1, Precision::Confusion());
|
||||
|
||||
ures2 = ThePSurfaceTool::UResolution(SURF2,Precision::Confusion());
|
||||
vres2 = ThePSurfaceTool::VResolution(SURF2,Precision::Confusion());
|
||||
memset (f, 0, sizeof (f));
|
||||
compute = Standard_False;
|
||||
tangent = Standard_False;
|
||||
ures2 = ThePSurfaceTool::UResolution(SURF2, Precision::Confusion());
|
||||
vres2 = ThePSurfaceTool::VResolution(SURF2, Precision::Confusion());
|
||||
memset(f, 0, sizeof(f));
|
||||
compute = Standard_False;
|
||||
tangent = Standard_False;
|
||||
}
|
||||
|
||||
Standard_Integer IntImp_ZerParFunc::NbVariables() const { return 3;}
|
||||
Standard_Integer IntImp_ZerParFunc::NbVariables() const
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
Standard_Integer IntImp_ZerParFunc::NbEquations() const { return 3;}
|
||||
Standard_Integer IntImp_ZerParFunc::NbEquations() const
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
Standard_Boolean IntImp_ZerParFunc::Value(const math_Vector& X,
|
||||
math_Vector& F) {
|
||||
Standard_Boolean IntImp_ZerParFunc::Value(const math_Vector& X, math_Vector& F)
|
||||
{
|
||||
|
||||
switch (chxIso) {
|
||||
case IntImp_UIsoparametricOnCaro1:
|
||||
{
|
||||
pntsol1= ThePSurfaceTool::Value(SURF1,paramConst,X(1));
|
||||
pntsol2= ThePSurfaceTool::Value(SURF2,X(2),X(3));
|
||||
switch (chxIso)
|
||||
{
|
||||
case IntImp_UIsoparametricOnCaro1: {
|
||||
pntsol1 = ThePSurfaceTool::Value(SURF1, paramConst, X(1));
|
||||
pntsol2 = ThePSurfaceTool::Value(SURF2, X(2), X(3));
|
||||
}
|
||||
break;
|
||||
case IntImp_VIsoparametricOnCaro1:
|
||||
{
|
||||
pntsol1= ThePSurfaceTool::Value(SURF1,X(1),paramConst);
|
||||
pntsol2= ThePSurfaceTool::Value(SURF2,X(2),X(3));
|
||||
case IntImp_VIsoparametricOnCaro1: {
|
||||
pntsol1 = ThePSurfaceTool::Value(SURF1, X(1), paramConst);
|
||||
pntsol2 = ThePSurfaceTool::Value(SURF2, X(2), X(3));
|
||||
}
|
||||
break;
|
||||
case IntImp_UIsoparametricOnCaro2:
|
||||
{
|
||||
pntsol1= ThePSurfaceTool::Value(SURF1,X(1),X(2));
|
||||
pntsol2= ThePSurfaceTool::Value(SURF2,paramConst,X(3));
|
||||
case IntImp_UIsoparametricOnCaro2: {
|
||||
pntsol1 = ThePSurfaceTool::Value(SURF1, X(1), X(2));
|
||||
pntsol2 = ThePSurfaceTool::Value(SURF2, paramConst, X(3));
|
||||
}
|
||||
break;
|
||||
case IntImp_VIsoparametricOnCaro2:
|
||||
{
|
||||
pntsol1= ThePSurfaceTool::Value(SURF1,X(1),X(2));
|
||||
pntsol2= ThePSurfaceTool::Value(SURF2,X(3),paramConst);
|
||||
case IntImp_VIsoparametricOnCaro2: {
|
||||
pntsol1 = ThePSurfaceTool::Value(SURF1, X(1), X(2));
|
||||
pntsol2 = ThePSurfaceTool::Value(SURF2, X(3), paramConst);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -95,137 +95,130 @@ Standard_Boolean IntImp_ZerParFunc::Value(const math_Vector& X,
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean IntImp_ZerParFunc::Derivatives (const math_Vector& X,
|
||||
math_Matrix& D) {
|
||||
|
||||
switch (chxIso) {
|
||||
case IntImp_UIsoparametricOnCaro1:
|
||||
{
|
||||
ThePSurfaceTool::D1(SURF1,paramConst,X(1),pntsol1,dpuv[0],dpuv[1]);
|
||||
ThePSurfaceTool::D1(SURF2,X(2),X(3),pntsol2,dpuv[2],dpuv[3]);
|
||||
D(1,1) = dpuv[1].X();
|
||||
D(1,2) =-dpuv[2].X();
|
||||
D(1,3) =-dpuv[3].X();
|
||||
D(2,1) = dpuv[1].Y();
|
||||
D(2,2) =-dpuv[2].Y();
|
||||
D(2,3) =-dpuv[3].Y();
|
||||
D(3,1) = dpuv[1].Z();
|
||||
D(3,2) =-dpuv[2].Z();
|
||||
D(3,3) =-dpuv[3].Z();
|
||||
Standard_Boolean IntImp_ZerParFunc::Derivatives(const math_Vector& X, math_Matrix& D)
|
||||
{
|
||||
|
||||
switch (chxIso)
|
||||
{
|
||||
case IntImp_UIsoparametricOnCaro1: {
|
||||
ThePSurfaceTool::D1(SURF1, paramConst, X(1), pntsol1, dpuv[0], dpuv[1]);
|
||||
ThePSurfaceTool::D1(SURF2, X(2), X(3), pntsol2, dpuv[2], dpuv[3]);
|
||||
D(1, 1) = dpuv[1].X();
|
||||
D(1, 2) = -dpuv[2].X();
|
||||
D(1, 3) = -dpuv[3].X();
|
||||
D(2, 1) = dpuv[1].Y();
|
||||
D(2, 2) = -dpuv[2].Y();
|
||||
D(2, 3) = -dpuv[3].Y();
|
||||
D(3, 1) = dpuv[1].Z();
|
||||
D(3, 2) = -dpuv[2].Z();
|
||||
D(3, 3) = -dpuv[3].Z();
|
||||
}
|
||||
break;
|
||||
case IntImp_VIsoparametricOnCaro1:
|
||||
{
|
||||
ThePSurfaceTool::D1(SURF1,X(1),paramConst,pntsol1,dpuv[0],dpuv[1]);
|
||||
ThePSurfaceTool::D1(SURF2,X(2),X(3),pntsol2,dpuv[2],dpuv[3]);
|
||||
D(1,1) = dpuv[0].X();
|
||||
D(1,2) =-dpuv[2].X();
|
||||
D(1,3) =-dpuv[3].X();
|
||||
D(2,1) = dpuv[0].Y();
|
||||
D(2,2) =-dpuv[2].Y();
|
||||
D(2,3) =-dpuv[3].Y();
|
||||
D(3,1) = dpuv[0].Z();
|
||||
D(3,2) =-dpuv[2].Z();
|
||||
D(3,3) =-dpuv[3].Z();
|
||||
case IntImp_VIsoparametricOnCaro1: {
|
||||
ThePSurfaceTool::D1(SURF1, X(1), paramConst, pntsol1, dpuv[0], dpuv[1]);
|
||||
ThePSurfaceTool::D1(SURF2, X(2), X(3), pntsol2, dpuv[2], dpuv[3]);
|
||||
D(1, 1) = dpuv[0].X();
|
||||
D(1, 2) = -dpuv[2].X();
|
||||
D(1, 3) = -dpuv[3].X();
|
||||
D(2, 1) = dpuv[0].Y();
|
||||
D(2, 2) = -dpuv[2].Y();
|
||||
D(2, 3) = -dpuv[3].Y();
|
||||
D(3, 1) = dpuv[0].Z();
|
||||
D(3, 2) = -dpuv[2].Z();
|
||||
D(3, 3) = -dpuv[3].Z();
|
||||
}
|
||||
break;
|
||||
case IntImp_UIsoparametricOnCaro2:
|
||||
{
|
||||
ThePSurfaceTool::D1(SURF1,X(1),X(2),pntsol1,dpuv[0],dpuv[1]);
|
||||
ThePSurfaceTool::D1(SURF2,paramConst,X(3),pntsol2,dpuv[2],dpuv[3]);
|
||||
D(1,1) = dpuv[0].X();
|
||||
D(1,2) = dpuv[1].X();
|
||||
D(1,3) =-dpuv[3].X();
|
||||
D(2,1) = dpuv[0].Y();
|
||||
D(2,2) = dpuv[1].Y();
|
||||
D(2,3) =-dpuv[3].Y();
|
||||
D(3,1) = dpuv[0].Z();
|
||||
D(3,2) = dpuv[1].Z();
|
||||
D(3,3) =-dpuv[3].Z();
|
||||
case IntImp_UIsoparametricOnCaro2: {
|
||||
ThePSurfaceTool::D1(SURF1, X(1), X(2), pntsol1, dpuv[0], dpuv[1]);
|
||||
ThePSurfaceTool::D1(SURF2, paramConst, X(3), pntsol2, dpuv[2], dpuv[3]);
|
||||
D(1, 1) = dpuv[0].X();
|
||||
D(1, 2) = dpuv[1].X();
|
||||
D(1, 3) = -dpuv[3].X();
|
||||
D(2, 1) = dpuv[0].Y();
|
||||
D(2, 2) = dpuv[1].Y();
|
||||
D(2, 3) = -dpuv[3].Y();
|
||||
D(3, 1) = dpuv[0].Z();
|
||||
D(3, 2) = dpuv[1].Z();
|
||||
D(3, 3) = -dpuv[3].Z();
|
||||
}
|
||||
break;
|
||||
case IntImp_VIsoparametricOnCaro2:
|
||||
{
|
||||
ThePSurfaceTool::D1(SURF1,X(1),X(2),pntsol1,dpuv[0],dpuv[1]);
|
||||
ThePSurfaceTool::D1(SURF2,X(3),paramConst,pntsol2,dpuv[2],dpuv[3]);
|
||||
D(1,1) = dpuv[0].X();
|
||||
D(1,2) = dpuv[1].X();
|
||||
D(1,3) =-dpuv[2].X();
|
||||
D(2,1) = dpuv[0].Y();
|
||||
D(2,2) = dpuv[1].Y();
|
||||
D(2,3) =-dpuv[2].Y();
|
||||
D(3,1) = dpuv[0].Z();
|
||||
D(3,2) = dpuv[1].Z();
|
||||
D(3,3) =-dpuv[2].Z();
|
||||
case IntImp_VIsoparametricOnCaro2: {
|
||||
ThePSurfaceTool::D1(SURF1, X(1), X(2), pntsol1, dpuv[0], dpuv[1]);
|
||||
ThePSurfaceTool::D1(SURF2, X(3), paramConst, pntsol2, dpuv[2], dpuv[3]);
|
||||
D(1, 1) = dpuv[0].X();
|
||||
D(1, 2) = dpuv[1].X();
|
||||
D(1, 3) = -dpuv[2].X();
|
||||
D(2, 1) = dpuv[0].Y();
|
||||
D(2, 2) = dpuv[1].Y();
|
||||
D(2, 3) = -dpuv[2].Y();
|
||||
D(3, 1) = dpuv[0].Z();
|
||||
D(3, 2) = dpuv[1].Z();
|
||||
D(3, 3) = -dpuv[2].Z();
|
||||
}
|
||||
break;
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean IntImp_ZerParFunc::Values( const math_Vector& X,
|
||||
math_Vector& F,
|
||||
math_Matrix& D) {
|
||||
Standard_Boolean IntImp_ZerParFunc::Values(const math_Vector& X, math_Vector& F, math_Matrix& D)
|
||||
{
|
||||
|
||||
switch (chxIso) {
|
||||
case IntImp_UIsoparametricOnCaro1:
|
||||
{
|
||||
ThePSurfaceTool::D1(SURF1,paramConst,X(1),pntsol1,dpuv[0],dpuv[1]);
|
||||
ThePSurfaceTool::D1(SURF2,X(2),X(3),pntsol2,dpuv[2],dpuv[3]);
|
||||
D(1,1) = dpuv[1].X();
|
||||
D(1,2) =-dpuv[2].X();
|
||||
D(1,3) =-dpuv[3].X();
|
||||
D(2,1) = dpuv[1].Y();
|
||||
D(2,2) =-dpuv[2].Y();
|
||||
D(2,3) =-dpuv[3].Y();
|
||||
D(3,1) = dpuv[1].Z();
|
||||
D(3,2) =-dpuv[2].Z();
|
||||
D(3,3) =-dpuv[3].Z();
|
||||
switch (chxIso)
|
||||
{
|
||||
case IntImp_UIsoparametricOnCaro1: {
|
||||
ThePSurfaceTool::D1(SURF1, paramConst, X(1), pntsol1, dpuv[0], dpuv[1]);
|
||||
ThePSurfaceTool::D1(SURF2, X(2), X(3), pntsol2, dpuv[2], dpuv[3]);
|
||||
D(1, 1) = dpuv[1].X();
|
||||
D(1, 2) = -dpuv[2].X();
|
||||
D(1, 3) = -dpuv[3].X();
|
||||
D(2, 1) = dpuv[1].Y();
|
||||
D(2, 2) = -dpuv[2].Y();
|
||||
D(2, 3) = -dpuv[3].Y();
|
||||
D(3, 1) = dpuv[1].Z();
|
||||
D(3, 2) = -dpuv[2].Z();
|
||||
D(3, 3) = -dpuv[3].Z();
|
||||
}
|
||||
break;
|
||||
case IntImp_VIsoparametricOnCaro1:
|
||||
{
|
||||
ThePSurfaceTool::D1(SURF1,X(1),paramConst,pntsol1,dpuv[0],dpuv[1]);
|
||||
ThePSurfaceTool::D1(SURF2,X(2),X(3),pntsol2,dpuv[2],dpuv[3]);
|
||||
D(1,1) = dpuv[0].X();
|
||||
D(1,2) =-dpuv[2].X();
|
||||
D(1,3) =-dpuv[3].X();
|
||||
D(2,1) = dpuv[0].Y();
|
||||
D(2,2) =-dpuv[2].Y();
|
||||
D(2,3) =-dpuv[3].Y();
|
||||
D(3,1) = dpuv[0].Z();
|
||||
D(3,2) =-dpuv[2].Z();
|
||||
D(3,3) =-dpuv[3].Z();
|
||||
case IntImp_VIsoparametricOnCaro1: {
|
||||
ThePSurfaceTool::D1(SURF1, X(1), paramConst, pntsol1, dpuv[0], dpuv[1]);
|
||||
ThePSurfaceTool::D1(SURF2, X(2), X(3), pntsol2, dpuv[2], dpuv[3]);
|
||||
D(1, 1) = dpuv[0].X();
|
||||
D(1, 2) = -dpuv[2].X();
|
||||
D(1, 3) = -dpuv[3].X();
|
||||
D(2, 1) = dpuv[0].Y();
|
||||
D(2, 2) = -dpuv[2].Y();
|
||||
D(2, 3) = -dpuv[3].Y();
|
||||
D(3, 1) = dpuv[0].Z();
|
||||
D(3, 2) = -dpuv[2].Z();
|
||||
D(3, 3) = -dpuv[3].Z();
|
||||
}
|
||||
break;
|
||||
case IntImp_UIsoparametricOnCaro2:
|
||||
{
|
||||
ThePSurfaceTool::D1(SURF1,X(1),X(2),pntsol1,dpuv[0],dpuv[1]);
|
||||
ThePSurfaceTool::D1(SURF2,paramConst,X(3),pntsol2,dpuv[2],dpuv[3]);
|
||||
D(1,1) = dpuv[0].X();
|
||||
D(1,2) = dpuv[1].X();
|
||||
D(1,3) =-dpuv[3].X();
|
||||
D(2,1) = dpuv[0].Y();
|
||||
D(2,2) = dpuv[1].Y();
|
||||
D(2,3) =-dpuv[3].Y();
|
||||
D(3,1) = dpuv[0].Z();
|
||||
D(3,2) = dpuv[1].Z();
|
||||
D(3,3) =-dpuv[3].Z();
|
||||
case IntImp_UIsoparametricOnCaro2: {
|
||||
ThePSurfaceTool::D1(SURF1, X(1), X(2), pntsol1, dpuv[0], dpuv[1]);
|
||||
ThePSurfaceTool::D1(SURF2, paramConst, X(3), pntsol2, dpuv[2], dpuv[3]);
|
||||
D(1, 1) = dpuv[0].X();
|
||||
D(1, 2) = dpuv[1].X();
|
||||
D(1, 3) = -dpuv[3].X();
|
||||
D(2, 1) = dpuv[0].Y();
|
||||
D(2, 2) = dpuv[1].Y();
|
||||
D(2, 3) = -dpuv[3].Y();
|
||||
D(3, 1) = dpuv[0].Z();
|
||||
D(3, 2) = dpuv[1].Z();
|
||||
D(3, 3) = -dpuv[3].Z();
|
||||
}
|
||||
break;
|
||||
case IntImp_VIsoparametricOnCaro2:
|
||||
{
|
||||
ThePSurfaceTool::D1(SURF1,X(1),X(2),pntsol1,dpuv[0],dpuv[1]);
|
||||
ThePSurfaceTool::D1(SURF2,X(3),paramConst,pntsol2,dpuv[2],dpuv[3]);
|
||||
D(1,1) = dpuv[0].X();
|
||||
D(1,2) = dpuv[1].X();
|
||||
D(1,3) =-dpuv[2].X();
|
||||
D(2,1) = dpuv[0].Y();
|
||||
D(2,2) = dpuv[1].Y();
|
||||
D(2,3) =-dpuv[2].Y();
|
||||
D(3,1) = dpuv[0].Z();
|
||||
D(3,2) = dpuv[1].Z();
|
||||
D(3,3) =-dpuv[2].Z();
|
||||
case IntImp_VIsoparametricOnCaro2: {
|
||||
ThePSurfaceTool::D1(SURF1, X(1), X(2), pntsol1, dpuv[0], dpuv[1]);
|
||||
ThePSurfaceTool::D1(SURF2, X(3), paramConst, pntsol2, dpuv[2], dpuv[3]);
|
||||
D(1, 1) = dpuv[0].X();
|
||||
D(1, 2) = dpuv[1].X();
|
||||
D(1, 3) = -dpuv[2].X();
|
||||
D(2, 1) = dpuv[0].Y();
|
||||
D(2, 2) = dpuv[1].Y();
|
||||
D(2, 3) = -dpuv[2].Y();
|
||||
D(3, 1) = dpuv[0].Z();
|
||||
D(3, 2) = dpuv[1].Z();
|
||||
D(3, 3) = -dpuv[2].Z();
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -235,82 +228,79 @@ Standard_Boolean IntImp_ZerParFunc::Values( const math_Vector& X,
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
void IntImp_ZerParFunc::ComputeParameters(
|
||||
const IntImp_ConstIsoparametric ChoixIso,
|
||||
const TColStd_Array1OfReal& Param,
|
||||
math_Vector& UVap,
|
||||
math_Vector& BornInf,
|
||||
math_Vector& BornSup,
|
||||
math_Vector& Tolerance ) {
|
||||
void IntImp_ZerParFunc::ComputeParameters(const IntImp_ConstIsoparametric ChoixIso,
|
||||
const TColStd_Array1OfReal& Param,
|
||||
math_Vector& UVap,
|
||||
math_Vector& BornInf,
|
||||
math_Vector& BornSup,
|
||||
math_Vector& Tolerance)
|
||||
{
|
||||
|
||||
chxIso = ChoixIso;
|
||||
switch (chxIso) {
|
||||
case IntImp_UIsoparametricOnCaro1:
|
||||
{
|
||||
switch (chxIso)
|
||||
{
|
||||
case IntImp_UIsoparametricOnCaro1: {
|
||||
paramConst = Param(1);
|
||||
UVap(1) = Param(2);
|
||||
UVap(2) = Param(3);
|
||||
UVap(3) = Param(4);
|
||||
|
||||
UVap(1) = Param(2);
|
||||
UVap(2) = Param(3);
|
||||
UVap(3) = Param(4);
|
||||
|
||||
BornInf(1) = va0;
|
||||
BornSup(1) = va1;
|
||||
|
||||
|
||||
BornInf(2) = ub0;
|
||||
BornInf(3) = vb0;
|
||||
BornSup(2) = ub1;
|
||||
BornSup(3) = vb1;
|
||||
|
||||
Tolerance(1)= vres1;
|
||||
Tolerance(2)= ures2;
|
||||
Tolerance(3)= vres2;
|
||||
|
||||
Tolerance(1) = vres1;
|
||||
Tolerance(2) = ures2;
|
||||
Tolerance(3) = vres2;
|
||||
}
|
||||
break;
|
||||
case IntImp_VIsoparametricOnCaro1:
|
||||
{
|
||||
case IntImp_VIsoparametricOnCaro1: {
|
||||
paramConst = Param(2);
|
||||
UVap(1) = Param(1);
|
||||
UVap(2) = Param(3);
|
||||
UVap(3) = Param(4);
|
||||
UVap(1) = Param(1);
|
||||
UVap(2) = Param(3);
|
||||
UVap(3) = Param(4);
|
||||
BornInf(1) = ua0;
|
||||
BornSup(1) = ua1;
|
||||
|
||||
|
||||
BornInf(2) = ub0;
|
||||
BornSup(2) = ub1;
|
||||
BornInf(3) = vb0;
|
||||
BornSup(3) = vb1;
|
||||
|
||||
Tolerance(1)= ures1;
|
||||
Tolerance(2)= ures2;
|
||||
Tolerance(3)= vres2;
|
||||
Tolerance(1) = ures1;
|
||||
Tolerance(2) = ures2;
|
||||
Tolerance(3) = vres2;
|
||||
}
|
||||
break;
|
||||
case IntImp_UIsoparametricOnCaro2:
|
||||
{
|
||||
paramConst = Param(3);
|
||||
UVap(1) = Param(1);
|
||||
UVap(2) = Param(2);
|
||||
UVap(3) = Param(4);
|
||||
|
||||
case IntImp_UIsoparametricOnCaro2: {
|
||||
paramConst = Param(3);
|
||||
UVap(1) = Param(1);
|
||||
UVap(2) = Param(2);
|
||||
UVap(3) = Param(4);
|
||||
|
||||
BornInf(1) = ua0;
|
||||
BornSup(1) = ua1;
|
||||
BornInf(2) = va0;
|
||||
BornSup(2) = va1;
|
||||
|
||||
|
||||
BornInf(3) = vb0;
|
||||
BornSup(3) = vb1;
|
||||
|
||||
Tolerance(1)= ures1;
|
||||
Tolerance(2)= vres1;
|
||||
Tolerance(3)= vres2;
|
||||
Tolerance(1) = ures1;
|
||||
Tolerance(2) = vres1;
|
||||
Tolerance(3) = vres2;
|
||||
}
|
||||
break;
|
||||
case IntImp_VIsoparametricOnCaro2:
|
||||
{
|
||||
paramConst = Param(4);
|
||||
UVap(1) = Param(1);
|
||||
UVap(2) = Param(2);
|
||||
UVap(3) = Param(3);
|
||||
|
||||
case IntImp_VIsoparametricOnCaro2: {
|
||||
paramConst = Param(4);
|
||||
UVap(1) = Param(1);
|
||||
UVap(2) = Param(2);
|
||||
UVap(3) = Param(3);
|
||||
|
||||
BornInf(1) = ua0;
|
||||
BornSup(1) = ua1;
|
||||
BornInf(2) = va0;
|
||||
@@ -319,88 +309,74 @@ void IntImp_ZerParFunc::ComputeParameters(
|
||||
BornInf(3) = ub0;
|
||||
BornSup(3) = ub1;
|
||||
|
||||
Tolerance(1)= ures1;
|
||||
Tolerance(2)= vres1;
|
||||
Tolerance(3)= ures2;
|
||||
Tolerance(1) = ures1;
|
||||
Tolerance(2) = vres1;
|
||||
Tolerance(3) = ures2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Standard_Real Incr1 = (BornSup(1)-BornInf(1))*0.01;
|
||||
Standard_Real Incr2 = (BornSup(2)-BornInf(2))*0.01;
|
||||
Standard_Real Incr3 = (BornSup(3)-BornInf(3))*0.01;
|
||||
Standard_Real Incr1 = (BornSup(1) - BornInf(1)) * 0.01;
|
||||
Standard_Real Incr2 = (BornSup(2) - BornInf(2)) * 0.01;
|
||||
Standard_Real Incr3 = (BornSup(3) - BornInf(3)) * 0.01;
|
||||
BornInf(1) -= Incr1;
|
||||
BornSup(1) += Incr1;
|
||||
BornInf(2) -= Incr2;
|
||||
BornSup(2) += Incr2;
|
||||
BornInf(3) -= Incr3;
|
||||
BornSup(3) += Incr3;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean IntImp_ZerParFunc::IsTangent(
|
||||
const math_Vector& UVap,
|
||||
TColStd_Array1OfReal& Param,
|
||||
IntImp_ConstIsoparametric& BestChoix)
|
||||
Standard_Boolean IntImp_ZerParFunc::IsTangent(const math_Vector& UVap,
|
||||
TColStd_Array1OfReal& Param,
|
||||
IntImp_ConstIsoparametric& BestChoix)
|
||||
{
|
||||
switch (chxIso) {
|
||||
case IntImp_UIsoparametricOnCaro1:
|
||||
{
|
||||
switch (chxIso)
|
||||
{
|
||||
case IntImp_UIsoparametricOnCaro1: {
|
||||
Param(1) = paramConst;
|
||||
Param(2) = UVap(1) ;
|
||||
Param(3) = UVap(2) ;
|
||||
Param(4) = UVap(3) ;
|
||||
Param(2) = UVap(1);
|
||||
Param(3) = UVap(2);
|
||||
Param(4) = UVap(3);
|
||||
}
|
||||
break;
|
||||
case IntImp_VIsoparametricOnCaro1:
|
||||
{
|
||||
case IntImp_VIsoparametricOnCaro1: {
|
||||
Param(2) = paramConst;
|
||||
Param(1) = UVap(1) ;
|
||||
Param(3) = UVap(2) ;
|
||||
Param(4) = UVap(3) ;
|
||||
Param(1) = UVap(1);
|
||||
Param(3) = UVap(2);
|
||||
Param(4) = UVap(3);
|
||||
}
|
||||
break;
|
||||
case IntImp_UIsoparametricOnCaro2:
|
||||
{
|
||||
case IntImp_UIsoparametricOnCaro2: {
|
||||
Param(3) = paramConst;
|
||||
Param(1) = UVap(1) ;
|
||||
Param(2) = UVap(2) ;
|
||||
Param(4) = UVap(3) ;
|
||||
Param(1) = UVap(1);
|
||||
Param(2) = UVap(2);
|
||||
Param(4) = UVap(3);
|
||||
}
|
||||
break;
|
||||
case IntImp_VIsoparametricOnCaro2:
|
||||
{
|
||||
case IntImp_VIsoparametricOnCaro2: {
|
||||
Param(4) = paramConst;
|
||||
Param(1) = UVap(1) ;
|
||||
Param(2) = UVap(2) ;
|
||||
Param(3) = UVap(3) ;
|
||||
Param(1) = UVap(1);
|
||||
Param(2) = UVap(2);
|
||||
Param(3) = UVap(3);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
IntImp_ConstIsoparametric TabIso[4];
|
||||
Standard_Real EpsUV[4];
|
||||
Standard_Real EpsUV[4];
|
||||
EpsUV[0] = ures1;
|
||||
EpsUV[1] = vres1;
|
||||
|
||||
|
||||
EpsUV[2] = ures2;
|
||||
EpsUV[3] = vres2;
|
||||
|
||||
|
||||
tangent = IntImp_ComputeTangence(dpuv,EpsUV,tgduv,TabIso);
|
||||
if (!tangent)
|
||||
tangent = IntImp_ComputeTangence(dpuv, EpsUV, tgduv, TabIso);
|
||||
if (!tangent)
|
||||
chxIso = TabIso[0];
|
||||
BestChoix = chxIso;
|
||||
return tangent;
|
||||
}
|
||||
|
||||
|
||||
#undef SURF1
|
||||
#undef SURF2
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -14,43 +14,38 @@
|
||||
|
||||
#include <gp_Vec2d.hxx>
|
||||
|
||||
|
||||
|
||||
IntImpParGen_ImpParTool::IntImpParGen_ImpParTool(const ImpTool& ITool,
|
||||
const ParCurve& PC):
|
||||
TheImpTool(ITool)
|
||||
{
|
||||
IntImpParGen_ImpParTool::IntImpParGen_ImpParTool(const ImpTool& ITool, const ParCurve& PC)
|
||||
: TheImpTool(ITool)
|
||||
{
|
||||
TheParCurve = (Standard_Address)(&PC);
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean IntImpParGen_ImpParTool::Value(const Standard_Real Param,
|
||||
Standard_Real& ApproxDistance) {
|
||||
|
||||
ApproxDistance = TheImpTool.Distance(ParTool::Value((*((ParCurve *)(TheParCurve))),Param));
|
||||
return(Standard_True);
|
||||
Standard_Real& ApproxDistance)
|
||||
{
|
||||
|
||||
ApproxDistance = TheImpTool.Distance(ParTool::Value((*((ParCurve*)(TheParCurve))), Param));
|
||||
return (Standard_True);
|
||||
}
|
||||
|
||||
Standard_Boolean IntImpParGen_ImpParTool::Derivative(const Standard_Real Param,
|
||||
Standard_Real& D_ApproxDistance_DV) {
|
||||
|
||||
Standard_Real& D_ApproxDistance_DV)
|
||||
{
|
||||
|
||||
gp_Pnt2d Pt;
|
||||
gp_Vec2d TanParCurve;
|
||||
gp_Vec2d Grad=TheImpTool.GradDistance(ParTool::Value((*((ParCurve *)(TheParCurve))),Param));
|
||||
ParTool::D1((*((ParCurve *)(TheParCurve))),Param,Pt,TanParCurve);
|
||||
gp_Vec2d Grad = TheImpTool.GradDistance(ParTool::Value((*((ParCurve*)(TheParCurve))), Param));
|
||||
ParTool::D1((*((ParCurve*)(TheParCurve))), Param, Pt, TanParCurve);
|
||||
D_ApproxDistance_DV = Grad.Dot(TanParCurve);
|
||||
return(Standard_True);
|
||||
return (Standard_True);
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean IntImpParGen_ImpParTool::Values(const Standard_Real Param,
|
||||
Standard_Real& ApproxDistance,
|
||||
Standard_Real& Deriv) {
|
||||
|
||||
this->Value(Param,ApproxDistance);
|
||||
this->Derivative(Param,Deriv);
|
||||
return(Standard_True);
|
||||
Standard_Real& ApproxDistance,
|
||||
Standard_Real& Deriv)
|
||||
{
|
||||
|
||||
this->Value(Param, ApproxDistance);
|
||||
this->Derivative(Param, Deriv);
|
||||
return (Standard_True);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -12,27 +12,39 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
IntStart_PathPoint::IntStart_PathPoint ()
|
||||
: tol(0.0),
|
||||
isnew(Standard_True),
|
||||
param(0.0)
|
||||
IntStart_PathPoint::IntStart_PathPoint()
|
||||
: tol(0.0),
|
||||
isnew(Standard_True),
|
||||
param(0.0)
|
||||
{
|
||||
}
|
||||
|
||||
IntStart_PathPoint::IntStart_PathPoint (const gp_Pnt& P,
|
||||
const Standard_Real Tol,
|
||||
const TheVertex& V,
|
||||
const TheArc& A,
|
||||
const Standard_Real Parameter):
|
||||
IntStart_PathPoint::IntStart_PathPoint(const gp_Pnt& P,
|
||||
const Standard_Real Tol,
|
||||
const TheVertex& V,
|
||||
const TheArc& A,
|
||||
const Standard_Real Parameter)
|
||||
:
|
||||
|
||||
point(P),tol(Tol),isnew(Standard_False),vtx(V),arc(A),param(Parameter)
|
||||
{}
|
||||
point(P),
|
||||
tol(Tol),
|
||||
isnew(Standard_False),
|
||||
vtx(V),
|
||||
arc(A),
|
||||
param(Parameter)
|
||||
{
|
||||
}
|
||||
|
||||
IntStart_PathPoint::IntStart_PathPoint (const gp_Pnt& P,
|
||||
const Standard_Real Tol,
|
||||
const TheArc& A,
|
||||
const Standard_Real Parameter):
|
||||
|
||||
point(P),tol(Tol),isnew(Standard_True),arc(A),param(Parameter)
|
||||
{}
|
||||
IntStart_PathPoint::IntStart_PathPoint(const gp_Pnt& P,
|
||||
const Standard_Real Tol,
|
||||
const TheArc& A,
|
||||
const Standard_Real Parameter)
|
||||
:
|
||||
|
||||
point(P),
|
||||
tol(Tol),
|
||||
isnew(Standard_True),
|
||||
arc(A),
|
||||
param(Parameter)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -13,91 +13,94 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef OCCT_DEBUG
|
||||
#define No_Standard_RangeError
|
||||
#define No_Standard_OutOfRange
|
||||
#define No_Standard_RangeError
|
||||
#define No_Standard_OutOfRange
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#include <math_FunctionSetRoot.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
|
||||
#include <TopAbs_State.hxx>
|
||||
|
||||
IntStart_SearchInside::IntStart_SearchInside (): done(Standard_False)
|
||||
{}
|
||||
|
||||
IntStart_SearchInside::IntStart_SearchInside (TheFunction& Func,
|
||||
const ThePSurface& PS,
|
||||
const Handle(TheTopolTool)& T,
|
||||
const Standard_Real Epsilon) {
|
||||
|
||||
Perform(Func,PS,T,Epsilon);
|
||||
IntStart_SearchInside::IntStart_SearchInside()
|
||||
: done(Standard_False)
|
||||
{
|
||||
}
|
||||
|
||||
IntStart_SearchInside::IntStart_SearchInside(TheFunction& Func,
|
||||
const ThePSurface& PS,
|
||||
const Handle(TheTopolTool)& T,
|
||||
const Standard_Real Epsilon)
|
||||
{
|
||||
|
||||
Perform(Func, PS, T, Epsilon);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose : Search all inside points
|
||||
// function : Perform
|
||||
// purpose : Search all inside points
|
||||
//=======================================================================
|
||||
|
||||
void IntStart_SearchInside::Perform (TheFunction& Func,
|
||||
const ThePSurface& PS,
|
||||
const Handle(TheTopolTool)& T,
|
||||
const Standard_Real Epsilon) {
|
||||
void IntStart_SearchInside::Perform(TheFunction& Func,
|
||||
const ThePSurface& PS,
|
||||
const Handle(TheTopolTool)& T,
|
||||
const Standard_Real Epsilon)
|
||||
{
|
||||
|
||||
done = Standard_False;
|
||||
list.Clear();
|
||||
Standard_Real aBinf[2], aBsup[2], aUVap[2], atoler[2];
|
||||
math_Vector Binf(aBinf,1,2), Bsup(aBsup,1,2), UVap(aUVap,1,2), toler(atoler,1,2);
|
||||
gp_Pnt psol;
|
||||
Standard_Real aBinf[2], aBsup[2], aUVap[2], atoler[2];
|
||||
math_Vector Binf(aBinf, 1, 2), Bsup(aBsup, 1, 2), UVap(aUVap, 1, 2), toler(atoler, 1, 2);
|
||||
gp_Pnt psol;
|
||||
Standard_Boolean testpnt;
|
||||
Standard_Integer i,j,nbpt;
|
||||
TopAbs_State situ;
|
||||
Standard_Real umin,umax,vmin,vmax;
|
||||
Standard_Integer i, j, nbpt;
|
||||
TopAbs_State situ;
|
||||
Standard_Real umin, umax, vmin, vmax;
|
||||
Binf(1) = umin = ThePSurfaceTool::FirstUParameter(PS);
|
||||
Binf(2) = vmin = ThePSurfaceTool::FirstVParameter(PS);
|
||||
Bsup(1) = umax = ThePSurfaceTool::LastUParameter(PS);
|
||||
Bsup(2) = vmax = ThePSurfaceTool::LastVParameter(PS);
|
||||
|
||||
Standard_Integer NbsampleU= T->NbSamplesU();
|
||||
Standard_Integer NbsampleV= T->NbSamplesV();
|
||||
Standard_Integer Nbsample = T->NbSamples();
|
||||
|
||||
Standard_Real du = Bsup(1)-Binf(1);
|
||||
Standard_Real dv = Bsup(2)-Binf(2);
|
||||
du/=(Standard_Real)NbsampleU*0.5;
|
||||
dv/=(Standard_Real)NbsampleV*0.5;
|
||||
|
||||
Standard_Real toler1 = toler(1) = ThePSurfaceTool::UResolution(PS,Precision::Confusion());
|
||||
Standard_Real toler2 = toler(2) = ThePSurfaceTool::VResolution(PS,Precision::Confusion());
|
||||
Standard_Real Maxtoler1toler2 = toler1;
|
||||
if(toler2>Maxtoler1toler2) Maxtoler1toler2 = toler2;
|
||||
|
||||
Standard_Integer NbsampleU = T->NbSamplesU();
|
||||
Standard_Integer NbsampleV = T->NbSamplesV();
|
||||
Standard_Integer Nbsample = T->NbSamples();
|
||||
|
||||
Standard_Real du = Bsup(1) - Binf(1);
|
||||
Standard_Real dv = Bsup(2) - Binf(2);
|
||||
du /= (Standard_Real)NbsampleU * 0.5;
|
||||
dv /= (Standard_Real)NbsampleV * 0.5;
|
||||
|
||||
Standard_Real toler1 = toler(1) = ThePSurfaceTool::UResolution(PS, Precision::Confusion());
|
||||
Standard_Real toler2 = toler(2) = ThePSurfaceTool::VResolution(PS, Precision::Confusion());
|
||||
Standard_Real Maxtoler1toler2 = toler1;
|
||||
if (toler2 > Maxtoler1toler2)
|
||||
Maxtoler1toler2 = toler2;
|
||||
|
||||
//-- lbr le 15 mai 97
|
||||
//-- on interdit aux points d'etre trop prets des restrictions
|
||||
Maxtoler1toler2*=1000;
|
||||
if(Maxtoler1toler2>du*0.001) Maxtoler1toler2=du*0.001;
|
||||
if(Maxtoler1toler2>dv*0.001) Maxtoler1toler2=dv*0.001;
|
||||
|
||||
|
||||
//-- on interdit aux points d'etre trop prets des restrictions
|
||||
Maxtoler1toler2 *= 1000;
|
||||
if (Maxtoler1toler2 > du * 0.001)
|
||||
Maxtoler1toler2 = du * 0.001;
|
||||
if (Maxtoler1toler2 > dv * 0.001)
|
||||
Maxtoler1toler2 = dv * 0.001;
|
||||
|
||||
Func.Set(PS);
|
||||
Standard_Real Tol = Func.Tolerance();
|
||||
|
||||
math_FunctionSetRoot Rsnld(Func,toler);
|
||||
math_FunctionSetRoot Rsnld(Func, toler);
|
||||
|
||||
//-- lbr le 15 mai 97
|
||||
umin+=du*0.01;
|
||||
vmin+=dv*0.01;
|
||||
umax-=du*0.01;
|
||||
vmax-=dv*0.01;
|
||||
//-- lbr le 15 mai 97
|
||||
umin += du * 0.01;
|
||||
vmin += dv * 0.01;
|
||||
umax -= du * 0.01;
|
||||
vmax -= dv * 0.01;
|
||||
|
||||
//-- lbr le 30 octobre 97 :
|
||||
//-- lbr le 30 octobre 97 :
|
||||
//-- Si une surface vient tangenter 2 edges proche d un coin
|
||||
//-- il faut faire attention qu un point de depart soit trouve au
|
||||
//-- il faut faire attention qu un point de depart soit trouve au
|
||||
//-- voisinage du coin. Car ds le cas contraire, le cheminement ne
|
||||
//-- pourra pas passer au travers des frontieres :
|
||||
//-- pourra pas passer au travers des frontieres :
|
||||
//--
|
||||
//-- typiquement I est un cylindre (conge)
|
||||
//--
|
||||
@@ -110,150 +113,204 @@ void IntStart_SearchInside::Perform (TheFunction& Func,
|
||||
//-- P I
|
||||
//-- PI
|
||||
//-- * I
|
||||
//-- PI I
|
||||
//-- PI I
|
||||
//-- P I I I I I I I I
|
||||
//--
|
||||
|
||||
|
||||
for (i=1; i <= Nbsample+12; i++) {
|
||||
gp_Pnt2d s2d;
|
||||
gp_Pnt s3d;
|
||||
Standard_Boolean nepastester=Standard_False;
|
||||
if(i<=Nbsample) {
|
||||
T->SamplePoint(i,s2d,s3d);
|
||||
UVap(1)=s2d.X(); UVap(2)=s2d.Y();
|
||||
|
||||
Standard_Real u1,v1,u2,v2;
|
||||
u1 = Binf(1) = Max(umin,UVap(1)-du);
|
||||
v1 = Binf(2) = Max(vmin,UVap(2)-dv);
|
||||
u2 = Bsup(1) = Min(umax,UVap(1)+du);
|
||||
v2 = Bsup(2) = Min(vmax,UVap(2)+dv);
|
||||
|
||||
|
||||
for (i = 1; i <= Nbsample + 12; i++)
|
||||
{
|
||||
gp_Pnt2d s2d;
|
||||
gp_Pnt s3d;
|
||||
Standard_Boolean nepastester = Standard_False;
|
||||
if (i <= Nbsample)
|
||||
{
|
||||
T->SamplePoint(i, s2d, s3d);
|
||||
UVap(1) = s2d.X();
|
||||
UVap(2) = s2d.Y();
|
||||
|
||||
Standard_Real u1, v1, u2, v2;
|
||||
u1 = Binf(1) = Max(umin, UVap(1) - du);
|
||||
v1 = Binf(2) = Max(vmin, UVap(2) - dv);
|
||||
u2 = Bsup(1) = Min(umax, UVap(1) + du);
|
||||
v2 = Bsup(2) = Min(vmax, UVap(2) + dv);
|
||||
|
||||
//-- gp_Pnt Pmilieu = ThePSurfaceTool::Value(PS,0.5*(u1+u2),0.5*(v1+v2));
|
||||
gp_Pnt Pextrm1 = ThePSurfaceTool::Value(PS,u1,v1);
|
||||
gp_Pnt Pextrm2 = ThePSurfaceTool::Value(PS,u2,v2);
|
||||
gp_Pnt Pextrm1 = ThePSurfaceTool::Value(PS, u1, v1);
|
||||
gp_Pnt Pextrm2 = ThePSurfaceTool::Value(PS, u2, v2);
|
||||
Standard_Real aValf[1];
|
||||
math_Vector Valf(aValf,1,1);
|
||||
Func.Value(UVap,Valf);
|
||||
Standard_Real rvalf = Valf(1);
|
||||
math_Vector Valf(aValf, 1, 1);
|
||||
Func.Value(UVap, Valf);
|
||||
Standard_Real rvalf = Valf(1);
|
||||
Standard_Real DistPP = Pextrm1.SquareDistance(Pextrm2);
|
||||
if(rvalf*rvalf > 3.0*DistPP) {
|
||||
nepastester=Standard_True;
|
||||
}
|
||||
if (rvalf * rvalf > 3.0 * DistPP)
|
||||
{
|
||||
nepastester = Standard_True;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(i==Nbsample+1) { s2d.SetCoord(umin+du*0.02,vmin+dv*0.02); }
|
||||
else if(i==Nbsample+2) { s2d.SetCoord(umax-du*0.02,vmin+dv*0.02); }
|
||||
else if(i==Nbsample+3) { s2d.SetCoord(umin+du*0.02,vmax-dv*0.02); }
|
||||
else if(i==Nbsample+4) { s2d.SetCoord(umax-du*0.02,vmax-dv*0.02); }
|
||||
else
|
||||
{
|
||||
if (i == Nbsample + 1)
|
||||
{
|
||||
s2d.SetCoord(umin + du * 0.02, vmin + dv * 0.02);
|
||||
}
|
||||
else if (i == Nbsample + 2)
|
||||
{
|
||||
s2d.SetCoord(umax - du * 0.02, vmin + dv * 0.02);
|
||||
}
|
||||
else if (i == Nbsample + 3)
|
||||
{
|
||||
s2d.SetCoord(umin + du * 0.02, vmax - dv * 0.02);
|
||||
}
|
||||
else if (i == Nbsample + 4)
|
||||
{
|
||||
s2d.SetCoord(umax - du * 0.02, vmax - dv * 0.02);
|
||||
}
|
||||
|
||||
else if(i==Nbsample+5) { s2d.SetCoord(umin+du*0.02,vmin+dv*0.02); }
|
||||
else if(i==Nbsample+6) { s2d.SetCoord(umax-du*0.02,vmin+dv*0.02); }
|
||||
else if(i==Nbsample+7) { s2d.SetCoord(umin+du*0.02,vmax-dv*0.02); }
|
||||
else if(i==Nbsample+8) { s2d.SetCoord(umax-du*0.02,vmax-dv*0.02); }
|
||||
else if (i == Nbsample + 5)
|
||||
{
|
||||
s2d.SetCoord(umin + du * 0.02, vmin + dv * 0.02);
|
||||
}
|
||||
else if (i == Nbsample + 6)
|
||||
{
|
||||
s2d.SetCoord(umax - du * 0.02, vmin + dv * 0.02);
|
||||
}
|
||||
else if (i == Nbsample + 7)
|
||||
{
|
||||
s2d.SetCoord(umin + du * 0.02, vmax - dv * 0.02);
|
||||
}
|
||||
else if (i == Nbsample + 8)
|
||||
{
|
||||
s2d.SetCoord(umax - du * 0.02, vmax - dv * 0.02);
|
||||
}
|
||||
|
||||
else if(i==Nbsample+9) { s2d.SetCoord(umin+du*0.005,vmin+dv*0.005); }
|
||||
else if(i==Nbsample+10){ s2d.SetCoord(umax-du*0.005,vmin+dv*0.005); }
|
||||
else if(i==Nbsample+11){ s2d.SetCoord(umin+du*0.005,vmax-dv*0.005); }
|
||||
else { s2d.SetCoord(umax-du*0.005,vmax-dv*0.005); }
|
||||
else if (i == Nbsample + 9)
|
||||
{
|
||||
s2d.SetCoord(umin + du * 0.005, vmin + dv * 0.005);
|
||||
}
|
||||
else if (i == Nbsample + 10)
|
||||
{
|
||||
s2d.SetCoord(umax - du * 0.005, vmin + dv * 0.005);
|
||||
}
|
||||
else if (i == Nbsample + 11)
|
||||
{
|
||||
s2d.SetCoord(umin + du * 0.005, vmax - dv * 0.005);
|
||||
}
|
||||
else
|
||||
{
|
||||
s2d.SetCoord(umax - du * 0.005, vmax - dv * 0.005);
|
||||
}
|
||||
|
||||
UVap(1)=s2d.X(); UVap(2)=s2d.Y();
|
||||
UVap(1) = s2d.X();
|
||||
UVap(2) = s2d.Y();
|
||||
|
||||
Binf(1) = Max(umin,UVap(1)-du);
|
||||
Binf(2) = Max(vmin,UVap(2)-dv);
|
||||
Bsup(1) = Min(umax,UVap(1)+du);
|
||||
Bsup(2) = Min(vmax,UVap(2)+dv);
|
||||
Binf(1) = Max(umin, UVap(1) - du);
|
||||
Binf(2) = Max(vmin, UVap(2) - dv);
|
||||
Bsup(1) = Min(umax, UVap(1) + du);
|
||||
Bsup(2) = Min(vmax, UVap(2) + dv);
|
||||
}
|
||||
|
||||
|
||||
if(nepastester==Standard_False) {
|
||||
Rsnld.Perform(Func,UVap,Binf,Bsup);
|
||||
if (Rsnld.IsDone()) {
|
||||
if (Abs(Func.Root()) <= Tol) {
|
||||
if (!Func.IsTangent()) {
|
||||
psol = Func.Point();
|
||||
Rsnld.Root(UVap);
|
||||
// On regarde si le point trouve est bien un nouveau point.
|
||||
j = 1;
|
||||
nbpt = list.Length();
|
||||
testpnt = (j <= nbpt);
|
||||
|
||||
while (testpnt) {
|
||||
const IntSurf_InteriorPoint& IPj = list(j);
|
||||
const gp_Pnt& Pj = IPj.Value();
|
||||
if ( (Abs(Pj.X()-psol.X()) <= Epsilon)
|
||||
&& (Abs(Pj.Y()-psol.Y()) <= Epsilon)
|
||||
&& (Abs(Pj.Z()-psol.Z()) <= Epsilon)
|
||||
&& (Abs(UVap(1)-IPj.UParameter()) <= toler1)
|
||||
&& (Abs(UVap(2)-IPj.VParameter()) <= toler2) ) {
|
||||
testpnt = Standard_False;
|
||||
}
|
||||
else {
|
||||
j = j+1;
|
||||
testpnt = (j <= nbpt);
|
||||
}
|
||||
}
|
||||
if (j > nbpt) {
|
||||
// situ = TheSITool::Classify(PS,UVap(1),UVap(2));
|
||||
situ = T->Classify(gp_Pnt2d(UVap(1),UVap(2)),
|
||||
Maxtoler1toler2,Standard_False); //-- ,Standard_False pour ne pas recadrer on Periodic
|
||||
if (situ == TopAbs_IN) {
|
||||
list.Append(IntSurf_InteriorPoint(psol,UVap(1),UVap(2),
|
||||
Func.Direction3d(),
|
||||
Func.Direction2d()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (nepastester == Standard_False)
|
||||
{
|
||||
Rsnld.Perform(Func, UVap, Binf, Bsup);
|
||||
if (Rsnld.IsDone())
|
||||
{
|
||||
if (Abs(Func.Root()) <= Tol)
|
||||
{
|
||||
if (!Func.IsTangent())
|
||||
{
|
||||
psol = Func.Point();
|
||||
Rsnld.Root(UVap);
|
||||
// On regarde si le point trouve est bien un nouveau point.
|
||||
j = 1;
|
||||
nbpt = list.Length();
|
||||
testpnt = (j <= nbpt);
|
||||
|
||||
while (testpnt)
|
||||
{
|
||||
const IntSurf_InteriorPoint& IPj = list(j);
|
||||
const gp_Pnt& Pj = IPj.Value();
|
||||
if ((Abs(Pj.X() - psol.X()) <= Epsilon) && (Abs(Pj.Y() - psol.Y()) <= Epsilon)
|
||||
&& (Abs(Pj.Z() - psol.Z()) <= Epsilon)
|
||||
&& (Abs(UVap(1) - IPj.UParameter()) <= toler1)
|
||||
&& (Abs(UVap(2) - IPj.VParameter()) <= toler2))
|
||||
{
|
||||
testpnt = Standard_False;
|
||||
}
|
||||
else
|
||||
{
|
||||
j = j + 1;
|
||||
testpnt = (j <= nbpt);
|
||||
}
|
||||
}
|
||||
if (j > nbpt)
|
||||
{
|
||||
// situ = TheSITool::Classify(PS,UVap(1),UVap(2));
|
||||
situ =
|
||||
T->Classify(gp_Pnt2d(UVap(1), UVap(2)),
|
||||
Maxtoler1toler2,
|
||||
Standard_False); //-- ,Standard_False pour ne pas recadrer on Periodic
|
||||
if (situ == TopAbs_IN)
|
||||
{
|
||||
list.Append(IntSurf_InteriorPoint(psol,
|
||||
UVap(1),
|
||||
UVap(2),
|
||||
Func.Direction3d(),
|
||||
Func.Direction2d()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//-- printf("\n Total : %d Rejet : %d RatioPointCalc : %g nbpt =%d\n",REJET_OK+REJET_KO,REJET_OK,(double)(REJET_KO)/(double)(REJET_OK+REJET_KO),list.Length());
|
||||
//-- printf("\n Total : %d Rejet : %d RatioPointCalc : %g nbpt
|
||||
//=%d\n",REJET_OK+REJET_KO,REJET_OK,(double)(REJET_KO)/(double)(REJET_OK+REJET_KO),list.Length());
|
||||
done = Standard_True;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose : Test the given inside point
|
||||
// function : Perform
|
||||
// purpose : Test the given inside point
|
||||
//=======================================================================
|
||||
|
||||
void IntStart_SearchInside::Perform (TheFunction& Func,
|
||||
const ThePSurface& PS,
|
||||
const Standard_Real UStart,
|
||||
const Standard_Real VStart)
|
||||
void IntStart_SearchInside::Perform(TheFunction& Func,
|
||||
const ThePSurface& PS,
|
||||
const Standard_Real UStart,
|
||||
const Standard_Real VStart)
|
||||
{
|
||||
done = Standard_False;
|
||||
list.Clear();
|
||||
math_Vector Binf(1,2), Bsup(1,2), toler(1,2);
|
||||
math_Vector Binf(1, 2), Bsup(1, 2), toler(1, 2);
|
||||
|
||||
Binf(1) = ThePSurfaceTool::FirstUParameter(PS);
|
||||
Binf(2) = ThePSurfaceTool::FirstVParameter(PS);
|
||||
Bsup(1) = ThePSurfaceTool::LastUParameter(PS);
|
||||
Bsup(2) = ThePSurfaceTool::LastVParameter(PS);
|
||||
|
||||
toler(1) = ThePSurfaceTool::UResolution(PS,Precision::Confusion());
|
||||
toler(2) = ThePSurfaceTool::VResolution(PS,Precision::Confusion());
|
||||
toler(1) = ThePSurfaceTool::UResolution(PS, Precision::Confusion());
|
||||
toler(2) = ThePSurfaceTool::VResolution(PS, Precision::Confusion());
|
||||
|
||||
if (UStart-Binf(1) > -toler(1) && UStart-Bsup(1) < toler(1) &&
|
||||
VStart-Binf(2) > -toler(2) && VStart-Bsup(2) < toler(2)) {
|
||||
if (UStart - Binf(1) > -toler(1) && UStart - Bsup(1) < toler(1) && VStart - Binf(2) > -toler(2)
|
||||
&& VStart - Bsup(2) < toler(2))
|
||||
{
|
||||
|
||||
Func.Set(PS);
|
||||
math_Vector UVap(1,2);
|
||||
UVap(1)=UStart; UVap(2)=VStart;
|
||||
math_Vector UVap(1, 2);
|
||||
UVap(1) = UStart;
|
||||
UVap(2) = VStart;
|
||||
|
||||
math_FunctionSetRoot Rsnld(Func,toler);
|
||||
Rsnld.Perform(Func,UVap,Binf,Bsup);
|
||||
if (Rsnld.IsDone()) {
|
||||
Standard_Real tol = Func.Tolerance();
|
||||
math_FunctionSetRoot Rsnld(Func, toler);
|
||||
Rsnld.Perform(Func, UVap, Binf, Bsup);
|
||||
if (Rsnld.IsDone())
|
||||
{
|
||||
Standard_Real tol = Func.Tolerance();
|
||||
Standard_Real valf = Func.Root();
|
||||
if (Abs(valf) <= tol && !Func.IsTangent()) {
|
||||
const gp_Pnt& psol = Func.Point();
|
||||
Rsnld.Root(UVap);
|
||||
IntSurf_InteriorPoint intp (psol,UVap(1),UVap(2),
|
||||
Func.Direction3d(),Func.Direction2d());
|
||||
list.Append(intp);
|
||||
if (Abs(valf) <= tol && !Func.IsTangent())
|
||||
{
|
||||
const gp_Pnt& psol = Func.Point();
|
||||
Rsnld.Root(UVap);
|
||||
IntSurf_InteriorPoint intp(psol, UVap(1), UVap(2), Func.Direction3d(), Func.Direction2d());
|
||||
list.Append(intp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -12,26 +12,23 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
IntStart_Segment::IntStart_Segment ()
|
||||
: hasfp(Standard_False),
|
||||
haslp(Standard_False)
|
||||
IntStart_Segment::IntStart_Segment()
|
||||
: hasfp(Standard_False),
|
||||
haslp(Standard_False)
|
||||
{
|
||||
}
|
||||
|
||||
void IntStart_Segment::SetLimitPoint(const ThePathPoint& V, const Standard_Boolean First)
|
||||
{
|
||||
|
||||
void IntStart_Segment::SetLimitPoint (const ThePathPoint& V,
|
||||
const Standard_Boolean First) {
|
||||
|
||||
if (First) {
|
||||
if (First)
|
||||
{
|
||||
hasfp = Standard_True;
|
||||
thefp = V;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
haslp = Standard_True;
|
||||
thelp = V;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -14,24 +14,26 @@
|
||||
|
||||
#include <IntSurf_Couple.hxx>
|
||||
|
||||
IntWalk_IWLine::IntWalk_IWLine (const IntSurf_Allocator& theAllocator) :
|
||||
line (new IntSurf_LineOn2S (theAllocator)),
|
||||
closed (Standard_False),
|
||||
hasFirst (Standard_False), hasLast (Standard_False),
|
||||
firstIndex (-1), lastIndex (-1),
|
||||
indextg (-1),
|
||||
istgtbeg (Standard_False), istgtend (Standard_False)
|
||||
IntWalk_IWLine::IntWalk_IWLine(const IntSurf_Allocator& theAllocator)
|
||||
: line(new IntSurf_LineOn2S(theAllocator)),
|
||||
closed(Standard_False),
|
||||
hasFirst(Standard_False),
|
||||
hasLast(Standard_False),
|
||||
firstIndex(-1),
|
||||
lastIndex(-1),
|
||||
indextg(-1),
|
||||
istgtbeg(Standard_False),
|
||||
istgtend(Standard_False)
|
||||
{
|
||||
}
|
||||
|
||||
void IntWalk_IWLine::Reverse()
|
||||
{
|
||||
line->Reverse();
|
||||
Standard_Integer N = line->NbPoints();
|
||||
Standard_Integer N = line->NbPoints();
|
||||
Standard_Integer NbCouple = couple.Length();
|
||||
for (Standard_Integer i = 1; i <= NbCouple; i++) {
|
||||
couple(i) = IntSurf_Couple(N - couple(i).First() + 1,
|
||||
couple(i).Second());
|
||||
for (Standard_Integer i = 1; i <= NbCouple; i++)
|
||||
{
|
||||
couple(i) = IntSurf_Couple(N - couple(i).First() + 1, couple(i).Second());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -19,206 +19,226 @@
|
||||
|
||||
// Modified by skv - Wed Jul 12 15:20:58 2006 OCC12627
|
||||
|
||||
|
||||
#include <IntRes2d_IntersectionSegment.hxx>
|
||||
#include <IntRes2d_IntersectionPoint.hxx>
|
||||
#include <gp_Vec2d.hxx>
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
TopClass_Classifier2d::TopClass_Classifier2d() :
|
||||
myIsSet(Standard_False),
|
||||
myFirstCompare(Standard_True),
|
||||
myFirstTrans(Standard_True),
|
||||
myParam(0.0),
|
||||
myTolerance(0.0),
|
||||
myClosest(0),
|
||||
myState(TopAbs_UNKNOWN), // skv OCC12627
|
||||
myIsHeadOrEnd(Standard_False) // skv OCC12627
|
||||
TopClass_Classifier2d::TopClass_Classifier2d()
|
||||
: myIsSet(Standard_False),
|
||||
myFirstCompare(Standard_True),
|
||||
myFirstTrans(Standard_True),
|
||||
myParam(0.0),
|
||||
myTolerance(0.0),
|
||||
myClosest(0),
|
||||
myState(TopAbs_UNKNOWN), // skv OCC12627
|
||||
myIsHeadOrEnd(Standard_False) // skv OCC12627
|
||||
{
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
void TopClass_Classifier2d::Reset(const gp_Lin2d& L,
|
||||
const Standard_Real P,
|
||||
const Standard_Real Tol)
|
||||
void TopClass_Classifier2d::Reset(const gp_Lin2d& L, const Standard_Real P, const Standard_Real Tol)
|
||||
{
|
||||
myLin = L;
|
||||
myParam = P;
|
||||
myTolerance = Tol;
|
||||
myState = TopAbs_UNKNOWN;
|
||||
myLin = L;
|
||||
myParam = P;
|
||||
myTolerance = Tol;
|
||||
myState = TopAbs_UNKNOWN;
|
||||
myFirstCompare = Standard_True;
|
||||
myFirstTrans = Standard_True;
|
||||
myClosest = 0;
|
||||
myIsSet = Standard_True;
|
||||
// Modified by skv - Wed Jul 12 15:20:58 2006 OCC12627 Begin
|
||||
myFirstTrans = Standard_True;
|
||||
myClosest = 0;
|
||||
myIsSet = Standard_True;
|
||||
// Modified by skv - Wed Jul 12 15:20:58 2006 OCC12627 Begin
|
||||
myIsHeadOrEnd = Standard_False;
|
||||
// Modified by skv - Wed Jul 12 15:20:58 2006 OCC12627 End
|
||||
// Modified by skv - Wed Jul 12 15:20:58 2006 OCC12627 End
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
void TopClass_Classifier2d::Compare(const TheEdge& E,
|
||||
const TopAbs_Orientation Or)
|
||||
void TopClass_Classifier2d::Compare(const TheEdge& E, const TopAbs_Orientation Or)
|
||||
{
|
||||
// intersect the edge and the segment
|
||||
myClosest = 0;
|
||||
myIntersector.Perform(myLin,myParam,myTolerance,E);
|
||||
if (!myIntersector.IsDone()) return;
|
||||
if ((myIntersector.NbPoints() == 0)&&
|
||||
(myIntersector.NbSegments() == 0)) return;
|
||||
myIntersector.Perform(myLin, myParam, myTolerance, E);
|
||||
if (!myIntersector.IsDone())
|
||||
return;
|
||||
if ((myIntersector.NbPoints() == 0) && (myIntersector.NbSegments() == 0))
|
||||
return;
|
||||
|
||||
// find the closest point
|
||||
Standard_Integer iPoint, iSegment, nbPoints, nbSegments;
|
||||
|
||||
const IntRes2d_IntersectionPoint *PClosest = NULL;
|
||||
const IntRes2d_IntersectionPoint* PClosest = NULL;
|
||||
|
||||
Standard_Real dMin = RealLast();
|
||||
nbPoints = myIntersector.NbPoints();
|
||||
for (iPoint = 1; iPoint <= nbPoints; iPoint++) {
|
||||
nbPoints = myIntersector.NbPoints();
|
||||
for (iPoint = 1; iPoint <= nbPoints; iPoint++)
|
||||
{
|
||||
const IntRes2d_IntersectionPoint& PInter = myIntersector.Point(iPoint);
|
||||
// test for ON
|
||||
if (PInter.TransitionOfFirst().PositionOnCurve() == IntRes2d_Head) {
|
||||
if (PInter.TransitionOfFirst().PositionOnCurve() == IntRes2d_Head)
|
||||
{
|
||||
myClosest = iPoint;
|
||||
myState = TopAbs_ON;
|
||||
myState = TopAbs_ON;
|
||||
return;
|
||||
}
|
||||
Standard_Real paramfirst = PInter.ParamOnFirst();
|
||||
if (paramfirst < dMin) {
|
||||
if (paramfirst < dMin)
|
||||
{
|
||||
myClosest = iPoint;
|
||||
PClosest = &PInter;
|
||||
dMin = paramfirst;
|
||||
PClosest = &PInter;
|
||||
dMin = paramfirst;
|
||||
}
|
||||
}
|
||||
|
||||
// for the segments we only test the first point
|
||||
nbSegments = myIntersector.NbSegments();
|
||||
for (iSegment = 1; iSegment <= nbSegments; iSegment++) {
|
||||
const IntRes2d_IntersectionSegment& SegInter =
|
||||
myIntersector.Segment(iSegment);
|
||||
const IntRes2d_IntersectionPoint& PInter = SegInter.FirstPoint();
|
||||
if (PInter.TransitionOfFirst().PositionOnCurve() == IntRes2d_Head) {
|
||||
myClosest = nbPoints + iSegment+ iSegment - 1;
|
||||
myState = TopAbs_ON;
|
||||
for (iSegment = 1; iSegment <= nbSegments; iSegment++)
|
||||
{
|
||||
const IntRes2d_IntersectionSegment& SegInter = myIntersector.Segment(iSegment);
|
||||
const IntRes2d_IntersectionPoint& PInter = SegInter.FirstPoint();
|
||||
if (PInter.TransitionOfFirst().PositionOnCurve() == IntRes2d_Head)
|
||||
{
|
||||
myClosest = nbPoints + iSegment + iSegment - 1;
|
||||
myState = TopAbs_ON;
|
||||
return;
|
||||
}
|
||||
Standard_Real paramfirst = PInter.ParamOnFirst();
|
||||
if (paramfirst < dMin) {
|
||||
myClosest = nbPoints + iSegment+iSegment - 1;
|
||||
PClosest = &PInter;
|
||||
dMin = paramfirst;
|
||||
if (paramfirst < dMin)
|
||||
{
|
||||
myClosest = nbPoints + iSegment + iSegment - 1;
|
||||
PClosest = &PInter;
|
||||
dMin = paramfirst;
|
||||
}
|
||||
}
|
||||
|
||||
// if no point was found return
|
||||
if (myClosest == 0) return;
|
||||
if (myClosest == 0)
|
||||
return;
|
||||
|
||||
// if the Edge is INTERNAL or EXTERNAL, no problem
|
||||
if (Or == TopAbs_INTERNAL) {
|
||||
if (Or == TopAbs_INTERNAL)
|
||||
{
|
||||
myState = TopAbs_IN;
|
||||
return;
|
||||
}
|
||||
else if (Or == TopAbs_EXTERNAL) {
|
||||
else if (Or == TopAbs_EXTERNAL)
|
||||
{
|
||||
myState = TopAbs_OUT;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ( ! myFirstCompare ) {
|
||||
if (!myFirstCompare)
|
||||
{
|
||||
Standard_Boolean b = (dMin > myParam);
|
||||
if (b) {
|
||||
if (b)
|
||||
{
|
||||
// dMin > myParam : le point le plus proche (dMin) trouve dans CETTE
|
||||
// intersection ligne,arete n'est pas le plus proche
|
||||
// de TOUS les points d'intersection avec les autres aretes (myParam).
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// process the closest point PClosest, found at dMin on line.
|
||||
myFirstCompare = Standard_False;
|
||||
|
||||
if(myParam > dMin) { //-- lbr le 13 mai 96
|
||||
myFirstTrans = Standard_True;
|
||||
}
|
||||
|
||||
myParam = dMin;
|
||||
if (myParam > dMin)
|
||||
{ //-- lbr le 13 mai 96
|
||||
myFirstTrans = Standard_True;
|
||||
}
|
||||
|
||||
myParam = dMin;
|
||||
const IntRes2d_Transition& T2 = PClosest->TransitionOfSecond();
|
||||
// Modified by skv - Wed Jul 12 15:20:58 2006 OCC12627 Begin
|
||||
// Standard_Boolean isHeadorEnd = (T2.PositionOnCurve() == IntRes2d_Head) ||
|
||||
// (T2.PositionOnCurve() == IntRes2d_End);
|
||||
myIsHeadOrEnd = (T2.PositionOnCurve() == IntRes2d_Head) ||
|
||||
(T2.PositionOnCurve() == IntRes2d_End);
|
||||
// Modified by skv - Wed Jul 12 15:20:58 2006 OCC12627 End
|
||||
|
||||
// Modified by skv - Wed Jul 12 15:20:58 2006 OCC12627 Begin
|
||||
// Standard_Boolean isHeadorEnd = (T2.PositionOnCurve() == IntRes2d_Head) ||
|
||||
// (T2.PositionOnCurve() == IntRes2d_End);
|
||||
myIsHeadOrEnd = (T2.PositionOnCurve() == IntRes2d_Head) || (T2.PositionOnCurve() == IntRes2d_End);
|
||||
// Modified by skv - Wed Jul 12 15:20:58 2006 OCC12627 End
|
||||
|
||||
// transition on the segment
|
||||
|
||||
TopAbs_Orientation SegTrans = TopAbs_FORWARD;
|
||||
|
||||
const IntRes2d_Transition& T1 = PClosest->TransitionOfFirst();
|
||||
switch (T1.TransitionType()) {
|
||||
case IntRes2d_In :
|
||||
if (Or == TopAbs_REVERSED) SegTrans = TopAbs_REVERSED;
|
||||
else SegTrans = TopAbs_FORWARD;
|
||||
break;
|
||||
case IntRes2d_Out :
|
||||
if (Or == TopAbs_REVERSED) SegTrans = TopAbs_FORWARD;
|
||||
else SegTrans = TopAbs_REVERSED;
|
||||
break;
|
||||
case IntRes2d_Touch :
|
||||
switch (T1.Situation()) {
|
||||
case IntRes2d_Inside :
|
||||
if (Or == TopAbs_REVERSED) SegTrans = TopAbs_EXTERNAL;
|
||||
else SegTrans = TopAbs_INTERNAL;
|
||||
switch (T1.TransitionType())
|
||||
{
|
||||
case IntRes2d_In:
|
||||
if (Or == TopAbs_REVERSED)
|
||||
SegTrans = TopAbs_REVERSED;
|
||||
else
|
||||
SegTrans = TopAbs_FORWARD;
|
||||
break;
|
||||
case IntRes2d_Outside :
|
||||
if (Or == TopAbs_REVERSED) SegTrans = TopAbs_INTERNAL;
|
||||
else SegTrans = TopAbs_EXTERNAL;
|
||||
case IntRes2d_Out:
|
||||
if (Or == TopAbs_REVERSED)
|
||||
SegTrans = TopAbs_FORWARD;
|
||||
else
|
||||
SegTrans = TopAbs_REVERSED;
|
||||
break;
|
||||
case IntRes2d_Unknown : return;
|
||||
}
|
||||
break;
|
||||
case IntRes2d_Undecided : return;
|
||||
case IntRes2d_Touch:
|
||||
switch (T1.Situation())
|
||||
{
|
||||
case IntRes2d_Inside:
|
||||
if (Or == TopAbs_REVERSED)
|
||||
SegTrans = TopAbs_EXTERNAL;
|
||||
else
|
||||
SegTrans = TopAbs_INTERNAL;
|
||||
break;
|
||||
case IntRes2d_Outside:
|
||||
if (Or == TopAbs_REVERSED)
|
||||
SegTrans = TopAbs_INTERNAL;
|
||||
else
|
||||
SegTrans = TopAbs_EXTERNAL;
|
||||
break;
|
||||
case IntRes2d_Unknown:
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case IntRes2d_Undecided:
|
||||
return;
|
||||
}
|
||||
|
||||
// are we inside the Edge ?
|
||||
// const IntRes2d_Transition& T2 = PClosest->TransitionOfSecond();
|
||||
if ( ! myIsHeadOrEnd ) {
|
||||
if (!myIsHeadOrEnd)
|
||||
{
|
||||
// PClosest is inside the edge
|
||||
switch (SegTrans) {
|
||||
switch (SegTrans)
|
||||
{
|
||||
|
||||
case TopAbs_FORWARD :
|
||||
case TopAbs_EXTERNAL :
|
||||
myState = TopAbs_OUT;
|
||||
break;
|
||||
case TopAbs_FORWARD:
|
||||
case TopAbs_EXTERNAL:
|
||||
myState = TopAbs_OUT;
|
||||
break;
|
||||
|
||||
case TopAbs_REVERSED :
|
||||
case TopAbs_INTERNAL :
|
||||
myState = TopAbs_IN;
|
||||
break;
|
||||
case TopAbs_REVERSED:
|
||||
case TopAbs_INTERNAL:
|
||||
myState = TopAbs_IN;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
// PClosest is Head or End of the edge : update the complex transition
|
||||
gp_Dir2d Tang2d,Norm2d;
|
||||
gp_Dir2d Tang2d, Norm2d;
|
||||
Standard_Real Curv;
|
||||
myIntersector.LocalGeometry
|
||||
(E,PClosest->ParamOnSecond(),Tang2d,Norm2d,Curv);
|
||||
gp_Dir Tang(Tang2d.X(),Tang2d.Y(),0.);
|
||||
gp_Dir Norm(Norm2d.X(),Norm2d.Y(),0.);
|
||||
if (myFirstTrans) {
|
||||
gp_Dir D(myLin.Direction().X(),myLin.Direction().Y(),0.);
|
||||
myIntersector.LocalGeometry(E, PClosest->ParamOnSecond(), Tang2d, Norm2d, Curv);
|
||||
gp_Dir Tang(Tang2d.X(), Tang2d.Y(), 0.);
|
||||
gp_Dir Norm(Norm2d.X(), Norm2d.Y(), 0.);
|
||||
if (myFirstTrans)
|
||||
{
|
||||
gp_Dir D(myLin.Direction().X(), myLin.Direction().Y(), 0.);
|
||||
myTrans.Reset(D);
|
||||
myFirstTrans = Standard_False;
|
||||
}
|
||||
|
||||
|
||||
TopAbs_Orientation Ort;
|
||||
if (T2.PositionOnCurve() == IntRes2d_Head) Ort = TopAbs_FORWARD;
|
||||
else Ort = TopAbs_REVERSED;
|
||||
myTrans.Compare(RealEpsilon(), Tang, Norm, Curv, SegTrans, Ort);
|
||||
if (T2.PositionOnCurve() == IntRes2d_Head)
|
||||
Ort = TopAbs_FORWARD;
|
||||
else
|
||||
Ort = TopAbs_REVERSED;
|
||||
myTrans.Compare(RealEpsilon(), Tang, Norm, Curv, SegTrans, Ort);
|
||||
myState = myTrans.StateBefore();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,35 +22,32 @@
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
TopClass_FaceClassifier::TopClass_FaceClassifier() :
|
||||
myEdgeParameter(0.0),
|
||||
rejected(Standard_False),
|
||||
nowires(Standard_True)
|
||||
TopClass_FaceClassifier::TopClass_FaceClassifier()
|
||||
: myEdgeParameter(0.0),
|
||||
rejected(Standard_False),
|
||||
nowires(Standard_True)
|
||||
{
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
TopClass_FaceClassifier::TopClass_FaceClassifier(TheFaceExplorer& FExp,
|
||||
const gp_Pnt2d& P,
|
||||
const Standard_Real Tol) :
|
||||
myEdgeParameter(0.0),
|
||||
rejected(Standard_False),
|
||||
nowires(Standard_True)
|
||||
TopClass_FaceClassifier::TopClass_FaceClassifier(TheFaceExplorer& FExp,
|
||||
const gp_Pnt2d& P,
|
||||
const Standard_Real Tol)
|
||||
: myEdgeParameter(0.0),
|
||||
rejected(Standard_False),
|
||||
nowires(Standard_True)
|
||||
{
|
||||
Perform(FExp,P,Tol);
|
||||
Perform(FExp, P, Tol);
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
void TopClass_FaceClassifier::Perform(TheFaceExplorer& Fexp,
|
||||
const gp_Pnt2d& P,
|
||||
const Standard_Real Tol)
|
||||
void TopClass_FaceClassifier::Perform(TheFaceExplorer& Fexp,
|
||||
const gp_Pnt2d& P,
|
||||
const Standard_Real Tol)
|
||||
{
|
||||
gp_Pnt2d aPoint(P);
|
||||
gp_Pnt2d aPoint(P);
|
||||
Standard_Boolean aResOfPointCheck = Standard_False;
|
||||
while (aResOfPointCheck == Standard_False)
|
||||
{
|
||||
@@ -76,65 +73,75 @@ void TopClass_FaceClassifier::Perform(TheFaceExplorer& Fexp,
|
||||
|
||||
nowires = Standard_True;
|
||||
|
||||
while (IsValidSegment) {
|
||||
while (IsValidSegment)
|
||||
{
|
||||
myClassifier.Reset(aLine, aParam, Tol);
|
||||
|
||||
for (Fexp.InitWires(); Fexp.MoreWires(); Fexp.NextWire()) {
|
||||
for (Fexp.InitWires(); Fexp.MoreWires(); Fexp.NextWire())
|
||||
{
|
||||
nowires = Standard_False;
|
||||
IsWReject = Fexp.RejectWire(aLine, myClassifier.Parameter());
|
||||
|
||||
if (!IsWReject) {
|
||||
// test this wire
|
||||
for (Fexp.InitEdges(); Fexp.MoreEdges(); Fexp.NextEdge()) {
|
||||
IsEReject = Fexp.RejectEdge(aLine, myClassifier.Parameter());
|
||||
if (!IsWReject)
|
||||
{
|
||||
// test this wire
|
||||
for (Fexp.InitEdges(); Fexp.MoreEdges(); Fexp.NextEdge())
|
||||
{
|
||||
IsEReject = Fexp.RejectEdge(aLine, myClassifier.Parameter());
|
||||
|
||||
if (!IsEReject) {
|
||||
// test this edge
|
||||
Fexp.CurrentEdge(anEdge, anEdgeOri);
|
||||
if (!IsEReject)
|
||||
{
|
||||
// test this edge
|
||||
Fexp.CurrentEdge(anEdge, anEdgeOri);
|
||||
|
||||
if (anEdgeOri == TopAbs_FORWARD || anEdgeOri == TopAbs_REVERSED) {
|
||||
myClassifier.Compare(anEdge, anEdgeOri);
|
||||
aClosestInd = myClassifier.ClosestIntersection();
|
||||
if (anEdgeOri == TopAbs_FORWARD || anEdgeOri == TopAbs_REVERSED)
|
||||
{
|
||||
myClassifier.Compare(anEdge, anEdgeOri);
|
||||
aClosestInd = myClassifier.ClosestIntersection();
|
||||
|
||||
if (aClosestInd != 0) {
|
||||
// save the closest edge
|
||||
TheIntersection2d &anIntersector = myClassifier.Intersector();
|
||||
Standard_Integer aNbPnts = anIntersector.NbPoints();
|
||||
if (aClosestInd != 0)
|
||||
{
|
||||
// save the closest edge
|
||||
TheIntersection2d& anIntersector = myClassifier.Intersector();
|
||||
Standard_Integer aNbPnts = anIntersector.NbPoints();
|
||||
|
||||
myEdge = anEdge;
|
||||
myEdge = anEdge;
|
||||
|
||||
if (aClosestInd <= aNbPnts) {
|
||||
aPInter = anIntersector.Point(aClosestInd);
|
||||
} else {
|
||||
aClosestInd -= aNbPnts;
|
||||
if (aClosestInd <= aNbPnts)
|
||||
{
|
||||
aPInter = anIntersector.Point(aClosestInd);
|
||||
}
|
||||
else
|
||||
{
|
||||
aClosestInd -= aNbPnts;
|
||||
|
||||
if (aClosestInd&1) {
|
||||
aPInter = anIntersector.
|
||||
Segment((aClosestInd + 1)/2).FirstPoint();
|
||||
} else {
|
||||
aPInter = anIntersector.
|
||||
Segment((aClosestInd + 1)/2).LastPoint();
|
||||
}
|
||||
}
|
||||
if (aClosestInd & 1)
|
||||
{
|
||||
aPInter = anIntersector.Segment((aClosestInd + 1) / 2).FirstPoint();
|
||||
}
|
||||
else
|
||||
{
|
||||
aPInter = anIntersector.Segment((aClosestInd + 1) / 2).LastPoint();
|
||||
}
|
||||
}
|
||||
|
||||
myPosition = aPInter.
|
||||
TransitionOfSecond().PositionOnCurve();
|
||||
myEdgeParameter = aPInter.ParamOnSecond();
|
||||
}
|
||||
// if we are ON, we stop
|
||||
aState = myClassifier.State();
|
||||
|
||||
if (aState == TopAbs_ON)
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
myPosition = aPInter.TransitionOfSecond().PositionOnCurve();
|
||||
myEdgeParameter = aPInter.ParamOnSecond();
|
||||
}
|
||||
// if we are ON, we stop
|
||||
aState = myClassifier.State();
|
||||
|
||||
// if we are out of the wire we stop
|
||||
aState = myClassifier.State();
|
||||
if (aState == TopAbs_ON)
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (aState == TopAbs_OUT)
|
||||
return;
|
||||
// if we are out of the wire we stop
|
||||
aState = myClassifier.State();
|
||||
|
||||
if (aState == TopAbs_OUT)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,32 +155,28 @@ void TopClass_FaceClassifier::Perform(TheFaceExplorer& Fexp,
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
TopAbs_State TopClass_FaceClassifier::State() const
|
||||
{
|
||||
if (rejected) return TopAbs_OUT;
|
||||
else if (nowires) return TopAbs_IN;
|
||||
else return myClassifier.State();
|
||||
if (rejected)
|
||||
return TopAbs_OUT;
|
||||
else if (nowires)
|
||||
return TopAbs_IN;
|
||||
else
|
||||
return myClassifier.State();
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
const TheEdge& TopClass_FaceClassifier::Edge() const
|
||||
{
|
||||
Standard_DomainError_Raise_if(rejected,
|
||||
"TopClass_FaceClassifier::Edge:rejected");
|
||||
Standard_DomainError_Raise_if(rejected, "TopClass_FaceClassifier::Edge:rejected");
|
||||
return myEdge;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
Standard_Real TopClass_FaceClassifier::EdgeParameter() const
|
||||
{
|
||||
Standard_DomainError_Raise_if(rejected,
|
||||
"TopClass_FaceClassifier::EdgeParameter:rejected");
|
||||
Standard_DomainError_Raise_if(rejected, "TopClass_FaceClassifier::EdgeParameter:rejected");
|
||||
return myEdgeParameter;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,23 +16,19 @@
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
TopBas_Interference::TopBas_Interference()
|
||||
{
|
||||
}
|
||||
TopBas_Interference::TopBas_Interference() {}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
TopBas_Interference::TopBas_Interference(const TheSubShape& Inters,
|
||||
const TheShape& Bound,
|
||||
const TopAbs_Orientation Orient,
|
||||
const TopAbs_Orientation Trans,
|
||||
const TopAbs_Orientation BTrans) :
|
||||
myIntersection(Inters),
|
||||
myBoundary(Bound),
|
||||
myOrientation(Orient),
|
||||
myTransition(Trans),
|
||||
myBTransition(BTrans)
|
||||
TopBas_Interference::TopBas_Interference(const TheSubShape& Inters,
|
||||
const TheShape& Bound,
|
||||
const TopAbs_Orientation Orient,
|
||||
const TopAbs_Orientation Trans,
|
||||
const TopAbs_Orientation BTrans)
|
||||
: myIntersection(Inters),
|
||||
myBoundary(Bound),
|
||||
myOrientation(Orient),
|
||||
myTransition(Trans),
|
||||
myBTransition(BTrans)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
MAT_TList::MAT_TList()
|
||||
{
|
||||
thecurrentindex = 0;
|
||||
@@ -25,62 +24,57 @@ MAT_TList::MAT_TList()
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
void MAT_TList::First()
|
||||
{
|
||||
thecurrentnode = thefirstnode;
|
||||
thecurrentnode = thefirstnode;
|
||||
thecurrentindex = 1;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
void MAT_TList::Last()
|
||||
{
|
||||
thecurrentnode = thelastnode;
|
||||
thecurrentnode = thelastnode;
|
||||
thecurrentindex = thenumberofitems;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
void MAT_TList::Init(const Item& anitem)
|
||||
{
|
||||
First();
|
||||
while(More())
|
||||
{
|
||||
if(anitem == thecurrentnode->GetItem()) break;
|
||||
Next();
|
||||
}
|
||||
while (More())
|
||||
{
|
||||
if (anitem == thecurrentnode->GetItem())
|
||||
break;
|
||||
Next();
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
void MAT_TList::Next()
|
||||
{
|
||||
if(!IsEmpty())
|
||||
{
|
||||
thecurrentnode = thecurrentnode->Next();
|
||||
thecurrentindex = (thecurrentindex % thenumberofitems) + 1;
|
||||
}
|
||||
if (!IsEmpty())
|
||||
{
|
||||
thecurrentnode = thecurrentnode->Next();
|
||||
thecurrentindex = (thecurrentindex % thenumberofitems) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
void MAT_TList::Previous()
|
||||
{
|
||||
if(!IsEmpty())
|
||||
{
|
||||
thecurrentnode = thecurrentnode->Previous();
|
||||
thecurrentindex = ((thecurrentindex+thenumberofitems-2)%thenumberofitems)+1;
|
||||
}
|
||||
if (!IsEmpty())
|
||||
{
|
||||
thecurrentnode = thecurrentnode->Previous();
|
||||
thecurrentindex = ((thecurrentindex + thenumberofitems - 2) % thenumberofitems) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
Standard_Boolean MAT_TList::More() const
|
||||
{
|
||||
return (!thecurrentnode.IsNull());
|
||||
@@ -88,7 +82,6 @@ Standard_Boolean MAT_TList::More() const
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
Item MAT_TList::Current() const
|
||||
{
|
||||
return thecurrentnode->GetItem();
|
||||
@@ -96,7 +89,6 @@ Item MAT_TList::Current() const
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
void MAT_TList::Current(const Item& anitem) const
|
||||
{
|
||||
thecurrentnode->SetItem(anitem);
|
||||
@@ -104,7 +96,6 @@ void MAT_TList::Current(const Item& anitem) const
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
Item MAT_TList::FirstItem() const
|
||||
{
|
||||
return thefirstnode->GetItem();
|
||||
@@ -112,7 +103,6 @@ Item MAT_TList::FirstItem() const
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
Item MAT_TList::LastItem() const
|
||||
{
|
||||
return thelastnode->GetItem();
|
||||
@@ -120,7 +110,6 @@ Item MAT_TList::LastItem() const
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
Item MAT_TList::PreviousItem() const
|
||||
{
|
||||
return thecurrentnode->Previous()->GetItem();
|
||||
@@ -128,7 +117,6 @@ Item MAT_TList::PreviousItem() const
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
Item MAT_TList::NextItem() const
|
||||
{
|
||||
return thecurrentnode->Next()->GetItem();
|
||||
@@ -136,39 +124,37 @@ Item MAT_TList::NextItem() const
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
Item MAT_TList::Brackets (const Standard_Integer anindex)
|
||||
Item MAT_TList::Brackets(const Standard_Integer anindex)
|
||||
{
|
||||
if(thecurrentindex > anindex)
|
||||
if (thecurrentindex > anindex)
|
||||
{
|
||||
while (thecurrentindex != anindex)
|
||||
{
|
||||
while(thecurrentindex != anindex)
|
||||
{
|
||||
thecurrentindex--;
|
||||
thecurrentnode = thecurrentnode->Previous();
|
||||
}
|
||||
thecurrentindex--;
|
||||
thecurrentnode = thecurrentnode->Previous();
|
||||
}
|
||||
else if(thecurrentindex < anindex)
|
||||
}
|
||||
else if (thecurrentindex < anindex)
|
||||
{
|
||||
while (thecurrentindex != anindex)
|
||||
{
|
||||
while(thecurrentindex != anindex)
|
||||
{
|
||||
thecurrentindex++;
|
||||
thecurrentnode = thecurrentnode->Next();
|
||||
}
|
||||
thecurrentindex++;
|
||||
thecurrentnode = thecurrentnode->Next();
|
||||
}
|
||||
}
|
||||
return thecurrentnode->GetItem();
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
void MAT_TList::Unlink()
|
||||
{
|
||||
Standard_Boolean previousisnull = thecurrentnode->Previous().IsNull();
|
||||
Standard_Boolean nextisnull = thecurrentnode->Next().IsNull();
|
||||
Standard_Boolean nextisnull = thecurrentnode->Next().IsNull();
|
||||
|
||||
if(thecurrentindex)
|
||||
if (thecurrentindex)
|
||||
{
|
||||
if(!nextisnull)
|
||||
if (!nextisnull)
|
||||
{
|
||||
thecurrentnode->Next()->Previous(thecurrentnode->Previous());
|
||||
}
|
||||
@@ -177,11 +163,11 @@ void MAT_TList::Unlink()
|
||||
thecurrentnode->Previous()->Next(thecurrentnode->Next());
|
||||
}
|
||||
|
||||
if(thecurrentindex == 1)
|
||||
if (thecurrentindex == 1)
|
||||
{
|
||||
thefirstnode = thecurrentnode->Next();
|
||||
}
|
||||
else if(thecurrentindex == thenumberofitems)
|
||||
else if (thecurrentindex == thenumberofitems)
|
||||
{
|
||||
thelastnode = thecurrentnode->Previous();
|
||||
}
|
||||
@@ -192,27 +178,27 @@ void MAT_TList::Unlink()
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
void MAT_TList::LinkBefore(const Item& anitem)
|
||||
{
|
||||
thenumberofitems++;
|
||||
if(thecurrentindex)thecurrentindex++;
|
||||
if (thecurrentindex)
|
||||
thecurrentindex++;
|
||||
|
||||
Handle(MAT_TListNode) previous;
|
||||
|
||||
Handle(MAT_TListNode) node = new MAT_TListNode(anitem);
|
||||
|
||||
if(!(thecurrentnode->Previous()).IsNull())
|
||||
{
|
||||
previous = thecurrentnode->Previous();
|
||||
previous->Next(node);
|
||||
node->Previous(previous);
|
||||
}
|
||||
if (!(thecurrentnode->Previous()).IsNull())
|
||||
{
|
||||
previous = thecurrentnode->Previous();
|
||||
previous->Next(node);
|
||||
node->Previous(previous);
|
||||
}
|
||||
|
||||
if(thecurrentindex == 2)
|
||||
{
|
||||
thefirstnode = node;
|
||||
}
|
||||
if (thecurrentindex == 2)
|
||||
{
|
||||
thefirstnode = node;
|
||||
}
|
||||
|
||||
thecurrentnode->Previous(node);
|
||||
node->Next(thecurrentnode);
|
||||
@@ -220,7 +206,6 @@ void MAT_TList::LinkBefore(const Item& anitem)
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
void MAT_TList::LinkAfter(const Item& anitem)
|
||||
{
|
||||
thenumberofitems++;
|
||||
@@ -228,17 +213,17 @@ void MAT_TList::LinkAfter(const Item& anitem)
|
||||
|
||||
Handle(MAT_TListNode) node = new MAT_TListNode(anitem);
|
||||
|
||||
if(!(thecurrentnode->Next()).IsNull())
|
||||
{
|
||||
next = thecurrentnode->Next();
|
||||
next->Previous(node);
|
||||
node->Next(next);
|
||||
}
|
||||
if (!(thecurrentnode->Next()).IsNull())
|
||||
{
|
||||
next = thecurrentnode->Next();
|
||||
next->Previous(node);
|
||||
node->Next(next);
|
||||
}
|
||||
|
||||
if(thecurrentindex+1 ==thenumberofitems)
|
||||
{
|
||||
thelastnode = node;
|
||||
}
|
||||
if (thecurrentindex + 1 == thenumberofitems)
|
||||
{
|
||||
thelastnode = node;
|
||||
}
|
||||
|
||||
thecurrentnode->Next(node);
|
||||
node->Previous(thecurrentnode);
|
||||
@@ -246,51 +231,49 @@ void MAT_TList::LinkAfter(const Item& anitem)
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
void MAT_TList::FrontAdd(const Item& anitem)
|
||||
{
|
||||
thenumberofitems++;
|
||||
if(thecurrentindex)thecurrentindex++;
|
||||
if (thecurrentindex)
|
||||
thecurrentindex++;
|
||||
|
||||
Handle(MAT_TListNode) node = new MAT_TListNode(anitem);
|
||||
|
||||
if(!thefirstnode.IsNull())
|
||||
{
|
||||
thefirstnode->Previous(node);
|
||||
node->Next(thefirstnode);
|
||||
}
|
||||
if (!thefirstnode.IsNull())
|
||||
{
|
||||
thefirstnode->Previous(node);
|
||||
node->Next(thefirstnode);
|
||||
}
|
||||
else
|
||||
{
|
||||
thelastnode = node;
|
||||
}
|
||||
{
|
||||
thelastnode = node;
|
||||
}
|
||||
|
||||
thefirstnode = node;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
void MAT_TList::BackAdd(const Item& anitem)
|
||||
{
|
||||
thenumberofitems++;
|
||||
Handle(MAT_TListNode) node = new MAT_TListNode(anitem);
|
||||
|
||||
if(!thelastnode.IsNull())
|
||||
{
|
||||
thelastnode->Next(node);
|
||||
node->Previous(thelastnode);
|
||||
}
|
||||
if (!thelastnode.IsNull())
|
||||
{
|
||||
thelastnode->Next(node);
|
||||
node->Previous(thelastnode);
|
||||
}
|
||||
else
|
||||
{
|
||||
thefirstnode = node;
|
||||
}
|
||||
{
|
||||
thefirstnode = node;
|
||||
}
|
||||
|
||||
thelastnode = node;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
void MAT_TList::Permute()
|
||||
{
|
||||
Handle(MAT_TListNode) previous = thecurrentnode->Previous();
|
||||
@@ -299,34 +282,35 @@ void MAT_TList::Permute()
|
||||
Handle(MAT_TListNode) nextnext = next->Next();
|
||||
Handle(MAT_TListNode) null;
|
||||
|
||||
if(!previous.IsNull())
|
||||
{
|
||||
previous->Next(next);
|
||||
next->Previous(previous);
|
||||
}
|
||||
if (!previous.IsNull())
|
||||
{
|
||||
previous->Next(next);
|
||||
next->Previous(previous);
|
||||
}
|
||||
else
|
||||
{
|
||||
next->Previous(null);
|
||||
}
|
||||
{
|
||||
next->Previous(null);
|
||||
}
|
||||
next->Next(current);
|
||||
current->Previous(next);
|
||||
if(!nextnext.IsNull())
|
||||
{
|
||||
current->Next(nextnext);
|
||||
nextnext->Previous(current);
|
||||
}
|
||||
if (!nextnext.IsNull())
|
||||
{
|
||||
current->Next(nextnext);
|
||||
nextnext->Previous(current);
|
||||
}
|
||||
else
|
||||
{
|
||||
current->Next(null);
|
||||
}
|
||||
if(thefirstnode == current) thefirstnode = next;
|
||||
if(thelastnode == next) thelastnode = current;
|
||||
{
|
||||
current->Next(null);
|
||||
}
|
||||
if (thefirstnode == current)
|
||||
thefirstnode = next;
|
||||
if (thelastnode == next)
|
||||
thelastnode = current;
|
||||
thecurrentindex++;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
void MAT_TList::Loop() const
|
||||
{
|
||||
thelastnode->Next(thefirstnode);
|
||||
@@ -335,16 +319,15 @@ void MAT_TList::Loop() const
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
void MAT_TList::Dump(const Standard_Integer ashift,
|
||||
const Standard_Integer alevel)
|
||||
void MAT_TList::Dump(const Standard_Integer ashift, const Standard_Integer alevel)
|
||||
{
|
||||
for(First(); More(); Next()) Current()->Dump(ashift,alevel);
|
||||
for (First(); More(); Next())
|
||||
Current()->Dump(ashift, alevel);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ~MAT_TList
|
||||
//purpose :
|
||||
// function : ~MAT_TList
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
MAT_TList::~MAT_TList()
|
||||
@@ -353,8 +336,8 @@ MAT_TList::~MAT_TList()
|
||||
while (!aNode.IsNull())
|
||||
{
|
||||
Handle(MAT_TListNode) aNext = aNode->Next();
|
||||
aNode->Next (NULL);
|
||||
aNode->Previous (NULL);
|
||||
aNode->Next(NULL);
|
||||
aNode->Previous(NULL);
|
||||
aNode = aNext;
|
||||
}
|
||||
thecurrentnode.Nullify();
|
||||
|
||||
@@ -16,5 +16,4 @@
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
void MAT_TListNode::Dummy()const {}
|
||||
void MAT_TListNode::Dummy() const {}
|
||||
|
||||
Reference in New Issue
Block a user