const Handle(IntPatch_WLine) &theWLine,
const Standard_Real Deflection);
+//=======================================================================
+//function : DublicateOfLinesProcessing
+//purpose : Decides, if rejecting current line is necessary
+//=======================================================================
+static void DublicateOfLinesProcessing( const IntWalk_PWalking& thePW,
+ const Standard_Integer theWLID,
+ IntPatch_SequenceOfLine& theLines,
+ Standard_Boolean& theIsRejectReq)
+{
+ const Handle(IntPatch_WLine)& anExistWL =
+ *((Handle(IntPatch_WLine)*)&theLines.Value(theWLID));
+ const Standard_Integer aNbPrevPoints = anExistWL->NbPnts();
+ const Standard_Integer aNbCurrPoints = thePW.NbPoints();
+
+ if(aNbPrevPoints < aNbCurrPoints)
+ {//Remove preview line
+ theLines.Remove(theWLID);
+ theIsRejectReq = Standard_False;
+ }
+ else if(aNbPrevPoints == aNbCurrPoints)
+ {
+ Standard_Real aLPrev = 0.0, aLCurr = 0.0;
+ for(Standard_Integer aNbPP = 1; aNbPP < aNbPrevPoints; aNbPP++)
+ {
+ const gp_Pnt aP1prev(anExistWL->Point(aNbPP).Value()),
+ aP2prev(anExistWL->Point(aNbPP+1).Value());
+ const gp_Pnt aP1curr(thePW.Value(aNbPP).Value()),
+ aP2curr(thePW.Value(aNbPP+1).Value());
+
+ aLPrev += aP1prev.Distance(aP2prev);
+ aLCurr += aP1curr.Distance(aP2curr);
+ }
+
+ if(aLPrev < aLCurr)
+ {//Remove preview line
+ theLines.Remove(theWLID);
+ theIsRejectReq = Standard_False;
+ }
+ }
+}
//==================================================================================
// function :
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 ; ver<= NbLigCalculee ; ver++) {
const Handle(IntPatch_WLine)& verwline = *((Handle(IntPatch_WLine)*)&SLin.Value(ver));
// Check end point if it is on existing line.
const IntSurf_PntOn2S& verPointDebut = verwline->Point(1);
const IntSurf_PntOn2S& verPointFin = verwline->Point(verwline->NbPnts());
- if( Point3dDebut.Distance(verPointDebut.Value()) <= TolTangency ) {
- if(Point3dFin.Distance(verPointFin.Value()) <= TolTangency)
- RejetLigne = Standard_True;
+ if( (Point3dDebut.Distance(verPointDebut.Value()) <= TolTangency) &&
+ (Point3dFin.Distance(verPointFin.Value()) <= TolTangency))
+ {
+ RejetLigne = Standard_True;
+ break;
}
}
+ if(RejetLigne)
+ {
+ DublicateOfLinesProcessing(PW, ver, SLin, RejetLigne);
+ }
+
if(!RejetLigne) {
// Calculation transition
IntSurf_TypeTrans trans1,trans2;
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 ; ver<= NbLigCalculee ; ver++) {
const Handle(IntPatch_WLine)& verwline = *((Handle(IntPatch_WLine)*)&SLin.Value(ver));
// Check end point if it is on existing line.
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) ||
+ (Point3dFin.Distance(verPointFin.Value()) < TolTangency))
+ {
RejetLigne = Standard_True;
- else {
- if(Point3dFin.Distance(verPointFin.Value()) < TolTangency)
- RejetLigne = Standard_True;
+ break;
}
}
+ if(RejetLigne)
+ {
+ DublicateOfLinesProcessing(PW, ver, SLin, RejetLigne);
+ }
+
if(!RejetLigne) {
IntSurf_TypeTrans trans1,trans2;
Standard_Real locu,locv;
RejetLigne = Standard_False;
Point3dDebut = PW.Value(1).Value();
Point3dFin = PW.Value(PW.NbPoints()).Value();
- for(ver=1 ; (!RejetLigne) && (ver<= NbLigCalculee) ; ver++) {
+ for(ver=1 ; ver<= NbLigCalculee ; ver++) {
const Handle(IntPatch_WLine)& verwline = *((Handle(IntPatch_WLine)*)&SLin.Value(ver));
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) ||
+ (Point3dFin.Distance(verPointFin.Value()) < TolTangency))
+ {
RejetLigne = Standard_True;
- else {
- if(Point3dFin.Distance(verPointFin.Value()) < TolTangency)
- RejetLigne = Standard_True;
+ break;
}
}
+ if(RejetLigne)
+ {
+ DublicateOfLinesProcessing(PW, ver, SLin, RejetLigne);
+ }
+
if(!RejetLigne) {
IntSurf_TypeTrans trans1,trans2;
Standard_Real locu,locv;
imax++;
if(imin<imax) {
- Handle_IntSurf_LineOn2S PWLine = new IntSurf_LineOn2S();
+ Handle(IntSurf_LineOn2S) PWLine = new IntSurf_LineOn2S();
for(i=imin;i<=imax;i++)
PWLine->Add(PW.Line()->Value(i));
RejetLigne = Standard_False;
Point3dDebut = PW.Value(1).Value();
Point3dFin = PW.Value(PW.NbPoints()).Value();
- for( ver = 1 ; (!RejetLigne) && (ver<= NbLigCalculee) ; ver++) {
+ for( ver = 1 ; ver<= NbLigCalculee ; ver++) {
const Handle(IntPatch_WLine)& verwline = *((Handle(IntPatch_WLine)*)&SLin.Value(ver));
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) ||
+ (Point3dFin.Distance(verPointFin.Value()) < TolTangency))
+ {
RejetLigne = Standard_True;
- else {
- if(Point3dFin.Distance(verPointFin.Value()) < TolTangency)
- RejetLigne = Standard_True;
+ break;
}
}
+ if(RejetLigne)
+ {
+ DublicateOfLinesProcessing(PW, ver, SLin, RejetLigne);
+ }
+
if(!RejetLigne) {
IntSurf_TypeTrans trans1,trans2;
Standard_Real locu,locv;
imax++;
if(imin<imax) {
- Handle_IntSurf_LineOn2S PWLine = new IntSurf_LineOn2S();
+ Handle(IntSurf_LineOn2S) PWLine = new IntSurf_LineOn2S();
for(i=imin;i<=imax;i++)
PWLine->Add(PW.Line()->Value(i));
// function : NewLine
// purpose :
//==================================================================================
-Handle_IntPatch_Line IntPatch_PrmPrmIntersection::NewLine (const Handle(Adaptor3d_HSurface)& Surf1,
+Handle(IntPatch_Line) IntPatch_PrmPrmIntersection::NewLine (const Handle(Adaptor3d_HSurface)& Surf1,
const Handle(Adaptor3d_HSurface)& Surf2,
const Standard_Integer NumLine,
const Standard_Integer Low,
Periods[3] = (Surf2->IsVPeriodic())? Surf2->VPeriod() : 0.;
IntSurf_ListIteratorOfListOfPntOn2S IterLOP1(LOfPnts);
+ if (Surf1->IsUClosed() || Surf1->IsVClosed() ||
+ Surf2->IsUClosed() || Surf2->IsVClosed())
+ {
+ Standard_Real TolPar = Precision::PConfusion();
+ IntSurf_ListOfPntOn2S AdditionalPnts;
+ Standard_Real NewU1, NewV1, NewU2, NewV2;
+ for(; IterLOP1.More(); IterLOP1.Next())
+ {
+ IntSurf_PntOn2S Pnt = IterLOP1.Value();
+ Pnt.Parameters(U1, V1, U2, V2);
+ IntSurf_PntOn2S NewPnt;
+ if (Surf1->IsUClosed())
+ {
+ if (Abs(U1 - Surf1->FirstUParameter()) <= TolPar)
+ {
+ NewU1 = Surf1->LastUParameter();
+ NewPnt.SetValue( NewU1, V1, U2, V2 );
+ AdditionalPnts.Append(NewPnt);
+ }
+ else if (Abs(U1 - Surf1->LastUParameter()) <= TolPar)
+ {
+ NewU1 = Surf1->FirstUParameter();
+ NewPnt.SetValue( NewU1, V1, U2, V2 );
+ AdditionalPnts.Append(NewPnt);
+ }
+ }
+ if (Surf1->IsVClosed())
+ {
+ if (Abs(V1 - Surf1->FirstVParameter()) <= TolPar)
+ {
+ NewV1 = Surf1->LastVParameter();
+ NewPnt.SetValue( U1, NewV1, U2, V2 );
+ AdditionalPnts.Append(NewPnt);
+ }
+ else if (Abs(V1 - Surf1->LastVParameter()) <= TolPar)
+ {
+ NewV1 = Surf1->FirstVParameter();
+ NewPnt.SetValue( U1, NewV1, U2, V2 );
+ AdditionalPnts.Append(NewPnt);
+ }
+ }
+ if (Surf2->IsUClosed())
+ {
+ if (Abs(U2 - Surf2->FirstUParameter()) <= TolPar)
+ {
+ NewU2 = Surf2->LastUParameter();
+ NewPnt.SetValue( U1, V1, NewU2, V2);
+ AdditionalPnts.Append(NewPnt);
+ }
+ else if (Abs(U2 - Surf2->LastUParameter()) <= TolPar)
+ {
+ NewU2 = Surf2->FirstUParameter();
+ NewPnt.SetValue( U1, V1, NewU2, V2);
+ AdditionalPnts.Append(NewPnt);
+ }
+ }
+ if (Surf2->IsVClosed())
+ {
+ if (Abs(V2 - Surf2->FirstVParameter()) <= TolPar)
+ {
+ NewV2 = Surf2->LastVParameter();
+ NewPnt.SetValue( U1, V1, U2, NewV2 );
+ AdditionalPnts.Append(NewPnt);
+ }
+ else if (Abs(V2 - Surf2->LastVParameter()) <= TolPar)
+ {
+ NewV2 = Surf2->FirstVParameter();
+ NewPnt.SetValue( U1, V1, U2, NewV2 );
+ AdditionalPnts.Append(NewPnt);
+ }
+ }
+ }
+ //Cut repeated points
+ for (IterLOP1.Initialize(LOfPnts); IterLOP1.More(); IterLOP1.Next())
+ {
+ IntSurf_PntOn2S aPnt = IterLOP1.Value();
+ aPnt.Parameters(U1, V1, U2, V2);
+ IntSurf_ListIteratorOfListOfPntOn2S iter2(AdditionalPnts);
+ while (iter2.More())
+ {
+ IntSurf_PntOn2S aNewPnt = iter2.Value();
+ aNewPnt.Parameters(NewU1, NewV1, NewU2, NewV2);
+ if (Abs(U1 - NewU1) <= TolPar &&
+ Abs(V1 - NewV1) <= TolPar &&
+ Abs(U2 - NewU2) <= TolPar &&
+ Abs(V2 - NewV2) <= TolPar)
+ AdditionalPnts.Remove(iter2);
+ else
+ iter2.Next();
+ }
+ }
- for(; IterLOP1.More(); IterLOP1.Next()){
+ LOfPnts.Append(AdditionalPnts);
+ }
+
+ for(IterLOP1.Initialize(LOfPnts); IterLOP1.More(); IterLOP1.Next()){
IntSurf_PntOn2S Pnt = IterLOP1.Value();
Pnt.Parameters(U1, V1, U2, V2);
if(U1>UmaxLig1) UmaxLig1=U1;
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 ; ver<= NbLigCalculee ; ver++) {
const Handle(IntPatch_WLine)& verwline = *((Handle(IntPatch_WLine)*)&SLin.Value(ver));
// Check end point if it is on existing line.
const IntSurf_PntOn2S& verPointDebut = verwline->Point(1);
const IntSurf_PntOn2S& verPointFin = verwline->Point(verwline->NbPnts());
- if(Point3dDebut.Distance(verPointDebut.Value()) <= TolTangency) {
- if(Point3dFin.Distance(verPointFin.Value()) <= TolTangency)
- RejetLigne = Standard_True;
+ if( (Point3dDebut.Distance(verPointDebut.Value()) <= TolTangency) &&
+ (Point3dFin.Distance(verPointFin.Value()) <= TolTangency))
+ {
+ RejetLigne = Standard_True;
+ break;
}
}
+ if(RejetLigne)
+ {
+ DublicateOfLinesProcessing(PW, ver, SLin, RejetLigne);
+ }
+
if(!RejetLigne) {
IntSurf_TypeTrans trans1,trans2;
Standard_Real locu,locv;
IntPatch_IType aType = aSLine->ArcType();
if( aType != IntPatch_Walking)
continue;
- const Handle(IntPatch_WLine)& aWLine = (*((Handle(IntPatch_WLine)*)&aSLine));
+ Handle(IntPatch_WLine) aWLine (Handle(IntPatch_WLine)::DownCast (aSLine));
Standard_Integer tnbV = aWLine->NbVertex();
Standard_Integer tiV;
for( tiV = 1; tiV <= tnbV; tiV++ ) {
if( VDMin != 0 ) {
const Handle(IntPatch_Line)& aSLine = SLin.Value(WLDMin);
- const Handle(IntPatch_WLine)& aWLine = (*((Handle(IntPatch_WLine)*)&aSLine));
+ Handle(IntPatch_WLine) aWLine (Handle(IntPatch_WLine)::DownCast (aSLine));
Standard_Integer tiVpar = (Standard_Integer)aWLine->Vertex(VDMin).ParameterOnLine();
Standard_Integer ciVpar = (Standard_Integer)wline->Vertex(ciV).ParameterOnLine();
Standard_Real u11 = 0., u12 = 0., v11 = 0., v12 = 0.;
// Standard_Real nIncrement=Increment;
// if(MaxOscill>10) {
- // #ifdef DEB
+ // #ifdef OCCT_DEBUG
// cout<<"\n IntPatch_PrmPrmIntersection.gxx : Increment:"<<Increment<<" -> "<<Increment/(0.5*MaxOscill)<<endl;
// #endif
// nIncrement/=0.5*MaxOscill;
//modified by NIZNHY-PKV Tue May 10 11:08:13 2011t
RejectLine = Standard_True;
+ ver--;
break;
}
}//for(m=1; m<iPWNbPoints; ++m){
}// for( ver = 1 ; (!RejetLigne) && (ver<= NbLigCalculee) ; ver++) {
//
+ if(RejectLine)
+ {
+ DublicateOfLinesProcessing(PW, ver, SLin, RejectLine);
+ }
+
if(!RejectLine)
{
IntSurf_TypeTrans trans1,trans2;
IntPatch_IType aType = aSLine->ArcType();
if( aType != IntPatch_Walking)
continue;
- const Handle(IntPatch_WLine)& aWLine = (*((Handle(IntPatch_WLine)*)&aSLine));
+ Handle(IntPatch_WLine) aWLine (Handle(IntPatch_WLine)::DownCast (aSLine));
Standard_Integer tnbV = aWLine->NbVertex();
Standard_Integer tiV;
for( tiV = 1; tiV <= tnbV; tiV++ )
if( VDMin != 0 )
{
const Handle(IntPatch_Line)& aSLine = SLin.Value(WLDMin);
- const Handle(IntPatch_WLine)& aWLine = (*((Handle(IntPatch_WLine)*)&aSLine));
+ Handle(IntPatch_WLine) aWLine (Handle(IntPatch_WLine)::DownCast (aSLine));
Standard_Integer tiVpar = (Standard_Integer)aWLine->Vertex(VDMin).ParameterOnLine();
Standard_Integer ciVpar = (Standard_Integer)wline->Vertex(ciV).ParameterOnLine();
Standard_Real u11 = 0., u12 = 0., v11 = 0., v12 = 0.;
const IntSurf_PntOn2S& PointFin = PW.Value(PW.NbPoints());
Point3dFin = PointFin.Value();
- for(ver=1 ; (!RejetLigne) && (ver<= NbLigCalculee) ; ver++)
+ for(ver=1 ; 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));
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) ||
+ (Point3dFin.Distance(verPointFin.Value()) < TolTangency))
{
RejetLigne = Standard_True;
- }
- else
- {
- if(Point3dFin.Distance(verPointFin.Value()) < TolTangency)
- {
- RejetLigne = Standard_True;
- }
+ break;
}
}
+ if(RejetLigne)
+ {
+ DublicateOfLinesProcessing(PW, ver, SLin, RejetLigne);
+ }
+
if(!RejetLigne)
{
IntSurf_TypeTrans trans1,trans2;
const Standard_Integer j) {
return myP2[Index(i,j)];
};
-protected:
+
+private:
+
+ IntPatch_InfoPD (const IntPatch_InfoPD&);
+ IntPatch_InfoPD& operator=(const IntPatch_InfoPD&);
+
+private:
+
Standard_Integer myNBI;
char *myP1DS2;
char *myP2DS1;