1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-05-21 10:55:33 +03:00

0024472: Wrong section curves

1. Checking, if intersection curve is collapsed, is added. (file GeomInt_LineConstructor.cxx)
2. Earlier, intersection line was considered as valid if only mid-point of every interval of this line is into two intersected surfaces (with given tolerance). That's no good because after inserting of new points, old points, which is considered as valid only because they are into beginning or into end of interval (therefore, they was not checked), moved to mid of interval and became invalid. Therefore, checking for first and last points was added. (file GeomInt_LineConstructor.cxx)
3. Intersection line became valid (see bug description) after adding of new additional points into it (file IntPatch_PrmPrmIntersection.cxx). Methods for finding and adding of new points were added. (file IntWalk_PWalking_1.gxx)
Some test cases were changed.
Test cases for issue CR24472
This commit is contained in:
nbv 2014-02-06 11:12:09 +04:00 committed by apn
parent ec0cdc0e65
commit 00302ba4e7
10 changed files with 3453 additions and 2587 deletions

View File

@ -104,7 +104,8 @@ void GeomInt_IntSS::Perform(const Handle(Geom_Surface)& S1,
// ============================================================
if (myIntersector.IsDone()) {
const Standard_Integer nblin = myIntersector.NbLines();
for (Standard_Integer i=1; i<= nblin; i++) {
for (Standard_Integer i=1; i<= nblin; i++)
{
MakeCurve(i,dom1,dom2,Tol,Approx,ApproxS1,ApproxS2);
}
}

View File

@ -186,10 +186,22 @@ void GeomInt_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
{
firstp = GeomInt_LineTool::Vertex(L,i).ParameterOnLine();
lastp = GeomInt_LineTool::Vertex(L,i+1).ParameterOnLine();
if(firstp!=lastp)
{
const Standard_Real pmid = (firstp+lastp)*0.5;
const gp_Pnt Pmid = ALine->Value(pmid);
//Checking, if it is an "micro-curve" (can it be collapsed in one point?).
//If "yes" then first-, last- and midpoints are same point.
gp_Pnt aP1 = ALine->Value(RealToInt(firstp)),
aP2 = ALine->Value(RealToInt(lastp));
Standard_Real aSQDist = aP1.SquareDistance(aP2);
aSQDist = Max(aSQDist, aP1.SquareDistance(Pmid));
aSQDist = Max(aSQDist, aP2.SquareDistance(Pmid));
Standard_Boolean isMicro = aSQDist*100.0 < Tol;
if((Abs(firstp-lastp)>Precision::PConfusion()) && !isMicro)
{
Parameters(myHS1,myHS2,Pmid,u1,v1,u2,v2);
Recadre(myHS1,myHS2,u1,v1,u2,v2);
const TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
@ -210,27 +222,84 @@ void GeomInt_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
Standard_Real u1,v1,u2,v2;
Handle(IntPatch_WLine)& WLine = *((Handle(IntPatch_WLine) *)&L);
seqp.Clear();
i = 1;
{
firstp = GeomInt_LineTool::Vertex(L,1).ParameterOnLine();
const IntSurf_PntOn2S& Pf = WLine->Point(RealToInt(firstp));
Pf.Parameters(u1,v1,u2,v2);
//Inscribe parameters into main period for periodic surfaces
Recadre(myHS1,myHS2,u1,v1,u2,v2);
const TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
const TopAbs_State in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
if((in1 == TopAbs_OUT) || (in2 == TopAbs_OUT))
{
i = 2;
}
}
nbvtx = GeomInt_LineTool::NbVertex(L);
for(i=1;i<nbvtx;i++)
for(;i<nbvtx;i++)
{
firstp = GeomInt_LineTool::Vertex(L,i).ParameterOnLine();
lastp = GeomInt_LineTool::Vertex(L,i+1).ParameterOnLine();
if(firstp!=lastp)
{
const Standard_Integer pmid = (Standard_Integer )( (firstp+lastp)/2);
const Standard_Integer pmid = RealToInt((firstp+lastp)*0.5);
const IntSurf_PntOn2S& Pmid = WLine->Point(pmid);
//Checking, if it is an "micro-curve" (can it be collapsed in one point?).
//If "yes" then first-, last- and midpoints are same point.
gp_Pnt aP1 = WLine->Point(RealToInt(firstp)).Value(),
aP2 = WLine->Point(RealToInt(lastp)).Value();
Standard_Real aSQDist = aP1.SquareDistance(aP2);
aSQDist = Max(aSQDist, aP1.SquareDistance(Pmid.Value()));
aSQDist = Max(aSQDist, aP2.SquareDistance(Pmid.Value()));
Standard_Boolean isMicro = aSQDist*100.0 < Tol;
if((Abs(firstp-lastp)>Precision::PConfusion()) && !isMicro)
{
Pmid.Parameters(u1,v1,u2,v2);
//Inscribe parameters into main period for periodic surfaces
Recadre(myHS1,myHS2,u1,v1,u2,v2);
const TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
if(in1 != TopAbs_OUT) { //-- !=ON donne Pb
const TopAbs_State in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
if(in2 != TopAbs_OUT) { //-- !=ON
const TopAbs_State in1m = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
if(in1m == TopAbs_OUT)
{
continue;
}
const TopAbs_State in2m = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
if(in2m == TopAbs_OUT)
{
continue;
}
const IntSurf_PntOn2S& Plast = WLine->Point(RealToInt(lastp));
Plast.Parameters(u1,v1,u2,v2);
//Inscribe parameters into main period for periodic surfaces
Recadre(myHS1,myHS2,u1,v1,u2,v2);
const TopAbs_State in1l = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
if(in1l == TopAbs_OUT)
{
continue;
}
const TopAbs_State in2l = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
if(in2l == TopAbs_OUT)
{
continue;
}
seqp.Append(firstp);
seqp.Append(lastp);
}
}
}
}
done = Standard_True;
return;
}
@ -245,22 +314,51 @@ void GeomInt_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
{
firstp = GeomInt_LineTool::Vertex(L,i).ParameterOnLine();
lastp = GeomInt_LineTool::Vertex(L,i+1).ParameterOnLine();
if(Abs(firstp-lastp)>Precision::PConfusion())
if((Abs(firstp-lastp)>Precision::PConfusion()))
{
intrvtested = Standard_True;
const Standard_Real pmid = (firstp+lastp)*0.5;
gp_Pnt Pmid;
gp_Pnt Pmid, aP1, aP2;
switch (typl)
{
case IntPatch_Lin: Pmid = ElCLib::Value(pmid,GLine->Line()); break;
case IntPatch_Circle: Pmid = ElCLib::Value(pmid,GLine->Circle()); break;
case IntPatch_Ellipse: Pmid = ElCLib::Value(pmid,GLine->Ellipse()); break;
case IntPatch_Hyperbola: Pmid = ElCLib::Value(pmid,GLine->Hyperbola()); break;
case IntPatch_Parabola: Pmid = ElCLib::Value(pmid,GLine->Parabola()); break;
case IntPatch_Lin:
Pmid = ElCLib::Value(pmid,GLine->Line());
aP1 = ElCLib::Value(firstp,GLine->Line());
aP2 = ElCLib::Value(lastp,GLine->Line());
break;
case IntPatch_Circle:
Pmid = ElCLib::Value(pmid,GLine->Circle());
aP1 = ElCLib::Value(firstp,GLine->Circle());
aP2 = ElCLib::Value(lastp,GLine->Circle());
break;
case IntPatch_Ellipse:
Pmid = ElCLib::Value(pmid,GLine->Ellipse());
aP1 = ElCLib::Value(firstp,GLine->Ellipse());
aP2 = ElCLib::Value(lastp,GLine->Ellipse());
break;
case IntPatch_Hyperbola:
Pmid = ElCLib::Value(pmid,GLine->Hyperbola());
aP1 = ElCLib::Value(firstp,GLine->Hyperbola());
aP2 = ElCLib::Value(lastp,GLine->Hyperbola());
break;
case IntPatch_Parabola:
Pmid = ElCLib::Value(pmid,GLine->Parabola());
aP1 = ElCLib::Value(firstp,GLine->Parabola());
aP2 = ElCLib::Value(lastp,GLine->Parabola());
break;
case IntPatch_Analytic:
case IntPatch_Walking:
case IntPatch_Restriction: break; // cases Analytic, Walking and Restriction are handled above
}
Standard_Real aSQDist = aP1.SquareDistance(aP2);
aSQDist = Max(aSQDist, aP1.SquareDistance(Pmid));
aSQDist = Max(aSQDist, aP2.SquareDistance(Pmid));
if(aSQDist*100.0 > Tol)
{ //if it is not an "micro-curve" (can it be collapsed in one point?).
//If "yes" then first-, last- and midpoints are same point.
Parameters(myHS1,myHS2,Pmid,u1,v1,u2,v2);
Recadre(myHS1,myHS2,u1,v1,u2,v2);
const TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
@ -273,18 +371,28 @@ void GeomInt_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
}
}
}
}
if(typl == IntPatch_Circle || typl == IntPatch_Ellipse)
{
const Standard_Real aT = M_PI + M_PI;
firstp = GeomInt_LineTool::Vertex(L,nbvtx).ParameterOnLine();
lastp = M_PI + M_PI + GeomInt_LineTool::Vertex(L,1).ParameterOnLine();
lastp = aT + GeomInt_LineTool::Vertex(L,1).ParameterOnLine();
const Standard_Real cadrinf = GeomInt_LineTool::FirstParameter(L);
const Standard_Real cadrsup = GeomInt_LineTool::LastParameter(L);
Standard_Real acadr = (firstp+lastp)*0.5;
while(acadr < cadrinf) { acadr+=M_PI+M_PI; }
while(acadr > cadrsup) { acadr-=M_PI+M_PI; }
while(acadr < cadrinf)
{
acadr+=aT;
}
while(acadr > cadrsup)
{
acadr-=aT;
}
if(acadr>=cadrinf && acadr<=cadrsup)
{
if(Abs(firstp-lastp)>Precision::PConfusion())
if(Abs(firstp-lastp) > Precision::PConfusion())
{
intrvtested = Standard_True;
const Standard_Real pmid = (firstp+lastp)*0.5;
@ -296,9 +404,11 @@ void GeomInt_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
Parameters(myHS1,myHS2,Pmid,u1,v1,u2,v2);
Recadre(myHS1,myHS2,u1,v1,u2,v2);
const TopAbs_State in1 = myDom1->Classify(gp_Pnt2d(u1,v1),Tol);
if(in1 != TopAbs_OUT) {
if(in1 != TopAbs_OUT)
{
const TopAbs_State in2 = myDom2->Classify(gp_Pnt2d(u2,v2),Tol);
if(in2 != TopAbs_OUT) {
if(in2 != TopAbs_OUT)
{
seqp.Append(firstp);
seqp.Append(lastp);
}
@ -306,6 +416,7 @@ void GeomInt_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
}
}
}
if (!intrvtested) {
// on garde a priori. Il faudrait un point 2d sur chaque
// surface pour prendre la decision. Sera fait dans
@ -370,24 +481,32 @@ void GeomInt_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
{
// on cumule
GeomInt_ParameterAndOrientation& valj = seqpss.ChangeValue(j);
if (or1 != TopAbs_INTERNAL) {
if (valj.Orientation1() != TopAbs_INTERNAL) {
if (or1 != valj.Orientation1()) {
if (or1 != TopAbs_INTERNAL)
{
if (valj.Orientation1() != TopAbs_INTERNAL)
{
if (or1 != valj.Orientation1())
{
valj.SetOrientation1(TopAbs_INTERNAL);
}
}
else {
else
{
valj.SetOrientation1(or1);
}
}
if (or2 != TopAbs_INTERNAL) {
if (valj.Orientation2() != TopAbs_INTERNAL) {
if (or2 != valj.Orientation2()) {
if (or2 != TopAbs_INTERNAL)
{
if (valj.Orientation2() != TopAbs_INTERNAL)
{
if (or2 != valj.Orientation2())
{
valj.SetOrientation2(TopAbs_INTERNAL);
}
}
else {
else
{
valj.SetOrientation2(or2);
}
}
@ -403,7 +522,9 @@ void GeomInt_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
break;
}
}
if (!inserted) {
if (!inserted)
{
seqpss.Append(GeomInt_ParameterAndOrientation(prm,or1,or2));
}
}
@ -505,10 +626,12 @@ void GeomInt_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
lastp = seqpss(i).Parameter();
Standard_Real stofirst = Max(firstp, thefirst);
Standard_Real stolast = Min(lastp, thelast) ;
if (stolast > stofirst) {
if (stolast > stofirst)
{
seqp.Append(stofirst);
seqp.Append(stolast);
}
if (lastp > thelast)
break;
}

View File

@ -52,12 +52,12 @@ static void SectionPointToParameters(const Intf_SectionPoint& Sp,
static
void AdjustOnPeriodic(const Handle(Adaptor3d_HSurface)& Surf1,
void AdjustOnPeriodic(const Handle(Adaptor3d_HSurface)& Surf1,
const Handle(Adaptor3d_HSurface)& Surf2,
IntPatch_SequenceOfLine& aSLin);
static
IntSurf_PntOn2S MakeNewPoint(const IntSurf_PntOn2S& replacePnt,
IntSurf_PntOn2S MakeNewPoint(const IntSurf_PntOn2S& replacePnt,
const IntSurf_PntOn2S& oldPnt,
const Standard_Real* Periods);
@ -1605,14 +1605,12 @@ void IntPatch_PrmPrmIntersection::Perform(const Handle(Adaptor3d_HSurface)& S
const Standard_Real TolTangency,
const Standard_Real Epsilon,
const Standard_Real Deflection,
const Standard_Real Increment) {
// Standard_Integer NbU1 = D1->NbSamplesU();
// Standard_Integer NbV1 = D1->NbSamplesV();
// Standard_Integer NbU2 = D2->NbSamplesU();
// Standard_Integer NbV2 = D2->NbSamplesV();
const Standard_Real Increment)
{
// Standard_Integer NbU1 = D1->NbSamplesU();
// Standard_Integer NbV1 = D1->NbSamplesV();
// Standard_Integer NbU2 = D2->NbSamplesU();
// Standard_Integer NbV2 = D2->NbSamplesV();
//-- Traitement des Lignes de sections
empt = Standard_True;
@ -1625,18 +1623,18 @@ void IntPatch_PrmPrmIntersection::Perform(const Handle(Adaptor3d_HSurface)& S
TColStd_Array1OfReal StartParams(1,4);
// Standard_Integer MaxOscill = NbU1;
// if(MaxOscill < NbU2) MaxOscill=NbU2;
// if(MaxOscill < NbV1) MaxOscill=NbV1;
// if(MaxOscill < NbV2) MaxOscill=NbV2;
// Standard_Integer MaxOscill = NbU1;
// if(MaxOscill < NbU2) MaxOscill=NbU2;
// if(MaxOscill < NbV1) MaxOscill=NbV1;
// if(MaxOscill < NbV2) MaxOscill=NbV2;
// Standard_Real nIncrement=Increment;
// if(MaxOscill>10) {
// #ifdef DEB
// cout<<"\n IntPatch_PrmPrmIntersection.gxx : Increment:"<<Increment<<" -> "<<Increment/(0.5*MaxOscill)<<endl;
// #endif
// nIncrement/=0.5*MaxOscill;
// }
// Standard_Real nIncrement=Increment;
// if(MaxOscill>10) {
// #ifdef DEB
// cout<<"\n IntPatch_PrmPrmIntersection.gxx : Increment:"<<Increment<<" -> "<<Increment/(0.5*MaxOscill)<<endl;
// #endif
// nIncrement/=0.5*MaxOscill;
// }
IntPatch_ThePWalkingInter PW(Surf1,Surf2,
TolTangency,
@ -1886,15 +1884,17 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
const Standard_Real Increment,
const Standard_Boolean ClearFlag)
{
Standard_Integer NbU1, NbV1, NbU2, NbV2, Limit;
Standard_Integer Limit = 2500;
Standard_Integer NbU1 = 10, NbV1 = 10, NbU2 = 10, NbV2 = 10;
//
D1->SamplePnts(Deflection, 10, 10);
D2->SamplePnts(Deflection, 10, 10);
D1->SamplePnts(Deflection, NbU1, NbV1);
D2->SamplePnts(Deflection, NbU2, NbV2);
//
NbU1 = D1->NbSamplesU();
NbV1 = D1->NbSamplesV();
NbU2 = D2->NbSamplesU();
NbV2 = D2->NbSamplesV();
TColStd_Array1OfReal anUpars1(1, NbU1), aVpars1(1, NbV1);
TColStd_Array1OfReal anUpars2(1, NbU2), aVpars2(1, NbV2);
//
@ -1910,23 +1910,28 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
Periods[3] = (Surf2->IsVPeriodic())? Surf2->VPeriod() : 0.;
//---------------------------------------------
Limit = 2500;
if((NbU1*NbV1<=Limit && NbV2*NbU2<=Limit)) {
if((NbU1*NbV1<=Limit && NbV2*NbU2<=Limit))
{
empt = Standard_True;
if (ClearFlag){
if (ClearFlag)
{
SLin.Clear();
}
//
IntPolyh_Intersection* pInterference = NULL;
if ( D1->IsUniformSampling() || D2->IsUniformSampling() ) {
if ( D1->IsUniformSampling() || D2->IsUniformSampling() )
{
pInterference = new IntPolyh_Intersection(Surf1,NbU1,NbV1,Surf2,NbU2,NbV2);
}
else {
else
{
pInterference = new IntPolyh_Intersection(Surf1, anUpars1, aVpars1,
Surf2, anUpars2, aVpars2 );
}
if ( !pInterference ) {
if ( !pInterference )
{
done = Standard_False;
return;
}
@ -1934,11 +1939,14 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
IntPolyh_Intersection& Interference = *pInterference;
//
done = Interference.IsDone();
if( !done ) {
if (pInterference) {
if( !done )
{
if (pInterference)
{
delete pInterference;
pInterference = NULL;
}
return;
}
@ -1947,50 +1955,59 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
Standard_Real SeuildPointLigne = 15.0 * Increment * Increment;
Standard_Integer NbLigCalculee = 0, ver;
Standard_Real U1,U2,V1,V2, pu1,pu2,pv1,pv2, incidence, dminiPointLigne;
Standard_Boolean HasStartPoint,RejetLigne;
Standard_Real pu1,pu2,pv1,pv2, incidence, dminiPointLigne;
Standard_Boolean HasStartPoint = Standard_False, RejectLine = Standard_False;
IntSurf_PntOn2S StartPOn2S;
gp_Pnt Point3dDebut,Point3dFin;
TColStd_Array1OfReal StartParams(1,4);
IntPatch_ThePWalkingInter PW(Surf1,Surf2,TolTangency,Epsilon,Deflection,Increment);
if(nbLigSec>=1) {
if(nbLigSec>=1)
{
Standard_Integer *TabL = new Standard_Integer [nbLigSec+1];
Standard_Integer ls;
for(ls=1; ls<=nbLigSec; ++ls){
for(Standard_Integer ls=1; ls<=nbLigSec; ++ls)
{
TabL[ls]=ls;
}
//----------------------------------------1.1
{
Standard_Boolean triok;
do {
Standard_Integer b, nb_B, nb_A, tyu;
//
Standard_Integer nb_A, nb_B, tyu;
do
{
triok=Standard_True;
for( b = 2; b <= nbLigSec; ++b ) {
for(Standard_Integer b = 2; b <= nbLigSec; ++b )
{
nb_B = Interference.NbPointsInLine(TabL[b]);
nb_A = Interference.NbPointsInLine(TabL[b-1]);
if( nb_B > nb_A ) {
if( nb_B > nb_A )
{
tyu=TabL[b];
TabL[b]=TabL[b-1];
TabL[b-1]=tyu;
triok=Standard_False;
}
}
} while(triok==Standard_False);
}
while(triok==Standard_False);
}
//----------------------------------------
// 1.2 For the line "ls" get 2D-bounds U,V for surfaces 1,2
//
for( ls = 1; ls <= nbLigSec; ++ls) {
Standard_Integer nbp, ilig, *TabPtDep;
//
nbp = Interference.NbPointsInLine(TabL[ls]);
if (!nbp) {
for(Standard_Integer ls = 1; ls <= nbLigSec; ++ls)
{
Standard_Integer nbp = Interference.NbPointsInLine(TabL[ls]);
if (!nbp)
{
continue;
}
//
TabPtDep = new Standard_Integer [nbp+1];
for( ilig = 1; ilig <= nbp; ++ilig ) {
Standard_Integer *TabPtDep = new Standard_Integer [nbp+1];
for(Standard_Integer ilig = 1; ilig <= nbp; ++ilig )
{
TabPtDep[ilig]=0;
}
//
@ -1998,8 +2015,7 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
Standard_Real UminLig2,VminLig2,UmaxLig2,VmaxLig2;
Standard_Real _x,_y,_z;
//
Interference.GetLinePoint(TabL[ls], 1,
_x,_y,_z,
Interference.GetLinePoint(TabL[ls], 1, _x, _y, _z,
UminLig1, VminLig1, UminLig2, VminLig2,
incidence);
@ -2008,7 +2024,9 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
UmaxLig2=UminLig2;
VmaxLig2=VminLig2;
//
for( ilig = 2; ilig <= nbp; ilig++ ) {
for(Standard_Integer ilig = 2; ilig <= nbp; ilig++ )
{
Standard_Real U1, U2, V1, V2;
Interference.GetLinePoint(TabL[ls],ilig,_x,_y,_z,U1,V1,U2,V2,incidence);
//
if(U1>UmaxLig1) UmaxLig1=U1;
@ -2029,13 +2047,16 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
Standard_Boolean lignetrouvee=Standard_False;
const Standard_Integer NbDePointsDeDepartDuChmLimit = 5;
//
do {
do
{
NombreDePointsDeDepartDuCheminement++;
switch (NombreDePointsDeDepartDuCheminement) {
switch (NombreDePointsDeDepartDuCheminement)
{
case 1:
nbps2 = (nbp > 1) ? nbp/2 : 1;
if(nbp<3)
NombreDePointsDeDepartDuCheminement = NbDePointsDeDepartDuChmLimit;
break;
case 2:
nbps2 = 1;
@ -2043,9 +2064,11 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
case 3:
nbps2 = nbp-1;
break;
case 4:
nbps2 = 3 * nbp / 4;
break;
case 5:
nbps2 = nbp / 4;
break;
@ -2053,8 +2076,12 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
nbps2 = NombreDePointsDeDepartDuCheminement-3;
NombreDePointsDeDepartDuCheminement++;
}
//
if(TabPtDep[nbps2] == 0) {
if(TabPtDep[nbps2] == 0)
{
Standard_Real U1, U2, V1, V2;
TabPtDep[nbps2] = 1;
Interference.GetLinePoint(TabL[ls],nbps2,_x,_y,_z,U1,V1,U2,V2,incidence);
@ -2065,38 +2092,56 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
HasStartPoint = PW.PerformFirstPoint(StartParams,StartPOn2S);
dminiPointLigne = SeuildPointLigne + SeuildPointLigne;
if(HasStartPoint) {
if(HasStartPoint)
{
StartPOn2S.Parameters(pu1,pv1,pu2,pv2);
NbLigCalculee = SLin.Length();
Standard_Integer l;
for( l = 1; (l <= NbLigCalculee) && (dminiPointLigne >= SeuildPointLigne); l++) {
for( l = 1; (l <= NbLigCalculee) && (dminiPointLigne >= SeuildPointLigne); l++)
{
const Handle(IntPatch_WLine)& testwline = *((Handle(IntPatch_WLine)*)&SLin.Value(l));
if (IsPointOnLine(StartPOn2S, testwline, Deflection)) {
if (IsPointOnLine(StartPOn2S, testwline, Deflection))
{
dminiPointLigne = 0.0;
}
}// for( l ...
if(dminiPointLigne > SeuildPointLigne) {
PW.Perform(StartParams,UminLig1,VminLig1,UminLig2,VminLig2,UmaxLig1,VmaxLig1,UmaxLig2,VmaxLig2);
if(dminiPointLigne > SeuildPointLigne)
{
PW.Perform(StartParams, UminLig1, VminLig1, UminLig2, VminLig2,
UmaxLig1, VmaxLig1, UmaxLig2, VmaxLig2);
//
Standard_Boolean bPWIsDone;
Standard_Integer iPWNbPoints, aNbPointsVer;
Standard_Real aD11, aD12, aD21, aD22, aDx;
//
bPWIsDone=PW.IsDone();
if(bPWIsDone) {
if(bPWIsDone)
{
iPWNbPoints=PW.NbPoints();
//
if( iPWNbPoints > 2 ) {
RejetLigne = Standard_False;
if( iPWNbPoints > 2 )
{
const Standard_Integer aMinNbPoints = 40;
if(iPWNbPoints < aMinNbPoints)
{
PW.SeekAdditionalPoints(Surf1, Surf2, aMinNbPoints);
iPWNbPoints = PW.NbPoints();
}
RejectLine = Standard_False;
Point3dDebut = PW.Value(1).Value();
Point3dFin = PW.Value(iPWNbPoints).Value();
for( ver = 1; (!RejetLigne) && (ver<= NbLigCalculee); ++ver) {
for( ver = 1; (!RejectLine) && (ver<= NbLigCalculee); ++ver)
{
const Handle(IntPatch_WLine)& verwline = *((Handle(IntPatch_WLine)*)&SLin.Value(ver));
//
aNbPointsVer=verwline->NbPnts();
if (aNbPointsVer<3) {
if (aNbPointsVer<3)
{
continue;
}
//
@ -2112,38 +2157,48 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
aD22=Point3dFin.Distance(aP22);
//
if((aD11<=TolTangency && aD22<=TolTangency) ||
(aD12<=TolTangency && aD21<=TolTangency)) {
(aD12<=TolTangency && aD21<=TolTangency))
{
Standard_Integer m, mx;
//
mx=aNbPointsVer/2;
if (aNbPointsVer%2) {
if (aNbPointsVer%2)
{
++mx;
}
//
const gp_Pnt& aPx=verwline->Point(mx).Value();
for(m=1; m<iPWNbPoints; ++m){
for(m=1; m<iPWNbPoints; ++m)
{
const gp_Pnt& aP1=PW.Value(m).Value();
const gp_Pnt& aP2=PW.Value(m+1).Value();
gp_Vec aVec12(aP1, aP2);
if (aVec12.SquareMagnitude()<1.e-20){
if (aVec12.SquareMagnitude()<1.e-20)
{
continue;
}
//
gp_Dir aDir12(aVec12);
gp_Lin aLin12(aP1, aDir12);
aDx=aLin12.Distance(aPx);
//modified by NIZNHY-PKV Tue May 10 11:08:07 2011f
if (aDx<=2.*Epsilon) {
if (aDx<=2.*Epsilon)
{
//if (aDx<=TolTangency) {
//modified by NIZNHY-PKV Tue May 10 11:08:13 2011t
RejetLigne = Standard_True;
RejectLine = Standard_True;
break;
}
}//for(m=1; m<iPWNbPoints; ++m){
}//if((aD11<=TolTangency && aD22<=TolTangency) ||...
}// for( ver = 1 ; (!RejetLigne) && (ver<= NbLigCalculee) ; ver++) {
//
if(!RejetLigne) {
if(!RejectLine)
{
IntSurf_TypeTrans trans1,trans2;
Standard_Real locu,locv;
gp_Vec norm1,norm2,d1u,d1v;
@ -2156,11 +2211,13 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
PW.Line()->Value(indextg).ParametersOnS2(locu,locv);
Surf2->D1(locu,locv,ptbid,d1u,d1v);
norm2 = d1u.Crossed(d1v);
if( tgline.DotCross(norm2,norm1) >= 0. ) {
if( tgline.DotCross(norm2,norm1) >= 0. )
{
trans1 = IntSurf_Out;
trans2 = IntSurf_In;
}
else {
else
{
trans1 = IntSurf_In;
trans2 = IntSurf_Out;
}
@ -2170,7 +2227,8 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
IntPatch_RstInt::PutVertexOnLine(wline,Surf1,D1,Surf2,Standard_True,TolTang);
IntPatch_RstInt::PutVertexOnLine(wline,Surf2,D2,Surf1,Standard_False,TolTang);
if(wline->NbVertex() == 0) {
if(wline->NbVertex() == 0)
{
IntPatch_Point vtx;
IntSurf_PntOn2S POn2S = PW.Line()->Value(1);
POn2S.Parameters(pu1,pv1,pu2,pv2);
@ -2190,16 +2248,19 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
lignetrouvee = Standard_True;
Standard_Integer slinlen = SLin.Length();
if( slinlen > 0 ) {
if( slinlen > 0 )
{
Standard_Integer cnbV = wline->NbVertex();
Standard_Integer ciV;
for( ciV = 1; ciV <= cnbV; ciV++ ) {
for( ciV = 1; ciV <= cnbV; ciV++ )
{
Standard_Real pntDMin = 1.e+100;
Standard_Integer VDMin = 0;
Standard_Integer WLDMin = 0;
gp_Pnt cPV = wline->Vertex(ciV).Value();
Standard_Integer iL;
for( iL = 1; iL <= slinlen; iL++) {
for( iL = 1; iL <= slinlen; iL++)
{
const Handle(IntPatch_Line)& aSLine = SLin.Value(iL);
IntPatch_IType aType = aSLine->ArcType();
if( aType != IntPatch_Walking)
@ -2207,7 +2268,8 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
const Handle(IntPatch_WLine)& aWLine = (*((Handle(IntPatch_WLine)*)&aSLine));
Standard_Integer tnbV = aWLine->NbVertex();
Standard_Integer tiV;
for( tiV = 1; tiV <= tnbV; tiV++ ) {
for( tiV = 1; tiV <= tnbV; tiV++ )
{
gp_Pnt tPV = aWLine->Vertex(tiV).Value();
Standard_Real tDistance = cPV.Distance(tPV);
Standard_Real uRs1 = Surf1->Surface().UResolution(tDistance);
@ -2216,8 +2278,10 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
Standard_Real vRs2 = Surf2->Surface().VResolution(tDistance);
Standard_Real RmaxS1 = Max(uRs1,vRs1);
Standard_Real RmaxS2 = Max(uRs2,vRs2);
if(RmaxS1 < 1.e-4 && RmaxS2 < 1.e-4) {
if( pntDMin > tDistance && tDistance > 1.e-9) {
if(RmaxS1 < 1.e-4 && RmaxS2 < 1.e-4)
{
if( pntDMin > tDistance && tDistance > 1.e-9)
{
pntDMin = tDistance;
VDMin = tiV;
WLDMin = iL;
@ -2226,7 +2290,8 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
}
}
if( VDMin != 0 ) {
if( VDMin != 0 )
{
const Handle(IntPatch_Line)& aSLine = SLin.Value(WLDMin);
const Handle(IntPatch_WLine)& aWLine = (*((Handle(IntPatch_WLine)*)&aSLine));
Standard_Integer tiVpar = (Standard_Integer)aWLine->Vertex(VDMin).ParameterOnLine();
@ -2242,7 +2307,8 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
TColStd_SequenceOfInteger VPold;
Standard_Integer iPo;
for( iPo = 1; iPo <= cnbV; iPo++ ) {
for( iPo = 1; iPo <= cnbV; iPo++ )
{
Standard_Real Po = wline->Vertex(iPo).ParameterOnLine();
Standard_Integer IPo = (Standard_Integer) Po;
VPold.Append(IPo);
@ -2250,47 +2316,59 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
Standard_Boolean removeNext = Standard_False;
Standard_Boolean removePrev = Standard_False;
if( ciV == 1) {
if( ciV == 1)
{
Standard_Integer dPar = Abs( VPold.Value(ciV) - VPold.Value(ciV+1));
if(dPar > 10) {
if(dPar > 10)
{
removeNext = Standard_True;
for( iPo = (ciV+1); iPo <= cnbV; iPo++ )
VPold.SetValue(iPo, VPold.Value(iPo) - 1 );
}
}
else if( ciV == cnbV) {
else if( ciV == cnbV)
{
Standard_Integer dPar = Abs( VPold.Value(ciV) - VPold.Value(ciV-1));
if(dPar > 10) {
if(dPar > 10)
{
removePrev = Standard_True;
VPold.SetValue(ciV, VPold.Value(ciV) - 1 );
}
}
else {
else
{
Standard_Integer dParMi = Abs( VPold.Value(ciV) - VPold.Value(ciV-1));
Standard_Integer dParMa = Abs( VPold.Value(ciV) - VPold.Value(ciV+1));
if(dParMi > 10) {
if(dParMi > 10)
{
removePrev = Standard_True;
VPold.SetValue(ciV, VPold.Value(ciV) - 1 );
}
if(dParMa > 10) {
if(dParMa > 10)
{
removeNext = Standard_True;
for( iPo = (ciV+1); iPo <= cnbV; iPo++ ) {
for( iPo = (ciV+1); iPo <= cnbV; iPo++ )
{
if(dParMi > 10)
VPold.SetValue(iPo, VPold.Value(iPo) - 2 );
else
VPold.SetValue(iPo, VPold.Value(iPo) - 1 );
}
}
else {
else
{
if(dParMi > 10)
for( iPo = (ciV+1); iPo <= cnbV; iPo++ )
VPold.SetValue(iPo, VPold.Value(iPo) - 1 );
}
}
Standard_Integer pI = (Standard_Integer) ciVpar;
Standard_Integer pI = ciVpar;
Standard_Integer iP;
for( iP = 1; iP <= cNbP; iP++) {
for( iP = 1; iP <= cNbP; iP++)
{
if( pI == iP )
{
IntSurf_PntOn2S newPnt = MakeNewPoint(replacePnt, wline->Point(iP), Periods);
@ -2313,10 +2391,12 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
Handle(IntPatch_WLine) NWLine = new IntPatch_WLine(newL2s,Standard_False,trans1,trans2);
Standard_Integer iV;
for( iV = 1; iV <= cnbV; iV++ ) {
for( iV = 1; iV <= cnbV; iV++ )
{
if( iV == ciV )
NWLine->AddVertex(newVtx);
else {
else
{
IntPatch_Point theVtx = wline->Vertex(iV);
theVtx.SetParameter(VPold.Value(iV));
NWLine->AddVertex(theVtx);
@ -2324,8 +2404,8 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
}
wline = NWLine;
}
}
}//if( VDMin != 0 )
}//for( ciV = 1; ciV <= cnbV; ciV++ )
}// SLin.Length > 0
AddWLine(SLin, wline, Deflection);
@ -2360,11 +2440,13 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
// NbPointsInTangentZone always == 1 (eap)
Standard_Integer z;
for( z=1; z <= nbTanZon; z++) {
for( z=1; z <= nbTanZon; z++)
{
//Standard_Integer NbPointsInTangentZone=Interference.NbPointsInTangentZone(z);
//for(Standard_Integer pz=1; pz<=NbPointsInTangentZone; pz++) {
Standard_Integer pz=1;
Standard_Real _x,_y,_z;
Standard_Real U1, U2, V1, V2;
Interference.GetTangentZonePoint(z,pz,_x,_y,_z,U1,V1,U2,V2);
if(U1>UmaxLig1) UmaxLig1=U1;
@ -2378,12 +2460,14 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
if(V2<VminLig2) VminLig2=V2;
//}
}
for(z=1; z <= nbTanZon; z++) {
for(z=1; z <= nbTanZon; z++)
{
//Standard_Integer NbPointsInTangentZone=Interference.NbPointsInTangentZone(z);
//for(Standard_Integer pz=1; pz<=NbPointsInTangentZone; pz++) {
Standard_Integer pz=1;
Standard_Real _x,_y,_z;
Standard_Real U1, U2, V1, V2;
Interference.GetTangentZonePoint(z,pz,_x,_y,_z,U1,V1,U2,V2);
StartParams(1) = U1;
@ -2395,7 +2479,8 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
//-- Calcul du premier point de cheminement a partir du point approche --
//-----------------------------------------------------------------------
HasStartPoint = PW.PerformFirstPoint(StartParams,StartPOn2S);
if(HasStartPoint) {
if(HasStartPoint)
{
//-------------------------------------------------
//-- Un point a ete trouve --
//-- On verifie qu il n appartient pas --
@ -2408,61 +2493,77 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
for(Standard_Integer l=1;
(l <= NbLigCalculee) && (dminiPointLigne >= SeuildPointLigne);
l++) {
l++)
{
const Handle(IntPatch_WLine)& testwline = *((Handle(IntPatch_WLine)*)&SLin.Value(l));
if (IsPointOnLine(StartPOn2S, testwline, Deflection)) {
if (IsPointOnLine(StartPOn2S, testwline, Deflection))
{
dminiPointLigne = 0.0;
}
}
//-- Fin d exploration des lignes
if(dminiPointLigne > SeuildPointLigne) {
if(dminiPointLigne > SeuildPointLigne)
{
//---------------------------------------------------
//-- Le point de depart du nouveau cheminement --
//-- n est present dans aucune ligne deja calculee.--
//---------------------------------------------------
PW.Perform(StartParams,
UminLig1,VminLig1,UminLig2,VminLig2,
PW.Perform(StartParams,UminLig1,VminLig1,UminLig2,VminLig2,
UmaxLig1,VmaxLig1,UmaxLig2,VmaxLig2);
if(PW.IsDone()) {
if(PW.NbPoints()>2) {
if(PW.IsDone())
{
if(PW.NbPoints()>2)
{
const Standard_Integer aMinNbPoints = 40;
if(PW.NbPoints() < aMinNbPoints)
{
PW.SeekAdditionalPoints(Surf1, Surf2, aMinNbPoints);
}
//-----------------------------------------------
//-- Verification a posteriori :
//-- On teste si le point de depart et de fin de
//-- la ligne de cheminement est present dans une
//-- autre ligne .
//-----------------------------------------------
RejetLigne = Standard_False;
RejectLine = Standard_False;
Point3dDebut = PW.Value(1).Value();
const IntSurf_PntOn2S& PointFin = PW.Value(PW.NbPoints());
Point3dFin = PointFin.Value();
for(ver=1 ; (!RejetLigne) && (ver<= NbLigCalculee) ; ver++) {
for(ver=1 ; (!RejectLine) && (ver<= NbLigCalculee) ; ver++)
{
const Handle(IntPatch_WLine)& verwline = *((Handle(IntPatch_WLine)*)&SLin.Value(ver));
//-- Handle(IntPatch_WLine) verwline=Handle(IntPatch_WLine)::DownCast(SLin.Value(ver));
// Check end point if it is on existing line.
// Start point is checked before.
if (IsPointOnLine(PointFin, verwline, Deflection)) {
RejetLigne = Standard_True;
if (IsPointOnLine(PointFin, verwline, Deflection))
{
RejectLine = Standard_True;
break;
}
const IntSurf_PntOn2S& verPointDebut = verwline->Point(1);
const IntSurf_PntOn2S& verPointFin = verwline->Point(verwline->NbPnts());
if(Point3dDebut.Distance(verPointDebut.Value()) < TolTangency) {
RejetLigne = Standard_True;
if(Point3dDebut.Distance(verPointDebut.Value()) < TolTangency)
{
RejectLine = Standard_True;
}
else {
if(Point3dFin.Distance(verPointFin.Value()) < TolTangency) {
RejetLigne = Standard_True;
else
{
if(Point3dFin.Distance(verPointFin.Value()) < TolTangency)
{
RejectLine = Standard_True;
}
}
}
if(!RejetLigne) {
if(!RejectLine)
{
IntSurf_TypeTrans trans1,trans2;
Standard_Real locu,locv;
gp_Vec norm1,norm2,d1u,d1v;
@ -2475,24 +2576,25 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
PW.Line()->Value(indextg).ParametersOnS2(locu,locv);
Surf2->D1(locu,locv,ptbid,d1u,d1v);
norm2 = d1u.Crossed(d1v);
if (tgline.DotCross(norm2,norm1)>0.) {
if (tgline.DotCross(norm2,norm1)>0.)
{
trans1 = IntSurf_Out;
trans2 = IntSurf_In;
}
else {
else
{
trans1 = IntSurf_In;
trans2 = IntSurf_Out;
}
Standard_Real TolTang = TolTangency;
Handle(IntPatch_WLine) wline = new IntPatch_WLine(PW.Line(),Standard_False,trans1,trans2);
IntPatch_RstInt::PutVertexOnLine(wline,Surf1,D1,Surf2,Standard_True,TolTang);
IntPatch_RstInt::PutVertexOnLine(wline,Surf2,D2,Surf1,Standard_False,TolTang);
//---------------
if(wline->NbVertex() == 0) {
if(wline->NbVertex() == 0)
{
IntPatch_Point vtx;
IntSurf_PntOn2S POn2S = PW.Line()->Value(1);
POn2S.Parameters(pu1,pv1,pu2,pv2);
@ -2512,9 +2614,9 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
//---------------
AddWLine(SLin, wline, Deflection);
empt = Standard_False;
}
else {
else
{
//-- cout<<" ----- REJET DE LIGNE (POINT DE DEPART) ----- "<<endl;
}
//------------------------------------------------------------
@ -2525,10 +2627,12 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
//} //-- Boucle Sur les Points de la Tangent Zone
} //-- Boucle sur Les Tangent Zones
if ( pInterference ) {
if ( pInterference )
{
delete pInterference;
pInterference = NULL;
}
return;
}// if((NbU1*NbV1<=Limit && NbV2*NbU2<=Limit)) {
@ -2576,7 +2680,8 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
//-- Calcul du premier point de cheminement a partir du point approche --
//-----------------------------------------------------------------------
HasStartPoint = PW.PerformFirstPoint(StartParams,StartPOn2S);
if(HasStartPoint) {
if(HasStartPoint)
{
//-------------------------------------------------
//-- Un point a ete trouve --
//-- On verifie qu il n appartient pas --
@ -2589,23 +2694,28 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
for(Standard_Integer l=1;
(l <= NbLigCalculee) && (dminiPointLigne >= SeuildPointLigne);
l++) {
l++)
{
const Handle(IntPatch_WLine)& testwline = *((Handle(IntPatch_WLine)*)&SLin.Value(l));
if (IsPointOnLine(StartPOn2S, testwline, Deflection)) {
if (IsPointOnLine(StartPOn2S, testwline, Deflection))
{
dminiPointLigne = 0.0;
}
}
//-- Fin d exploration des lignes
if(dminiPointLigne > SeuildPointLigne) {
if(dminiPointLigne > SeuildPointLigne)
{
//---------------------------------------------------
//-- Le point de depart du nouveau cheminement --
//-- n est present dans aucune ligne deja calculee.--
//---------------------------------------------------
PW.Perform(StartParams);
if(PW.IsDone()) {
if(PW.NbPoints()>2) {
if(PW.IsDone())
{
if(PW.NbPoints()>2)
{
//-----------------------------------------------
//-- Verification a posteriori :
//-- On teste si le point de depart et de fin de
@ -2617,31 +2727,36 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
const IntSurf_PntOn2S& PointFin = PW.Value(PW.NbPoints());
Point3dFin = PointFin.Value();
for(ver=1 ; (!RejetLigne) && (ver<= NbLigCalculee) ; ver++) {
for(ver=1 ; (!RejetLigne) && (ver<= NbLigCalculee) ; ver++)
{
const Handle(IntPatch_WLine)& verwline = *((Handle(IntPatch_WLine)*)&SLin.Value(ver));
//-- Handle(IntPatch_WLine) verwline=Handle(IntPatch_WLine)::DownCast(SLin.Value(ver));
// Check end point if it is on existing line.
// Start point is checked before.
if (IsPointOnLine(PointFin, verwline, Deflection)) {
if (IsPointOnLine(PointFin, verwline, Deflection))
{
RejetLigne = Standard_True;
break;
}
const IntSurf_PntOn2S& verPointDebut = verwline->Point(1);
const IntSurf_PntOn2S& verPointFin = verwline->Point(verwline->NbPnts());
if(Point3dDebut.Distance(verPointDebut.Value()) < TolTangency) {
if(Point3dDebut.Distance(verPointDebut.Value()) < TolTangency)
{
RejetLigne = Standard_True;
}
else {
if(Point3dFin.Distance(verPointFin.Value()) < TolTangency) {
else
{
if(Point3dFin.Distance(verPointFin.Value()) < TolTangency)
{
RejetLigne = Standard_True;
}
}
}
if(!RejetLigne) {
if(!RejetLigne)
{
IntSurf_TypeTrans trans1,trans2;
Standard_Real locu,locv;
gp_Vec norm1,norm2,d1u,d1v;
@ -2654,7 +2769,8 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
PW.Line()->Value(indextg).ParametersOnS2(locu,locv);
Surf2->D1(locu,locv,ptbid,d1u,d1v);
norm2 = d1u.Crossed(d1v);
if (tgline.DotCross(norm2,norm1)>0.) {
if (tgline.DotCross(norm2,norm1)>0.)
{
trans1 = IntSurf_Out;
trans2 = IntSurf_In;
}
@ -2663,15 +2779,14 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
trans2 = IntSurf_Out;
}
Standard_Real TolTang = TolTangency;
Handle(IntPatch_WLine) wline = new IntPatch_WLine(PW.Line(),Standard_False,trans1,trans2);
IntPatch_RstInt::PutVertexOnLine(wline,Surf1,D1,Surf2,Standard_True,TolTang);
IntPatch_RstInt::PutVertexOnLine(wline,Surf2,D2,Surf1,Standard_False,TolTang);
//---------------
if(wline->NbVertex() == 0) {
if(wline->NbVertex() == 0)
{
IntPatch_Point vtx;
const IntSurf_PntOn2S& POn2Sf = PW.Line()->Value(1);
POn2Sf.Parameters(pu1,pv1,pu2,pv2);
@ -2691,9 +2806,9 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
//---------------
AddWLine(SLin, wline, Deflection);
empt = Standard_False;
}
else {
else
{
//-- cout<<" ----- REJET DE LIGNE (POINT DE DEPART) ----- "<<endl;
}
//------------------------------------------------------------
@ -2702,7 +2817,6 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
} //-- le point approche ne renvoie pas sur une ligne existante
} //-- Si HasStartPoint
} //-- Boucle sur Les Tangent Zones
}
//modified by NIZNHY-PKV Wed May 25 09:39:07 2011f
//=======================================================================
@ -2710,7 +2824,7 @@ void IntPatch_PrmPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
//purpose :
//=======================================================================
class IntPatch_InfoPD {
public:
public:
//----------------------------------------C-tor
IntPatch_InfoPD(const Standard_Integer aNBI) {
Standard_Integer aNBI2, i, j;
@ -2783,7 +2897,7 @@ class IntPatch_InfoPD {
const Standard_Integer j) {
return myP2[Index(i,j)];
};
protected:
protected:
Standard_Integer myNBI;
char *myP1DS2;
char *myP2DS1;

View File

@ -32,7 +32,8 @@ uses XY from gp,
PntOn2S from IntSurf,
LineOn2S from IntSurf,
Dir from gp,
Dir2d from gp
Dir2d from gp,
Pnt from gp
raises OutOfRange from Standard,
@ -253,10 +254,32 @@ is
---C++: inline
ExtendLineInCommonZone(me: in out; theChoixIso: ConstIsoparametric from IntImp;
theDirectionFlag: Boolean from Standard)
theDirectionFlag: Boolean from Standard)
returns Boolean from Standard
is private;
DistanceMinimizeByGradient( me : in out;
theASurf1 , theASurf2 : ThePSurface ;
theU1, theV1, theU2, theV2: out Real from Standard;
theStep0U1V1: Real from Standard = 1.0e-6;
theStep0U2V2: Real from Standard = 1.0e-6)
returns Boolean from Standard
is private;
DistanceMinimizeByExtrema(me : in out;
theASurf1 : ThePSurface ;
theP0 : Pnt from gp;
theU0, theV0: out Real from Standard;
theStep0U: Real from Standard = 1.0;
theStep0V: Real from Standard = 1.0)
returns Boolean from Standard
is private;
SeekAdditionalPoints( me : in out;
theASurf1 , theASurf2 : ThePSurface;
theMinNbPoints : Integer from Standard)
returns Boolean from Standard;
fields
done : Boolean from Standard;

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
puts "TODO ?OCC23753 ALL: Process killed by CPU limit"
puts "TODO ?OCC23753 ALL: TEST INCOMPLETE"
puts "TODO ?OCC24472 ALL: Error : Result shape is WRONG because it must contains 70 edges instead of 71"
puts "TODO ?OCC24472 ALL: Error : Result shape is WRONG because it must contains 139 shapes instead of 140"
puts "============"
puts "OCC19793"
@ -9,8 +9,7 @@ puts ""
# Fuse problem of symetrical shapes. Appendix for NPAL19789
#######################################################################
cpulimit 1000
#cpulimit 4500
cpulimit 400
set BugNumber OCC19793
puts "Load first shape ..."

View File

@ -25,5 +25,5 @@ if { $ll_1 != $ll_2 } {
puts "PRO19653 OK : BREPALGO_BOOLEANOPERATION returns result"
}
set length 0
set length 228.265
set 2dviewer 0

45
tests/bugs/modalg_5/bug24299 Executable file
View File

@ -0,0 +1,45 @@
puts "========="
puts "CR24299"
puts "========="
puts ""
###############################
## Wrong section curve
###############################
restore [locate_data_file pro19653a.brep] b1
restore [locate_data_file pro19653b.brep] b2
explode b1 f
explode b2 f
mksurface s1 b1_1
mksurface s2 b2_1
intersect i s1 s2
dlog reset
dlog on
xdistcs i_2 s1 0 1 10
set Log1 [dlog get]
set List1 [split ${Log1} {TD= \t\n}]
set L1 [llength ${List1}]
set L2 10
set L3 5
set N [expr (${L1} - ${L2})/${L3} + 1]
set Tolerance 1.0e-5
set D_good 0.
for {set i 1} {${i} <= ${N}} {incr i} {
set j1 [expr ${L2} + (${i}-1)*${L3}]
set j2 [expr ${j1} + 2]
set T [lindex ${List1} ${j1}]
set D [lindex ${List1} ${j2}]
#puts "i=${i} j1=${j1} j2=${j2} T=${T} D=${D}"
if { [expr abs(${D} - ${D_good})] > ${Tolerance} } {
puts "Error: i=${i} T=${T} D=${D}"
}
}
smallview
fit
set only_screen_axo 1

112
tests/bugs/modalg_5/bug24472 Executable file
View File

@ -0,0 +1,112 @@
puts "========="
puts "CR24472"
puts "========="
puts ""
###############################
## Wrong section curves
###############################
proc checkList {List Tolerance D_good} {
set L1 [llength ${List}]
set L2 10
set L3 5
set N [expr (${L1} - ${L2})/${L3} + 1]
for {set i 1} {${i} <= ${N}} {incr i} {
set j1 [expr ${L2} + (${i}-1)*${L3}]
set j2 [expr ${j1} + 2]
set T [lindex ${List} ${j1}]
set D [lindex ${List} ${j2}]
#puts "i=${i} j1=${j1} j2=${j2} T=${T} D=${D}"
if { [expr abs(${D} - ${D_good})] > ${Tolerance} } {
puts "Error: i=${i} T=${T} D=${D}"
}
}
}
smallview
restore [locate_data_file bug24472_Pipe_1.brep] b1
explode b1 f
copy b1_2 f1
copy b1_3 f2
copy b1_6 f3
mksurface s1 f1
mksurface s2 f2
mksurface s3 f3
puts ""
puts "First test"
# 1.1 geometry
intersect i s1 s2
#donly i_22; fit
dlog reset
dlog on
xdistcs i_22 s1 0 1 10
set Log1 [dlog get]
set List1 [split ${Log1} {TD= \t\n}]
set Tolerance 1.0e-12
set D_good 0.
checkList ${List1} ${Tolerance} ${D_good}
puts ""
puts "Second test"
# 1.2 topology
bsection r f1 f2
bopcheck r
# r is self interfered
explode r e
mkcurve c r_1
#donly r_1; fit
dlog reset
dlog on
xdistcs c s1 0.0714822451660209 1 10
set Log2 [dlog get]
set List2 [split ${Log2} {TD= \t\n}]
set Tolerance 1.0e-12
set D_good 0.
checkList ${List2} ${Tolerance} ${D_good}
puts ""
puts "Third test"
# 2.1 geometry
intersect i s1 s3
#donly i_4; fit
dlog reset
dlog on
xdistcs i_4 s1 0 1 10
set Log3 [dlog get]
set List3 [split ${Log3} {TD= \t\n}]
set Tolerance 1.0e-6
set D_good 0.
checkList ${List3} ${Tolerance} ${D_good}
puts ""
puts "Fourth test"
# 2.2 topology
bsection r f1 f3
bopcheck r
#r is self interfered
explode r
mkcurve c r_1
#donly r_1; fit
dlog reset
dlog on
xdistcs c s1 0.0714822451660209 1 10
set Log4 [dlog get]
set List4 [split ${Log4} {TD= \t\n}]
set Tolerance 1.0e-12
set D_good 0.
checkList ${List4} ${Tolerance} ${D_good}

View File

@ -7,6 +7,8 @@ puts ""
## It is impossible to intersect two surfaces
##################################################
puts "TODO OCC24472 ALL: Error : Intersection was made WRONGLY"
restore [locate_data_file OCC13-1.draw] su1
############### checkshape su1 # is not a topological shape
restore [locate_data_file OCC13-2.draw] su2