1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-19 13:40:49 +03:00

Compare commits

..

1 Commits

Author SHA1 Message Date
jgv
936b6e5f88 First version (without tangential neighbors) 2017-08-08 20:58:04 +03:00
39 changed files with 738 additions and 1777 deletions

View File

@@ -292,7 +292,7 @@ void AIS_Shape::Compute(const Handle(Prs3d_Projector)& aProjector,
OCC_CATCH_SIGNALS
switch (TypeOfHLR()) {
case Prs3d_TOH_Algo:
StdPrs_HLRShape::Add (aPresentation, SH, myDrawer, aProjector);
StdPrs_HLRShape::Add (aPresentation, SH, myDrawer, aProjector);
break;
case Prs3d_TOH_PolyAlgo:
default:

View File

@@ -264,10 +264,10 @@ static void RemovePendingEdges(TopTools_IndexedDataMapOfShapeListOfShape& MVE)
//purpose :
//=======================================================================
static Standard_Boolean SamePnt2d(TopoDS_Vertex V,
TopoDS_Edge& E1,
TopoDS_Edge& E2,
TopoDS_Face& F)
static Standard_Boolean SamePnt2d(const TopoDS_Vertex& V,
const TopoDS_Edge& E1,
const TopoDS_Edge& E2,
const TopoDS_Face& F)
{
Standard_Real f1,f2,l1,l2;
gp_Pnt2d P1,P2;
@@ -649,6 +649,7 @@ void BRepAlgo_Loop::Perform()
//--------------------------------------------------
// Add new wire to the set of wires
//------------------------------------------------
/*
Standard_Real Tol = 0.001; //5.e-05; //5.e-07;
TopExp_Explorer explo( NW, TopAbs_VERTEX );
for (; explo.More(); explo.Next())
@@ -665,6 +666,7 @@ void BRepAlgo_Loop::Perform()
TE->Tolerance( Tol );
TE->Modified( Standard_True );
}
*/
if (VF.IsSame(CV) && SamePnt2d(VF,EF,CE,myFace))
{

View File

@@ -78,6 +78,7 @@
#include <TopTools_ListOfShape.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <Extrema_ExtPC2d.hxx>
#include <stdio.h>
#ifdef DRAW
@@ -496,6 +497,9 @@ static void RefEdgeInter(const TopoDS_Face& F,
const BRepAdaptor_Surface& BAsurf,
const TopoDS_Edge& E1,
const TopoDS_Edge& E2,
const TopoDS_Vertex& Vref,
const Standard_Boolean IsConstantE1,
const Standard_Boolean IsConstantE2,
const Handle(BRepAlgo_AsDes)& AsDes,
Standard_Real Tol,
Standard_Boolean WithOri,
@@ -545,125 +549,170 @@ static void RefEdgeInter(const TopoDS_Face& F,
Standard_Boolean WithDegen = BRep_Tool::Degenerated(E1) || BRep_Tool::Degenerated(E2);
if (WithDegen)
{
Standard_Integer ideg = (BRep_Tool::Degenerated(E1))? 1 : 2;
TopoDS_Iterator iter( EI[ideg] );
if (iter.More())
{
Standard_Integer ideg = (BRep_Tool::Degenerated(E1))? 1 : 2;
TopoDS_Iterator iter( EI[ideg] );
if (iter.More())
{
const TopoDS_Vertex& vdeg = TopoDS::Vertex(iter.Value());
DegPoint = BRep_Tool::Pnt(vdeg);
}
else
{
BRepAdaptor_Curve CEdeg( EI[ideg], F );
DegPoint = CEdeg.Value( CEdeg.FirstParameter() );
}
const TopoDS_Vertex& vdeg = TopoDS::Vertex(iter.Value());
DegPoint = BRep_Tool::Pnt(vdeg);
}
else
{
BRepAdaptor_Curve CEdeg( EI[ideg], F );
DegPoint = CEdeg.Value( CEdeg.FirstParameter() );
}
}
//
Handle(Geom2d_Curve) pcurve1 = BRep_Tool::CurveOnSurface(E1, F, f[1], l[1]);
Handle(Geom2d_Curve) pcurve2 = BRep_Tool::CurveOnSurface(E2, F, f[2], l[2]);
Geom2dAdaptor_Curve GAC1(pcurve1, f[1], l[1]);
Geom2dAdaptor_Curve GAC2(pcurve2, f[2], l[2]);
Geom2dInt_GInter Inter2d( GAC1, GAC2, TolDub, TolDub );
//
if (!Inter2d.IsDone() || !Inter2d.NbPoints()) {
theCoincide = (Inter2d.NbSegments() &&
(GAC1.GetType() == GeomAbs_Line) &&
(GAC2.GetType() == GeomAbs_Line));
return;
if (!Vref.IsNull())
{
gp_Pnt P3d = BRep_Tool::Pnt(Vref);
ResPoints.Append( P3d );
Standard_Real ParOnFirst, ParOnSecond;
if (IsConstantE1 && IsConstantE2)
{
ParOnFirst = BRep_Tool::Parameter(Vref, E1);
ParOnSecond = BRep_Tool::Parameter(Vref, E2);
}
else if (IsConstantE1)
{
ParOnFirst = BRep_Tool::Parameter(Vref, E1);
gp_Pnt2d aPnt2d = BRep_Tool::Parameters(Vref, F);
//Handle(Geom2d_Curve) pcurve2 = BRep_Tool::CurveOnSurface(E2, F, f[2], l[2]);
//Geom2dAdaptor_Curve GAC2(pcurve2, f[2], l[2]);
Extrema_ExtPC2d Projector(aPnt2d, GAC2);
Standard_Integer imin = 1;
for (Standard_Integer i = 2; i <= Projector.NbExt(); i++)
if (Projector.SquareDistance(i) < Projector.SquareDistance(imin))
imin = i;
ParOnSecond = Projector.Point(imin).Parameter();
}
else
{
ParOnSecond = BRep_Tool::Parameter(Vref, E2);
gp_Pnt2d aPnt2d = BRep_Tool::Parameters(Vref, F);
//Handle(Geom2d_Curve) pcurve1 = BRep_Tool::CurveOnSurface(E1, F, f[1], l[1]);
//Geom2dAdaptor_Curve GAC1(pcurve1, f[1], l[1]);
Extrema_ExtPC2d Projector(aPnt2d, GAC1);
Standard_Integer imin = 1;
for (Standard_Integer i = 2; i <= Projector.NbExt(); i++)
if (Projector.SquareDistance(i) < Projector.SquareDistance(imin))
imin = i;
ParOnFirst = Projector.Point(imin).Parameter();
}
ResParamsOnE1.Append( ParOnFirst );
ResParamsOnE2.Append( ParOnSecond );
}
//
for (i = 1; i <= Inter2d.NbPoints(); i++)
else
{
Geom2dInt_GInter Inter2d( GAC1, GAC2, TolDub, TolDub );
//
if (!Inter2d.IsDone() || !Inter2d.NbPoints()) {
theCoincide = (Inter2d.NbSegments() &&
(GAC1.GetType() == GeomAbs_Line) &&
(GAC2.GetType() == GeomAbs_Line));
return;
}
//
for (i = 1; i <= Inter2d.NbPoints(); i++)
{
gp_Pnt P3d;
if (WithDegen)
P3d = DegPoint;
else
{
gp_Pnt2d P2d = Inter2d.Point(i).Value();
P3d = BAsurf.Value( P2d.X(), P2d.Y() );
}
{
gp_Pnt2d P2d = Inter2d.Point(i).Value();
P3d = BAsurf.Value( P2d.X(), P2d.Y() );
}
ResPoints.Append( P3d );
ResParamsOnE1.Append( Inter2d.Point(i).ParamOnFirst() );
ResParamsOnE2.Append( Inter2d.Point(i).ParamOnSecond() );
}
} //else (without Vref)
for (i = 1; i <= ResPoints.Length(); i++)
{
Standard_Real aT1 = ResParamsOnE1(i); //ponc1.Parameter();
Standard_Real aT2 = ResParamsOnE2(i); //ponc2.Parameter();
if (Precision::IsInfinite(aT1) || Precision::IsInfinite(aT2))
{
Standard_Real aT1 = ResParamsOnE1(i); //ponc1.Parameter();
Standard_Real aT2 = ResParamsOnE2(i); //ponc2.Parameter();
if (Precision::IsInfinite(aT1) || Precision::IsInfinite(aT2))
{
#ifdef OCCT_DEBUG
cout << "Inter2d : Solution rejected due to infinite parameter"<<endl;
cout << "Inter2d : Solution rejected due to infinite parameter"<<endl;
#endif
continue;
}
gp_Pnt P = ResPoints(i); //ponc1.Value();
TopoDS_Vertex aNewVertex = BRepLib_MakeVertex(P);
aNewVertex.Orientation(TopAbs_INTERNAL);
B.UpdateVertex( aNewVertex, aT1, E1, Tol );
B.UpdateVertex( aNewVertex, aT2, E2, Tol );
gp_Pnt P1 = CE1.Value(aT1);
gp_Pnt P2 = CE2.Value(aT2);
Standard_Real dist1, dist2, dist3;
dist1 = P1.Distance(P);
dist2 = P2.Distance(P);
dist3 = P1.Distance(P2);
dist1 = Max( dist1, dist2 );
dist1 = Max( dist1, dist3 );
B.UpdateVertex( aNewVertex, dist1 );
#ifdef OCCT_DEBUG
if (aT1 < f[1]-Tol || aT1 > l[1]+Tol)
{
cout << "out of limit"<<endl;
cout<<"aT1 = "<<aT1<<", f[1] = "<<f[1]<<", l[1] = "<<l[1]<<endl;
}
if (aT2 < f[2]-Tol || aT2 > l[2]+Tol)
{
cout << "out of limit"<<endl;
cout<<"aT2 = "<<aT2<<", f[2] = "<<f[2]<<", l[2] = "<<l[2]<<endl;
}
Standard_Real MilTol2 = 1000*Tol*Tol;
if (P1.SquareDistance(P) > MilTol2 || P2.SquareDistance(P) > MilTol2 || P1.Distance(P2) > 2.*Tol)
{
cout << "Inter2d : Solution rejected"<<endl;
cout<<"P = "<<P.X()<<" "<<P.Y()<<" "<<P.Z()<<endl;
cout<<"P1 = "<<P1.X()<<" "<<P1.Y()<<" "<<P1.Z()<<endl;
cout<<"P2 = "<<P2.X()<<" "<<P2.Y()<<" "<<P2.Z()<<endl;
cout<<"MaxDist = "<<dist1<<endl;
}
#endif
//define the orientation of a new vertex
TopAbs_Orientation OO1 = TopAbs_REVERSED;
TopAbs_Orientation OO2 = TopAbs_REVERSED;
if (WithOri)
{
BRepAdaptor_Curve2d PCE1( E1, F );
BRepAdaptor_Curve2d PCE2( E2, F );
gp_Pnt2d P2d1, P2d2;
gp_Vec2d V1, V2, V1or, V2or;
PCE1.D1( aT1, P2d1, V1 );
PCE2.D1( aT2, P2d2, V2 );
V1or = V1; V2or = V2;
if (E1.Orientation() == TopAbs_REVERSED) V1or.Reverse();
if (E2.Orientation() == TopAbs_REVERSED) V2or.Reverse();
Standard_Real CrossProd = V2or ^ V1;
#ifdef OCCT_DEBUG
if (Abs(CrossProd) <= gp::Resolution())
cout<<endl<<"CrossProd = "<<CrossProd<<endl;
#endif
if (CrossProd > 0.)
OO1 = TopAbs_FORWARD;
CrossProd = V1or ^ V2;
if (CrossProd > 0.)
OO2 = TopAbs_FORWARD;
}
LV1.Append( aNewVertex.Oriented(OO1) );
LV2.Append( aNewVertex.Oriented(OO2) );
continue;
}
gp_Pnt P = ResPoints(i); //ponc1.Value();
TopoDS_Vertex aNewVertex = BRepLib_MakeVertex(P);
aNewVertex.Orientation(TopAbs_INTERNAL);
B.UpdateVertex( aNewVertex, aT1, E1, Tol );
B.UpdateVertex( aNewVertex, aT2, E2, Tol );
gp_Pnt P1 = CE1.Value(aT1);
gp_Pnt P2 = CE2.Value(aT2);
Standard_Real dist1, dist2, dist3;
dist1 = P1.Distance(P);
dist2 = P2.Distance(P);
dist3 = P1.Distance(P2);
dist1 = Max( dist1, dist2 );
dist1 = Max( dist1, dist3 );
B.UpdateVertex( aNewVertex, dist1 );
#ifdef OCCT_DEBUG
if (aT1 < f[1]-Tol || aT1 > l[1]+Tol)
{
cout << "out of limit"<<endl;
cout<<"aT1 = "<<aT1<<", f[1] = "<<f[1]<<", l[1] = "<<l[1]<<endl;
}
if (aT2 < f[2]-Tol || aT2 > l[2]+Tol)
{
cout << "out of limit"<<endl;
cout<<"aT2 = "<<aT2<<", f[2] = "<<f[2]<<", l[2] = "<<l[2]<<endl;
}
Standard_Real MilTol2 = 1000*Tol*Tol;
if (P1.SquareDistance(P) > MilTol2 || P2.SquareDistance(P) > MilTol2 || P1.Distance(P2) > 2.*Tol)
{
cout << "Inter2d : Solution rejected"<<endl;
cout<<"P = "<<P.X()<<" "<<P.Y()<<" "<<P.Z()<<endl;
cout<<"P1 = "<<P1.X()<<" "<<P1.Y()<<" "<<P1.Z()<<endl;
cout<<"P2 = "<<P2.X()<<" "<<P2.Y()<<" "<<P2.Z()<<endl;
cout<<"MaxDist = "<<dist1<<endl;
}
#endif
//define the orientation of a new vertex
TopAbs_Orientation OO1 = TopAbs_REVERSED;
TopAbs_Orientation OO2 = TopAbs_REVERSED;
if (WithOri)
{
BRepAdaptor_Curve2d PCE1( E1, F );
BRepAdaptor_Curve2d PCE2( E2, F );
gp_Pnt2d P2d1, P2d2;
gp_Vec2d V1, V2, V1or, V2or;
PCE1.D1( aT1, P2d1, V1 );
PCE2.D1( aT2, P2d2, V2 );
V1or = V1; V2or = V2;
if (E1.Orientation() == TopAbs_REVERSED) V1or.Reverse();
if (E2.Orientation() == TopAbs_REVERSED) V2or.Reverse();
Standard_Real CrossProd = V2or ^ V1;
#ifdef OCCT_DEBUG
if (Abs(CrossProd) <= gp::Resolution())
cout<<endl<<"CrossProd = "<<CrossProd<<endl;
#endif
if (CrossProd > 0.)
OO1 = TopAbs_FORWARD;
CrossProd = V1or ^ V2;
if (CrossProd > 0.)
OO2 = TopAbs_FORWARD;
}
LV1.Append( aNewVertex.Oriented(OO1) );
LV2.Append( aNewVertex.Oriented(OO2) );
}
//----------------------------------
// Test at end.
@@ -1427,6 +1476,7 @@ void BRepOffset_Inter2d::ConnexIntByInt
BRepOffset_Offset& OFI,
TopTools_DataMapOfShapeShape& MES,
const TopTools_DataMapOfShapeShape& Build,
const TopTools_MapOfShape& MapConstantEdges,
const Handle(BRepAlgo_AsDes)& AsDes2d,
const Standard_Real Offset,
const Standard_Real Tol,
@@ -1467,6 +1517,7 @@ void BRepOffset_Inter2d::ConnexIntByInt
if (MES.IsBound(FIO)) FIO = TopoDS::Face(MES(FIO));
//
BRepAdaptor_Surface BAsurf(FIO);
BRep_Builder BB;
TopExp_Explorer exp(FI.Oriented(TopAbs_FORWARD),TopAbs_WIRE);
for (; exp.More(); exp.Next()) {
@@ -1493,6 +1544,12 @@ void BRepOffset_Inter2d::ConnexIntByInt
TopoDS_Vertex Vref = CommonVertex(CurE, NextE);
gp_Pnt Pref = BRep_Tool::Pnt(Vref);
TopoDS_Vertex Vcommon;
Standard_Boolean IsConstantE1 = Standard_False, IsConstantE2 = Standard_False;
//Temporary : comment the following lines
if (MapConstantEdges.Contains(CurE) ||
MapConstantEdges.Contains(NextE))
Vcommon = Vref;
TopoDS_Shape aLocalShape = OFI.Generated(CurE);
TopoDS_Edge CEO = TopoDS::Edge(aLocalShape);
@@ -1502,7 +1559,7 @@ void BRepOffset_Inter2d::ConnexIntByInt
// Inter processing of images of CurE NextE.
//------------------------------------------
TopTools_ListOfShape LV1,LV2;
Standard_Boolean DoInter = 1;
Standard_Boolean DoInter = 1, ToExchange = Standard_False;
TopoDS_Shape NE1,NE2;
if (Build.IsBound(CurE) && Build.IsBound(NextE)) {
@@ -1516,6 +1573,7 @@ void BRepOffset_Inter2d::ConnexIntByInt
else if (Build.IsBound(NextE) && MES.IsBound(CEO)) {
NE1 = Build(NextE);
NE2 = MES(CEO);
ToExchange = Standard_True;
}
else {
DoInter = 0;
@@ -1530,8 +1588,35 @@ void BRepOffset_Inter2d::ConnexIntByInt
const TopoDS_Edge& aE1 = TopoDS::Edge(Exp1.Current());
for (Exp2.Init(NE2, TopAbs_EDGE); Exp2.More(); Exp2.Next()) {
const TopoDS_Edge& aE2 = TopoDS::Edge(Exp2.Current());
RefEdgeInter(FIO, BAsurf, aE1, aE2, AsDes2d,
Tol, Standard_True, Pref, theDMVV, bCoincide);
if (!Vcommon.IsNull())
{
TopoDS_Edge ProE1 = CurE, ProE2 = NextE;
if (ToExchange)
{ ProE1 = NextE; ProE2 = CurE; }
if (MapConstantEdges.Contains(ProE1))
IsConstantE1 = Standard_True;
if (MapConstantEdges.Contains(ProE2))
IsConstantE2 = Standard_True;
if (IsConstantE1)
{
Standard_Real ParOnFirst = BRep_Tool::Parameter(Vcommon, ProE1, FI);
BB.UpdateVertex(Vcommon, ParOnFirst, aE1, 0.);
BRepAdaptor_Curve2d BAcurve2d(ProE1, FI);
gp_Pnt2d aPnt2d = BAcurve2d.Value(ParOnFirst);
BB.UpdateVertex(Vcommon, aPnt2d.X(), aPnt2d.Y(), FIO, 0.);
}
if (IsConstantE2)
{
Standard_Real ParOnSecond = BRep_Tool::Parameter(Vcommon, ProE2, FI);
BB.UpdateVertex(Vcommon, ParOnSecond, aE2, 0.);
BRepAdaptor_Curve2d BAcurve2d(ProE2, FI);
gp_Pnt2d aPnt2d = BAcurve2d.Value(ParOnSecond);
BB.UpdateVertex(Vcommon, aPnt2d.X(), aPnt2d.Y(), FIO, 0.);
}
}
RefEdgeInter(FIO, BAsurf, aE1, aE2,
Vcommon, IsConstantE1, IsConstantE2,
AsDes2d, Tol, Standard_True, Pref, theDMVV, bCoincide);
}
}
//
@@ -1567,6 +1652,7 @@ void BRepOffset_Inter2d::ConnexIntByIntInVert
BRepOffset_Offset& OFI,
TopTools_DataMapOfShapeShape& MES,
const TopTools_DataMapOfShapeShape& Build,
const TopTools_MapOfShape& MapConstantEdges,
const Handle(BRepAlgo_AsDes)& AsDes,
const Handle(BRepAlgo_AsDes)& AsDes2d,
const Standard_Real Tol,
@@ -1616,6 +1702,15 @@ void BRepOffset_Inter2d::ConnexIntByIntInVert
CurE = NextE;
continue;
}
TopoDS_Vertex Vcommon;
Standard_Boolean IsConstantE1 = Standard_False, IsConstantE2 = Standard_False;
/*
if (MapConstantEdges.Contains(CurE) ||
MapConstantEdges.Contains(NextE))
Vcommon = Vref;
*/
//
TopoDS_Shape aLocalShape = OFI.Generated(CurE);
TopoDS_Edge CEO = TopoDS::Edge(aLocalShape);
@@ -1655,8 +1750,9 @@ void BRepOffset_Inter2d::ConnexIntByIntInVert
// intersection with first edge
for (Exp1.Init(NE1, TopAbs_EDGE); Exp1.More(); Exp1.Next()) {
const TopoDS_Edge& aE1 = TopoDS::Edge(Exp1.Current());
RefEdgeInter(FIO, BAsurf, aE1, aE3, AsDes2d,
Tol, Standard_True, Pref, theDMVV, bCoincide);
RefEdgeInter(FIO, BAsurf, aE1, aE3,
Vcommon, IsConstantE1, IsConstantE2,
AsDes2d, Tol, Standard_True, Pref, theDMVV, bCoincide);
if (bCoincide) {
// in case of coincidence trim the edge E3 the same way as E1
Store(aE3, AsDes2d->Descendant(aE1), Tol, Standard_True, AsDes2d, theDMVV);
@@ -1666,8 +1762,9 @@ void BRepOffset_Inter2d::ConnexIntByIntInVert
// intersection with second edge
for (Exp1.Init(NE2, TopAbs_EDGE); Exp1.More(); Exp1.Next()) {
const TopoDS_Edge& aE2 = TopoDS::Edge(Exp1.Current());
RefEdgeInter(FIO, BAsurf, aE2, aE3, AsDes2d,
Tol, Standard_True, Pref, theDMVV, bCoincide);
RefEdgeInter(FIO, BAsurf, aE2, aE3,
Vcommon, IsConstantE1, IsConstantE2,
AsDes2d, Tol, Standard_True, Pref, theDMVV, bCoincide);
if (bCoincide) {
// in case of coincidence trim the edge E3 the same way as E2
Store(aE3, AsDes2d->Descendant(aE2), Tol, Standard_True, AsDes2d, theDMVV);
@@ -1685,8 +1782,9 @@ void BRepOffset_Inter2d::ConnexIntByIntInVert
for (Exp1.Next(); Exp1.More(); Exp1.Next()) {
const TopoDS_Edge& aE3Next = TopoDS::Edge(Exp1.Current());
if (aME.Contains(aE3Next)) {
RefEdgeInter(FIO, BAsurf, aE3Next, aE3, AsDes2d,
Tol, Standard_True, Pref, theDMVV, bCoincide);
RefEdgeInter(FIO, BAsurf, aE3Next, aE3,
Vcommon, IsConstantE1, IsConstantE2,
AsDes2d, Tol, Standard_True, Pref, theDMVV, bCoincide);
}
}
}

View File

@@ -22,6 +22,7 @@
#include <Standard_Handle.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <Standard_Real.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
@@ -60,6 +61,7 @@ public:
BRepOffset_Offset& OFI,
TopTools_DataMapOfShapeShape& MES,
const TopTools_DataMapOfShapeShape& Build,
const TopTools_MapOfShape& MapConstantEdges,
const Handle(BRepAlgo_AsDes)& AsDes2d,
const Standard_Real Offset,
const Standard_Real Tol,
@@ -76,6 +78,7 @@ public:
BRepOffset_Offset& OFI,
TopTools_DataMapOfShapeShape& MES,
const TopTools_DataMapOfShapeShape& Build,
const TopTools_MapOfShape& MapConstantEdges,
const Handle(BRepAlgo_AsDes)& AsDes,
const Handle(BRepAlgo_AsDes)& AsDes2d,
const Standard_Real Tol,

View File

@@ -44,6 +44,7 @@
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
//#include <BRepBuilderAPI_Copy.hxx>
//
#include <BRepBndLib.hxx>
#include <BOPCol_BoxBndTree.hxx>
@@ -51,6 +52,28 @@
//
#include <BOPTools_AlgoTools.hxx>
static void FindCommonEdges(const TopoDS_Face& theF1,
const TopoDS_Face& theF2,
TopTools_ListOfShape& theList)
{
TopExp_Explorer Explo1(theF1.Oriented(TopAbs_FORWARD), TopAbs_EDGE);
for (; Explo1.More(); Explo1.Next())
{
const TopoDS_Shape& anEdge1 = Explo1.Current();
TopExp_Explorer Explo2(theF2, TopAbs_EDGE);
for (; Explo2.More(); Explo2.Next())
{
const TopoDS_Shape& anEdge2 = Explo2.Current();
if (anEdge1.IsSame(anEdge2))
{
theList.Append(anEdge1);
break;
}
}
}
}
//=======================================================================
//function : BRepOffset_Inter3d
//purpose :
@@ -269,14 +292,15 @@ void BRepOffset_Inter3d::FaceInter(const TopoDS_Face& F1,
// many sections.
//--------------------------------------------------------
if (InterFaces) {
TopTools_ListOfShape aList;
if (BRepOffset_Tool::FindCommonShapes(TopoDS::Face(InitF1),
TopoDS::Face(InitF2),LE,LV)) {
if (!LE.IsEmpty()) {
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge);
BRepOffset_Tool::Inter3D (F1,F2,F1,F2,LInt1,LInt2,aList,mySide,NullEdge);
}
}
else {
BRepOffset_Tool::Inter3D(F1,F2,LInt1,LInt2,mySide,NullEdge);
BRepOffset_Tool::Inter3D(F1,F2,F1,F2,LInt1,LInt2,aList,mySide,NullEdge);
}
}
}
@@ -287,7 +311,8 @@ void BRepOffset_Inter3d::FaceInter(const TopoDS_Face& F1,
BRepOffset_Tool::PipeInter(F1,F2,LInt1,LInt2,mySide);
}
else {
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge);
TopTools_ListOfShape aList;
BRepOffset_Tool::Inter3D (F1,F2,F1,F2,LInt1,LInt2,aList,mySide,NullEdge);
}
}
Store (F1,F2,LInt1,LInt2);
@@ -327,7 +352,8 @@ void BRepOffset_Inter3d::ConnexIntByArc(const TopTools_ListOfShape& /*SetOfFaces
F1 = TopoDS::Face(InitOffsetFace.Image(Anc.First()).First());
F2 = TopoDS::Face(InitOffsetFace.Image(Anc.Last ()).First());
if (!IsDone(F1,F2)) {
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,E,Standard_True);
TopTools_ListOfShape aList;
BRepOffset_Tool::Inter3D (F1,F2,F1,F2,LInt1,LInt2,aList,mySide,E,Standard_True);
Store (F1,F2,LInt1,LInt2);
}
}
@@ -406,13 +432,14 @@ void BRepOffset_Inter3d::ConnexIntByArc(const TopTools_ListOfShape& /*SetOfFaces
const TopTools_ListOfShape& AncE2 = Analyse.Ancestors(E2);
Standard_Boolean TangentFaces = Standard_False;
if (AncE2.Extent() == 2) {
TopTools_ListOfShape aList;
TopoDS_Face InitF2 = TopoDS::Face(AncE2.First ());
TangentFaces = (InitF2.IsSame(AncE1.First()) ||
InitF2.IsSame(AncE1.Last()));
if (!TangentFaces) {
F2 = TopoDS::Face(InitOffsetFace.Image(InitF2).First());
if (!IsDone(F1,F2)) {
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge);
BRepOffset_Tool::Inter3D (F1,F2,F1,F2,LInt1,LInt2,aList,mySide,NullEdge);
Store (F1,F2,LInt1,LInt2);
}
}
@@ -422,7 +449,7 @@ void BRepOffset_Inter3d::ConnexIntByArc(const TopTools_ListOfShape& /*SetOfFaces
if (!TangentFaces) {
F2 = TopoDS::Face(InitOffsetFace.Image(InitF2).First());
if (!IsDone(F1,F2)) {
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge);
BRepOffset_Tool::Inter3D (F1,F2,F1,F2,LInt1,LInt2,aList,mySide,NullEdge);
Store (F1,F2,LInt1,LInt2);
}
}
@@ -444,6 +471,7 @@ void BRepOffset_Inter3d::ConnexIntByArc(const TopTools_ListOfShape& /*SetOfFaces
void BRepOffset_Inter3d::ConnexIntByInt
(const TopoDS_Shape& SI,
const BRepOffset_DataMapOfShapeOffset& MapSF,
const TopTools_MapOfShape& MapModifyingFaces,
const BRepOffset_Analyse& Analyse,
TopTools_DataMapOfShapeShape& MES,
TopTools_DataMapOfShapeShape& Build,
@@ -592,10 +620,32 @@ void BRepOffset_Inter3d::ConnexIntByInt
//
OF1 = TopoDS::Face(MapSF(F1).Face());
OF2 = TopoDS::Face(MapSF(F2).Face());
if (!MES.IsBound(OF1)) {
Standard_Boolean F1remains = Standard_False, F2remains = Standard_False;
F1remains = (!MapSF(F1).IsInputOffsetFace() &&
MapSF(F1).Offset() == 0. &&
!MapModifyingFaces.Contains(F1));
//Temporary
//F1remains = Standard_False;
///////////
if (F1remains)
{
//NF1 = TopoDS::Face(BRepBuilderAPI_Copy(OF1));
NF1 = OF1;
MES.Bind(OF1,NF1);
//F1remains = Standard_True;
}
else if (!MES.IsBound(OF1)) {
Standard_Boolean enlargeU = Standard_True;
Standard_Boolean enlargeVfirst = Standard_True, enlargeVlast = Standard_True;
BRepOffset_Tool::CheckBounds( F1, Analyse, enlargeU, enlargeVfirst, enlargeVlast );
if (MapSF(F1).IsInputOffsetFace())
{
enlargeU = Standard_False;
enlargeVfirst = Standard_False; enlargeVlast = Standard_False;
}
else
BRepOffset_Tool::CheckBounds( F1, Analyse, enlargeU, enlargeVfirst, enlargeVlast );
BRepOffset_Tool::EnLargeFace(OF1,NF1,Standard_True,Standard_True,enlargeU,enlargeVfirst,enlargeVlast);
MES.Bind(OF1,NF1);
}
@@ -603,20 +653,53 @@ void BRepOffset_Inter3d::ConnexIntByInt
NF1 = TopoDS::Face(MES(OF1));
}
//
if (!MES.IsBound(OF2)) {
F2remains = (!MapSF(F2).IsInputOffsetFace() &&
MapSF(F2).Offset() == 0. &&
!MapModifyingFaces.Contains(F2));
//Temporary
//F2remains = Standard_False;
///////////
if (F2remains)
{
//NF2 = TopoDS::Face(BRepBuilderAPI_Copy(OF2));
NF2 = OF2;
MES.Bind(OF2,NF2);
//F2remains = Standard_True;
}
else if (!MES.IsBound(OF2)) {
Standard_Boolean enlargeU = Standard_True;
Standard_Boolean enlargeVfirst = Standard_True, enlargeVlast = Standard_True;
BRepOffset_Tool::CheckBounds( F2, Analyse, enlargeU, enlargeVfirst, enlargeVlast );
if (MapSF(F2).IsInputOffsetFace())
{
enlargeU = Standard_False;
enlargeVfirst = Standard_False; enlargeVlast = Standard_False;
}
else
BRepOffset_Tool::CheckBounds( F2, Analyse, enlargeU, enlargeVfirst, enlargeVlast );
BRepOffset_Tool::EnLargeFace(OF2,NF2,Standard_True,Standard_True,enlargeU,enlargeVfirst,enlargeVlast);
MES.Bind(OF2,NF2);
MES.Bind(OF2,NF2);
}
else {
NF2 = TopoDS::Face(MES(OF2));
}
//
if (!IsDone(NF1,NF2)) {
TopTools_ListOfShape LInt1,LInt2;
BRepOffset_Tool::Inter3D (NF1,NF2,LInt1,LInt2,CurSide,E,bEdge);
TopTools_ListOfShape LInt1, LInt2, LInt;
if (F1remains || F2remains)
FindCommonEdges(F1, F2, LInt);
if (F1remains && F2remains)
{
LInt1.Assign(LInt);
TopTools_ListIteratorOfListOfShape itl(LInt1);
for (; itl.More(); itl.Next())
LInt2.Append(itl.Value().Reversed());
}
else
{
BRepOffset_Tool::Inter3D(NF1, NF2, F1, F2, LInt1, LInt2, LInt,
CurSide, E, bEdge,
F1remains, F2remains);
}
if (LInt1.Extent() > 1) {
// intersection is in seceral edges (free sewing)
SelectEdge(aS, LInt1);
@@ -1018,9 +1101,9 @@ void BRepOffset_Inter3d::ContextIntByInt
}
if (!IsDone(NF,CF)) {
TopTools_ListOfShape LInt1,LInt2;
TopTools_ListOfShape LOE;
TopTools_ListOfShape LOE, aList;
LOE.Append(OE);
BRepOffset_Tool::Inter3D (WCF,NF,LInt1,LInt2,Side,E,bEdge);
BRepOffset_Tool::Inter3D (WCF,NF,WCF,NF,LInt1,LInt2,aList,Side,E,bEdge);
SetDone(NF,CF);
if (!LInt1.IsEmpty()) {
Store (CF,NF,LInt1,LInt2);
@@ -1241,7 +1324,8 @@ void BRepOffset_Inter3d::ContextIntByArc(const TopTools_IndexedMapOfShape& Conte
// If no trace try intersection.
//-------------------------------------------------------
if (LInt1.IsEmpty()) {
BRepOffset_Tool::Inter3D (CF,OF1,LInt1,LInt2,mySide,NullEdge);
TopTools_ListOfShape aList;
BRepOffset_Tool::Inter3D (CF,OF1,CF,OF1,LInt1,LInt2,aList,mySide,NullEdge);
}
Store (CF,OF1,LInt1,LInt2);
}

View File

@@ -53,7 +53,14 @@ public:
Standard_EXPORT void ConnexIntByArc (const TopTools_ListOfShape& SetOfFaces, const TopoDS_Shape& ShapeInit, const BRepOffset_Analyse& Analyse, const BRepAlgo_Image& InitOffsetFace);
Standard_EXPORT void ConnexIntByInt (const TopoDS_Shape& SI, const BRepOffset_DataMapOfShapeOffset& MapSF, const BRepOffset_Analyse& A, TopTools_DataMapOfShapeShape& MES, TopTools_DataMapOfShapeShape& Build, TopTools_ListOfShape& Failed, const Standard_Boolean bIsPlanar = Standard_False);
Standard_EXPORT void ConnexIntByInt (const TopoDS_Shape& SI,
const BRepOffset_DataMapOfShapeOffset& MapSF,
const TopTools_MapOfShape& MapModifyingFaces,
const BRepOffset_Analyse& A,
TopTools_DataMapOfShapeShape& MES,
TopTools_DataMapOfShapeShape& Build,
TopTools_ListOfShape& Failed,
const Standard_Boolean bIsPlanar = Standard_False);
Standard_EXPORT void ContextIntByInt (const TopTools_IndexedMapOfShape& ContextFaces, const Standard_Boolean ExtentContext, const BRepOffset_DataMapOfShapeOffset& MapSF, const BRepOffset_Analyse& A, TopTools_DataMapOfShapeShape& MES, TopTools_DataMapOfShapeShape& Build, TopTools_ListOfShape& Failed, const Standard_Boolean bIsPlanar = Standard_False);

View File

@@ -81,6 +81,7 @@
#include <gp_Lin2d.hxx>
#include <gp_Pnt.hxx>
#include <GProp_GProps.hxx>
#include <IntTools_Context.hxx>
#include <IntTools_FClass2d.hxx>
#include <NCollection_List.hxx>
#include <Precision.hxx>
@@ -627,6 +628,9 @@ void BRepOffset_MakeOffset::Clear()
myImageOffset .Clear();
myFaces .Clear();
myFaceOffset .Clear();
myMapFaceOffsetFace.Clear();
myMapModifyingFaces.Clear();
myMapConstantEdges.Clear();
myAsDes ->Clear();
myDone = Standard_False;
}
@@ -658,6 +662,21 @@ void BRepOffset_MakeOffset::SetOffsetOnFace(const TopoDS_Face& F,
myFaceOffset.Bind(F,Off);
}
//=======================================================================
//function : SetOffsetFace
//purpose :
//=======================================================================
void BRepOffset_MakeOffset::SetOffsetFace(const TopoDS_Face& F,
const TopoDS_Face& OF)
{
// Check the orientation of the offset face and make
// it oriented the same way as original
Handle(IntTools_Context) aCtx = new IntTools_Context;
Standard_Boolean bToReverse = BOPTools_AlgoTools::IsSplitToReverse(F, OF, aCtx);
TopoDS_Face anOffsetFace = bToReverse ? TopoDS::Face(OF.Reversed()) : OF;
myMapFaceOffsetFace.Bind(F, anOffsetFace);
}
//=======================================================================
//function : RemoveCorks
//purpose :
@@ -795,6 +814,50 @@ void BRepOffset_MakeOffset::MakeOffsetShape()
//----------------------------
UpdateFaceOffset();
//Filling of <myModifiedFaces> and <myMapConstantEdges>
TopTools_IndexedDataMapOfShapeListOfShape EFmap;
TopExp::MapShapesAndUniqueAncestors(myShape, TopAbs_EDGE, TopAbs_FACE, EFmap);
TopTools_DataMapIteratorOfDataMapOfShapeReal itr1(myFaceOffset);
for (; itr1.More(); itr1.Next())
{
const TopoDS_Shape& aFace = itr1.Key();
myMapModifyingFaces.Add(aFace);
TopExp_Explorer Explo(aFace, TopAbs_EDGE);
for (; Explo.More(); Explo.Next())
{
const TopoDS_Shape& anEdge = Explo.Current();
TopTools_ListIteratorOfListOfShape itl(EFmap.FindFromKey(anEdge));
for (; itl.More(); itl.Next())
myMapModifyingFaces.Add(itl.Value());
}
}
TopTools_DataMapIteratorOfDataMapOfShapeShape itr2(myMapFaceOffsetFace);
for (; itr2.More(); itr2.Next())
{
const TopoDS_Shape& aFace = itr2.Key();
myMapModifyingFaces.Add(aFace);
TopExp_Explorer Explo(aFace, TopAbs_EDGE);
for (; Explo.More(); Explo.Next())
{
const TopoDS_Shape& anEdge = Explo.Current();
TopTools_ListIteratorOfListOfShape itl(EFmap.FindFromKey(anEdge));
for (; itl.More(); itl.Next())
myMapModifyingFaces.Add(itl.Value());
}
}
TopExp_Explorer Explo(myShape, TopAbs_FACE);
for (; Explo.More(); Explo.Next())
{
const TopoDS_Shape& aFace = Explo.Current();
if (!myMapModifyingFaces.Contains(aFace))
{
TopExp_Explorer Explo2(aFace, TopAbs_EDGE);
for (; Explo2.More(); Explo2.Next())
myMapConstantEdges.Add(Explo2.Current());
}
}
////////////////////////////////////////////////////
if (myJoin == GeomAbs_Arc)
BuildOffsetByArc();
else if (myJoin == GeomAbs_Intersection)
@@ -1029,7 +1092,10 @@ void BRepOffset_MakeOffset::MakeOffsetFaces(BRepOffset_DataMapOfShapeOffset& the
for (; aItLF.More(); aItLF.Next()) {
const TopoDS_Face& aF = TopoDS::Face(aItLF.Value());
aCurOffset = myFaceOffset.IsBound(aF) ? myFaceOffset(aF) : myOffset;
BRepOffset_Offset OF(aF, aCurOffset, ShapeTgt, OffsetOutside, myJoin);
TopoDS_Face InputOffsetFace;
if (myMapFaceOffsetFace.IsBound(aF))
InputOffsetFace = TopoDS::Face(myMapFaceOffsetFace(aF));
BRepOffset_Offset OF(aF, aCurOffset, InputOffsetFace, ShapeTgt, OffsetOutside, myJoin);
TopTools_ListOfShape Let;
myAnalyse.Edges(aF,BRepOffset_Tangent,Let);
TopTools_ListIteratorOfListOfShape itl(Let);
@@ -1103,7 +1169,7 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
BRepOffset_Inter3d Inter3 (AsDes,Side,myTol);
// Intersection between parallel faces
Inter3.ConnexIntByInt(myShape,MapSF,myAnalyse,MES,Build,Failed,myIsPlanar);
Inter3.ConnexIntByInt(myShape,MapSF,myMapModifyingFaces,myAnalyse,MES,Build,Failed,myIsPlanar);
// Intersection with caps.
Inter3.ContextIntByInt(myFaces,ExtentContext,MapSF,myAnalyse,MES,Build,Failed,myIsPlanar);
@@ -3549,6 +3615,9 @@ Standard_Boolean BRepOffset_MakeOffset::CheckInputData()
}
}
if (!myMapFaceOffsetFace.IsEmpty())
isFound = Standard_True;
if (!isFound)
{
// No face with non-null offset found.
@@ -3817,7 +3886,8 @@ void BRepOffset_MakeOffset::IntersectEdges(const TopoDS_Shape& theShape,
const TopoDS_Face& aF = TopoDS::Face(aExp.Current());
aTolF = BRep_Tool::Tolerance(aF);
BRepOffset_Inter2d::ConnexIntByInt
(aF, theMapSF(aF), theMES, theBuild, theAsDes2d, myOffset, aTolF, aMFV, aDMVV);
(aF, theMapSF(aF), theMES, theBuild, myMapConstantEdges, theAsDes2d,
myOffset, aTolF, aMFV, aDMVV);
}
// intersect edges created from vertices
Standard_Integer i, aNbF = aMFV.Extent();
@@ -3825,7 +3895,8 @@ void BRepOffset_MakeOffset::IntersectEdges(const TopoDS_Shape& theShape,
const TopoDS_Face& aF = TopoDS::Face(aMFV(i));
aTolF = BRep_Tool::Tolerance(aF);
BRepOffset_Inter2d::ConnexIntByIntInVert
(aF, theMapSF(aF), theMES, theBuild, theAsDes, theAsDes2d, aTolF, aDMVV);
(aF, theMapSF(aF), theMES, theBuild, myMapConstantEdges, theAsDes, theAsDes2d,
aTolF, aDMVV);
}
//
// fuse vertices on edges

View File

@@ -82,6 +82,9 @@ public:
//! set the offset <Off> on the Face <F>
Standard_EXPORT void SetOffsetOnFace (const TopoDS_Face& F, const Standard_Real Off);
//! Sets the offset face for the face in the shape.
Standard_EXPORT void SetOffsetFace (const TopoDS_Face& F, const TopoDS_Face& OF);
Standard_EXPORT void MakeOffsetShape();
Standard_EXPORT void MakeThickSolid();
@@ -218,6 +221,9 @@ private:
Standard_Boolean myIsPlanar;
TopoDS_Shape myBadShape;
TopTools_DataMapOfShapeShape myMapFaceOffsetFace; // map of the face - extended offset face
TopTools_MapOfShape myMapModifyingFaces;
TopTools_MapOfShape myMapConstantEdges;
};
#endif // _BRepOffset_MakeOffset_HeaderFile

View File

@@ -4628,9 +4628,12 @@ void IntersectFaces(const TopoDS_Shape& theFInv,
{
// intersect faces
TopAbs_State aSide = TopAbs_OUT;
TopTools_ListOfShape aLInt1, aLInt2;
TopTools_ListOfShape aLInt1, aLInt2, aList;
TopoDS_Edge aNullEdge;
BRepOffset_Tool::Inter3D(TopoDS::Face(theFi), TopoDS::Face(theFj), aLInt1, aLInt2, aSide, aNullEdge);
BRepOffset_Tool::Inter3D(TopoDS::Face(theFi), TopoDS::Face(theFj),
TopoDS::Face(theFi), TopoDS::Face(theFj),
aLInt1, aLInt2, aList,
aSide, aNullEdge);
//
if (aLInt1.IsEmpty()) {
return;

View File

@@ -82,6 +82,7 @@
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_SequenceOfShape.hxx>
//#include <BRepBuilderAPI_Copy.hxx>
#ifdef OCCT_DEBUG
static Standard_Boolean Affich = Standard_False;
@@ -379,6 +380,8 @@ static void ComputeCurve3d(TopoDS_Edge Edge,
BRepOffset_Offset::BRepOffset_Offset()
{
myOffset = 0.;
myIsInputOffsetFace = Standard_False;
}
@@ -404,11 +407,12 @@ BRepOffset_Offset::BRepOffset_Offset(const TopoDS_Face& Face,
BRepOffset_Offset::BRepOffset_Offset
(const TopoDS_Face& Face,
const Standard_Real Offset,
const TopoDS_Face& InputOffsetFace,
const TopTools_DataMapOfShapeShape& Created,
const Standard_Boolean OffsetOutside,
const GeomAbs_JoinType JoinType)
{
Init(Face,Offset,Created,OffsetOutside,JoinType);
Init(Face,Offset,InputOffsetFace,Created,OffsetOutside,JoinType);
}
@@ -476,7 +480,8 @@ void BRepOffset_Offset::Init(const TopoDS_Face& Face,
const GeomAbs_JoinType JoinType)
{
TopTools_DataMapOfShapeShape Empty;
Init(Face,Offset,Empty,OffsetOutside,JoinType);
TopoDS_Face NullOffsetFace;
Init(Face,Offset,NullOffsetFace,Empty,OffsetOutside,JoinType);
}
@@ -487,11 +492,31 @@ void BRepOffset_Offset::Init(const TopoDS_Face& Face,
void BRepOffset_Offset::Init(const TopoDS_Face& Face,
const Standard_Real Offset,
const TopoDS_Face& InputOffsetFace,
const TopTools_DataMapOfShapeShape& Created,
const Standard_Boolean OffsetOutside,
const GeomAbs_JoinType JoinType)
{
myShape = Face;
myOffset = Offset;
myIsInputOffsetFace = Standard_False;
if (!InputOffsetFace.IsNull())
{
myFace = InputOffsetFace;
myIsInputOffsetFace = Standard_True;
myStatus = BRepOffset_Good;
return;
}
if (Abs(Offset) <= Precision::Confusion())
{
//myFace = TopoDS::Face(BRepBuilderAPI_Copy(myShape));
myFace = Face;
myStatus = BRepOffset_Good;
return;
}
Standard_Real myOffset = Offset;
if ( Face.Orientation() == TopAbs_REVERSED)
myOffset *= -1.;
@@ -1676,3 +1701,23 @@ BRepOffset_Status BRepOffset_Offset::Status() const
{
return myStatus;
}
//=======================================================================
//function : Offset
//purpose :
//=======================================================================
Standard_Real BRepOffset_Offset::Offset() const
{
return myOffset;
}
//=======================================================================
//function : IsInputOffsetFace
//purpose :
//=======================================================================
Standard_Boolean BRepOffset_Offset::IsInputOffsetFace() const
{
return myIsInputOffsetFace;
}

View File

@@ -49,7 +49,10 @@ public:
Standard_EXPORT BRepOffset_Offset();
Standard_EXPORT BRepOffset_Offset(const TopoDS_Face& Face, const Standard_Real Offset, const Standard_Boolean OffsetOutside = Standard_True, const GeomAbs_JoinType JoinType = GeomAbs_Arc);
Standard_EXPORT BRepOffset_Offset(const TopoDS_Face& Face,
const Standard_Real Offset,
const Standard_Boolean OffsetOutside = Standard_True,
const GeomAbs_JoinType JoinType = GeomAbs_Arc);
//! This method will be called when you want to share
//! the edges soon generated from an other face.
@@ -63,27 +66,73 @@ public:
//! E' = the image of E in the offseting of
//! another face sharing E with a
//! continuity at least G1
Standard_EXPORT BRepOffset_Offset(const TopoDS_Face& Face, const Standard_Real Offset, const TopTools_DataMapOfShapeShape& Created, const Standard_Boolean OffsetOutside = Standard_True, const GeomAbs_JoinType JoinType = GeomAbs_Arc);
Standard_EXPORT BRepOffset_Offset(const TopoDS_Face& Face,
const Standard_Real Offset,
const TopoDS_Face& InputOffsetFace,
const TopTools_DataMapOfShapeShape& Created,
const Standard_Boolean OffsetOutside = Standard_True,
const GeomAbs_JoinType JoinType = GeomAbs_Arc);
Standard_EXPORT BRepOffset_Offset(const TopoDS_Edge& Path, const TopoDS_Edge& Edge1, const TopoDS_Edge& Edge2, const Standard_Real Offset, const Standard_Boolean Polynomial = Standard_False, const Standard_Real Tol = 1.0e-4, const GeomAbs_Shape Conti = GeomAbs_C1);
Standard_EXPORT BRepOffset_Offset(const TopoDS_Edge& Path,
const TopoDS_Edge& Edge1,
const TopoDS_Edge& Edge2,
const Standard_Real Offset,
const Standard_Boolean Polynomial = Standard_False,
const Standard_Real Tol = 1.0e-4,
const GeomAbs_Shape Conti = GeomAbs_C1);
Standard_EXPORT BRepOffset_Offset(const TopoDS_Edge& Path, const TopoDS_Edge& Edge1, const TopoDS_Edge& Edge2, const Standard_Real Offset, const TopoDS_Edge& FirstEdge, const TopoDS_Edge& LastEdge, const Standard_Boolean Polynomial = Standard_False, const Standard_Real Tol = 1.0e-4, const GeomAbs_Shape Conti = GeomAbs_C1);
Standard_EXPORT BRepOffset_Offset(const TopoDS_Edge& Path,
const TopoDS_Edge& Edge1,
const TopoDS_Edge& Edge2,
const Standard_Real Offset,
const TopoDS_Edge& FirstEdge,
const TopoDS_Edge& LastEdge,
const Standard_Boolean Polynomial = Standard_False,
const Standard_Real Tol = 1.0e-4,
const GeomAbs_Shape Conti = GeomAbs_C1);
//! Tol and Conti are only used if Polynomial is True
//! (Used to perfrom the approximation)
Standard_EXPORT BRepOffset_Offset(const TopoDS_Vertex& Vertex, const TopTools_ListOfShape& LEdge, const Standard_Real Offset, const Standard_Boolean Polynomial = Standard_False, const Standard_Real Tol = 1.0e-4, const GeomAbs_Shape Conti = GeomAbs_C1);
Standard_EXPORT void Init (const TopoDS_Face& Face, const Standard_Real Offset, const Standard_Boolean OffsetOutside = Standard_True, const GeomAbs_JoinType JoinType = GeomAbs_Arc);
Standard_EXPORT void Init (const TopoDS_Face& Face,
const Standard_Real Offset,
const Standard_Boolean OffsetOutside = Standard_True,
const GeomAbs_JoinType JoinType = GeomAbs_Arc);
Standard_EXPORT void Init (const TopoDS_Face& Face, const Standard_Real Offset, const TopTools_DataMapOfShapeShape& Created, const Standard_Boolean OffsetOutside = Standard_True, const GeomAbs_JoinType JoinType = GeomAbs_Arc);
Standard_EXPORT void Init (const TopoDS_Face& Face,
const Standard_Real Offset,
const TopoDS_Face& InputOffsetFace,
const TopTools_DataMapOfShapeShape& Created,
const Standard_Boolean OffsetOutside = Standard_True,
const GeomAbs_JoinType JoinType = GeomAbs_Arc);
Standard_EXPORT void Init (const TopoDS_Edge& Path, const TopoDS_Edge& Edge1, const TopoDS_Edge& Edge2, const Standard_Real Offset, const Standard_Boolean Polynomial = Standard_False, const Standard_Real Tol = 1.0e-4, const GeomAbs_Shape Conti = GeomAbs_C1);
Standard_EXPORT void Init (const TopoDS_Edge& Path,
const TopoDS_Edge& Edge1,
const TopoDS_Edge& Edge2,
const Standard_Real Offset,
const Standard_Boolean Polynomial = Standard_False,
const Standard_Real Tol = 1.0e-4,
const GeomAbs_Shape Conti = GeomAbs_C1);
Standard_EXPORT void Init (const TopoDS_Edge& Path, const TopoDS_Edge& Edge1, const TopoDS_Edge& Edge2, const Standard_Real Offset, const TopoDS_Edge& FirstEdge, const TopoDS_Edge& LastEdge, const Standard_Boolean Polynomial = Standard_False, const Standard_Real Tol = 1.0e-4, const GeomAbs_Shape Conti = GeomAbs_C1);
Standard_EXPORT void Init (const TopoDS_Edge& Path,
const TopoDS_Edge& Edge1,
const TopoDS_Edge& Edge2,
const Standard_Real Offset,
const TopoDS_Edge& FirstEdge,
const TopoDS_Edge& LastEdge,
const Standard_Boolean Polynomial = Standard_False,
const Standard_Real Tol = 1.0e-4,
const GeomAbs_Shape Conti = GeomAbs_C1);
//! Tol and Conti are only used if Polynomial is True
//! (Used to perfrom the approximation)
Standard_EXPORT void Init (const TopoDS_Vertex& Vertex, const TopTools_ListOfShape& LEdge, const Standard_Real Offset, const Standard_Boolean Polynomial = Standard_False, const Standard_Real Tol = 1.0e-4, const GeomAbs_Shape Conti = GeomAbs_C1);
Standard_EXPORT void Init (const TopoDS_Vertex& Vertex,
const TopTools_ListOfShape& LEdge,
const Standard_Real Offset,
const Standard_Boolean Polynomial = Standard_False,
const Standard_Real Tol = 1.0e-4,
const GeomAbs_Shape Conti = GeomAbs_C1);
//! Only used in Rolling Ball. Pipe on Free Boundary
Standard_EXPORT void Init (const TopoDS_Edge& Edge, const Standard_Real Offset);
@@ -96,7 +145,9 @@ public:
Standard_EXPORT BRepOffset_Status Status() const;
Standard_EXPORT Standard_Boolean IsInputOffsetFace() const;
Standard_EXPORT Standard_Real Offset() const;
protected:
@@ -112,8 +163,8 @@ private:
TopoDS_Shape myShape;
BRepOffset_Status myStatus;
TopoDS_Face myFace;
TopTools_DataMapOfShapeShape myMap;
Standard_Real myOffset;
Standard_Boolean myIsInputOffsetFace;
};

View File

@@ -1579,11 +1579,16 @@ static TopoDS_Edge AssembleEdge(const BOPDS_PDS& pDS,
void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1,
const TopoDS_Face& F2,
const TopoDS_Face& ProF1,
const TopoDS_Face& ProF2,
TopTools_ListOfShape& L1,
TopTools_ListOfShape& L2,
const TopAbs_State Side,
const TopTools_ListOfShape& ListOnFirst,
const TopAbs_State Side,
const TopoDS_Edge& RefEdge,
const Standard_Boolean IsRefEdgeDefined)
const Standard_Boolean IsRefEdgeDefined,
const Standard_Boolean F1remains,
const Standard_Boolean F2remains)
{
#ifdef DRAW
if (AffichInter) {
@@ -1595,6 +1600,29 @@ void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1,
}
#endif
BRep_Builder BB;
if (F1remains || F2remains)
{
TopoDS_Face ProFace = (F1remains)? ProF2 : ProF1;
TopoDS_Face NewFace = (F1remains)? F2 : F1;
TopTools_ListIteratorOfListOfShape itl(ListOnFirst);
for (; itl.More(); itl.Next())
{
TopoDS_Edge anEdge = TopoDS::Edge(itl.Value());
Standard_Real fpar, lpar;
Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface(anEdge,ProFace,fpar,lpar);
Handle(Geom2d_Curve) NullPCurve;
BB.UpdateEdge(anEdge, NullPCurve, ProFace, 0.);
BB.UpdateEdge(anEdge, aPCurve, NewFace, 0.);
L1.Append(anEdge);
//L2.Append(anEdge.Reversed());
if (F1.Orientation() == F2.Orientation())
anEdge.Reverse();
L2.Append(anEdge);
}
return;
}
// Check if the faces are planar and not trimmed - in this case
// the IntTools_FaceFace intersection algorithm will be used directly.
BRepAdaptor_Surface aBAS1(F1, Standard_False), aBAS2(F2, Standard_False);
@@ -3604,7 +3632,8 @@ void BRepOffset_Tool::ExtentFace (const TopoDS_Face& F,
if (ConstShapes.IsBound(E)) ToBuild.UnBind(E);
if (ToBuild.IsBound(E)) {
EnLargeFace(TopoDS::Face(ToBuild(E)),StopFace,Standard_False);
BRepOffset_Tool::Inter3D (EF,StopFace,LInt1,LInt2,Side,E,Standard_True);
TopTools_ListOfShape aList;
BRepOffset_Tool::Inter3D (EF,StopFace,EF,StopFace,LInt1,LInt2,aList,Side,E,Standard_True);
// No intersection, it may happen for example for a chosen (non-offseted) planar face and
// its neighbour offseted cylindrical face, if the offset is directed so that
// the radius of the cylinder becomes smaller.
@@ -4148,4 +4177,4 @@ void PerformPlanes(const TopoDS_Face& theFace1,
Standard_Boolean IsInf(const Standard_Real theVal)
{
return (theVal > TheInfini*0.9);
}
}

View File

@@ -83,7 +83,18 @@ public:
//! edges solution are stored in <LInt1> with the
//! orientation on <F1>, the sames edges are stored in
//! <Lint2> with the orientation on <F2>.
Standard_EXPORT static void Inter3D (const TopoDS_Face& F1, const TopoDS_Face& F2, TopTools_ListOfShape& LInt1, TopTools_ListOfShape& LInt2, const TopAbs_State Side, const TopoDS_Edge& RefEdge, const Standard_Boolean IsRefEdgeDefined = Standard_False);
Standard_EXPORT static void Inter3D (const TopoDS_Face& F1,
const TopoDS_Face& F2,
const TopoDS_Face& ProF1,
const TopoDS_Face& ProF2,
TopTools_ListOfShape& LInt1,
TopTools_ListOfShape& LInt2,
const TopTools_ListOfShape& ListOnFirst,
const TopAbs_State Side,
const TopoDS_Edge& RefEdge,
const Standard_Boolean IsRefEdgeDefined = Standard_False,
const Standard_Boolean F1remains = Standard_False,
const Standard_Boolean F2remains = Standard_False);
//! Find if the edges <Edges> of the face <F2> are on
//! the face <F1>.

View File

@@ -1106,6 +1106,27 @@ Standard_Integer offsetonface(Draw_Interpretor&, Standard_Integer n, const char*
return 0;
}
//=======================================================================
//function : addoffsetface
//purpose :
//=======================================================================
static Standard_Integer addoffsetface(Draw_Interpretor&, Standard_Integer n, const char** a)
{
if ( n < 3) return 1;
for (Standard_Integer i = 1 ; i < n; i+=2) {
TopoDS_Shape SF = DBRep::Get(a[i],TopAbs_FACE);
if (!SF.IsNull()) {
TopoDS_Shape OF = DBRep::Get(a[i+1],TopAbs_FACE);
if (!OF.IsNull()) {
TheOffset.SetOffsetFace(TopoDS::Face(SF), TopoDS::Face(OF));
}
}
}
return 0;
}
//=======================================================================
//function : offsetperform
//purpose :
@@ -2374,6 +2395,10 @@ void BRepTest::FeatureCommands (Draw_Interpretor& theCommands)
"offsetonface face1 offset1 face2 offset2 ...",
__FILE__,offsetonface,g);
theCommands.Add("addoffsetface",
"addoffsetface face1 offset_face1 face2 offset_face2 ...",
__FILE__,addoffsetface,g);
theCommands.Add("offsetperform",
"offsetperform result",
__FILE__,offsetperform,g);

View File

@@ -67,7 +67,7 @@ void BRepTopAdaptor_Tool::Init(const Handle(Adaptor3d_HSurface)& surface,
myloaded=Standard_True;
}
Handle(BRepTopAdaptor_TopolTool) BRepTopAdaptor_Tool::GetTopolTool() const{
Handle(BRepTopAdaptor_TopolTool) BRepTopAdaptor_Tool::GetTopolTool() {
if(myloaded) {
return(myTopolTool);
}
@@ -79,7 +79,7 @@ Handle(BRepTopAdaptor_TopolTool) BRepTopAdaptor_Tool::GetTopolTool() const{
}
}
Handle(Adaptor3d_HSurface) BRepTopAdaptor_Tool::GetSurface() const{
Handle(Adaptor3d_HSurface) BRepTopAdaptor_Tool::GetSurface() {
if(myloaded) {
return(myHSurface);
}

View File

@@ -46,11 +46,11 @@ public:
Standard_EXPORT void Init (const Handle(Adaptor3d_HSurface)& Surface, const Standard_Real Tol2d);
Standard_EXPORT Handle(BRepTopAdaptor_TopolTool) GetTopolTool() const;
Standard_EXPORT Handle(BRepTopAdaptor_TopolTool) GetTopolTool();
Standard_EXPORT void SetTopolTool (const Handle(BRepTopAdaptor_TopolTool)& TT);
Standard_EXPORT Handle(Adaptor3d_HSurface) GetSurface() const;
Standard_EXPORT Handle(Adaptor3d_HSurface) GetSurface();
Standard_EXPORT void Destroy();
~BRepTopAdaptor_Tool()

View File

@@ -1554,12 +1554,13 @@ void BiTgte_Blend::ComputeCenters()
if (AS.ShapeType() == TopAbs_FACE) {
const TopoDS_Face& F = TopoDS::Face(myFaces(i));
TopoDS_Face NullFace;
if ( TouchedByCork.Contains(F)) {
BRepOffset_Tool::EnLargeFace(F,BigF,Standard_True);
OF1.Init(BigF,myRadius,EdgeTgt);
OF1.Init(BigF,myRadius,NullFace,EdgeTgt);
}
else {
OF1.Init(F,myRadius,EdgeTgt);
OF1.Init(F,myRadius,NullFace,EdgeTgt);
}
}
else { // So this is a Free Border edge on which the ball rolls.

View File

@@ -300,23 +300,3 @@ void Bnd_Box2d::Dump () const
cout << "\n Gap : " << Gap;
cout << "\n";
}
Standard_Real Bnd_Box2d::SquareDistance (const gp_Pnt2d& thePnt2d) const
{
Standard_Real Xmin, Xmax, Ymin, Ymax;
Standard_Real X = thePnt2d.X(), Y = thePnt2d.Y();
Standard_Real dd = 0;
Get(Xmin, Ymin, Xmax, Ymax);
if (X < Xmin)
dd += (Xmin - X)*(Xmin - X);
else if (X > Xmax)
dd += (Xmax - X)*(Xmax - X);
if (Y < Ymin)
dd += (Ymin - Y)*(Ymin - Y);
else if (Y > Ymax)
dd += (Ymax - Y)*(Ymax - Y);
return dd;
}

View File

@@ -182,10 +182,6 @@ public:
//! Returns True if the 2d pnt <P> is out <me>.
Standard_EXPORT Standard_Boolean IsOut (const gp_Pnt2d& P) const;
//! Returns distance from point <thePnt2d> to <me>
//! distance will be 0 if point is inside of <me>
Standard_EXPORT Standard_Real SquareDistance (const gp_Pnt2d& thePnt2d) const;
//! Returns True if <Box2d> is out <me>.
Standard_EXPORT Standard_Boolean IsOut (const Bnd_Box2d& Other) const;

View File

@@ -36,15 +36,14 @@ void Contap_ArcFunction::Set(const Handle(Adaptor3d_HSurface)& S)
{
mySurf = S;
Standard_Integer i;
Standard_Real uinf, vinf, usup, vsup;
Standard_Integer nbs = Contap_HContTool::NbSamplePoints(S, uinf, vinf, usup, vsup);
Standard_Integer nbs = Contap_HContTool::NbSamplePoints(S);
Standard_Real U,V;
// gp_Vec d1u,d1v;
gp_Vec norm;
if (nbs > 0) {
myMean = 0.;
for (i = 1; i <= nbs; i++) {
Contap_HContTool::SamplePoint(S,i,U,V, uinf, vinf, usup, vsup);
Contap_HContTool::SamplePoint(S,i,U,V);
// Adaptor3d_HSurfaceTool::D1(S,U,V,solpt,d1u,d1v);
// myMean = myMean + d1u.Crossed(d1v).Magnitude();
Contap_SurfProps::Normale(S,U,V,solpt,norm);

View File

@@ -1237,16 +1237,9 @@ void ComputeInternalPoints
// Essayer de converger
// cout << "Changement de signe detecte" << endl;
solution = Standard_False;
math_Vector dir1(1,2), dir2(1,2);
math_Vector prevX(1,2), prevPrevX (1,2);
int count = 0;
int revCount = 0;
double dot = 0;
double t = 0.5;
while (!solution)
{
X(1) =/* (XInf(1) + XSup(1)) /2.;*/ XInf(1) + t * (XSup(1) - XInf(1));
X(2) = /*(XInf(2) + XSup(2)) /2.;*/XInf(2) + t * (XSup(2) - XInf(2));
while (!solution) {
X(1) = (XInf(1) + XSup(1)) /2.;
X(2) = (XInf(2) + XSup(2)) /2.;
rsnld.Perform(SFunc,X,infb,supb);
if (!rsnld.IsDone()) {
@@ -1271,27 +1264,6 @@ void ComputeInternalPoints
else {
vtestb = gp_Vec(0.,0.,0.);
}
count++;
if (count > 10)
{
if (count > 12)
{
dir1 = prevX - prevPrevX;
dir2 = X - prevX;
double d1n = dir1.Norm();
double d2n = dir2.Norm();
if (d1n > gp::Resolution() && d2n > gp::Resolution())
{
dir1 /= d1n;
dir2 /= d2n;
dot = dir1(1) * dir2(1) + dir1(2) * dir2(2);
if (Abs(dot + 1) < 1e-10)
revCount++;
}
}
prevPrevX = prevX;
prevX = X;
}
if ((vtestb.Magnitude() <= gp::Resolution())||
(Abs(X(1)-XInf(1)) <= toler(1)
&& Abs(X(2)-XInf(2)) <= toler(2)) ||
@@ -1306,11 +1278,6 @@ void ComputeInternalPoints
}
else {
XInf = X;
if (revCount > 10000)
{
//XInf = (X + prevPrevX)/2;
t = 0.75;
}
}
}
else { // on n est pas sur une solution

View File

@@ -24,6 +24,8 @@
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
static Standard_Real uinf,vinf,usup,vsup;
Standard_Integer Contap_HContTool::NbSamplesV
(const Handle(Adaptor3d_HSurface)& S,
const Standard_Real ,
@@ -123,7 +125,7 @@ Standard_Integer Contap_HContTool::NbSamplesU
}
Standard_Integer Contap_HContTool::NbSamplePoints
(const Handle(Adaptor3d_HSurface)& S, Standard_Real& uinf, Standard_Real& vinf, Standard_Real& usup, Standard_Real& vsup)
(const Handle(Adaptor3d_HSurface)& S)
{
uinf = S->FirstUParameter();
usup = S->LastUParameter();
@@ -173,11 +175,7 @@ Standard_Integer Contap_HContTool::NbSamplePoints
void Contap_HContTool::SamplePoint (const Handle(Adaptor3d_HSurface)& S,
const Standard_Integer Index,
Standard_Real& U,
Standard_Real& V,
const Standard_Real& uinf,
const Standard_Real& vinf,
const Standard_Real& usup,
const Standard_Real& vsup)
Standard_Real& V )
{
if(S->GetType() == GeomAbs_BSplineSurface) {
Standard_Integer nbIntU = NbSamplesU(S,uinf,usup)/3;

View File

@@ -44,10 +44,9 @@ public:
Standard_EXPORT static Standard_Integer NbSamplesV (const Handle(Adaptor3d_HSurface)& S, const Standard_Real v1, const Standard_Real v2);
Standard_EXPORT static Standard_Integer NbSamplePoints (const Handle(Adaptor3d_HSurface)& S, Standard_Real& uinf, Standard_Real& vinf, Standard_Real& usup, Standard_Real& vsup);
Standard_EXPORT static Standard_Integer NbSamplePoints (const Handle(Adaptor3d_HSurface)& S);
Standard_EXPORT static void SamplePoint (const Handle(Adaptor3d_HSurface)& S, const Standard_Integer Index, Standard_Real& U, Standard_Real& V,
const Standard_Real& uinf, const Standard_Real& vinf, const Standard_Real& usup, const Standard_Real& vsup);
Standard_EXPORT static void SamplePoint (const Handle(Adaptor3d_HSurface)& S, const Standard_Integer Index, Standard_Real& U, Standard_Real& V);
//! Returns True if all the intersection point and edges
//! are known on the Arc.

View File

@@ -42,14 +42,13 @@ void Contap_SurfFunction::Set(const Handle(Adaptor3d_HSurface)& S)
{
mySurf = S;
Standard_Integer i;
Standard_Real uinf,vinf,usup,vsup;
Standard_Integer nbs = Contap_HContTool::NbSamplePoints(S,uinf,vinf,usup,vsup);
Standard_Integer nbs = Contap_HContTool::NbSamplePoints(S);
Standard_Real U,V;
gp_Vec norm;
if (nbs > 0) {
myMean = 0.;
for (i = 1; i <= nbs; i++) {
Contap_HContTool::SamplePoint(S,i,U,V,uinf,vinf,usup,vsup);
Contap_HContTool::SamplePoint(S,i,U,V);
// Adaptor3d_HSurfaceTool::D1(S,U,V,solpt,d1u,d1v);
// myMean = myMean + d1u.Crossed(d1v).Magnitude();
Contap_SurfProps::Normale(S,U,V,solpt,norm);

View File

@@ -112,13 +112,3 @@ TopoDS_Shape HLRAppli_ReflectLines::GetResult() const
{
return GetCompoundOf3dEdges(HLRBRep_OutLine, Standard_True, Standard_True);
}
//=======================================================================
//function : GetCompoundOfFaces
//purpose :
//=======================================================================
TopoDS_Shape HLRAppli_ReflectLines::GetCompoundOfFaces(bool theMode,
TopTools_DataMapOfShapeShape& OrigFaceToProjFace ) const
{
HLRBRep_HLRToShape aHLRToShape( myHLRAlgo );
return aHLRToShape.CompoundOfFaces(theMode, OrigFaceToProjFace);
}

View File

@@ -26,7 +26,6 @@
#include <HLRBRep_TypeOfResultingEdge.hxx>
#include <TopoDS_Shape.hxx>
#include <Standard_Real.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
class TopoDS_Shape;
@@ -61,9 +60,6 @@ public:
const Standard_Boolean visible,
const Standard_Boolean In3d) const;
Standard_EXPORT TopoDS_Shape GetCompoundOfFaces(bool theMode,
TopTools_DataMapOfShapeShape& OrigFaceToProjFace) const;
protected:
@@ -74,6 +70,8 @@ protected:
private:
HLRAlgo_Projector myProjector;
Handle(HLRBRep_Algo) myHLRAlgo;
TopoDS_Shape myShape;

View File

@@ -899,6 +899,7 @@ void HLRBRep_Data::InitEdge (const Standard_Integer FI,
Standard_Boolean HLRBRep_Data::MoreEdge ()
{
if (iFaceTest) {
if (myFaceItr2.MoreEdge()) { // all edges must be tested if
myLE = myFaceItr2.Edge (); // the face is not a simple
@@ -926,25 +927,61 @@ Standard_Boolean HLRBRep_Data::MoreEdge ()
return myCurSortEd <= myNbrSortEd;
}
//=======================================================================
//function : GetNextEdge
//function : NextEdge
//purpose :
//=======================================================================
void HLRBRep_Data::GetNextEdge()
void HLRBRep_Data::NextEdge (const Standard_Boolean skip)
{
if (myCurSortEd > myNbrSortEd)
if (skip) {
if (iFaceTest) myFaceItr2.NextEdge();
else myCurSortEd++;
}
if (!MoreEdge()) return;
if (iFaceTest) {
myLE = myFaceItr2.Edge ();
myLEOutLine = myFaceItr2.OutLine ();
myLEInternal = myFaceItr2.Internal();
myLEDouble = myFaceItr2.Double ();
myLEIsoLine = myFaceItr2.IsoLine ();
myLEData = &myEData(myLE);
myLEGeom = &myLEData->ChangeGeometry();
myLEMinMax = &myLEData->MinMax();
myLETol = myLEData->Tolerance();
myLEType = myLEGeom->GetType();
if (((HLRBRep_EdgeData*)myLEData)->Vertical() ||
(myLEDouble &&
((HLRBRep_EdgeData*)myLEData)->HideCount() == myHideCount-1))
NextEdge();
((HLRBRep_EdgeData*)myLEData)->HideCount(myHideCount-1);
return;
for (;myCurSortEd <= myNbrSortEd;myCurSortEd++)
{
myLE = myEdgeIndices(myCurSortEd);
if (myEData(myLE).Vertical() || myEData(myLE).Status().AllHidden())
continue;
myLEData = &myEData(myLE);
if (myLEData->HideCount() > myHideCount-2)
continue;
myLEMinMax = &myLEData->MinMax();
if (((iFaceMinMax->Max[0] - myLEMinMax->Min[0]) & 0x80008000) != 0 ||
}
else {
myLE = Edge();
myLEOutLine = Standard_False;
myLEInternal = Standard_False;
myLEDouble = Standard_False;
myLEIsoLine = Standard_False;
myLEData = &myEData(myLE);
myLEGeom = &myLEData->ChangeGeometry();
myLEMinMax = &myLEData->MinMax();
myLETol = myLEData->Tolerance();
myLEType = myLEGeom->GetType();
}
if (((HLRBRep_EdgeData*)myLEData)->Vertical()) {
NextEdge();
return;
}
if (((HLRBRep_EdgeData*)myLEData)->HideCount() > myHideCount-2) {
NextEdge();
return;
}
if (((HLRBRep_EdgeData*)myLEData)->Status().AllHidden()) {
NextEdge();
return;
}
if (((iFaceMinMax->Max[0] - myLEMinMax->Min[0]) & 0x80008000) != 0 ||
((myLEMinMax->Max[0] - iFaceMinMax->Min[0]) & 0x80008000) != 0 ||
((iFaceMinMax->Max[1] - myLEMinMax->Min[1]) & 0x80008000) != 0 ||
((myLEMinMax->Max[1] - iFaceMinMax->Min[1]) & 0x80008000) != 0 ||
@@ -958,59 +995,15 @@ void HLRBRep_Data::GetNextEdge()
((myLEMinMax->Max[5] - iFaceMinMax->Min[5]) & 0x80008000) != 0 ||
((iFaceMinMax->Max[6] - myLEMinMax->Min[6]) & 0x80008000) != 0 ||
((myLEMinMax->Max[6] - iFaceMinMax->Min[6]) & 0x80008000) != 0 ||
((iFaceMinMax->Max[7] - myLEMinMax->Min[7]) & 0x80008000) != 0)
continue;
myLEGeom = &myLEData->ChangeGeometry();
myLETol = myLEData->Tolerance();
if (((HLRBRep_Surface*)iFaceGeom)->IsAbove
(iFaceBack,myLEGeom,(Standard_Real)myLETol))
continue;
break;
}
myLEOutLine = Standard_False;
myLEInternal = Standard_False;
myLEDouble = Standard_False;
myLEIsoLine = Standard_False;
myLEGeom = &myLEData->ChangeGeometry();
myLETol = myLEData->Tolerance();
myLEType = myLEGeom->GetType();
}
void HLRBRep_Data::NextEdge (const Standard_Boolean skip)
{
if (skip)
{
if (iFaceTest)
myFaceItr2.NextEdge();
else
myCurSortEd++;
}
if (iFaceTest && !MoreEdge())
return;
if (!iFaceTest)
{
GetNextEdge();
return;
}
myLE = myFaceItr2.Edge ();
myLEOutLine = myFaceItr2.OutLine ();
myLEInternal = myFaceItr2.Internal();
myLEDouble = myFaceItr2.Double ();
myLEIsoLine = myFaceItr2.IsoLine ();
myLEData = &myEData(myLE);
myLEGeom = &myLEData->ChangeGeometry();
myLEMinMax = &myLEData->MinMax();
myLETol = myLEData->Tolerance();
myLEType = myLEGeom->GetType();
if (((HLRBRep_EdgeData*)myLEData)->Vertical() ||
(myLEDouble &&
((HLRBRep_EdgeData*)myLEData)->HideCount() == myHideCount-1))
((iFaceMinMax->Max[7] - myLEMinMax->Min[7]) & 0x80008000) != 0) { //-- rejection en z
NextEdge();
((HLRBRep_EdgeData*)myLEData)->HideCount(myHideCount-1);
return;
}
if (((HLRBRep_Surface*)iFaceGeom)->IsAbove
(iFaceBack,myLEGeom,(Standard_Real)myLETol)) {
NextEdge();
return;
}
return; // edge is OK
}

View File

@@ -109,8 +109,6 @@ public:
Standard_EXPORT Standard_Boolean MoreEdge();
Standard_EXPORT void NextEdge (const Standard_Boolean skip = Standard_True);
Standard_EXPORT void GetNextEdge();
//! Returns the current Edge
Standard_EXPORT Standard_Integer Edge() const;
@@ -238,9 +236,7 @@ private:
Standard_Boolean iFaceBack;
Standard_Boolean iFaceSimp;
Standard_Boolean iFaceSmpl;
public:
Standard_Boolean iFaceTest;
private:
Standard_Integer myHideCount;
Standard_Real myDeca[16];
Standard_Real mySurD[16];

View File

@@ -38,12 +38,10 @@ myFlags(0),mySize(0)
void HLRBRep_FaceData::Set (const TopoDS_Face& FG,
const TopAbs_Orientation Or,
const Standard_Boolean Cl,
const Standard_Integer NW,
const Standard_Boolean isInitSurf) //TODO isInitSurf can be deleted
const Standard_Integer NW)
{
Closed(Cl);
if (isInitSurf)
Geometry().Surface(FG);
Geometry().Surface(FG);
myTolerance = (Standard_ShortReal)(BRep_Tool::Tolerance(FG));
Orientation(Or);
Wires() = new HLRAlgo_WiresBlock(NW);

View File

@@ -46,7 +46,7 @@ public:
//! if the face belongs to a closed volume. <NW> is
//! the number of wires ( or block of edges ) of the
//! face.
Standard_EXPORT void Set (const TopoDS_Face& FG, const TopAbs_Orientation Or, const Standard_Boolean Cl, const Standard_Integer NW, const Standard_Boolean isInitSurf);
Standard_EXPORT void Set (const TopoDS_Face& FG, const TopAbs_Orientation Or, const Standard_Boolean Cl, const Standard_Integer NW);
//! Set <NE> the number of edges of the wire number
//! <WI>.

View File

@@ -28,34 +28,6 @@
#include <TopoDS_Shape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <BRepLib.hxx>
#include <BRepLib_MakeVertex.hxx>
#include <BRepTools.hxx>
#include <TopExp.hxx>
#include <IntTools_FClass2d.hxx>
#include <BRepTools_ReShape.hxx>
#include <Poly_MakeLoops.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <NCollection_UBTreeFiller.hxx>
#include <BndLib_Add2dCurve.hxx>
#include <Bnd_Box2d.hxx>
#include <BRepAdaptor_Curve2d.hxx>
#include <BRepGProp.hxx>
#include <GProp_GProps.hxx>
#include <NCollection_Handle.hxx>
#include <BRepBndLib.hxx>
#include <BOPTools_AlgoTools3D.hxx>
#include <IntTools_Context.hxx>
#include <BRepAlgoAPI_BuilderAlgo.hxx>
#include <NCollection_UBTree.hxx>
#include <Extrema_POnCurv2d.hxx>
#include <IntCurvesFace_ShapeIntersector.hxx>
#include <Extrema_ExtPC2d.hxx>
#include <HLRTopoBRep_OutLiner.hxx>
#include <Geom_Plane.hxx>
#include <BRepBndLib.hxx>
#include <TopTools_DataMapOfShapeReal.hxx>
#include <algorithm>
//=======================================================================
//function : HLRBRep_HLRToShape
//purpose :
@@ -278,932 +250,3 @@ HLRBRep_HLRToShape::DrawEdge (const Standard_Boolean visible,
}
}
}
//UBTree edge-point
typedef NCollection_UBTree <Standard_Integer, Bnd_Box2d> HLRVV_BndBoxTree;
class HLRVV_BndBoxTreeSelector : public HLRVV_BndBoxTree::Selector
{
public:
HLRVV_BndBoxTreeSelector( const TopTools_IndexedMapOfShape& theInpShapes,
double theMinDDist)
: myInpShapes(theInpShapes),
myMinDDist(theMinDDist),
myResId (-1),
myCId (-1)
{}
Standard_Boolean Reject (const Bnd_Box2d& theBox) const
{
double aCurDDist = theBox.SquareDistance(myCPnt);
if (aCurDDist > myMinDDist)
return true;
else
return false;
}
Standard_Boolean Accept (const Standard_Integer& theObj)
{
//extrema pnt <-> vertex
const TopoDS_Shape& aSh = myInpShapes(theObj);
if (theObj == myCId)
return Standard_False;
gp_Pnt aCVP = BRep_Tool::Pnt(TopoDS::Vertex(aSh));
gp_Pnt2d aCVP2d(aCVP.X(), aCVP.Y());
double aDD = aCVP2d.SquareDistance(myCPnt);
if (aDD < myMinDDist)
{
myMinDDist = aDD;
myResId = theObj;
}
return Standard_True;
}
void Reset(double theMinDDist)
{
myMinDDist = theMinDDist;
myResId = -1;
myCId = -1;
}
void SetCurrentPoint( int id )
{
gp_Pnt CP = BRep_Tool::Pnt(TopoDS::Vertex(myInpShapes(id)));
myCPnt.SetX(CP.X());
myCPnt.SetY(CP.Y());
myCId = id;
}
double GetMinDDist() const
{
return myMinDDist;
}
int GetResVId() const
{
return myResId;
}
private:
HLRVV_BndBoxTreeSelector(const HLRVV_BndBoxTreeSelector& );
HLRVV_BndBoxTreeSelector& operator=(const HLRVV_BndBoxTreeSelector& );
private:
const TopTools_IndexedMapOfShape& myInpShapes;
gp_Pnt2d myCPnt;
double myMinDDist;
int myResId;
int myCId;
};
///
//UBTree edge-point
typedef NCollection_UBTree <Standard_Integer, Bnd_Box2d> HLRVE_BndBoxTree;
class HLRVE_BndBoxTreeSelector : public HLRVE_BndBoxTree::Selector
{
public:
HLRVE_BndBoxTreeSelector(
const NCollection_IndexedDataMap<TopoDS_Edge, BRepAdaptor_Curve2d, TopTools_ShapeMapHasher>& theEdgeAdapt,
double theMinDDist)
: myEdgeAdapt (theEdgeAdapt),
myMinDDist(theMinDDist)
{}
Standard_Boolean Reject (const Bnd_Box2d& theBox) const
{
double aCurDDist = theBox.SquareDistance(myCPnt);
if (aCurDDist > myMinDDist)
return true;
else
return false;
}
Standard_Boolean Accept (const Standard_Integer& theObj)
{
const BRepAdaptor_Curve2d& adapt = myEdgeAdapt(theObj);
Extrema_ExtPC2d aExtPC(myCPnt, adapt, adapt.FirstParameter(), adapt.LastParameter());
if (aExtPC.IsDone() && aExtPC.NbExt() > 0 )
{
NCollection_Handle<Extrema_POnCurv2d> aPSol;// = aExtPC.Point(1);
double aMinDD = Precision::Infinite();
double aFp = adapt.FirstParameter();
double aLp = adapt.LastParameter();
for ( Standard_Integer i = 1; i <= aExtPC.NbExt(); i++)
{
double aCDD = aExtPC.SquareDistance(i);
Extrema_POnCurv2d aCurSol = aExtPC.Point(i);
if (Abs(aCurSol.Parameter() - aFp) < Precision::Confusion() ||
Abs(aCurSol.Parameter() - aLp) < Precision::Confusion()) //TODO it's better to use tolerance of vertex here
continue;
if ( aCDD < aMinDD)
{
aMinDD = aCDD;
aPSol = new Extrema_POnCurv2d(aExtPC.Point(i));
}
}
if (aMinDD < myMinDDist)
{
myMinDDist = aMinDD;
myEARes = adapt;
if (!myPSolRes)
myPSolRes = new Extrema_POnCurv2d( *aPSol );
else
myPSolRes->SetValues(aPSol->Parameter(), aPSol->Value());
}
}
return Standard_True;
}
void Reset(double theMinDDist)
{
myMinDDist = theMinDDist;
myPSolRes.Nullify();
}
void SetCurrentPoint( const gp_Pnt& thePnt )
{
myCPnt.SetX(thePnt.X());
myCPnt.SetY(thePnt.Y());
}
bool GetPResult(Extrema_POnCurv2d& thePSolRes, BRepAdaptor_Curve2d& theERes) const
{
if (!myPSolRes.IsNull())
{
thePSolRes = *myPSolRes;
theERes = myEARes;
return true;
}
else
return false;
}
private:
HLRVE_BndBoxTreeSelector(const HLRVE_BndBoxTreeSelector& );
HLRVE_BndBoxTreeSelector& operator=(const HLRVE_BndBoxTreeSelector& );
private:
const NCollection_IndexedDataMap<TopoDS_Edge, BRepAdaptor_Curve2d, TopTools_ShapeMapHasher>& myEdgeAdapt;
gp_Pnt2d myCPnt;
double myMinDDist;
NCollection_Handle<Extrema_POnCurv2d> myPSolRes;
BRepAdaptor_Curve2d myEARes;
};
//! deriatives of the edges on both ends
struct BRepFill_TangentLinkInfo
{
gp_Dir2d myD1L;
gp_Dir2d myD1F;
};
class BRepFill_PolyHelper : public Poly_MakeLoops2D::Helper
{
public:
BRepFill_PolyHelper( const NCollection_DataMap<Poly_MakeLoops2D::Link, BRepFill_TangentLinkInfo>& mL2TI,
const NCollection_DataMap<Standard_Integer, Poly_MakeLoops2D::ListOfLink>& themNode2ListOfLinks) :
myL2TI (mL2TI),
mymNode2ListOfLinks (themNode2ListOfLinks)
{
};
virtual const Poly_MakeLoops2D::ListOfLink& GetAdjacentLinks (Standard_Integer theNode) const
{
return mymNode2ListOfLinks(theNode);
}
virtual Standard_Boolean GetFirstTangent(const Poly_MakeLoops2D::Link& theLink, gp_Dir2d& theDir) const
{
if (theLink.flags & Poly_MakeLoops2D::LF_Reversed)
theDir = -myL2TI(theLink).myD1L;
else
theDir = myL2TI(theLink).myD1F;
return Standard_True;
}
virtual Standard_Boolean GetLastTangent(const Poly_MakeLoops2D::Link& theLink, gp_Dir2d& theDir) const
{
if (theLink.flags & Poly_MakeLoops2D::LF_Reversed)
theDir = -myL2TI(theLink).myD1F;
else
theDir = myL2TI(theLink).myD1L;
return Standard_True;
}
private:
BRepFill_PolyHelper& operator= (const BRepFill_PolyHelper &theOther);
private:
const NCollection_DataMap<Poly_MakeLoops2D::Link, BRepFill_TangentLinkInfo>& myL2TI;
const NCollection_DataMap<Standard_Integer, Poly_MakeLoops2D::ListOfLink>& mymNode2ListOfLinks;
};
typedef NCollection_UBTree <Standard_Integer, Bnd_Box> HLRFL_BndBoxTree;
class HLRFL_BndBoxTreeSelector : public HLRFL_BndBoxTree::Selector
{
public:
struct FaceParam
{
TopoDS_Face myF;
double LPar;
};
HLRFL_BndBoxTreeSelector(const TopTools_IndexedMapOfShape& theFMap, bool theMode)
: HLRFL_BndBoxTreeSelector::Selector(),
myFMap (theFMap),
myIntersectors(1, theFMap.Size()),
myMode (theMode)
{
for (int i =1; i <= myIntersectors.Size(); i++)
myIntersectors(i) = NULL;
}
~HLRFL_BndBoxTreeSelector()
{
for (int i =1; i <= myIntersectors.Size(); i++)
{
IntCurvesFace_ShapeIntersector* an_inter = myIntersectors(i);
if (an_inter)
delete an_inter;
}
}
Standard_Boolean Reject (const Bnd_Box& theBox) const
{
return theBox.IsOut (myLine);
}
Standard_Boolean Accept (const Standard_Integer& theObj)
{
if (theObj > myFMap.Extent())
return Standard_False;
const TopoDS_Face& F = TopoDS::Face(myFMap(theObj));
IntCurvesFace_ShapeIntersector* an_inter = myIntersectors(theObj);
if (!an_inter)
{
an_inter = new IntCurvesFace_ShapeIntersector();
an_inter->Load(F, Precision::Confusion());
}
an_inter->Perform(myLine, -Precision::Infinite(), Precision::Infinite()); //TODO trim the line according to bnd box of face
if (an_inter->IsDone() && an_inter->NbPnt())
{
for (int i=1; i <= an_inter->NbPnt(); i++)
{
FaceParam fp;
fp.LPar = an_inter->WParameter(i);
fp.myF = an_inter->Face(i);
myRParams.push_back(fp);
}
if (!myMode)
myStop = 1;
}
return Standard_True;
//int nbpnt = an_inter->.NbPnt();
}
void SetLine (const gp_Lin& theLine)
{
myLine = theLine;
}
const std::vector<FaceParam>& GetRParams () const
{
return myRParams;
}
void ResetResult()
{
myRParams.clear();
}
private:
HLRFL_BndBoxTreeSelector(const HLRFL_BndBoxTreeSelector& );
HLRFL_BndBoxTreeSelector& operator=(const HLRFL_BndBoxTreeSelector& );
private:
const TopTools_IndexedMapOfShape& myFMap;
gp_Lin myLine;
NCollection_Array1<IntCurvesFace_ShapeIntersector*> myIntersectors;
std::vector<FaceParam> myRParams;
bool myMode; //if true => find all line-face intersections; otherwise - find any and stop the search
};
static bool FuseVE(TopoDS_Shape& theRes)
{
TopTools_IndexedMapOfShape allE;
TopExp::MapShapes(theRes, TopAbs_EDGE, allE);
TopTools_ListOfShape aLSE;
for (int i = 1; i <= allE.Extent(); i++ )
aLSE.Append(allE(i));
Standard_Real aFV = 0;
BRepAlgoAPI_BuilderAlgo aBlr;
aBlr.SetArguments(aLSE);
aBlr.SetRunParallel(Standard_True);
aBlr.SetFuzzyValue(aFV);
aBlr.Build();
if (aBlr.HasErrors())
{
aBlr.DumpErrors(cout);
return false;
}
theRes = aBlr.Shape();
return true;
}
static void ProcessHVertices(TopoDS_Shape& theRes,
NCollection_IndexedDataMap<TopoDS_Edge, BRepAdaptor_Curve2d, TopTools_ShapeMapHasher>& theEdAd,
NCollection_DataMap<TopoDS_Edge, Bnd_Box2d, TopTools_ShapeMapHasher>& theEdBnd2d )
{
BRepTools_ReShape reshaper;
///hanging vertices => find closely located point on some edge or vertex
TopoDS_Face aDraftPrFace;
BRep_Builder().MakeFace(aDraftPrFace, BRepLib::Plane(), Precision::Confusion());
TopTools_IndexedDataMapOfShapeListOfShape M;
TopExp::MapShapesAndAncestors(theRes, TopAbs_VERTEX, TopAbs_EDGE, M);
TopTools_IndexedMapOfShape HV;
for (int i = 1; i <= M.Extent(); i++)
if (M(i).Extent() == 1)
HV.Add(M.FindKey(i));
//
TopTools_IndexedMapOfShape VV, EE;
TopExp::MapShapes(theRes, TopAbs_VERTEX, VV);
TopExp::MapShapes(theRes, TopAbs_EDGE, EE);
//
//vertex-vertex extrema
NCollection_UBTree <Standard_Integer, Bnd_Box2d> aTreeVV;
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box2d> aTreeFillerVV (aTreeVV);
for (Standard_Integer i = 1; i <= VV.Extent(); i++)
{
const TopoDS_Vertex& aV = TopoDS::Vertex(VV(i));
Bnd_Box2d aBB;
gp_Pnt aPV = BRep_Tool::Pnt(aV);
aBB.Add(gp_Pnt2d(aPV.X(), aPV.Y()));
aBB.Enlarge(BRep_Tool::Tolerance(aV));
aTreeFillerVV.Add(i, aBB);
}
aTreeFillerVV.Fill();
HLRVV_BndBoxTreeSelector aSelectorVV(VV, Precision::Infinite());
//vertex-edge extrema
NCollection_UBTree <Standard_Integer, Bnd_Box2d> aTreeVE;
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box2d> aTreeFillerVE (aTreeVE);
int nbEE = EE.Extent();
//NCollection_Array1<BRepAdaptor_Curve2d> anEdgeAdapters(1, nbEE);
for (Standard_Integer i = 1; i <= nbEE; i++)
{
const TopoDS_Edge& anE = TopoDS::Edge(EE(i));
Bnd_Box2d aBB;
theEdAd.Add(anE, BRepAdaptor_Curve2d(anE, aDraftPrFace));
BndLib_Add2dCurve::Add(*theEdAd.Seek(anE), 0, aBB);
theEdBnd2d.Bind(anE, aBB);
aTreeFillerVE.Add(i, aBB);
}
aTreeFillerVE.Fill();
HLRVE_BndBoxTreeSelector aSelectorVE(theEdAd, Precision::Infinite()); //min dist doesn't matter here
//
TopTools_IndexedMapOfShape toadd, torem;//temp
for (int i = 1; i <= HV.Extent(); i++ )
{
const TopoDS_Vertex& CHV = TopoDS::Vertex(HV(i));
gp_Pnt CHVPnt = BRep_Tool::Pnt(CHV);
//
int id = VV.FindIndex(CHV);
aSelectorVV.Reset(Precision::Infinite());
aSelectorVV.SetCurrentPoint( id );
/*int resVV =*/ aTreeVV.Select(aSelectorVV);
double aMinDDistReached = aSelectorVV.GetMinDDist();
TopoDS_Vertex aResV = TopoDS::Vertex(VV(aSelectorVV.GetResVId()));
//
aSelectorVE.Reset(aMinDDistReached);
aSelectorVE.SetCurrentPoint( CHVPnt );
/*int resVE = */aTreeVE.Select(aSelectorVE);
Extrema_POnCurv2d aPSolRes;
BRepAdaptor_Curve2d aResEA;
bool VEFound = aSelectorVE.GetPResult(aPSolRes, aResEA);
if (VEFound)
{
///if (BRep_Tool::Degenerated(E)) //can be degenerted??
double aPar = aPSolRes.Parameter();
const TopoDS_Edge& aResE = aResEA.Edge();
TopoDS_Edge aDE1 = TopoDS::Edge(aResE.EmptyCopied().Oriented(TopAbs_FORWARD));
TopoDS_Edge aDE2 = TopoDS::Edge(aResE.EmptyCopied().Oriented(TopAbs_FORWARD));
TopoDS_Vertex aFV, aLV;
TopExp::Vertices(aResE, aFV, aLV);
double aFP = aResEA.FirstParameter();
double aLP = aResEA.LastParameter();
gp_Pnt2d aResP2d = aResEA.Value(aPar);
gp_Pnt aResP3d(aResP2d.X(), aResP2d.Y(), 0.0);
TopoDS_Vertex aDummyV = BRepLib_MakeVertex(aResP3d).Vertex();
//
NCollection_List<TopoDS_Shape> nls;
nls.Append(aDummyV);
nls.Append(CHV);
gp_Pnt aNC;
double aNTol;
BRepLib::BoundingVertex(nls, aNC, aNTol);
gp_Pnt aFVP = BRep_Tool::Pnt(aFV);
gp_Pnt aLVP = BRep_Tool::Pnt(aLV);
if (aFVP.Distance(aNC) < aNTol*1e10 ||
aLVP.Distance(aNC) < aNTol*1e10)
{
nls.RemoveFirst();
nls.Append(aResV);
BRepLib::BoundingVertex(nls, aNC, aNTol);
BRep_Builder().UpdateVertex(aResV, aNC, aNTol);
reshaper.Replace(CHV, aResV.Oriented(CHV.Orientation()));
if (HV.Contains(aResV)) //if the closest vertex lays on edge => never contains in HV
HV.RemoveKey(aResV);
}
else
{
BRep_Builder().UpdateVertex(CHV, aNC, aNTol);
BRep_Builder().Range(aDE1, aFP, aPar);
BRep_Builder().Add(aDE1, aFV.Oriented(TopAbs_FORWARD));
BRep_Builder().Add(aDE1, CHV.Oriented(TopAbs_REVERSED));
//
BRep_Builder().Range(aDE2, aPar, aLP );
BRep_Builder().Add(aDE2, CHV.Oriented(TopAbs_FORWARD));
BRep_Builder().Add(aDE2, aLV.Oriented(TopAbs_REVERSED));
//
///TODO temp
torem.Add(aResE);
toadd.Add(aDE1);
toadd.Add(aDE2);
//TopoDS_Compound aResCmp;
//BRep_Builder().MakeCompound(aResCmp);
//BRep_Builder().Add(aResCmp, aDE1);
//BRep_Builder().Add(aResCmp, aDE2);
//
//TopoDS_Wire aResW;
//BRep_Builder().MakeWire(aResW);
//BRep_Builder().Add(aResW, aDE1);
//BRep_Builder().Add(aResW, aDE2);
//TopoDS_Wire aResW = BRepBuilderAPI_MakeWire(aDE1, aDE2).Wire(); //this will control proper sharing and tolerance matching between vertices
/*{ //DEB
TopTools_IndexedMapOfShape VVVV;
TopExp::MapShapes(aResW, TopAbs_VERTEX, VVVV);
//cout << VVVV.Extent() << endl;
}*/
//aResW.Orientation(aResE.Orientation());
//reshape.Replace(aResE, aResCmp);
}
}
else
{
NCollection_List<TopoDS_Shape> nls; //TODO move to ext func
nls.Append(CHV);
nls.Append(aResV);
gp_Pnt aNC;
double aNTol;
BRepLib::BoundingVertex(nls, aNC, aNTol);
BRep_Builder().UpdateVertex(aResV, aNC, aNTol);
reshaper.Replace(CHV, aResV.Oriented(CHV.Orientation()));
if (HV.Contains(aResV)) //if the closest vertex lays on edge => never contains in HV
HV.RemoveKey(aResV);
}
}
//DEB
for (int i =1; i<= torem.Extent() ;i++)
BRep_Builder().Remove(theRes, torem(i));
//DEB
for (int i =1; i<= toadd.Extent() ;i++)
BRep_Builder().Add(theRes, toadd(i));
//
theRes = reshaper.Apply(theRes); //replace only vertices
}
static void FillNode2LLMap(Standard_Integer NewNode, const Poly_MakeLoops2D::Link& NewLink,
NCollection_DataMap<Standard_Integer, Poly_MakeLoops2D::ListOfLink>& mNode2ListOfLinks)
{
if (!mNode2ListOfLinks.IsBound(NewNode))
mNode2ListOfLinks.Bound(NewNode, Poly_MakeLoops2D::ListOfLink())->Append(NewLink);
else
mNode2ListOfLinks(NewNode).Append(NewLink);
}
static TopAbs_State GetStateOfSamplePoint(const TopoDS_Face& ff2,
const IntTools_FClass2d& fclass,
const Bnd_Box2d& fbnd)
{
TopExp_Explorer exp(ff2, TopAbs_EDGE); //should contains at least one edge
TopoDS_Edge fe2 = TopoDS::Edge(exp.Current());
BRepAdaptor_Curve2d afe2(fe2, ff2);
gp_Pnt2d middlepoint = afe2.Value((afe2.LastParameter() + afe2.FirstParameter()) / 2.0);
Bnd_Box bb3d;
BRepBndLib::Add(ff2, bb3d);
Bnd_Box2d bb2d;
bb2d.Set(gp_Pnt2d(bb3d.CornerMin().X(), bb3d.CornerMin().Y()));
bb2d.Add(gp_Pnt2d(bb3d.CornerMax().X(), bb3d.CornerMax().Y()));
if (bb2d.IsOut(middlepoint))
return TopAbs_OUT;
else
return fclass.Perform(middlepoint);
}
bool HLRBRep_ParComp(const HLRFL_BndBoxTreeSelector::FaceParam& a,
const HLRFL_BndBoxTreeSelector::FaceParam& b)
{
return a.LPar < b.LPar;
}
static TopoDS_Shape ProcessLoops(const TopoDS_Shape& theRes,
NCollection_IndexedDataMap<TopoDS_Edge, BRepAdaptor_Curve2d, TopTools_ShapeMapHasher>& anEdAd,
NCollection_DataMap<TopoDS_Edge, Bnd_Box2d, TopTools_ShapeMapHasher> theEdBnd2d,
HLRAlgo_Projector& projector,
const TopTools_ListOfShape& anOrigShapes,
bool theMode,
TopTools_DataMapOfShapeShape& OrigFaceToProjFace )
{
NCollection_List<TopoDS_Wire> theLoops;
NCollection_List<TopoDS_Wire> SelfLoops;
NCollection_DataMap<TopoDS_Shape, Bnd_Box2d, TopTools_ShapeMapHasher> aShToBnd2d;
TopoDS_Face aDraftPrFace;
BRep_Builder().MakeFace(aDraftPrFace, BRepLib::Plane(), Precision::Confusion());
TopTools_IndexedMapOfShape mN2V;
TopExp::MapShapes(theRes, TopAbs_VERTEX, mN2V);
NCollection_DataMap<Standard_Integer, Poly_MakeLoops2D::ListOfLink> mNode2ListOfLinks;
NCollection_DataMap<Poly_MakeLoops2D::Link, BRepFill_TangentLinkInfo> mL2TI;
//Create links for Poly_MakeLoops algo and bind them to the existing edges
NCollection_DataMap<Poly_MakeLoops2D::Link, TopoDS_Edge> mL2E;
Standard_Integer LastIndV = mN2V.Extent();
TopExp_Explorer ExpE;
ExpE.Init(theRes, TopAbs_EDGE);
for (; ExpE.More(); ExpE.Next())
{
const TopoDS_Edge& E = TopoDS::Edge(ExpE.Current());
// If edge contains only one vertex => self loop (should be non degenerated)
TopoDS_Vertex FV, LV;
FV = TopExp::FirstVertex(E, Standard_True);
LV = TopExp::LastVertex(E, Standard_True);
if (FV.IsSame(LV))
{
if (!BRep_Tool::Degenerated(E))
{
const TopoDS_Wire& aW = BRepLib_MakeWire(E).Wire();
SelfLoops.Append(aW);
Bnd_Box2d aBB;
BndLib_Add2dCurve::Add(BRepAdaptor_Curve2d(E, aDraftPrFace), 0, aBB);
aShToBnd2d.Bind(aW, aBB);
}
continue;
}
const BRepAdaptor_Curve2d* anAd = anEdAd.Seek(E);
if (!anAd)
{
anEdAd.Add(E, BRepAdaptor_Curve2d(E, aDraftPrFace));
anAd = anEdAd.Seek(E);
Bnd_Box2d aBB;
BndLib_Add2dCurve::Add(*anEdAd.Seek(E), 0, aBB);
theEdBnd2d.Bind(E, aBB);
}
//NCollection_Handle<BRepAdaptor_Curve2d> adapt = new BRepAdaptor_Curve2d(E, aDraftPrFace);
gp_Pnt2d Pnt;
gp_Vec2d Vec;
gp_Dir2d D1F, D1L;
if (anAd->Curve().IsNull())
continue;
TopAbs_Orientation EOri = E.Orientation();
if (EOri == TopAbs_FORWARD)
{
anAd->D1(anAd->FirstParameter(), Pnt, Vec);
if (Vec.SquareMagnitude() <= gp::Resolution())
anAd->D1(anAd->FirstParameter() + Precision::Confusion(), Pnt, Vec);
D1F.SetCoord(Vec.X(), Vec.Y());
anAd->D1(anAd->LastParameter(), Pnt, Vec);
if (Vec.SquareMagnitude() <= gp::Resolution())
anAd->D1(anAd->LastParameter() - Precision::Confusion(), Pnt, Vec);
D1L.SetCoord(Vec.X(), Vec.Y());
}
else if (EOri == TopAbs_REVERSED)
{
anAd->D1(anAd->LastParameter(), Pnt, Vec);
if (Vec.SquareMagnitude() <= gp::Resolution())
anAd->D1(anAd->LastParameter() - Precision::Confusion(), Pnt, Vec);
D1F.SetCoord(-Vec.X(), -Vec.Y());
anAd->D1(anAd->FirstParameter(), Pnt, Vec);
if (Vec.SquareMagnitude() <= gp::Resolution())
anAd->D1(anAd->FirstParameter() + Precision::Confusion(), Pnt, Vec);
D1L.SetCoord(-Vec.X(), -Vec.Y());
}
else
continue;
Standard_Integer Node1 = mN2V.FindIndex(FV);
Standard_Integer Node2 = mN2V.FindIndex(LV);
Poly_MakeLoops2D::Link aLink(Node1, Node2);
aLink.flags = Poly_MakeLoops2D::LF_Both;
if (!mL2E.IsBound(aLink))
{
mL2E.Bind(aLink, E);
FillNode2LLMap(Node1, aLink, mNode2ListOfLinks);
FillNode2LLMap(Node2, aLink, mNode2ListOfLinks);
BRepFill_TangentLinkInfo* Info = mL2TI.Bound(aLink, BRepFill_TangentLinkInfo());
Info->myD1F = D1F;
Info->myD1L = D1L;
}
else
{
//link have been met twise. This may indicate that it is has
//opposite direction now. Try to divide it (node1, node2) => (node1, ind) + (ind, node2)
//so it can be passed to loop maker
LastIndV++;
Poly_MakeLoops2D::Link aLink1(Node1, LastIndV);
aLink1.flags = Poly_MakeLoops2D::LF_Both;
Poly_MakeLoops2D::Link aLink2(LastIndV, Node2);
aLink2.flags = Poly_MakeLoops2D::LF_Both;
mL2E.Bind(aLink1, E);
mL2E.Bind(aLink2, TopoDS_Edge()); //indicates that one edge represented as two links
FillNode2LLMap(Node1, aLink1, mNode2ListOfLinks);
FillNode2LLMap(Node2, aLink2, mNode2ListOfLinks);
FillNode2LLMap(LastIndV, aLink1, mNode2ListOfLinks);
FillNode2LLMap(LastIndV, aLink2, mNode2ListOfLinks);
BRepFill_TangentLinkInfo* Info1 = mL2TI.Bound(aLink1, BRepFill_TangentLinkInfo());
Info1->myD1F = D1F;
Info1->myD1L = gp_Dir2d(1., 1.);
BRepFill_TangentLinkInfo* Info2 = mL2TI.Bound(aLink2, BRepFill_TangentLinkInfo());
Info2->myD1F = gp_Dir2d(1., 1.);
Info2->myD1L = D1L;
}
}
//DEBUG: print D1F
/*{
NCollection_DataMap<Standard_Integer, Poly_MakeLoops2D::ListOfLink>::Iterator it(mNode2ListOfLinks);
for (;it.More();it.Next())
{
int nK = it.Key();
Poly_MakeLoops2D::ListOfLink links = it.Value();
Poly_MakeLoops2D::ListOfLink::Iterator itl(links);
cout << "next:" << endl;
for (;itl.More();itl.Next())
{
BRepFill_TangentLinkInfo linfo = mL2TI(itl.Value());
cout << linfo.myD1F.X() << " " << linfo.myD1F.Y() << endl;
TopoDS_Edge eee = mL2E(itl.Value());
}
}
*/
//
BRepFill_PolyHelper helper(mL2TI, mNode2ListOfLinks);
Poly_MakeLoops2D aLoopMaker(1, &helper, NCollection_BaseAllocator::CommonBaseAllocator() );
for (NCollection_DataMap<Poly_MakeLoops2D::Link, TopoDS_Edge>::Iterator aMapIt (mL2E); aMapIt.More(); aMapIt.Next())
aLoopMaker.AddLink(aMapIt.Key());
aLoopMaker.Perform(); //try to find loops
Standard_Integer NbLoops = aLoopMaker.GetNbLoops();
Standard_Integer NbHangs = aLoopMaker.GetNbHanging();
cout << "NbLoops=" << NbLoops << endl;
cout << "NbHangs=" << NbHangs << endl;
// if (NbLoops == 0 || NbHangs != 0 )
// return Standard_False;
theLoops.Append(SelfLoops);
for (Standard_Integer i = 1; i <= NbLoops; i++) //loops to wires
{
Poly_MakeLoops2D::Loop aLoop = aLoopMaker.GetLoop(i);
Poly_MakeLoops2D::Loop::Iterator it(aLoop);
BRepBuilderAPI_MakeWire aWM;
Bnd_Box2d aWBox2d;
TopoDS_Edge E;
for (;it.More(); it.Next())
{
const Poly_MakeLoops2D::Link& Link = it.Value();
E = mL2E(Link);
if (Link.flags & Poly_MakeLoops2D::LF_Reversed)
E.Reverse();
//if null => probably this edge was passed as two links (based on the same edge); so skip this edge
if (!E.IsNull())
{
aWM.Add(E);
aWBox2d.Add(theEdBnd2d(E));
}
}
if (aWM.IsDone())
{
TopoDS_Wire W = aWM.Wire();
if (W.Closed())
{
theLoops.Append(W);
aShToBnd2d.Bind(W, aWBox2d);
}
}
}
//DEBUG
/* Poly_MakeLoops2D::ListOfLink theHLinks;
aLoopMaker.GetHangingLinks(theHLinks);
Poly_MakeLoops2D::ListOfLink::Iterator itt(theHLinks);
TopoDS_Compound cmpH;BRep_Builder().MakeCompound(cmpH);
for (; itt.More();itt.Next())
{
Poly_MakeLoops2D::Link alink = itt.Value();
const Poly_MakeLoops2D::Link& Link = itt.Value();
TopoDS_Edge E = mL2E(Link);
if (Link.flags & Poly_MakeLoops2D::LF_Reversed)
E.Reverse();
//if null => probably this edge was passed as two links (based on the same edge); so skip this edge
if (!E.IsNull())
BRep_Builder().Add(cmpH, E);
}*/
//
IntTools_Context context1;// = new IntTools_Context();
NCollection_List<TopoDS_Wire>::Iterator itL(theLoops);
NCollection_IndexedDataMap<TopoDS_Shape, double> lf1, lf2;
for (; itL.More(); itL.Next())
{
const TopoDS_Wire& aW = itL.Value();
if (aW.IsNull())
continue;
TopoDS_Face ff;
BRep_Builder().MakeFace(ff, BRepLib::Plane(), Precision::Confusion());
//plane is static; pcurves of edges are already based on this plane
BRep_Builder().Add(ff, aW);
aShToBnd2d(aW).Enlarge(0.001);
aShToBnd2d.Bind(ff, aShToBnd2d(aW)); //bndbox still the same
GProp_GProps pr;
BRepGProp::SurfaceProperties(ff, pr);
Standard_Real CurMass = pr.Mass();
if (Abs(CurMass) < 1e-10) //?? TODO
continue;
if (CurMass >= 0)
lf1.Add(ff, CurMass);
else
lf2.Add(ff, CurMass);
}
NCollection_IndexedDataMap<TopoDS_Face, NCollection_List<TopoDS_Face>> FaceToIntWires;
for (int i = 1; i <= lf1.Size() && !lf2.IsEmpty(); i++)
{
//NCollection_Handle<BRepTopAdaptor_FClass2d> fclass;
NCollection_Sequence<TopoDS_Face> intf;
const TopoDS_Face& ff1 = TopoDS::Face(lf1.FindKey(i));
for (int j=1;j<= lf2.Size();j++)
{
double pm = lf1.FindFromIndex(i);
double nm = lf2.FindFromIndex(j);
if (pm < -nm)
continue;
const TopoDS_Face& ff2 = TopoDS::Face(lf2.FindKey(j));
//if (!fclass)
// fclass = new BRepTopAdaptor_FClass2d(ff1, Precision::Confusion());
IntTools_FClass2d& fclass = context1.FClass2d(ff1);
Bnd_Box2d fbnd = aShToBnd2d(ff1);
TopAbs_State st = GetStateOfSamplePoint(ff2, fclass, fbnd);
if (st == TopAbs_IN)
intf.Append(ff2);
}
NCollection_Map<int> intfInd;
for (int i = 1; i<= intf.Size();i++)
{
if (intfInd.Contains(i))
continue;
//BRepTopAdaptor_FClass2d fclassInt(intf(i), Precision::Confusion());
IntTools_FClass2d& fclassInt = context1.FClass2d(intf(i));
Bnd_Box2d fbndi = aShToBnd2d(intf(i));
for (int j=1; j<= intf.Size();j++)
{
if (i==j)
continue;
if (intfInd.Contains(j))
continue;
TopAbs_State st = GetStateOfSamplePoint(intf(j), fclassInt, fbndi);
if (st == TopAbs_OUT) //note that intf-faces are holes
intfInd.Add(j);
}
}
FaceToIntWires.Add(ff1, NCollection_List<TopoDS_Face>());
NCollection_List<TopoDS_Face>& nl = FaceToIntWires.ChangeFromKey(ff1);
for (int i = 1; i<= intf.Size();i++)
{
if (intfInd.Contains(i))
continue;
nl.Append(intf(i));
}
}
TopoDS_Compound aResCmp;
BRep_Builder().MakeCompound(aResCmp);
TopTools_ListIteratorOfListOfShape itOrS(anOrigShapes);
TopTools_IndexedMapOfShape anOrigFaces;
for (;itOrS.More();itOrS.Next())
TopExp::MapShapes(itOrS.Value(), TopAbs_FACE, anOrigFaces);
NCollection_UBTree <Standard_Integer, Bnd_Box> aTreeFL;
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFillerFL (aTreeFL);
for (Standard_Integer i = 1; i <= anOrigFaces.Extent(); i++)
{
const TopoDS_Face& aF = TopoDS::Face(anOrigFaces(i));
Bnd_Box aBB;
BRepBndLib::Add(aF, aBB);
aTreeFillerFL.Add(i, aBB);
}
aTreeFillerFL.Fill();
HLRFL_BndBoxTreeSelector aSelFL(anOrigFaces, theMode);
for (int i = 1; i <= FaceToIntWires.Extent(); i++)
{
TopoDS_Face cf = FaceToIntWires.FindKey(i);
NCollection_List<TopoDS_Face>::Iterator it(FaceToIntWires.FindFromIndex(i));
for (;it.More();it.Next())
{
TopoDS_Face ff = it.Value();
TopoDS_Iterator it(ff);
TopoDS_Shape int_wire = it.Value();
BRep_Builder().Add(cf, int_wire);
}
gp_Pnt2d p2d;
gp_Pnt p3d;
TopExp_Explorer exp(cf, TopAbs_EDGE);
Handle(IntTools_Context) context = new IntTools_Context();
BOPTools_AlgoTools3D::PointNearEdge( TopoDS::Edge(exp.Current()), cf, p2d, p3d, context);
gp_Lin shot_line = projector.Shoot(p2d.X(), p2d.Y());
aSelFL.ResetResult();
aSelFL.SetLine( shot_line );
aTreeFL.Select(aSelFL);
std::vector<HLRFL_BndBoxTreeSelector::FaceParam> fp = aSelFL.GetRParams();
if (!fp.empty())
{
BRep_Builder().Add(aResCmp, cf);
if (theMode)
{
std::sort(fp.begin(), fp.end(), HLRBRep_ParComp);
OrigFaceToProjFace.Bind(cf, fp.front().myF);
}
}
}
//
return aResCmp;
}
TopoDS_Shape HLRBRep_HLRToShape::CompoundOfFaces(bool theMode,
TopTools_DataMapOfShapeShape& OrigFaceToProjFace)
{
//
TopTools_ListOfShape anOrigShapes;
const HLRBRep_SeqOfShapeBounds& aSeqOfShBnds = myAlgo->SeqOfShapeBounds();
for (int i=1; i<= aSeqOfShBnds.Size(); i++)
anOrigShapes.Append(aSeqOfShBnds(i).Shape()->OriginalShape());
//
TopoDS_Compound aTotalOSh;
BRep_Builder BB;
BB.MakeCompound(aTotalOSh);
TopoDS_Shape aSharpSh = InternalCompound(HLRBRep_Sharp, Standard_True, TopoDS_Shape(), Standard_False); //TODO check
if (!aSharpSh.IsNull())
BB.Add(aTotalOSh, aSharpSh);
TopoDS_Shape anOutLSh = InternalCompound(HLRBRep_OutLine, Standard_True, TopoDS_Shape(), Standard_False);
if (!anOutLSh.IsNull())
BB.Add(aTotalOSh, anOutLSh);
TopoDS_Shape aRg1Sh = InternalCompound(HLRBRep_Rg1Line, Standard_True, TopoDS_Shape(), Standard_False);
if (!aRg1Sh.IsNull())
BB.Add(aTotalOSh, aRg1Sh);
//
BRepLib::BuildCurves3d(aTotalOSh);
BRepLib::SameParameter(aTotalOSh, Precision::PConfusion(),Standard_False);
//
if( !FuseVE (aTotalOSh))
return TopoDS_Shape();
//
NCollection_DataMap<TopoDS_Edge, Bnd_Box2d, TopTools_ShapeMapHasher> theEdBnd2d;
NCollection_IndexedDataMap<TopoDS_Edge, BRepAdaptor_Curve2d, TopTools_ShapeMapHasher> anEdAd;
ProcessHVertices(aTotalOSh, anEdAd, theEdBnd2d);
//
TopoDS_Shape aRes = ProcessLoops(aTotalOSh, anEdAd, theEdBnd2d,
myAlgo->Projector(), anOrigShapes, theMode, OrigFaceToProjFace);
//
return aRes;
}

View File

@@ -25,7 +25,6 @@
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
#include <HLRBRep_TypeOfResultingEdge.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
class HLRBRep_Algo;
class TopoDS_Shape;
class HLRBRep_Data;
@@ -132,8 +131,6 @@ public:
const Standard_Boolean visible,
const Standard_Boolean In3d);
TopoDS_Shape CompoundOfFaces (bool theMode,
TopTools_DataMapOfShapeShape& OrigFaceToProjFace);
protected:

View File

@@ -39,7 +39,6 @@
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <OSD_Parallel.hxx>
//=======================================================================
// Function : Load
@@ -174,7 +173,7 @@ HLRBRep_ShapeToHLR::Load(const Handle(HLRTopoBRep_OutLiner)& S,
void
HLRBRep_ShapeToHLR::ExploreFace(const Handle(HLRTopoBRep_OutLiner)& S,
Handle(HLRBRep_Data)& DS,
const Handle(HLRBRep_Data)& DS,
const TopTools_IndexedMapOfShape& FM,
const TopTools_IndexedMapOfShape& EM,
Standard_Integer& i,
@@ -194,7 +193,7 @@ HLRBRep_ShapeToHLR::ExploreFace(const Handle(HLRTopoBRep_OutLiner)& S,
for (Ex1.Init(theFace, TopAbs_WIRE); Ex1.More(); Ex1.Next())
nw++;
fd.Set (theFace, orient, closed, nw, Standard_False);
fd.Set (theFace, orient, closed, nw);
nw = 0;
for (Ex1.Init(theFace, TopAbs_WIRE); Ex1.More(); Ex1.Next()) {
@@ -235,47 +234,15 @@ HLRBRep_ShapeToHLR::ExploreFace(const Handle(HLRTopoBRep_OutLiner)& S,
//purpose :
//=======================================================================
class ParallelSurfInitFunctor
{
public:
ParallelSurfInitFunctor(HLRBRep_Array1OfFData& theFaceDataArr, const TopTools_IndexedMapOfShape& theFM)
: myFaceDataArr (theFaceDataArr), myFM (theFM)
{
}
void operator() (const Standard_Integer theIndex) const
{
const TopoDS_Face& aF = TopoDS::Face(myFM(theIndex));
HLRBRep_FaceData& fd = myFaceDataArr.ChangeValue(theIndex);
fd.Geometry().Surface( TopoDS::Face(aF.Oriented (TopAbs_FORWARD)));
}
private:
ParallelSurfInitFunctor( const ParallelSurfInitFunctor& );
ParallelSurfInitFunctor& operator =( ParallelSurfInitFunctor& );
private:
HLRBRep_Array1OfFData& myFaceDataArr;
const TopTools_IndexedMapOfShape& myFM;
};
void
HLRBRep_ShapeToHLR::ExploreShape (const Handle(HLRTopoBRep_OutLiner)& S,
Handle(HLRBRep_Data)& DS,
const Handle(HLRBRep_Data)& DS,
const TopTools_IndexedMapOfShape& FM,
const TopTools_IndexedMapOfShape& EM)
{
TopTools_MapOfShape ShapeMap;
TopExp_Explorer exshell, exface, exedge;
Standard_Integer i = 1;
ParallelSurfInitFunctor aSurfFunctor(DS->FDataArray(), FM);
OSD_Parallel::For(1, FM.Extent() + 1, aSurfFunctor, Standard_False);
i = 0;
Standard_Integer i = 0;
for (exshell.Init (S->OriginalShape(), TopAbs_SHELL);
exshell.More ();
@@ -309,7 +276,7 @@ HLRBRep_ShapeToHLR::ExploreShape (const Handle(HLRTopoBRep_OutLiner)& S,
delete [] flag;
flag = NULL;
}
for (exface.Init(exshell.Current(), TopAbs_FACE);
exface.More();
exface.Next()) {

View File

@@ -57,9 +57,9 @@ protected:
private:
Standard_EXPORT static void ExploreFace (const Handle(HLRTopoBRep_OutLiner)& S, Handle(HLRBRep_Data)& DS, const TopTools_IndexedMapOfShape& FM, const TopTools_IndexedMapOfShape& EM, Standard_Integer& i, const TopoDS_Face& F, const Standard_Boolean closed);
Standard_EXPORT static void ExploreFace (const Handle(HLRTopoBRep_OutLiner)& S, const Handle(HLRBRep_Data)& DS, const TopTools_IndexedMapOfShape& FM, const TopTools_IndexedMapOfShape& EM, Standard_Integer& i, const TopoDS_Face& F, const Standard_Boolean closed);
Standard_EXPORT static void ExploreShape (const Handle(HLRTopoBRep_OutLiner)& S, Handle(HLRBRep_Data)& DS, const TopTools_IndexedMapOfShape& FM, const TopTools_IndexedMapOfShape& EM);
Standard_EXPORT static void ExploreShape (const Handle(HLRTopoBRep_OutLiner)& S, const Handle(HLRBRep_Data)& DS, const TopTools_IndexedMapOfShape& FM, const TopTools_IndexedMapOfShape& EM);

View File

@@ -62,109 +62,14 @@
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <HLRAlgo_Projector.hxx>
#include <Adaptor3d_HSurface.hxx>
#include <NCollection_Handle.hxx>
#include <BRepAdaptor_HSurface.hxx>
#include <OSD_Parallel.hxx>
#include <math_FunctionSetRoot.hxx>
#include <Adaptor3d_HSurfaceTool.hxx>
#include <NCollection_List.hxx>
struct ContourSurfInfo
{
ContourSurfInfo() : myDomain(NULL), mySurface(NULL)
{};
ContourSurfInfo(NCollection_Handle<Contap_Contour> theHFO,
const Handle(BRepTopAdaptor_TopolTool)& theDomain,
const Handle(Adaptor3d_HSurface) theSurface) :
myHFO(theHFO), myDomain (theDomain.get()), mySurface (theSurface.get())
{};
ContourSurfInfo& operator=( const ContourSurfInfo& otherSurfInfo)
{
myHFO = otherSurfInfo.myHFO;
myDomain = otherSurfInfo.myDomain;
mySurface = otherSurfInfo.mySurface;
return *this;
};
NCollection_Handle<Contap_Contour> myHFO;
const BRepTopAdaptor_TopolTool* myDomain;
const Adaptor3d_HSurface* mySurface;
};
struct BRTInfo
{
BRTInfo()
{};
BRTInfo(BRepTopAdaptor_Tool* thepBRT, ContourSurfInfo* theCSI, const TopoDS_Face& theF )
: mypBRT (thepBRT), myCSI (theCSI), myF (theF)
{};
BRepTopAdaptor_Tool* mypBRT;
ContourSurfInfo* myCSI;
TopoDS_Face myF;
};
class ParallelContourFunctor
{
public:
ParallelContourFunctor(NCollection_Array1<ContourSurfInfo>& theContourSurfInfo)
: myContourSurfInfo (theContourSurfInfo)
{
}
void operator() (const Standard_Integer theIndex) const
{
ContourSurfInfo& aCSInfo = myContourSurfInfo(theIndex);
aCSInfo.myHFO->Perform(aCSInfo.mySurface, aCSInfo.myDomain);
}
private:
ParallelContourFunctor( const ParallelContourFunctor& );
ParallelContourFunctor& operator =( ParallelContourFunctor& );
private:
NCollection_Array1<ContourSurfInfo>& myContourSurfInfo;
};
class ParallelBRTInitFunctor
{
public:
ParallelBRTInitFunctor(NCollection_Array1<BRTInfo>& theBRTInfo)
: myBRTInfo (theBRTInfo)
{
}
void operator() (const Standard_Integer theIndex) const
{
BRTInfo& BI = myBRTInfo(theIndex);
BI.mypBRT->Init(BI.myF,Precision::PConfusion());
BI.myCSI->myDomain = BI.mypBRT->GetTopolTool().get();
BI.myCSI->mySurface = BI.mypBRT->GetSurface().get();
}
private:
ParallelBRTInitFunctor( const ParallelBRTInitFunctor& );
ParallelBRTInitFunctor& operator =( ParallelBRTInitFunctor& );
private:
NCollection_Array1<BRTInfo>& myBRTInfo;
};
//=======================================================================
//function : Insert
//purpose : explore the faces and insert them
//=======================================================================
void HLRTopoBRep_DSFiller::Insert (const TopoDS_Shape& S,
const HLRAlgo_Projector& P,
const gp_Vec& Vecz,
Contap_Contour& FO,
HLRTopoBRep_Data& DS,
BRepTopAdaptor_MapOfShapeTool& MST,
const Standard_Integer nbIso)
@@ -173,135 +78,38 @@ void HLRTopoBRep_DSFiller::Insert (const TopoDS_Shape& S,
TopExp_Explorer ex(S,TopAbs_FACE);
DS.Clear();
Standard_Boolean withPCurve = Standard_True; // instead of nbIso != 0;
gp_Pnt Eye;
gp_Dir DirZ;
if (P.Perspective ())
Eye.SetXYZ (P.Focus ()*Vecz.XYZ ());
else
DirZ = Vecz;
NCollection_List<ContourSurfInfo> ContourSurfInfoList;
NCollection_List<BRTInfo> nonInitBRTs;
while (ex.More())
{
if (ShapeMap.Add(ex.Current()))
{
Standard_Integer f = 0;
while (ex.More()) {
if (ShapeMap.Add(ex.Current())) {
f++;
TopoDS_Face S1 = TopoDS::Face(ex.Current());
S1.Orientation(TopAbs_FORWARD);
//
NCollection_Handle<Contap_Contour> HFO = new Contap_Contour();
if (P.Perspective ())
HFO->Init(Eye);
else
HFO->Init(DirZ);
//
BRepTopAdaptor_Tool* pBRT = MST.ChangeSeek(S1);
if(pBRT)
{
ContourSurfInfo CSInfo(HFO, pBRT->GetTopolTool(), pBRT->GetSurface());
ContourSurfInfoList.Append(CSInfo);
Handle(BRepTopAdaptor_TopolTool) Domain;
Handle(Adaptor3d_HSurface) Surface;
if(MST.IsBound(S1)) {
BRepTopAdaptor_Tool& BRT = MST.ChangeFind(S1);
Domain = BRT.GetTopolTool();
Surface = BRT.GetSurface();
}
else
{
pBRT = MST.Bound(S1,BRepTopAdaptor_Tool());
BRTInfo& brtI = nonInitBRTs.Append(BRTInfo());
brtI.mypBRT = pBRT;
brtI.myCSI = &ContourSurfInfoList.Append(ContourSurfInfo(HFO, NULL, NULL));
brtI.myF = S1;
else {
BRepTopAdaptor_Tool BRT(S1,Precision::PConfusion());
MST.Bind(S1,BRT);
Domain = BRT.GetTopolTool();
Surface = BRT.GetSurface();
}
FO.Perform(Surface, Domain);
if (FO.IsDone()) {
if (!FO.IsEmpty())
InsertFace(f,S1,FO,DS,withPCurve);
}
if (nbIso != 0) HLRTopoBRep_FaceIsoLiner::Perform(f,S1,DS,nbIso);
}
ex.Next();
}
//
NCollection_List<BRTInfo>::Iterator itBRTIt(nonInitBRTs);
NCollection_Array1<BRTInfo> nonInitBRTArr(1, nonInitBRTs.Extent());
Standard_Integer f = 1;
for (;itBRTIt.More();itBRTIt.Next(), f++)
nonInitBRTArr(f) = itBRTIt.Value();
ParallelBRTInitFunctor aBRTFunctor(nonInitBRTArr);
OSD_Parallel::For(nonInitBRTArr.Lower(), nonInitBRTArr.Upper() + 1, aBRTFunctor, Standard_False);
//
NCollection_List<ContourSurfInfo>::Iterator itCS(ContourSurfInfoList);
int nbC = ContourSurfInfoList.Extent();
f = 1;
NCollection_Array1<ContourSurfInfo> aContourSurfInfoArray(1, nbC);
for (;itCS.More();itCS.Next(), f++)
aContourSurfInfoArray(f) = itCS.Value();
//
ParallelContourFunctor aContourFunctor(aContourSurfInfoArray);
OSD_Parallel::For(aContourSurfInfoArray.Lower(), aContourSurfInfoArray.Upper() + 1, aContourFunctor, Standard_False);
//
for (f = aContourSurfInfoArray.Lower(); f <= aContourSurfInfoArray.Upper(); f++)
{
ContourSurfInfo& CSInfo = aContourSurfInfoArray(f);
Handle(BRepAdaptor_HSurface) BrepSurf = Handle(BRepAdaptor_HSurface)::DownCast(CSInfo.mySurface);
const TopoDS_Face& S1 = BrepSurf->ChangeSurface().Face();
if (CSInfo.myHFO->IsDone())
if (!CSInfo.myHFO->IsEmpty())
InsertFace(f,S1,*CSInfo.myHFO, CSInfo.myDomain, DS,withPCurve);
if (nbIso != 0)
HLRTopoBRep_FaceIsoLiner::Perform(f,S1,DS,nbIso);
}
//
ProcessEdges(DS);
}
static void GetSurfInfo(const Handle(Adaptor3d_HSurface)& Surf, math_Vector& tol,
math_Vector& inf, math_Vector& sup)
{
tol(1) = Adaptor3d_HSurfaceTool::UResolution(Surf,Precision::Confusion());
tol(2) = Adaptor3d_HSurfaceTool::VResolution(Surf,Precision::Confusion());
inf(1) = Adaptor3d_HSurfaceTool::FirstUParameter(Surf);
inf(2) = Adaptor3d_HSurfaceTool::FirstVParameter(Surf);
sup(1) = Adaptor3d_HSurfaceTool::LastUParameter(Surf);
sup(2) = Adaptor3d_HSurfaceTool::LastVParameter(Surf);
}
//=======================================================================
//function : ClarifyPoint
//purpose : p2d - point to clarify, p2d corresponds to the clarifying 2d point on surface Surf
//=======================================================================
static bool ClarifyPoint(math_FunctionSetRoot& rsnld, Contap_SurfFunction& SFunc,
const BRepTopAdaptor_TopolTool* Domain, math_Vector& inf, math_Vector& sup,
gp_Pnt2d& P2d, gp_Pnt& p3d)
{
math_Vector StartP(1,2);
StartP.Value(1) = P2d.X() ;
StartP.Value(2) = P2d.Y();
rsnld.Perform(SFunc,StartP,inf,sup);
if (rsnld.IsDone())
{
math_Vector Sol(1,2);
math_Vector F(1,1);
rsnld.Root(Sol);
SFunc.Value(Sol,F);
if (Abs(F(1)) <= SFunc.Tolerance())
{
P2d.SetCoord(Sol(1), Sol(2));
TopAbs_State state = const_cast<BRepTopAdaptor_TopolTool*>(Domain)
->Classify(P2d,Precision::PConfusion());
if (state == TopAbs_IN || state == TopAbs_ON)
{
const Handle(Adaptor3d_HSurface)& Surf = SFunc.Surface();
p3d = Adaptor3d_HSurfaceTool::Value(Surf,P2d.X(),P2d.Y());
return true;
}
}
}
return false;
}
//=======================================================================
//function : InsertFace
//purpose : private, insert the outlines of a face
@@ -309,7 +117,7 @@ static bool ClarifyPoint(math_FunctionSetRoot& rsnld, Contap_SurfFunction& SFunc
void HLRTopoBRep_DSFiller::InsertFace (const Standard_Integer /*FI*/,
const TopoDS_Face& F,
Contap_Contour& FO, const BRepTopAdaptor_TopolTool* Domain,
Contap_Contour& FO,
HLRTopoBRep_Data& DS,
const Standard_Boolean withPCurve)
{
@@ -531,8 +339,7 @@ void HLRTopoBRep_DSFiller::InsertFace (const Standard_Integer /*FI*/,
Maxx=Maxy=Maxz=Maxu=Maxv=-RealLast();
Minx=Miny=Minz=Minu=Minv=RealLast();
for(Standard_Integer i=1;i<=nbp;i++)
{
for(Standard_Integer i=1;i<=nbp;i++) {
knots.SetValue(i,(Standard_Real)i);
mults.SetValue(i,1);
const gp_Pnt& P= Line.Point(i+ipF-1).Value();
@@ -545,30 +352,29 @@ void HLRTopoBRep_DSFiller::InsertFace (const Standard_Integer /*FI*/,
Points.SetValue(i,P);
}
mults(1)=mults(nbp)=2;
//Handle(Geom_BSplineCurve) AppC;
//Handle(Geom2d_BSplineCurve) AppC2d;
//AppC = new Geom_BSplineCurve(Points,knots,mults,1);
Handle(Geom_BSplineCurve) AppC;
Handle(Geom2d_BSplineCurve) AppC2d;
AppC = new Geom_BSplineCurve(Points,knots,mults,1);
TColgp_Array1OfPnt2d Points2d(1,nbp);
for(Standard_Integer i=1;i<=nbp;i++)
{
Standard_Real u,v;
Line.Point(i+ipF-1).ParametersOnS2(u,v);
if(u<Minu) Minu=u;
if(v<Minv) Minv=v;
if(u>Maxu) Maxu=u;
if(v>Maxv) Maxv=v;
Points2d.SetValue(i,gp_Pnt2d(u,v));
if(withPCurve) {
TColgp_Array1OfPnt2d Points2d(1,nbp);
for(Standard_Integer i=1;i<=nbp;i++) {
Standard_Real u,v;
Line.Point(i+ipF-1).ParametersOnS2(u,v);
if(u<Minu) Minu=u;
if(v<Minv) Minv=v;
if(u>Maxu) Maxu=u;
if(v>Maxv) Maxv=v;
Points2d.SetValue(i,gp_Pnt2d(u,v));
}
AppC2d = new Geom2d_BSplineCurve(Points2d,knots,mults,1);
}
//AppC2d = new Geom2d_BSplineCurve(Points2d,knots,mults,1);
first = 1;
last = nbp;
//Handle(BRepApprox_ApproxLine) AppLine;
Handle(BRepApprox_ApproxLine) AppLine;
Handle(Geom2d_BSplineCurve) CNull;
//AppLine = new BRepApprox_ApproxLine(AppC,AppC2d,CNull);
AppLine = new BRepApprox_ApproxLine(AppC,AppC2d,CNull);
Standard_Integer dmin=4,dmax=8,niter=0;
Standard_Boolean tg= Standard_False;
@@ -583,140 +389,14 @@ void HLRTopoBRep_DSFiller::InsertFace (const Standard_Integer /*FI*/,
TOL3d=TOL*Maxx; if(TOL3d<1e-12) TOL3d=1e-12; else if(TOL3d>0.1) TOL3d=0.1;
TOL2d=TOL*Maxu; if(TOL2d<1e-12) TOL2d=1e-12; else if(TOL2d>0.1) TOL2d=0.1;
Contap_SurfFunction& SFunc = FO.SurfaceFunction();
const Handle(Adaptor3d_HSurface)& Surf = SFunc.Surface();
double cmax = 2.0;
double c = 100;
int newsize;
NCollection_List<gp_Pnt2d> lp2d;
NCollection_List<gp_Pnt> lp;
lp2d.Append(Points2d.First());
lp.Append(Points.First());
for (int jj=2; jj < Points.Size(); jj++ )
{
gp_Pnt curPnt = Points(jj);
gp_Pnt2d curPnt2d = Points2d(jj);
double d3_1 = lp.Last().Distance(curPnt);
double d3_2 = curPnt.Distance(Points(jj+1));
double d1 = lp2d.Last().Distance(Points2d(jj));
double d2 = Points2d(jj).Distance(Points2d(jj+1));
double x0 = curPnt2d.X();
double y0 = curPnt2d.Y();
double coeff = d3_1/d3_2;
c = 1.4;
if (coeff > cmax)
{
//left is wider
double t = 1;
double x1 = lp2d.Last().X();
double y1 = lp2d.Last().Y();
NCollection_List<gp_Pnt2d> dp;
NCollection_List<gp_Pnt> dp3d;
math_Vector tol(1,2), inf(1,2), sup(1,2);
GetSurfInfo(Surf, tol, inf, sup);
math_FunctionSetRoot rsnld(SFunc,tol,50);
for (;;)
{
t = 1 - d2/d1*c;
if (t <= 0)
break;
gp_Pnt2d pnt;
double Xt = x0 + (x1-x0)*t;
double Yt = y0 + (y1-y0)*t;
c=c*c;
gp_Pnt2d draft2d(Xt, Yt);
gp_Pnt draft3d;
//
if (ClarifyPoint(rsnld, SFunc, Domain, inf, sup, draft2d, draft3d))
{
lp2d.Append(dp);
lp.Append(dp3d);
}
}
//
lp2d.Append(curPnt2d);
lp.Append(curPnt);
}
else if (1/coeff > cmax )
{
//right is wider
double t = 0;
lp2d.Append(curPnt2d);
lp.Append(curPnt);
double x1 = Points2d(jj+1).X();
double y1 = Points2d(jj+1).Y();
math_Vector tol(1,2), inf(1,2), sup(1,2);
GetSurfInfo(Surf, tol, inf, sup);
math_FunctionSetRoot rsnld(SFunc,tol,50);
for (;;)
{
t = d1/d2*c;
if (t >= 1)
break;
gp_Pnt2d pnt;
double Xt = x0 + (x1-x0)*t;
double Yt = y0 + (y1-y0)*t;
c=c*c;
gp_Pnt2d draft2d(Xt, Yt);
gp_Pnt draft3d;
//
if (ClarifyPoint(rsnld, SFunc, Domain, inf, sup, draft2d, draft3d))
{
lp.Append(draft3d);
lp2d.Append(draft2d);
}
}
}
else
{
lp2d.Append(curPnt2d);
lp.Append(curPnt);
}
}
lp2d.Append(Points2d.Last());
lp.Append(Points.Last());
//
newsize = lp.Size();
TColgp_Array1OfPnt2d newPoints2dA(1,newsize);
TColgp_Array1OfPnt newPoints3dA(1,newsize);
TColStd_Array1OfReal nknots(1,newsize);
TColStd_Array1OfInteger nmults(1,newsize);
NCollection_List<gp_Pnt>::Iterator itl(lp);
NCollection_List<gp_Pnt2d>::Iterator itl2(lp2d);
for (int jj = 1;itl.More(), itl2.More();itl.Next(), itl2.Next(), jj++)
{
nknots.SetValue(jj,(Standard_Real)jj);
nmults.SetValue(jj,1);
newPoints2dA.SetValue(jj, itl2.Value());
newPoints3dA.SetValue(jj, itl.Value());
}
nmults(1)=nmults(newsize)=2;
Handle_BRepApprox_ApproxLine nAppLine ;
Handle(Geom_BSplineCurve) nAppC =
new Geom_BSplineCurve(newPoints3dA,nknots,nmults,1);
Handle(Geom2d_BSplineCurve) nAppC2d=
new Geom2d_BSplineCurve(newPoints2dA,nknots,nmults,1);
nAppLine = new BRepApprox_ApproxLine(nAppC,nAppC2d,CNull);
//AppC2d = new Geom2d_BSplineCurve(Points2d,knots,mults,1);
//-- cout<<"\nHLRTopoBRep_DSFiller : nbp="<<nbp<<" Tol3d="<<TOL3d<<" Tol2d="<<TOL2d<<endl;
Approx.SetParameters(TOL3d, TOL2d, dmin, dmax, niter, 30, tg);
Approx.Perform(nAppLine,Standard_True,Standard_True,Standard_False,1,newsize/*nbp*/);
Approx.Perform(AppLine,Standard_True,Standard_True,Standard_False,1,nbp);
if (!Approx.IsDone()) {
C = nAppC;
C2d=nAppC2d;
C = AppC;
C2d=AppC2d;
first = 1;
last = nbp;
}

View File

@@ -32,7 +32,6 @@ class TopoDS_Face;
class TopoDS_Vertex;
class Contap_Point;
class TopoDS_Edge;
class HLRAlgo_Projector;
//! Provides methods to fill a HLRTopoBRep_Data.
@@ -45,7 +44,7 @@ public:
//! Stores in <DS> the outlines of <S> using the current
//! outliner and stores the isolines in <DS> using a Hatcher.
Standard_EXPORT static void Insert (const TopoDS_Shape& S,const HLRAlgo_Projector& P, const gp_Vec& Vecz, HLRTopoBRep_Data& DS, BRepTopAdaptor_MapOfShapeTool& MST, const Standard_Integer nbIso);
Standard_EXPORT static void Insert (const TopoDS_Shape& S, Contap_Contour& FO, HLRTopoBRep_Data& DS, BRepTopAdaptor_MapOfShapeTool& MST, const Standard_Integer nbIso);
@@ -61,8 +60,7 @@ private:
//! Stores in <DS> the outlines of <F> using the current
//! outliner.
Standard_EXPORT static void InsertFace (const Standard_Integer FI, const TopoDS_Face& F, Contap_Contour& FO,
const BRepTopAdaptor_TopolTool* Domain, HLRTopoBRep_Data& DS, const Standard_Boolean withPCurve);
Standard_EXPORT static void InsertFace (const Standard_Integer FI, const TopoDS_Face& F, Contap_Contour& FO, HLRTopoBRep_Data& DS, const Standard_Boolean withPCurve);
//! Make a vertex from an intersection point <P>and
//! store it in the data structure <DS>.

View File

@@ -82,7 +82,17 @@ void HLRTopoBRep_OutLiner::Fill(const HLRAlgo_Projector& P,
gp_Trsf Tr (P.Transformation ());
Tr.Invert ();
Vecz.Transform (Tr);
HLRTopoBRep_DSFiller::Insert(myOriginalShape,P,Vecz,myDS,MST,nbIso);
Contap_Contour FO;
if (P.Perspective ()) {
gp_Pnt Eye;
Eye.SetXYZ (P.Focus ()*Vecz.XYZ ());
FO.Init(Eye);
}
else {
gp_Dir DirZ(Vecz);
FO.Init(DirZ);
}
HLRTopoBRep_DSFiller::Insert(myOriginalShape,FO,myDS,MST,nbIso);
BuildShape(MST);
}
}

View File

@@ -1584,7 +1584,6 @@ static Standard_Integer OCC26930(Draw_Interpretor& theDI,
//function : OCC27341
//purpose : check exact HLR algorighm's work
//=======================================================================
#include <OSD_Timer.hxx>
static Standard_Integer OCC27341 (Draw_Interpretor& , Standard_Integer n, const char** a)
{
if (n != 4)
@@ -1644,11 +1643,7 @@ static Standard_Integer OCC27341 (Draw_Interpretor& , Standard_Integer n, const
anOrigin.X(), anOrigin.Y(), anOrigin.Z(),
aDX.X(), aDX.Y(), aDX.Z());
OSD_Timer aTimer;
aTimer.Start();
Reflector.Perform();
aTimer.Stop();
aTimer.Show();
TopoDS_Compound Result;
BRep_Builder BB;
@@ -1663,86 +1658,12 @@ static Standard_Integer OCC27341 (Draw_Interpretor& , Standard_Integer n, const
TopoDS_Shape SmoothEdges = Reflector.GetCompoundOf3dEdges(HLRBRep_Rg1Line, Standard_True, Standard_False);
if (!SmoothEdges.IsNull())
BB.Add(Result, SmoothEdges);
DBRep::Set(a[1], Result);
return 0;
}
//=======================================================================
//function : OCC28991
//purpose :
//=======================================================================
static Standard_Integer OCC28991 (Draw_Interpretor& , Standard_Integer n, const char** a)
{
if (n != 4)
{
cout << "Use: OCC28991 res shape axo/top/bottom/front/back/left/right" << endl;
return 1;
}
TopoDS_Shape aShape = DBRep::Get(a[2]);
if (aShape.IsNull())
return 1;
gp_Pnt anOrigin(0.,0.,0.);
gp_Dir aNormal(0.57735026918962573, -0.57735026918962573, 0.57735026918962573);
gp_Ax2 anAxes(anOrigin, aNormal);
gp_Dir aDX = anAxes.XDirection();
HLRAppli_ReflectLines Reflector(aShape);
if (strcmp(a[3],"axo") == 0)
{
aNormal.SetCoord(0.57735026918962573, -0.57735026918962573, 0.57735026918962573);
aDX.SetCoord(-0.40824829046386307, 0.40824829046386307, 0.81649658092772615);
}
else if (strcmp(a[3],"top") == 0)
{
aNormal.SetCoord(0,0,1);
aDX.SetCoord(0,1,0);
}
else if (strcmp(a[3],"bottom") == 0)
{
aNormal.SetCoord(0,0,-1);
aDX.SetCoord(0,-1,0);
}
else if (strcmp(a[3],"front") == 0)
{
aNormal.SetCoord(0,-1,0);
aDX.SetCoord(0,0,1);
}
else if (strcmp(a[3],"back") == 0)
{
aNormal.SetCoord(0,1,0);
aDX.SetCoord(0,0,1);
}
else if (strcmp(a[3],"left") == 0)
{
aNormal.SetCoord(-1,0,0);
aDX.SetCoord(0,0,1);
}
else if (strcmp(a[3],"right") == 0)
{
aNormal.SetCoord(1,0,0);
aDX.SetCoord(0,0,1);
}
Reflector.SetAxes(aNormal.X(), aNormal.Y(), aNormal.Z(),
anOrigin.X(), anOrigin.Y(), anOrigin.Z(),
aDX.X(), aDX.Y(), aDX.Z());
Reflector.Perform();
TopTools_DataMapOfShapeShape aDummy;
TopoDS_Shape aFaces = Reflector.GetCompoundOfFaces(true, aDummy);
DBRep::Set(a[1], aFaces);
return 0;
}
//=======================================================================
//function : OCC27466
//purpose :
@@ -2526,9 +2447,6 @@ void QABugs::Commands_20(Draw_Interpretor& theCommands) {
theCommands.Add("OCC27341",
"OCC27341 res shape axo/top/bottom/front/back/left/right",
__FILE__, OCC27341, group);
theCommands.Add("OCC28991",
"OCC289911 res shape axo/top/bottom/front/back/left/right",
__FILE__, OCC28991, group);
theCommands.Add ("OCC26747_1", "OCC26747_1 result", __FILE__, OCC26747_1, group);
theCommands.Add ("OCC26747_2", "OCC26747_2 result", __FILE__, OCC26747_2, group);
theCommands.Add ("OCC26747_3", "OCC26747_3 result", __FILE__, OCC26747_3, group);

View File

@@ -6,4 +6,3 @@ TKG2d
TKG3d
TKGeomAlgo
TKTopAlgo
TKBO