-// File: IntPatch_RstInt.cxx
-// Created: Fri May 7 12:45:18 1993
-// Author: Jacques GOUSSARD
-// Copyright: Matra Datavision 1993
+// Created on: 1993-05-07
+// Created by: Jacques GOUSSARD
+// Copyright (c) 1993-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
// ----------------------------------------------------------------------
//-- lbr: Modifs importantes du 16-17 Nov 95
#include <Precision.hxx>
#include <Adaptor2d_HCurve2d.hxx>
-#include <IntPatch_PolygoTool.hxx>
#include <IntPatch_WLine.hxx>
#include <IntPatch_RLine.hxx>
#include <IntPatch_HInterTool.hxx>
#include <IntPatch_CSFunction.hxx>
#include <IntPatch_CurvIntSurf.hxx>
+#define myInfinite 1.e15 // the same as was in Adaptor3d_TopolTool
static void Recadre(GeomAbs_SurfaceType typeS1,
GeomAbs_SurfaceType typeS2,
case GeomAbs_Cone:
case GeomAbs_Sphere:
case GeomAbs_Torus:
- while(U1<(U1p-1.5*PI)) U1+=PI+PI;
- while(U1>(U1p+1.5*PI)) U1-=PI+PI;
+ while(U1<(U1p-1.5*M_PI)) U1+=M_PI+M_PI;
+ while(U1>(U1p+1.5*M_PI)) U1-=M_PI+M_PI;
break;
default:
break;
}
if(typeS1==GeomAbs_Torus) {
- while(V1<(V1p-1.5*PI)) V1+=PI+PI;
- while(V1>(V1p+1.5*PI)) V1-=PI+PI;
+ while(V1<(V1p-1.5*M_PI)) V1+=M_PI+M_PI;
+ while(V1>(V1p+1.5*M_PI)) V1-=M_PI+M_PI;
}
switch(typeS2) {
case GeomAbs_Cone:
case GeomAbs_Sphere:
case GeomAbs_Torus:
- while(U2<(U2p-1.5*PI)) U2+=PI+PI;
- while(U2>(U2p+1.5*PI)) U2-=PI+PI;
+ while(U2<(U2p-1.5*M_PI)) U2+=M_PI+M_PI;
+ while(U2>(U2p+1.5*M_PI)) U2-=M_PI+M_PI;
break;
default:
break;
}
if(typeS2==GeomAbs_Torus) {
- while(V2<(V1p-1.5*PI)) V2+=PI+PI;
- while(V2>(V2p+1.5*PI)) V2-=PI+PI;
+ while(V2<(V1p-1.5*M_PI)) V2+=M_PI+M_PI;
+ while(V2>(V2p+1.5*M_PI)) V2-=M_PI+M_PI;
}
}
const Standard_Boolean OnFirst,
Standard_Real& U, Standard_Real& V)
{
+ Handle(IntPatch_WLine) wlin = Handle(IntPatch_WLine)::DownCast(L);
+ Handle(IntPatch_RLine) rlin = Handle(IntPatch_RLine)::DownCast(L);
IntPatch_IType typL = L->ArcType();
- const Handle(IntPatch_WLine)& wlin = (const Handle(IntPatch_WLine)&)L;
- const Handle(IntPatch_RLine)& rlin = (const Handle(IntPatch_RLine)&)L;
Standard_Integer Nbptlin = (typL == IntPatch_Walking
? wlin->NbPnts()
: rlin->NbPnts());
// Dans le cas d une ligne de cheminement, il faudrait voir la projection
// et le calcul de la tangente.
- const Handle(IntPatch_RLine)& rlin = (*((Handle(IntPatch_RLine)*)&L)); //-- aucune verification n est
- const Handle(IntPatch_WLine)& wlin = (*((Handle(IntPatch_WLine)*)&L)); //-- faite au cast.
+ Handle(IntPatch_RLine) rlin (Handle(IntPatch_RLine)::DownCast (L)); //-- aucune verification n est
+ Handle(IntPatch_WLine) wlin (Handle(IntPatch_WLine)::DownCast (L)); //-- faite au cast.
gp_Pnt ptbid;
gp_Vec d1u,d1v;
gp_Pnt2d p2d;
const Handle(Adaptor3d_TopolTool)& Domain,
const Handle(Adaptor3d_HSurface)& OtherSurf,
const Standard_Boolean OnFirst,
- const Standard_Real Tol )
+ const Standard_Real Tol,
+ const Standard_Boolean hasBeenAdded)
{
// Domain est le domaine de restriction de la surface Surf.
// Si OnFirst = True, c est que la surface Surf correspond a la 1ere
// surface donnee aux algo d intersection.
- static IntPatch_SearchPnt Commun;
+ IntPatch_SearchPnt Commun;
Standard_Real U,V,W;
- Standard_Real U1,V1,U2,V2;
+ Standard_Real U1,V1,U2 = 0.,V2 = 0.;
Standard_Real paramarc=0.,paramline=0.;
Standard_Integer i,j,k;
TColgp_SequenceOfPnt locpt;
TColgp_SequenceOfPnt2d locpt2;
- const Handle(IntPatch_RLine)& rlin = (*((Handle(IntPatch_RLine)*)&L)); //-- aucune verification n est
- const Handle(IntPatch_WLine)& wlin = (*((Handle(IntPatch_WLine)*)&L)); //-- faite au cast.
+ Handle(IntPatch_RLine) rlin (Handle(IntPatch_RLine)::DownCast (L)); //-- aucune verification n est
+ Handle(IntPatch_WLine) wlin (Handle(IntPatch_WLine)::DownCast (L)); //-- faite au cast.
Standard_Integer Nbvtx =0;
Standard_Integer Nbptlin =0;
Standard_Real tolPLin = Surf->UResolution(Precision::Confusion());
Standard_Real VRes = Surf->VResolution(edgeTol);
IntPatch_HInterTool::Bounds(arc,PFirst,PLast);
- if (Precision::IsNegativeInfinite(PFirst) ||
- Precision::IsPositiveInfinite(PLast)) {
- //-- cout<<" IntPatch_RstInt::PutVertexOnLine ---> Restrictions Infinies :"<<endl;
- return;
- }
+ if(Precision::IsNegativeInfinite(PFirst))
+ PFirst = -myInfinite;
+ if(Precision::IsPositiveInfinite(PLast))
+ PLast = myInfinite;
+ //if (Precision::IsNegativeInfinite(PFirst) ||
+ // Precision::IsPositiveInfinite(PLast)) {
+ // //-- cout<<" IntPatch_RstInt::PutVertexOnLine ---> Restrictions Infinies :"<<endl;
+ // return;
+ //}
Standard_Boolean isVFirst = Standard_False, isVLast = Standard_False;
gp_Pnt2d p2dFirst,p2dLast;
}
}
- Bnd_Box2d BPLin = IntPatch_PolygoTool::Bounding(PLin);
+ Bnd_Box2d BPLin = PLin.Bounding();
if(SurfaceIsPeriodic) {
Standard_Real xmin,ymin,xmax,ymax,g;
BPLin.Get(xmin,ymin,xmax,ymax);
g = BPLin.GetGap();
BPLin.SetVoid();
- BPLin.Update(xmin-PI-PI,ymin,
- xmax+PI+PI,ymax);
+ BPLin.Update(xmin-M_PI-M_PI,ymin,
+ xmax+M_PI+M_PI,ymax);
BPLin.SetGap(g);
}
if(SurfaceIsBiPeriodic) {
BPLin.Get(xmin,ymin,xmax,ymax);
g = BPLin.GetGap();
BPLin.SetVoid();
- BPLin.Update(xmin,ymin-PI-PI,
- xmax,ymax+PI+PI);
+ BPLin.Update(xmin,ymin-M_PI-M_PI,
+ xmax,ymax+M_PI+M_PI);
BPLin.SetGap(g);
}
do {
if(IndiceOffsetBiPeriodic == 1)
- OffsetV = -PI-PI;
+ OffsetV = -M_PI-M_PI;
else if(IndiceOffsetBiPeriodic == 2)
- OffsetV = PI+PI;
+ OffsetV = M_PI+M_PI;
do {
if(IndiceOffsetPeriodic == 1)
- OffsetU = -PI-PI;
+ OffsetU = -M_PI-M_PI;
else if(IndiceOffsetPeriodic == 2)
- OffsetU = PI+PI;
+ OffsetU = M_PI+M_PI;
Brise.SetOffset(OffsetU,OffsetV);
static int debug_polygon2d =0;
if(debug_polygon2d) {
cout<<" ***** Numero Restriction : "<<NumeroEdge<<" *****"<<endl;
- IntPatch_PolygoTool::Dump(PLin);
- IntPatch_PolygoTool::Dump(Brise);
+ PLin.Dump();
+ Brise.Dump();
}
Commun.Perform(PLin,Brise);
tolU = Max(tolULast,tolU); tolV = Max(tolVLast,tolV);
}
Standard_Real nptCh = UMaxCh-UMinCh;
- Standard_Boolean isNptLow = nptCh < 10. && nptCh < Nbptlin/100. ||
- !Domain->Has3d() && Standard_Integer(nptCh)+1 < Nbptlin;
+ Standard_Boolean isNptLow = (nptCh < 10. && nptCh < Nbptlin/100.) ||
+ (!Domain->Has3d() && Standard_Integer(nptCh)+1 < Nbptlin);
if (!isNptLow && !IsSegment2dSmall(Brise,UMinAr,UMaxAr,tolU,tolV)) {
// treat both ends
- Standard_Real UMinChP,UMaxChP,UMinArP,UMaxArP;
- UMinChP = IntegerPart(UMinCh); UMinArP = IntegerPart(UMinAr);
- UMaxChP = IntegerPart(UMaxCh); UMaxArP = IntegerPart(UMaxAr);
- Standard_Integer irangCh1,irangCh2,irangAr1,irangAr2;
- irangCh1 = Standard_Integer(UMinChP)+1; irangCh2 = Standard_Integer(UMaxChP)+1;
- irangAr1 = Standard_Integer(UMinArP)+1; irangAr2 = Standard_Integer(UMaxArP)+1;
- UMinChP = UMinCh - UMinChP; UMinArP = UMinAr - UMinArP;
+ Standard_Real UMinChP,UMinArP,UMaxArP;
+ UMinChP = IntegerPart(UMinCh);
+ UMinArP = IntegerPart(UMinAr);
+ UMaxArP = IntegerPart(UMaxAr);
+ Standard_Integer irangAr1,irangAr2;
+ irangAr1 = Standard_Integer(UMinArP)+1;
+ irangAr2 = Standard_Integer(UMaxArP)+1;
+ UMinChP = UMinCh - UMinChP;
+ UMinArP = UMinAr - UMinArP;
//UMaxChP = UMaxCh - UMaxChP; UMaxArP = UMaxAr - UMaxArP;
const Standard_Real eps = 1e-10;
// Standard_Boolean isChExtr1 = irangCh1==1 && UMinChP<eps;
if (ptsommet.Distance(locpt(j)) <= edgeTol) {
if (possiblyClosed) {
locpt2(j).Coord(U,V);
- if (OSurfaceIsUClosed && Abs(U-U2) > tolOUClosed ||
- OSurfaceIsVClosed && Abs(V-V2) > tolOVClosed)
+ if ((OSurfaceIsUClosed && Abs(U-U2) > tolOUClosed) ||
+ (OSurfaceIsVClosed && Abs(V-V2) > tolOVClosed))
continue;
}
duplicate = Standard_True;
}
if (!duplicate) {
- Standard_Integer ParamApproxOnLine = Standard_Integer(W1[ip])+1;
-
- arc->D1(paramarc,p2d,d2d);
- U1 = p2d.X(); V1 = p2d.Y();
- if (typL == IntPatch_Walking && SurfaceIsPeriodic)
- if (OnFirst)
- Recadre(TypeS1,TypeS2,wlin,ParamApproxOnLine,U1,V1,U2,V2);
- else
- Recadre(TypeS1,TypeS2,wlin,ParamApproxOnLine,U2,V2,U1,V1);
-
+ Standard_Integer ParamApproxOnLine = Standard_Integer(W1[ip])+1;
+
+ arc->D1(paramarc,p2d,d2d);
+ U1 = p2d.X(); V1 = p2d.Y();
+ if (typL == IntPatch_Walking && SurfaceIsPeriodic) {
+ if (OnFirst)
+ Recadre(TypeS1,TypeS2,wlin,ParamApproxOnLine,U1,V1,U2,V2);
+ else
+ Recadre(TypeS1,TypeS2,wlin,ParamApproxOnLine,U2,V2,U1,V1);
+ }
locpt.Append(ptsommet);
locpt2.Append(gp_Pnt2d(U2,V2));
// check in 2d
if (SurfaceIsUClosed || SurfaceIsVClosed) {
GetLinePoint2d (L, paramline, OnFirst, U,V);
- if (SurfaceIsUClosed && Abs(U-U1) > tolUClosed ||
- SurfaceIsVClosed && Abs(V-V1) > tolVClosed)
+ if ((SurfaceIsUClosed && Abs(U-U1) > tolUClosed) ||
+ (SurfaceIsVClosed && Abs(V-V1) > tolVClosed))
found = Standard_False;
}
if (found && (OSurfaceIsUClosed || OSurfaceIsVClosed)) {
GetLinePoint2d (L, paramline, !OnFirst, U,V);
- if (OSurfaceIsUClosed && Abs(U-U2) > tolOUClosed ||
- OSurfaceIsVClosed && Abs(V-V2) > tolOVClosed)
+ if ((OSurfaceIsUClosed && Abs(U-U2) > tolOUClosed) ||
+ (OSurfaceIsVClosed && Abs(V-V2) > tolOVClosed))
found = Standard_False;
}
}
? wlin->Vertex(j)
: rlin->Vertex(j));
Standard_Boolean APointOnRstStillExist =
- (OnFirst && Rptline.IsOnDomS1() && Rptline.ArcOnS1() == arc ||
- !OnFirst && Rptline.IsOnDomS2() && Rptline.ArcOnS2() == arc);
+ ((OnFirst && Rptline.IsOnDomS1() && Rptline.ArcOnS1() == arc) ||
+ (!OnFirst && Rptline.IsOnDomS2() && Rptline.ArcOnS2() == arc));
if(!APointOnRstStillExist) {
if (possiblyClosed) {
if (SurfaceIsUClosed || SurfaceIsVClosed) {
if (OnFirst) Rptline.ParametersOnS1(U,V);
else Rptline.ParametersOnS2(U,V);
- if (SurfaceIsUClosed && Abs(U-U1) > tolUClosed ||
- SurfaceIsVClosed && Abs(V-V1) > tolVClosed)
+ if ((SurfaceIsUClosed && Abs(U-U1) > tolUClosed) ||
+ (SurfaceIsVClosed && Abs(V-V1) > tolVClosed))
continue;
}
if (OSurfaceIsUClosed || OSurfaceIsVClosed) {
if (OnFirst) Rptline.ParametersOnS2(U,V);
else Rptline.ParametersOnS1(U,V);
- if (OSurfaceIsUClosed && Abs(U-U2) > tolOUClosed ||
- OSurfaceIsVClosed && Abs(V-V2) > tolOVClosed)
+ if ((OSurfaceIsUClosed && Abs(U-U2) > tolOUClosed) ||
+ (OSurfaceIsVClosed && Abs(V-V2) > tolOVClosed))
continue;
}
}
// on doit avoir VtxOnArc = True. On duplique le point sur S1
// en changeant ArcOnS2.
Standard_Boolean OnDifferentRst =
- (OnFirst && ptline.IsOnDomS1() && ptline.ArcOnS1() != arc ||
- !OnFirst && ptline.IsOnDomS2() && ptline.ArcOnS2() != arc);
+ ((OnFirst && ptline.IsOnDomS1() && ptline.ArcOnS1() != arc) ||
+ (!OnFirst && ptline.IsOnDomS2() && ptline.ArcOnS2() != arc));
ptline.SetTolerance(vtxTol);
if ( (!ptline.IsVertexOnS1() && OnFirst)
|| (!ptline.IsVertexOnS2() && !OnFirst)
case GeomAbs_Cylinder:
case GeomAbs_Cone:
case GeomAbs_Sphere:
- pu1=PI+PI;
+ pu1=M_PI+M_PI;
break;
case GeomAbs_Torus:
- pu1=pv1=PI+PI;
+ pu1=pv1=M_PI+M_PI;
break;
default:
{
case GeomAbs_Cone:
case GeomAbs_Sphere:
- pu2=PI+PI;
+ pu2=M_PI+M_PI;
break;
case GeomAbs_Torus:
- pu2=pv2=PI+PI;
+ pu2=pv2=M_PI+M_PI;
break;
default:
{
*/
wlin->SetPeriod(pu1,pv1,pu2,pv2);
- wlin->ComputeVertexParameters(Tol);
+ wlin->ComputeVertexParameters(Tol, hasBeenAdded);
}
else {
-#ifdef DEB
- //if(rlin->NbVertex()==0) {
- // cout<<" \n *** IntPatch RstInt.gxx : nbvtx = 0 sur rline *** \n"<<endl;
- //}
-#endif
rlin->ComputeVertexParameters(Tol);
}
}