mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0022771: An extra vertex produced in result of Boolean section for the cases of closed intersection curves.
This commit is contained in:
parent
999d2599ea
commit
3928aec6c9
@ -496,6 +496,18 @@ is
|
||||
---Purpose:
|
||||
--- Try to put 3D-point <aP> (parameter aT) on the curve <aBC>
|
||||
---
|
||||
|
||||
--modified by NIZNHY-PKV Thu Oct 20 07:17:11 2011f
|
||||
PutClosingPaveOnCurve (me:out;
|
||||
aBC :out Curve from BOPTools;
|
||||
aFF :out SSInterference from BOPTools)
|
||||
is protected;
|
||||
---Purpose:
|
||||
--- Put paves on the curve <aBC> in case when <aBC>
|
||||
-- is closed 3D-curve
|
||||
---
|
||||
--modified by NIZNHY-PKV Thu Oct 20 07:17:11 2011t
|
||||
|
||||
FindPave (me:out;
|
||||
aP :Pnt from gp;
|
||||
aTpV: Real from Standard;
|
||||
@ -560,13 +572,11 @@ is
|
||||
RecomputeCommonBlocks(me: in out; nE: Integer from Standard)
|
||||
is private;
|
||||
|
||||
--modified by NIZNHY-PKV Tue Oct 19 10:28:42 2004f
|
||||
ExtendedTolerance(me:out;
|
||||
nV : Integer from Standard;
|
||||
aTolExt : out Real from Standard)
|
||||
returns Boolean from Standard
|
||||
is protected;
|
||||
--modified by NIZNHY-PKV Tue Oct 19 10:28:44 2004t
|
||||
|
||||
fields
|
||||
|
||||
|
@ -130,7 +130,6 @@ static
|
||||
BOPTools_PaveFiller& aPF,
|
||||
TColStd_SequenceOfInteger& aSeqVx,
|
||||
TColStd_SequenceOfReal& aSeqTolVx);
|
||||
//modified by NIZNHY-PKV Wed Aug 31 10:32:52 2011f
|
||||
static
|
||||
void ProcessAloneStickVertices(const Standard_Integer nF1,
|
||||
const Standard_Integer nF2,
|
||||
@ -139,7 +138,6 @@ static
|
||||
BOPTools_PaveFiller& aPF,
|
||||
TColStd_SequenceOfInteger& aSeqVx,
|
||||
TColStd_SequenceOfReal& aSeqTolVx);
|
||||
//modified by NIZNHY-PKV Wed Aug 31 10:32:59 2011t
|
||||
//wkar OCC334 t
|
||||
|
||||
static
|
||||
@ -191,13 +189,11 @@ static Standard_Integer RejectBuildingEdge(const IntTools_Curve& theC,
|
||||
const TopTools_ListOfShape& theL,
|
||||
Standard_Real& theTF);
|
||||
|
||||
//modified by NIZNHY-PKV Sat Mar 05 12:23:05 2011f
|
||||
static
|
||||
void CorrectTolR3D(BOPTools_PaveFiller& aPF,
|
||||
const BOPTools_SSInterference& aFF,
|
||||
const TColStd_MapOfInteger& aMVStick,
|
||||
Standard_Real& aTolR3D);
|
||||
//modified by NIZNHY-PKV Sat Mar 05 12:23:07 2011t
|
||||
|
||||
//=======================================================================
|
||||
// function: PerformFF
|
||||
@ -206,7 +202,7 @@ static
|
||||
void BOPTools_PaveFiller::PerformFF()
|
||||
{
|
||||
myIsDone=Standard_False;
|
||||
Standard_Boolean bIsFound;
|
||||
Standard_Boolean bIsFound, bToSplit;
|
||||
Standard_Integer n1, n2, anIndexIn=0, nF1, nF2, aNbFFs, aBlockLength;
|
||||
BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger aMapWhat, aMapWith;
|
||||
//
|
||||
@ -222,6 +218,10 @@ static
|
||||
aFFs.SetBlockLength(aNbFFs);
|
||||
}
|
||||
//
|
||||
//modified by NIZNHY-PKV Thu Oct 20 07:09:57 2011f
|
||||
bToSplit=Standard_False;
|
||||
//modified by NIZNHY-PKV Thu Oct 20 07:09:59 2011t
|
||||
|
||||
for (; myDSIt.More(); myDSIt.Next()) {
|
||||
Standard_Boolean justaddinterference = Standard_True;
|
||||
myDSIt.Current(n1, n2, justaddinterference);
|
||||
@ -402,7 +402,10 @@ static
|
||||
if (aTolR3D < 1.e-7){
|
||||
aTolR3D=1.e-7;
|
||||
}
|
||||
aFF.PrepareLines3D();
|
||||
//modified by NIZNHY-PKV Thu Oct 20 07:10:38 2011f
|
||||
aFF.PrepareLines3D(bToSplit);
|
||||
//aFF.PrepareLines3D();
|
||||
//modified by NIZNHY-PKV Thu Oct 20 07:10:41 2011t
|
||||
//
|
||||
anIndexIn=0;
|
||||
Standard_Integer aNbCurves, aNbPoints;
|
||||
@ -1360,11 +1363,9 @@ static
|
||||
aPaveSet.Append(aPaveNew);
|
||||
//<-B
|
||||
BOPTools_Tools::UpdateVertex (aC, aT, aV);
|
||||
//modified by NIZNHY-PKV Sat Mar 05 13:43:27 2011f
|
||||
if(aTolR3D<aTolTresh) {
|
||||
aBB.UpdateVertex(aV, aTolR3D);
|
||||
}
|
||||
//modified by NIZNHY-PKV Sat Mar 05 13:43:29 2011t
|
||||
}
|
||||
}
|
||||
//
|
||||
@ -1455,7 +1456,7 @@ static
|
||||
BOPTools_PaveSet aPSF;
|
||||
PrepareSetForFace (nF1, nF2, aPSF);
|
||||
//
|
||||
//modified by NIZNHY-PKV Sat Mar 05 12:12:05 2011f
|
||||
//f
|
||||
{
|
||||
Standard_Integer nVX;
|
||||
BOPTools_ListIteratorOfListOfPave aItLP;
|
||||
@ -1471,7 +1472,7 @@ static
|
||||
//
|
||||
CorrectTolR3D(*this, aFFi, aMVStick, aTolR3D);
|
||||
}
|
||||
//modified by NIZNHY-PKV Sat Mar 05 12:12:07 2011t
|
||||
//t
|
||||
//
|
||||
BOPTools_SequenceOfCurves& aSCvs=aFFi.Curves();
|
||||
aNbCurves=aSCvs.Length();
|
||||
@ -1483,7 +1484,7 @@ static
|
||||
//
|
||||
PutPaveOnCurve (aPSF, aTolR3D, aBC);
|
||||
}
|
||||
//modified by NIZNHY-PKV Tue Aug 30 14:54:50 2011f
|
||||
//f
|
||||
{
|
||||
Standard_Integer aNbVtx, jx;
|
||||
Standard_Real aTolVRange;
|
||||
@ -1519,7 +1520,7 @@ static
|
||||
}
|
||||
}
|
||||
}
|
||||
//modified by NIZNHY-PKV Tue Aug 30 14:54:56 2011t
|
||||
//t
|
||||
//
|
||||
// Put bounding paves on curves
|
||||
//Check very specific case of cone-cone intersection (OCC13211)
|
||||
@ -1552,14 +1553,23 @@ static
|
||||
}
|
||||
}
|
||||
//
|
||||
//modified by NIZNHY-PKV Thu Oct 20 07:14:32 2011f
|
||||
// Put closing pave if needded
|
||||
for (j=1; j<=aNbCurves; ++j) {
|
||||
BOPTools_Curve& aBC=aSCvs(j);
|
||||
PutClosingPaveOnCurve (aBC, aFFi);
|
||||
}
|
||||
//modified by NIZNHY-PKV Thu Oct 20 07:14:34 2011t
|
||||
//
|
||||
// xxx
|
||||
for (j=1; j<=aNbCurves; j++) {
|
||||
BOPTools_Curve& aBC=aSCvs(j);
|
||||
BOPTools_ListOfPave anOldList;
|
||||
anOldList = aBC.Set().Set();
|
||||
|
||||
if (aBC.NewPaveBlocks().IsEmpty())
|
||||
if (aBC.NewPaveBlocks().IsEmpty()) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
|
||||
BOPTools_CArray1OfESInterference& aESs = myIntrPool->ESInterferences();
|
||||
@ -1885,7 +1895,7 @@ void ProcessAloneStickVertices(const Standard_Integer nF1,
|
||||
TColStd_SequenceOfInteger& aSeqVx,
|
||||
TColStd_SequenceOfReal& aSeqTolVx)
|
||||
{
|
||||
Standard_Boolean bFound;
|
||||
Standard_Boolean bFound, bIsClosed;
|
||||
Standard_Integer aNbVtx, jx, nV;
|
||||
Standard_Real aTolVRange;
|
||||
TColStd_IndexedMapOfInteger aMapUnUsed;
|
||||
@ -1937,8 +1947,15 @@ void ProcessAloneStickVertices(const Standard_Integer nF1,
|
||||
aNbSCvs=aSCvs.Length();
|
||||
if (aNbSCvs==1) {
|
||||
BOPTools_Curve& aBC=aSCvs(1);
|
||||
const IntTools_Curve& aC=aBC.Curve();
|
||||
Handle (Geom_Curve) aC3D= aC.Curve();
|
||||
const IntTools_Curve& aIC=aBC.Curve();
|
||||
Handle (Geom_Curve) aC3D= aIC.Curve();
|
||||
//modified by NIZNHY-PKV Wed Nov 02 13:33:42 2011f
|
||||
//
|
||||
bIsClosed=IntTools_Tools::IsClosed(aC3D);
|
||||
if (bIsClosed) {
|
||||
return;
|
||||
}
|
||||
//modified by NIZNHY-PKV Wed Nov 02 13:33:44 2011t
|
||||
GeomAPI_ProjectPointOnCurve& aProjPT=aCtx.ProjPT(aC3D);
|
||||
//
|
||||
for (jx=1; jx<=aNbVtx; ++jx) {
|
||||
@ -1962,7 +1979,6 @@ void ProcessAloneStickVertices(const Standard_Integer nF1,
|
||||
}
|
||||
}
|
||||
}
|
||||
//modified by NIZNHY-PKV Wed Aug 31 10:29:29 2011f
|
||||
//=======================================================================
|
||||
// function: ProcessAloneStickVertices
|
||||
// purpose:
|
||||
@ -2061,7 +2077,6 @@ void ProcessAloneStickVertices(const Standard_Integer nF1,
|
||||
}//for (jVU=1; jVU=aNbVU; ++jVU) {
|
||||
}//if(aType1==GeomAbs_Torus || aType2==GeomAbs_Torus) {
|
||||
}
|
||||
//modified by NIZNHY-PKV Wed Aug 31 10:29:37 2011t
|
||||
//=======================================================================
|
||||
// function: UnUsedMap
|
||||
// purpose:
|
||||
@ -3073,33 +3088,69 @@ Standard_Boolean RejectPaveBlock(const IntTools_Curve& theC,
|
||||
const TopoDS_Vertex& theV,
|
||||
Standard_Real& theRT)
|
||||
{
|
||||
Standard_Boolean bIsPeriodic, bClosed, isp, c3d;
|
||||
Standard_Real aPeriod, dt, pf, pl, dp, aTol;
|
||||
Handle(Geom_Curve) aC;
|
||||
//
|
||||
theRT = BRep_Tool::Tolerance(theV);
|
||||
Handle(Geom_Curve) aC = theC.Curve();
|
||||
|
||||
Standard_Real pf = aC->FirstParameter();
|
||||
Standard_Real pl = aC->LastParameter();
|
||||
Standard_Real dp = fabs(pl-pf);
|
||||
aC = theC.Curve();
|
||||
//
|
||||
pf = aC->FirstParameter();
|
||||
pl = aC->LastParameter();
|
||||
dp = fabs(pl-pf);
|
||||
aTol=1.e-9;
|
||||
bIsPeriodic=aC->IsPeriodic();
|
||||
bClosed=IntTools_Tools::IsClosed(aC);
|
||||
//
|
||||
isp=Standard_False;
|
||||
if (bIsPeriodic) {
|
||||
aPeriod=aC->Period();
|
||||
isp=(fabs(aPeriod-dp) <= aTol);
|
||||
dt = fabs(theT2-theT1);
|
||||
isp = (isp || fabs(aPeriod-dt) <= aTol);
|
||||
}
|
||||
c3d=(bClosed || isp);
|
||||
//
|
||||
/*
|
||||
Standard_Boolean isp = (aC->IsPeriodic() && fabs(aC->Period()-dp) <= 1.e-9);
|
||||
Standard_Real dt = fabs(theT2-theT1);
|
||||
isp = (isp || (aC->IsPeriodic() && fabs(aC->Period()-dt) <= 1.e-9));
|
||||
Standard_Boolean c3d = (aC->IsClosed() || isp);
|
||||
|
||||
if(c3d)
|
||||
return Standard_False;
|
||||
|
||||
Standard_Real p1 = Max(pf,theT1);
|
||||
Standard_Real p2 = Min(pl,theT2);
|
||||
*/
|
||||
if(c3d) {
|
||||
return !c3d;
|
||||
}
|
||||
//
|
||||
Standard_Real p1, p2, tp, d3d2, aRT2;;
|
||||
//
|
||||
p1 = Max(pf,theT1);
|
||||
p2 = Min(pl,theT2);
|
||||
if(p2 != p1) {
|
||||
if(p2 < p1) {
|
||||
Standard_Real tp = p1; p1 = p2; p2 = tp;
|
||||
tp = p1;
|
||||
p1 = p2;
|
||||
p2 = tp;
|
||||
}
|
||||
gp_Pnt pntf, pntl;
|
||||
aC->D0(p1,pntf);
|
||||
aC->D0(p2,pntl);
|
||||
//
|
||||
//modified by NIZNHY-PKV Thu Oct 20 09:13:45 2011f
|
||||
//
|
||||
aRT2=theRT*theRT;
|
||||
d3d2 = pntf.SquareDistance(pntl);
|
||||
if(d3d2 > aRT2) {
|
||||
theRT=sqrt(d3d2);
|
||||
}
|
||||
//
|
||||
/*
|
||||
Standard_Real d3d = pntf.Distance(pntl);
|
||||
if(d3d > theRT)
|
||||
if(d3d > theRT) {
|
||||
theRT = d3d;
|
||||
}
|
||||
*/
|
||||
//modified by NIZNHY-PKV Thu Oct 20 09:15:20 2011t
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
@ -3328,3 +3379,66 @@ void CorrectTolR3D(BOPTools_PaveFiller& aPF,
|
||||
aTolR3D=aTolR;
|
||||
}
|
||||
}
|
||||
//modified by NIZNHY-PKV Thu Oct 20 07:18:39 2011f
|
||||
//=======================================================================
|
||||
// function: PutClosingPaveOnCurve
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void BOPTools_PaveFiller::PutClosingPaveOnCurve(BOPTools_Curve& aBC,
|
||||
BOPTools_SSInterference& aFFi)
|
||||
{
|
||||
Standard_Boolean bIsClosed, bHasBounds, bAdded;
|
||||
Standard_Integer nVC, j;
|
||||
Standard_Real aT[2], aTolR3D, aTC, dT, aTx;
|
||||
gp_Pnt aP[2] ;
|
||||
BOPTools_Pave aPVx;
|
||||
BOPTools_ListIteratorOfListOfPave aItLP;
|
||||
//
|
||||
const IntTools_Curve& aIC=aBC.Curve();
|
||||
const Handle (Geom_Curve)& aC3D=aIC.Curve();
|
||||
if(aC3D.IsNull()) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
bIsClosed=IntTools_Tools::IsClosed(aC3D);
|
||||
if (!bIsClosed) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
bHasBounds=aIC.HasBounds ();
|
||||
if (!bHasBounds){
|
||||
return;
|
||||
}
|
||||
//
|
||||
bAdded=Standard_False;
|
||||
dT=Precision::PConfusion();
|
||||
aTolR3D=aFFi.TolR3D();
|
||||
aIC.Bounds (aT[0], aT[1], aP[0], aP[1]);
|
||||
//
|
||||
BOPTools_PaveSet& aFFiPS=aFFi.NewPaveSet();
|
||||
BOPTools_PaveSet& aCPS=aBC.Set();
|
||||
//
|
||||
const BOPTools_ListOfPave& aLP=aCPS.Set();
|
||||
aItLP.Initialize(aLP);
|
||||
for (; aItLP.More() && !bAdded; aItLP.Next()) {
|
||||
const BOPTools_Pave& aPC=aItLP.Value();
|
||||
nVC=aPC.Index();
|
||||
const TopoDS_Vertex aVC=TopoDS::Vertex(myDS->Shape(nVC));
|
||||
aTC=aPC.Param();
|
||||
//
|
||||
for (j=0; j<2; ++j) {
|
||||
if (fabs(aTC-aT[j]) < dT) {
|
||||
aTx=(!j) ? aT[1] : aT[0];
|
||||
aPVx.SetIndex(nVC);
|
||||
aPVx.SetParam(aTx);
|
||||
//
|
||||
aCPS.Append(aPVx);
|
||||
aFFiPS.Append(aPVx);
|
||||
//
|
||||
bAdded=Standard_True;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//modified by NIZNHY-PKV Thu Oct 20 07:18:42 2011t
|
||||
|
@ -2709,16 +2709,25 @@ Standard_Boolean IsDegeneratedZone(const gp_Pnt2d& aP2d,
|
||||
// of the points is less than 2.
|
||||
//=========================================================================
|
||||
Handle(IntPatch_WLine) ComputePurgedWLine(const Handle(IntPatch_WLine)& theWLine) {
|
||||
Handle(IntPatch_WLine) aResult;
|
||||
Handle(IntPatch_WLine) aLocalWLine;
|
||||
Handle(IntPatch_WLine) aTmpWLine = theWLine;
|
||||
|
||||
Handle(IntSurf_LineOn2S) aLineOn2S = new IntSurf_LineOn2S();
|
||||
aLocalWLine = new IntPatch_WLine(aLineOn2S, Standard_False);
|
||||
//modified by NIZNHY-PKV Tue Nov 29 12:14:07 2011f
|
||||
Standard_Integer i, k, v, nb, nbvtx;
|
||||
Handle(IntPatch_WLine) aResult;
|
||||
nbvtx = theWLine->NbVertex();
|
||||
nb = theWLine->NbPnts();
|
||||
|
||||
if (nb==2) {
|
||||
const IntSurf_PntOn2S& p1 = theWLine->Point(1);
|
||||
const IntSurf_PntOn2S& p2 = theWLine->Point(2);
|
||||
if(p1.Value().IsEqual(p2.Value(), gp::Resolution())) {
|
||||
return aResult;
|
||||
}
|
||||
}
|
||||
//
|
||||
Handle(IntPatch_WLine) aLocalWLine;
|
||||
Handle(IntPatch_WLine) aTmpWLine = theWLine;
|
||||
Handle(IntSurf_LineOn2S) aLineOn2S = new IntSurf_LineOn2S();
|
||||
aLocalWLine = new IntPatch_WLine(aLineOn2S, Standard_False);
|
||||
//modified by NIZNHY-PKV Tue Nov 29 12:13:19 2011t
|
||||
for(i = 1; i <= nb; i++) {
|
||||
aLineOn2S->Add(theWLine->Point(i));
|
||||
}
|
||||
|
@ -32,130 +32,32 @@
|
||||
//
|
||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Recadre
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static void Recadre(const Handle(GeomAdaptor_HSurface)& myHS1,
|
||||
const Handle(GeomAdaptor_HSurface)& myHS2,
|
||||
Standard_Real& u1,
|
||||
Standard_Real& v1,
|
||||
Standard_Real& u2,
|
||||
Standard_Real& v2)
|
||||
{
|
||||
Standard_Boolean myHS1IsUPeriodic,myHS1IsVPeriodic;
|
||||
const GeomAbs_SurfaceType typs1 = myHS1->GetType();
|
||||
switch (typs1)
|
||||
{
|
||||
case GeomAbs_Cylinder:
|
||||
case GeomAbs_Cone:
|
||||
case GeomAbs_Sphere:
|
||||
{
|
||||
myHS1IsUPeriodic = Standard_True;
|
||||
myHS1IsVPeriodic = Standard_False;
|
||||
break;
|
||||
}
|
||||
case GeomAbs_Torus:
|
||||
{
|
||||
myHS1IsUPeriodic = myHS1IsVPeriodic = Standard_True;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
//-- Case of periodic biparameters is processed upstream
|
||||
myHS1IsUPeriodic = myHS1IsVPeriodic = Standard_False;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Standard_Boolean myHS2IsUPeriodic,myHS2IsVPeriodic;
|
||||
const GeomAbs_SurfaceType typs2 = myHS2->GetType();
|
||||
switch (typs2)
|
||||
{
|
||||
case GeomAbs_Cylinder:
|
||||
case GeomAbs_Cone:
|
||||
case GeomAbs_Sphere:
|
||||
{
|
||||
myHS2IsUPeriodic = Standard_True;
|
||||
myHS2IsVPeriodic = Standard_False;
|
||||
break;
|
||||
}
|
||||
case GeomAbs_Torus:
|
||||
{
|
||||
myHS2IsUPeriodic = myHS2IsVPeriodic = Standard_True;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
//-- Case of periodic biparameters is processed upstream
|
||||
myHS2IsUPeriodic = myHS2IsVPeriodic = Standard_False;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(myHS1IsUPeriodic) {
|
||||
const Standard_Real lmf = M_PI+M_PI; //-- myHS1->UPeriod();
|
||||
const Standard_Real f = myHS1->FirstUParameter();
|
||||
const Standard_Real l = myHS1->LastUParameter();
|
||||
while(u1 < f) { u1+=lmf; }
|
||||
while(u1 > l) { u1-=lmf; }
|
||||
}
|
||||
if(myHS1IsVPeriodic) {
|
||||
const Standard_Real lmf = M_PI+M_PI; //-- myHS1->VPeriod();
|
||||
const Standard_Real f = myHS1->FirstVParameter();
|
||||
const Standard_Real l = myHS1->LastVParameter();
|
||||
while(v1 < f) { v1+=lmf; }
|
||||
while(v1 > l) { v1-=lmf; }
|
||||
}
|
||||
if(myHS2IsUPeriodic) {
|
||||
const Standard_Real lmf = M_PI+M_PI; //-- myHS2->UPeriod();
|
||||
const Standard_Real f = myHS2->FirstUParameter();
|
||||
const Standard_Real l = myHS2->LastUParameter();
|
||||
while(u2 < f) { u2+=lmf; }
|
||||
while(u2 > l) { u2-=lmf; }
|
||||
}
|
||||
if(myHS2IsVPeriodic) {
|
||||
const Standard_Real lmf = M_PI+M_PI; //-- myHS2->VPeriod();
|
||||
const Standard_Real f = myHS2->FirstVParameter();
|
||||
const Standard_Real l = myHS2->LastVParameter();
|
||||
while(v2 < f) { v2+=lmf; }
|
||||
while(v2 > l) { v2-=lmf; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Parameters
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static void Parameters(const Handle(GeomAdaptor_HSurface)& myHS1,
|
||||
static
|
||||
void Parameters(const Handle(GeomAdaptor_HSurface)& myHS1,
|
||||
const gp_Pnt& Ptref,
|
||||
Standard_Real& U1,
|
||||
Standard_Real& V1);
|
||||
static
|
||||
void Parameters(const Handle(GeomAdaptor_HSurface)& myHS1,
|
||||
const Handle(GeomAdaptor_HSurface)& myHS2,
|
||||
const gp_Pnt& Ptref,
|
||||
Standard_Real& U1,
|
||||
Standard_Real& V1,
|
||||
Standard_Real& U2,
|
||||
Standard_Real& V2)
|
||||
{
|
||||
IntSurf_Quadric quad1,quad2;
|
||||
switch (myHS1->Surface().GetType())
|
||||
{
|
||||
case GeomAbs_Plane: quad1.SetValue(myHS1->Surface().Plane()); break;
|
||||
case GeomAbs_Cylinder: quad1.SetValue(myHS1->Surface().Cylinder()); break;
|
||||
case GeomAbs_Cone: quad1.SetValue(myHS1->Surface().Cone()); break;
|
||||
case GeomAbs_Sphere: quad1.SetValue(myHS1->Surface().Sphere()); break;
|
||||
default: Standard_ConstructionError::Raise("IntTools_LineConstructor::Parameters");
|
||||
}
|
||||
switch (myHS2->Surface().GetType())
|
||||
{
|
||||
case GeomAbs_Plane: quad2.SetValue(myHS2->Surface().Plane()); break;
|
||||
case GeomAbs_Cylinder: quad2.SetValue(myHS2->Surface().Cylinder()); break;
|
||||
case GeomAbs_Cone: quad2.SetValue(myHS2->Surface().Cone()); break;
|
||||
case GeomAbs_Sphere: quad2.SetValue(myHS2->Surface().Sphere()); break;
|
||||
default: Standard_ConstructionError::Raise("IntTools_LineConstructor::Parameters");
|
||||
}
|
||||
quad1.Parameters(Ptref,U1,V1);
|
||||
quad2.Parameters(Ptref,U2,V2);
|
||||
}
|
||||
Standard_Real& V2);
|
||||
|
||||
static
|
||||
void GLinePoint(const IntPatch_IType typl,
|
||||
const Handle(IntPatch_GLine)& GLine,
|
||||
const Standard_Real aT,
|
||||
gp_Pnt& aP);
|
||||
static
|
||||
void Recadre(const Handle(GeomAdaptor_HSurface)& myHS1,
|
||||
const Handle(GeomAdaptor_HSurface)& myHS2,
|
||||
Standard_Real& u1,
|
||||
Standard_Real& v1,
|
||||
Standard_Real& u2,
|
||||
Standard_Real& v2);
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
@ -168,18 +70,15 @@ void IntTools_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
|
||||
const Standard_Real Tol = Precision::PConfusion() * 35.0;
|
||||
|
||||
const IntPatch_IType typl = L->ArcType();
|
||||
if(typl == IntPatch_Analytic)
|
||||
{
|
||||
if(typl == IntPatch_Analytic) {
|
||||
Standard_Real u1,v1,u2,v2;
|
||||
Handle(IntPatch_ALine)& ALine = *((Handle(IntPatch_ALine) *)&L);
|
||||
seqp.Clear();
|
||||
nbvtx = GeomInt_LineTool::NbVertex(L);
|
||||
for(i=1;i<nbvtx;i++)
|
||||
{
|
||||
for(i=1;i<nbvtx;i++) {
|
||||
firstp = GeomInt_LineTool::Vertex(L,i).ParameterOnLine();
|
||||
lastp = GeomInt_LineTool::Vertex(L,i+1).ParameterOnLine();
|
||||
if(firstp!=lastp)
|
||||
{
|
||||
if(firstp!=lastp) {
|
||||
const Standard_Real pmid = (firstp+lastp)*0.5;
|
||||
const gp_Pnt Pmid = ALine->Value(pmid);
|
||||
Parameters(myHS1,myHS2,Pmid,u1,v1,u2,v2);
|
||||
@ -196,21 +95,17 @@ void IntTools_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
|
||||
}
|
||||
done = Standard_True;
|
||||
return;
|
||||
}
|
||||
else if(typl == IntPatch_Walking)
|
||||
{
|
||||
} // if(typl == IntPatch_Analytic) {
|
||||
else if(typl == IntPatch_Walking) {
|
||||
Standard_Real u1,v1,u2,v2;
|
||||
Handle(IntPatch_WLine)& WLine = *((Handle(IntPatch_WLine) *)&L);
|
||||
seqp.Clear();
|
||||
nbvtx = GeomInt_LineTool::NbVertex(L);
|
||||
for(i=1;i<nbvtx;i++)
|
||||
{
|
||||
for(i=1;i<nbvtx;i++) {
|
||||
firstp = GeomInt_LineTool::Vertex(L,i).ParameterOnLine();
|
||||
lastp = GeomInt_LineTool::Vertex(L,i+1).ParameterOnLine();
|
||||
if(firstp!=lastp)
|
||||
{
|
||||
if(lastp != firstp+1)
|
||||
{
|
||||
if(firstp!=lastp) {
|
||||
if(lastp != firstp+1) {
|
||||
const Standard_Integer pmid = (Standard_Integer )( (firstp+lastp)/2);
|
||||
const IntSurf_PntOn2S& Pmid = WLine->Point(pmid);
|
||||
Pmid.Parameters(u1,v1,u2,v2);
|
||||
@ -224,8 +119,7 @@ void IntTools_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
const IntSurf_PntOn2S& Pfirst = WLine->Point((Standard_Integer)(firstp));
|
||||
Pfirst.Parameters(u1,v1,u2,v2);
|
||||
Recadre(myHS1,myHS2,u1,v1,u2,v2);
|
||||
@ -246,12 +140,9 @@ void IntTools_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
//XX
|
||||
// 904/L7
|
||||
//
|
||||
// The One resulting curve consists of 7 segments that are
|
||||
// connected between each other.
|
||||
@ -261,18 +152,36 @@ void IntTools_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
|
||||
// Why -? It is not known yet.
|
||||
// PKV 22.Apr.2002
|
||||
//
|
||||
const GeomAbs_SurfaceType aST1 = myHS1->Surface().GetType();
|
||||
const GeomAbs_SurfaceType aST2 = myHS2->Surface().GetType();
|
||||
if ((aST1==GeomAbs_Plane && aST2==GeomAbs_SurfaceOfExtrusion) ||
|
||||
(aST2==GeomAbs_Plane && aST1==GeomAbs_SurfaceOfExtrusion))
|
||||
{
|
||||
Standard_Integer aNbParts;
|
||||
//
|
||||
aNbParts = seqp.Length()/2;
|
||||
if (aNbParts > 1) {
|
||||
Standard_Boolean bCond;
|
||||
GeomAbs_SurfaceType aST1, aST2;
|
||||
aST1 = myHS1->Surface().GetType();
|
||||
aST2 = myHS2->Surface().GetType();
|
||||
//
|
||||
bCond=Standard_False;
|
||||
if (aST1==GeomAbs_Plane) {
|
||||
if (aST2==GeomAbs_SurfaceOfExtrusion ||
|
||||
aST2==GeomAbs_SurfaceOfRevolution) {//+zft
|
||||
bCond=!bCond;
|
||||
}
|
||||
}
|
||||
else if (aST2==GeomAbs_Plane) {
|
||||
if (aST1==GeomAbs_SurfaceOfExtrusion ||
|
||||
aST1==GeomAbs_SurfaceOfRevolution) {//+zft
|
||||
bCond=!bCond;
|
||||
}
|
||||
}
|
||||
//
|
||||
if (bCond) {
|
||||
Standard_Integer aNb, anIndex, aNbTmp, jx;
|
||||
TColStd_IndexedMapOfInteger aMap;
|
||||
TColStd_SequenceOfReal aSeqTmp;
|
||||
|
||||
Standard_Integer aNb, anIndex, aNbTmp, jx;
|
||||
|
||||
//
|
||||
aNb=seqp.Length();
|
||||
for(i=1; i<=aNb;++i) {
|
||||
for(i=1; i<=aNb; ++i) {
|
||||
lastp =seqp(i);
|
||||
anIndex=(Standard_Integer)lastp;
|
||||
if (!aMap.Contains(anIndex)){
|
||||
@ -295,35 +204,84 @@ void IntTools_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
|
||||
seqp.Append(firstp);
|
||||
seqp.Append(lastp);
|
||||
}
|
||||
}//if (bCond) {
|
||||
}
|
||||
////XX
|
||||
done = Standard_True;
|
||||
return;
|
||||
}// else if(typl == IntPatch_Walking) {
|
||||
//
|
||||
else if (typl != IntPatch_Restriction) {
|
||||
Standard_Boolean intrvtested;
|
||||
Standard_Real u1,v1,u2,v2;
|
||||
//
|
||||
seqp.Clear();
|
||||
//
|
||||
Handle(IntPatch_GLine)& GLine = *((Handle(IntPatch_GLine) *)&L);
|
||||
// reject micro circles, ellipses
|
||||
switch (typl) {
|
||||
case IntPatch_Circle: {
|
||||
Standard_Real aR;
|
||||
gp_Circ aCirc;
|
||||
//
|
||||
aCirc=GLine->Circle();
|
||||
aR=aCirc.Radius();
|
||||
if (aR<Tol) {
|
||||
done = Standard_True;
|
||||
return;
|
||||
}
|
||||
else if (typl != IntPatch_Restriction)
|
||||
{
|
||||
Standard_Real u1,v1,u2,v2;
|
||||
Handle(IntPatch_GLine)& GLine = *((Handle(IntPatch_GLine) *)&L);
|
||||
seqp.Clear();
|
||||
break;
|
||||
}
|
||||
case IntPatch_Ellipse: {
|
||||
Standard_Real aR;
|
||||
gp_Elips aEllipse;
|
||||
//
|
||||
aEllipse=GLine->Ellipse();
|
||||
aR=aEllipse.MajorRadius();
|
||||
if (aR<Tol) {
|
||||
done = Standard_True;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
//modified by NIZNHY-PKV Wed Nov 02 11:50:23 2011t
|
||||
//
|
||||
nbvtx = GeomInt_LineTool::NbVertex(L);
|
||||
Standard_Boolean intrvtested = Standard_False;
|
||||
for(i=1;i<nbvtx;i++)
|
||||
{
|
||||
intrvtested = Standard_False;
|
||||
for(i=1; i<nbvtx; ++i) {
|
||||
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;
|
||||
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;
|
||||
//modified by NIZNHY-PKV Fri Nov 11 10:27:01 2011f
|
||||
GLinePoint(typl, GLine, pmid, Pmid);
|
||||
/*
|
||||
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;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
*/
|
||||
//modified by NIZNHY-PKV Fri Nov 11 12:25:40 2011t
|
||||
//
|
||||
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);
|
||||
@ -336,27 +294,30 @@ void IntTools_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(typl == IntPatch_Circle || typl == IntPatch_Ellipse)
|
||||
{
|
||||
//
|
||||
if(typl == IntPatch_Circle || typl == IntPatch_Ellipse) {
|
||||
firstp = GeomInt_LineTool::Vertex(L,nbvtx).ParameterOnLine();
|
||||
lastp = M_PI + M_PI + 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; }
|
||||
if(acadr>=cadrinf && acadr<=cadrsup)
|
||||
{
|
||||
if(Abs(firstp-lastp)>Precision::PConfusion())
|
||||
{
|
||||
while(acadr < cadrinf) {
|
||||
acadr+=M_PI+M_PI;
|
||||
}
|
||||
while(acadr > cadrsup) {
|
||||
acadr-=M_PI+M_PI;
|
||||
}
|
||||
if(acadr>=cadrinf && acadr<=cadrsup) {
|
||||
if(Abs(firstp-lastp)>Precision::PConfusion()) {
|
||||
intrvtested = Standard_True;
|
||||
const Standard_Real pmid = (firstp+lastp)*0.5;
|
||||
gp_Pnt Pmid;
|
||||
if (typl == IntPatch_Circle)
|
||||
if (typl == IntPatch_Circle) {
|
||||
Pmid = ElCLib::Value(pmid,GLine->Circle());
|
||||
else
|
||||
}
|
||||
else {
|
||||
Pmid = ElCLib::Value(pmid,GLine->Ellipse());
|
||||
}
|
||||
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);
|
||||
@ -377,47 +338,104 @@ void IntTools_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
|
||||
seqp.Append(GeomInt_LineTool::LastParameter(L));
|
||||
}
|
||||
//
|
||||
//modified by NIZNHY-PKV Mon Jan 21 17:02:12 2002 f
|
||||
// Treatment Circles/Ellipses that are the results of intersection
|
||||
// between Plane / (Cylinder, Sphere).
|
||||
// In these cases the intersection curves can contain
|
||||
// a lot of 'vertices' on the curve that leads to a lot of parts
|
||||
// of the curve. Some adjacent parts can be united to the one part.
|
||||
//
|
||||
// Unite neighbouring intervals if it's possible.
|
||||
// It is valid when 3D intersection curve does not go through
|
||||
// the apex on surface. So for the moment we take into account
|
||||
// Plane and Cylinder - surfaces that do not contain an apex.
|
||||
// by NIZNHY-PKV Tue Jan 22 14:00:51 2002
|
||||
|
||||
const GeomAbs_SurfaceType aST1 = myHS1->Surface().GetType();
|
||||
const GeomAbs_SurfaceType aST2 = myHS2->Surface().GetType();
|
||||
if ((aST1==GeomAbs_Plane || aST1==GeomAbs_Cylinder) &&
|
||||
(aST2==GeomAbs_Plane || aST2==GeomAbs_Cylinder))
|
||||
{
|
||||
if(typl == IntPatch_Circle || typl == IntPatch_Ellipse)
|
||||
{
|
||||
Standard_Integer aNbParts = seqp.Length()/2;
|
||||
Standard_Integer aNbParts;
|
||||
//
|
||||
if (aNbParts > 1)
|
||||
{
|
||||
Standard_Integer j, i2, j2;
|
||||
Standard_Real aFi = seqp(1), aLi, aFj, aLj, aF, aL;
|
||||
aNbParts = seqp.Length()/2;
|
||||
if (aNbParts > 1 && (typl == IntPatch_Circle || typl == IntPatch_Ellipse)) {
|
||||
Standard_Boolean bCond, bPCS, bPCS1, bPCS2, bCC;
|
||||
GeomAbs_SurfaceType aST1, aST2;
|
||||
//
|
||||
aST1 = myHS1->Surface().GetType();
|
||||
aST2 = myHS2->Surface().GetType();
|
||||
//
|
||||
bPCS1=((aST1==GeomAbs_Plane) && (aST2==GeomAbs_Cylinder || aST2==GeomAbs_Sphere));
|
||||
bPCS2=((aST2==GeomAbs_Plane) && (aST1==GeomAbs_Cylinder || aST1==GeomAbs_Sphere));
|
||||
bPCS=(bPCS1 || bPCS2);
|
||||
bCC=(aST1==GeomAbs_Cylinder && aST2==GeomAbs_Cylinder);
|
||||
//
|
||||
// ZZ
|
||||
//modified by NIZNHY-PKV Fri Nov 11 10:13:58 2011f
|
||||
Standard_Integer j, i1, i2;
|
||||
Standard_Real aT, aU, aV;
|
||||
Handle(GeomAdaptor_HSurface) aHS;
|
||||
//
|
||||
bCond=Standard_False;
|
||||
//
|
||||
if (bCC) {
|
||||
bCond=Standard_True;
|
||||
}
|
||||
else if (bPCS) {
|
||||
if ((aST1==GeomAbs_Sphere) || (aST2==GeomAbs_Sphere)) {
|
||||
if (aST1==GeomAbs_Sphere) {
|
||||
aHS=myHS1;
|
||||
}
|
||||
else if (aST2==GeomAbs_Sphere){
|
||||
aHS=myHS2;
|
||||
}
|
||||
//
|
||||
Standard_Integer aNbP;
|
||||
Standard_Real aHalfPI, aPPC;
|
||||
//
|
||||
bCond=Standard_True;
|
||||
//
|
||||
aNbP=seqp.Length();
|
||||
aPPC=Precision::PConfusion();
|
||||
aHalfPI=0.5*PI;
|
||||
i1=0;
|
||||
i2=0;
|
||||
//
|
||||
for (i=1; i<=aNbP; ++i) {
|
||||
gp_Pnt aP;
|
||||
//
|
||||
aT=seqp(i);
|
||||
GLinePoint(typl, GLine, aT, aP);
|
||||
Parameters(aHS, aP, aU, aV);
|
||||
if (aV<0.) {
|
||||
if (fabs(aV+aHalfPI) < aPPC) {
|
||||
++i2;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (fabs(aV-aHalfPI) < aPPC) {
|
||||
++i1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i1==2 || i2==2) {
|
||||
bCond=Standard_False;
|
||||
}
|
||||
}
|
||||
}// else if (bPCS1 || bPCS2) {
|
||||
//modified by NIZNHY-PKV Fri Nov 11 10:14:00 2011t
|
||||
//
|
||||
if (bCond){
|
||||
Standard_Integer i2, j2;
|
||||
Standard_Real aFi, aLi, aFj, aLj, aF, aL;
|
||||
TColStd_SequenceOfReal aSeq;
|
||||
//
|
||||
aFi=seqp(1);
|
||||
aSeq.Append(aFi);
|
||||
for (i=1; i<aNbParts; ++i)
|
||||
{
|
||||
for (i=1; i<aNbParts; ++i) {
|
||||
j=i+1;
|
||||
i2=2*i;
|
||||
j2=2*j;
|
||||
|
||||
//
|
||||
aFi=seqp(i2-1);
|
||||
aLi=seqp(i2);
|
||||
|
||||
//
|
||||
aFj=seqp(j2-1);
|
||||
aLj=seqp(j2);
|
||||
|
||||
if (fabs (aFj-aLi) < Tol)
|
||||
{
|
||||
//
|
||||
if (fabs (aFj-aLi) < Tol) {
|
||||
aL=aLj;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
aL=aLi;
|
||||
aSeq.Append(aL);
|
||||
aF=aFj;
|
||||
@ -428,19 +446,16 @@ void IntTools_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
|
||||
//
|
||||
seqp.Clear();
|
||||
aNbParts=aSeq.Length();
|
||||
for (i=1; i<=aNbParts; ++i)
|
||||
{
|
||||
for (i=1; i<=aNbParts; ++i) {
|
||||
aF=aSeq(i);
|
||||
seqp.Append(aF);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//modified by NIZNHY-PKV Mon Jan 21 17:02:17 2002 t
|
||||
//
|
||||
done =Standard_True;
|
||||
return;
|
||||
}
|
||||
}// else if (typl != IntPatch_Restriction) {
|
||||
|
||||
done = Standard_False;
|
||||
seqp.Clear();
|
||||
@ -456,42 +471,37 @@ void IntTools_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
|
||||
GeomInt_SequenceOfParameterAndOrientation seqpss;
|
||||
TopAbs_Orientation or1=TopAbs_FORWARD,or2=TopAbs_FORWARD;
|
||||
|
||||
for (i=1; i<=nbvtx; i++)
|
||||
{
|
||||
for (i=1; i<=nbvtx; i++) {
|
||||
const IntPatch_Point& thevtx = GeomInt_LineTool::Vertex(L,i);
|
||||
const Standard_Real prm = thevtx.ParameterOnLine();
|
||||
if (thevtx.IsOnDomS1())
|
||||
{
|
||||
switch (thevtx.TransitionLineArc1().TransitionType())
|
||||
{
|
||||
if (thevtx.IsOnDomS1()) {
|
||||
switch (thevtx.TransitionLineArc1().TransitionType()) {
|
||||
case IntSurf_In: or1 = TopAbs_FORWARD; break;
|
||||
case IntSurf_Out: or1 = TopAbs_REVERSED; break;
|
||||
case IntSurf_Touch: or1 = TopAbs_INTERNAL; break;
|
||||
case IntSurf_Undecided: or1 = TopAbs_INTERNAL; break;
|
||||
}
|
||||
}
|
||||
else
|
||||
else {
|
||||
or1 = TopAbs_INTERNAL;
|
||||
}
|
||||
|
||||
if (thevtx.IsOnDomS2())
|
||||
{
|
||||
switch (thevtx.TransitionLineArc2().TransitionType())
|
||||
{
|
||||
if (thevtx.IsOnDomS2()) {
|
||||
switch (thevtx.TransitionLineArc2().TransitionType()) {
|
||||
case IntSurf_In: or2 = TopAbs_FORWARD; break;
|
||||
case IntSurf_Out: or2 = TopAbs_REVERSED; break;
|
||||
case IntSurf_Touch: or2 = TopAbs_INTERNAL; break;
|
||||
case IntSurf_Undecided: or2 = TopAbs_INTERNAL; break;
|
||||
}
|
||||
}
|
||||
else
|
||||
else {
|
||||
or2 = TopAbs_INTERNAL;
|
||||
|
||||
}
|
||||
//
|
||||
const Standard_Integer nbinserted = seqpss.Length();
|
||||
Standard_Boolean inserted = Standard_False;
|
||||
for (Standard_Integer j=1; j<=nbinserted;j++)
|
||||
{
|
||||
if (Abs(prm-seqpss(j).Parameter()) <= Tol)
|
||||
{
|
||||
for (Standard_Integer j=1; j<=nbinserted;j++) {
|
||||
if (Abs(prm-seqpss(j).Parameter()) <= Tol) {
|
||||
// accumulate
|
||||
GeomInt_ParameterAndOrientation& valj = seqpss.ChangeValue(j);
|
||||
if (or1 != TopAbs_INTERNAL) {
|
||||
@ -538,24 +548,19 @@ void IntTools_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
|
||||
Standard_Boolean dansS2 = Standard_False;
|
||||
|
||||
nbvtx = seqpss.Length();
|
||||
for (i=1; i<= nbvtx; i++)
|
||||
{
|
||||
for (i=1; i<= nbvtx; i++) {
|
||||
or1 = seqpss(i).Orientation1();
|
||||
if (or1 != TopAbs_INTERNAL)
|
||||
{
|
||||
if (or1 != TopAbs_INTERNAL) {
|
||||
trim = Standard_True;
|
||||
dansS1 = (or1 != TopAbs_FORWARD);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i > nbvtx)
|
||||
{
|
||||
if (i > nbvtx) {
|
||||
Standard_Real U,V;
|
||||
for (i=1; i<=GeomInt_LineTool::NbVertex(L); i++ )
|
||||
{
|
||||
if (!GeomInt_LineTool::Vertex(L,i).IsOnDomS1() )
|
||||
{
|
||||
for (i=1; i<=GeomInt_LineTool::NbVertex(L); i++ ) {
|
||||
if (!GeomInt_LineTool::Vertex(L,i).IsOnDomS1() ) {
|
||||
GeomInt_LineTool::Vertex(L,i).ParametersOnS1(U,V);
|
||||
gp_Pnt2d PPCC(U,V);
|
||||
if (myDom1->Classify(PPCC,Tol) == TopAbs_OUT) {
|
||||
@ -567,25 +572,20 @@ void IntTools_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
|
||||
}
|
||||
dansS1 = Standard_True; // Keep in doubt
|
||||
}
|
||||
|
||||
for (i=1; i<= nbvtx; i++)
|
||||
{
|
||||
//
|
||||
for (i=1; i<= nbvtx; i++) {
|
||||
or2 = seqpss(i).Orientation2();
|
||||
if (or2 != TopAbs_INTERNAL)
|
||||
{
|
||||
if (or2 != TopAbs_INTERNAL) {
|
||||
trim = Standard_True;
|
||||
dansS2 = (or2 != TopAbs_FORWARD);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i > nbvtx)
|
||||
{
|
||||
if (i > nbvtx) {
|
||||
Standard_Real U,V;
|
||||
for (i=1; i<=GeomInt_LineTool::NbVertex(L); i++ )
|
||||
{
|
||||
if (!GeomInt_LineTool::Vertex(L,i).IsOnDomS2() )
|
||||
{
|
||||
for (i=1; i<=GeomInt_LineTool::NbVertex(L); i++ ) {
|
||||
if (!GeomInt_LineTool::Vertex(L,i).IsOnDomS2() ) {
|
||||
GeomInt_LineTool::Vertex(L,i).ParametersOnS2(U,V);
|
||||
if (myDom2->Classify(gp_Pnt2d(U,V),Tol) == TopAbs_OUT) {
|
||||
done = Standard_True;
|
||||
@ -606,27 +606,22 @@ void IntTools_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
|
||||
|
||||
// sequence seqpss is peeled to create valid ends
|
||||
// and store them in seqp(2*i+1) and seqp(2*i+2)
|
||||
|
||||
Standard_Real thefirst = GeomInt_LineTool::FirstParameter(L);
|
||||
Standard_Real thelast = GeomInt_LineTool::LastParameter(L);
|
||||
firstp = thefirst;
|
||||
|
||||
for (i=1; i<=nbvtx; i++)
|
||||
{
|
||||
for (i=1; i<=nbvtx; i++) {
|
||||
or1 = seqpss(i).Orientation1();
|
||||
or2 = seqpss(i).Orientation2();
|
||||
if (dansS1 && dansS2)
|
||||
{
|
||||
if (or1 == TopAbs_REVERSED)
|
||||
if (dansS1 && dansS2) {
|
||||
if (or1 == TopAbs_REVERSED){
|
||||
dansS1 = Standard_False;
|
||||
/*else if (or1 == TopAbs_FORWARD) {
|
||||
}*/
|
||||
if (or2 == TopAbs_REVERSED)
|
||||
}
|
||||
|
||||
if (or2 == TopAbs_REVERSED){
|
||||
dansS2 = Standard_False;
|
||||
/*else if (or2 == TopAbs_FORWARD) {
|
||||
}*/
|
||||
if (!dansS1 || !dansS2)
|
||||
{
|
||||
}
|
||||
if (!dansS1 || !dansS2) {
|
||||
lastp = seqpss(i).Parameter();
|
||||
Standard_Real stofirst = Max(firstp, thefirst);
|
||||
Standard_Real stolast = Min(lastp, thelast) ;
|
||||
@ -635,48 +630,40 @@ void IntTools_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
|
||||
seqp.Append(stofirst);
|
||||
seqp.Append(stolast);
|
||||
}
|
||||
if (lastp > thelast)
|
||||
if (lastp > thelast) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dansS1)
|
||||
{
|
||||
if (or1 == TopAbs_REVERSED)
|
||||
}
|
||||
else {
|
||||
if (dansS1) {
|
||||
if (or1 == TopAbs_REVERSED) {
|
||||
dansS1 = Standard_False;
|
||||
/*else if (or1 == TopAbs_FORWARD) {
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
if (or1 == TopAbs_FORWARD)
|
||||
}
|
||||
else {
|
||||
if (or1 == TopAbs_FORWARD){
|
||||
dansS1 = Standard_True;
|
||||
/*else if (or1 == TopAbs_REVERSED) {
|
||||
}*/
|
||||
}
|
||||
if (dansS2)
|
||||
{
|
||||
if (or2 == TopAbs_REVERSED)
|
||||
}
|
||||
if (dansS2) {
|
||||
if (or2 == TopAbs_REVERSED) {
|
||||
dansS2 = Standard_False;
|
||||
/*else if (or2 == TopAbs_FORWARD) {
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
if (or2 == TopAbs_FORWARD)
|
||||
}
|
||||
else {
|
||||
if (or2 == TopAbs_FORWARD){
|
||||
dansS2 = Standard_True;
|
||||
/*else if (or2 == TopAbs_REVERSED) {
|
||||
}*/
|
||||
}
|
||||
if (dansS1 && dansS2)
|
||||
}
|
||||
if (dansS1 && dansS2){
|
||||
firstp = seqpss(i).Parameter();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//
|
||||
// finally to add
|
||||
if (dansS1 && dansS2)
|
||||
{
|
||||
if (dansS1 && dansS2) {
|
||||
lastp = thelast;
|
||||
firstp = Max(firstp,thefirst);
|
||||
if (lastp > firstp) {
|
||||
@ -752,3 +739,191 @@ void IntTools_LineConstructor::PeriodicLine (const Handle(IntPatch_Line)& L) con
|
||||
}
|
||||
}
|
||||
}
|
||||
//modified by NIZNHY-PKV Fri Nov 11 10:30:34 2011f
|
||||
//=======================================================================
|
||||
//function : Recadre
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Recadre(const Handle(GeomAdaptor_HSurface)& myHS1,
|
||||
const Handle(GeomAdaptor_HSurface)& myHS2,
|
||||
Standard_Real& u1,
|
||||
Standard_Real& v1,
|
||||
Standard_Real& u2,
|
||||
Standard_Real& v2)
|
||||
{
|
||||
Standard_Boolean myHS1IsUPeriodic,myHS1IsVPeriodic;
|
||||
const GeomAbs_SurfaceType typs1 = myHS1->GetType();
|
||||
switch (typs1)
|
||||
{
|
||||
case GeomAbs_Cylinder:
|
||||
case GeomAbs_Cone:
|
||||
case GeomAbs_Sphere:
|
||||
{
|
||||
myHS1IsUPeriodic = Standard_True;
|
||||
myHS1IsVPeriodic = Standard_False;
|
||||
break;
|
||||
}
|
||||
case GeomAbs_Torus:
|
||||
{
|
||||
myHS1IsUPeriodic = myHS1IsVPeriodic = Standard_True;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
//-- Case of periodic biparameters is processed upstream
|
||||
myHS1IsUPeriodic = myHS1IsVPeriodic = Standard_False;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Standard_Boolean myHS2IsUPeriodic,myHS2IsVPeriodic;
|
||||
const GeomAbs_SurfaceType typs2 = myHS2->GetType();
|
||||
switch (typs2)
|
||||
{
|
||||
case GeomAbs_Cylinder:
|
||||
case GeomAbs_Cone:
|
||||
case GeomAbs_Sphere:
|
||||
{
|
||||
myHS2IsUPeriodic = Standard_True;
|
||||
myHS2IsVPeriodic = Standard_False;
|
||||
break;
|
||||
}
|
||||
case GeomAbs_Torus:
|
||||
{
|
||||
myHS2IsUPeriodic = myHS2IsVPeriodic = Standard_True;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
//-- Case of periodic biparameters is processed upstream
|
||||
myHS2IsUPeriodic = myHS2IsVPeriodic = Standard_False;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(myHS1IsUPeriodic) {
|
||||
const Standard_Real lmf = PI+PI; //-- myHS1->UPeriod();
|
||||
const Standard_Real f = myHS1->FirstUParameter();
|
||||
const Standard_Real l = myHS1->LastUParameter();
|
||||
while(u1 < f) { u1+=lmf; }
|
||||
while(u1 > l) { u1-=lmf; }
|
||||
}
|
||||
if(myHS1IsVPeriodic) {
|
||||
const Standard_Real lmf = PI+PI; //-- myHS1->VPeriod();
|
||||
const Standard_Real f = myHS1->FirstVParameter();
|
||||
const Standard_Real l = myHS1->LastVParameter();
|
||||
while(v1 < f) { v1+=lmf; }
|
||||
while(v1 > l) { v1-=lmf; }
|
||||
}
|
||||
if(myHS2IsUPeriodic) {
|
||||
const Standard_Real lmf = PI+PI; //-- myHS2->UPeriod();
|
||||
const Standard_Real f = myHS2->FirstUParameter();
|
||||
const Standard_Real l = myHS2->LastUParameter();
|
||||
while(u2 < f) { u2+=lmf; }
|
||||
while(u2 > l) { u2-=lmf; }
|
||||
}
|
||||
if(myHS2IsVPeriodic) {
|
||||
const Standard_Real lmf = PI+PI; //-- myHS2->VPeriod();
|
||||
const Standard_Real f = myHS2->FirstVParameter();
|
||||
const Standard_Real l = myHS2->LastVParameter();
|
||||
while(v2 < f) { v2+=lmf; }
|
||||
while(v2 > l) { v2-=lmf; }
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Parameters
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Parameters(const Handle(GeomAdaptor_HSurface)& myHS1,
|
||||
const Handle(GeomAdaptor_HSurface)& myHS2,
|
||||
const gp_Pnt& Ptref,
|
||||
Standard_Real& U1,
|
||||
Standard_Real& V1,
|
||||
Standard_Real& U2,
|
||||
Standard_Real& V2)
|
||||
{
|
||||
//modified by NIZNHY-PKV Fri Nov 11 10:07:55 2011f
|
||||
Parameters(myHS1, Ptref, U1, V1);
|
||||
Parameters(myHS2, Ptref, U2, V2);
|
||||
/*
|
||||
IntSurf_Quadric quad1,quad2;
|
||||
switch (myHS1->Surface().GetType())
|
||||
{
|
||||
case GeomAbs_Plane: quad1.SetValue(myHS1->Surface().Plane()); break;
|
||||
case GeomAbs_Cylinder: quad1.SetValue(myHS1->Surface().Cylinder()); break;
|
||||
case GeomAbs_Cone: quad1.SetValue(myHS1->Surface().Cone()); break;
|
||||
case GeomAbs_Sphere: quad1.SetValue(myHS1->Surface().Sphere()); break;
|
||||
default: Standard_ConstructionError::Raise("IntTools_LineConstructor::Parameters");
|
||||
}
|
||||
switch (myHS2->Surface().GetType())
|
||||
{
|
||||
case GeomAbs_Plane: quad2.SetValue(myHS2->Surface().Plane()); break;
|
||||
case GeomAbs_Cylinder: quad2.SetValue(myHS2->Surface().Cylinder()); break;
|
||||
case GeomAbs_Cone: quad2.SetValue(myHS2->Surface().Cone()); break;
|
||||
case GeomAbs_Sphere: quad2.SetValue(myHS2->Surface().Sphere()); break;
|
||||
default: Standard_ConstructionError::Raise("IntTools_LineConstructor::Parameters");
|
||||
}
|
||||
quad1.Parameters(Ptref,U1,V1);
|
||||
quad2.Parameters(Ptref,U2,V2);
|
||||
*/
|
||||
//modified by NIZNHY-PKV Fri Nov 11 10:08:38 2011t
|
||||
}
|
||||
//modified by NIZNHY-PKV Fri Nov 11 10:06:02 2011f
|
||||
//=======================================================================
|
||||
//function : Parameter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Parameters(const Handle(GeomAdaptor_HSurface)& myHS1,
|
||||
const gp_Pnt& Ptref,
|
||||
Standard_Real& U1,
|
||||
Standard_Real& V1)
|
||||
{
|
||||
IntSurf_Quadric quad1;
|
||||
//
|
||||
switch (myHS1->Surface().GetType()) {
|
||||
case GeomAbs_Plane:
|
||||
quad1.SetValue(myHS1->Surface().Plane());
|
||||
break;
|
||||
case GeomAbs_Cylinder:
|
||||
quad1.SetValue(myHS1->Surface().Cylinder());
|
||||
break;
|
||||
case GeomAbs_Cone:
|
||||
quad1.SetValue(myHS1->Surface().Cone());
|
||||
break;
|
||||
case GeomAbs_Sphere:
|
||||
quad1.SetValue(myHS1->Surface().Sphere());
|
||||
break;
|
||||
default:
|
||||
Standard_ConstructionError::Raise("IntTools_LineConstructor::Parameters");
|
||||
}
|
||||
quad1.Parameters(Ptref,U1,V1);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GLinePoint
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GLinePoint(const IntPatch_IType typl,
|
||||
const Handle(IntPatch_GLine)& GLine,
|
||||
const Standard_Real aT,
|
||||
gp_Pnt& aP)
|
||||
{
|
||||
switch (typl) {
|
||||
case IntPatch_Lin:
|
||||
aP = ElCLib::Value(aT, GLine->Line());
|
||||
break;
|
||||
case IntPatch_Circle:
|
||||
aP = ElCLib::Value(aT, GLine->Circle());
|
||||
break;
|
||||
case IntPatch_Ellipse:
|
||||
aP = ElCLib::Value(aT, GLine->Ellipse());
|
||||
break;
|
||||
case IntPatch_Hyperbola:
|
||||
aP = ElCLib::Value(aT, GLine->Hyperbola());
|
||||
break;
|
||||
case IntPatch_Parabola:
|
||||
aP = ElCLib::Value(aT, GLine->Parabola());
|
||||
break;
|
||||
default:
|
||||
Standard_ConstructionError::Raise("IntTools_LineConstructor::Parameters");
|
||||
}
|
||||
}
|
||||
//modified by NIZNHY-PKV Fri Nov 11 10:06:04 2011t
|
||||
|
Loading…
x
Reference in New Issue
Block a user