#include <Adaptor2d_HCurve2d.hxx>
#include <Adaptor3d_HSurface.hxx>
#include <Adaptor3d_HVertex.hxx>
+#include <BRepAdaptor_HCurve2d.hxx>
#include <BRep_Tool.hxx>
+#include <BRepTools.hxx>
#include <BRepBlend_BlendTool.hxx>
#include <BRepBlend_HCurve2dTool.hxx>
#include <BRepClass_FaceClassifier.hxx>
Ufirst = BRepBlend_HCurve2dTool::FirstParameter(A);
Ulast = BRepBlend_HCurve2dTool::LastParameter(A);
}
+
+//=======================================================================
+//function : IsSeam
+//purpose :
+//=======================================================================
+Standard_Boolean BRepBlend_BlendTool::IsSeam(const Handle(Adaptor2d_HCurve2d)& C)
+{
+ Handle(BRepAdaptor_HCurve2d) brhc =
+ Handle(BRepAdaptor_HCurve2d)::DownCast(C);
+
+ if (brhc.IsNull())
+ return Standard_False;
+
+ return BRepTools::IsReallyClosed(((BRepAdaptor_Curve2d *)&(brhc->Curve2d()))->Edge(),
+ ((BRepAdaptor_Curve2d *)&(brhc->Curve2d()))->Face());
+}
//! or a bounding box for an infinite arc.
Standard_EXPORT static void Bounds (const Handle(Adaptor2d_HCurve2d)& C, Standard_Real& Ufirst, Standard_Real& Ulast);
+ //! Returns the status of edge:
+ //! is it a seam edge or not
+ Standard_EXPORT static Standard_Boolean IsSeam (const Handle(Adaptor2d_HCurve2d)& C);
+
static Handle(Adaptor2d_HCurve2d) CurveOnSurf (const Handle(Adaptor2d_HCurve2d)& C, const Handle(Adaptor3d_HSurface)& S);
lastpt2d.SetCoord(uprev,vprev);
Iter->Init();
while (Iter->More()) {
+
nbarc++; ok = 0;
+
+ if (TheBlendTool::IsSeam(Iter->Value()))
+ {
+ Iter->Next();
+ continue;
+ }
+
if (OnFirst) {
if(byinter) {
ok = okinter = TheBlendTool::Inters(pt2d,lastpt2d,
rsnld.Root(sol);
if(clasonS1) situ1 = domain1->Classify(gp_Pnt2d(sol(1),sol(2)),
- Min(tolerance(1),tolerance(2)),0);
+ Min(tolerance(1),tolerance(2)),Standard_True/*0*/);
else situ1 = TopAbs_IN;
if(clasonS2) situ2 = domain2->Classify(gp_Pnt2d(sol(3),sol(4)),
- Min(tolerance(3),tolerance(4)),0);
+ Min(tolerance(3),tolerance(4)),Standard_True/*0*/);
else situ2 = TopAbs_IN;
}
if(bonpoint && line->NbPoints() == 1 && (situ1 != TopAbs_IN || situ2 != TopAbs_IN)){
const TopoDS_Face& theFace2,
const GeomAbs_Shape Order)
{
- if (Order == GeomAbs_G1 && BRep_Tool::Continuity(theEdge, theFace1, theFace2) != GeomAbs_C0)
+ if (Order > GeomAbs_C0 &&
+ BRep_Tool::Continuity( theEdge, theFace1, theFace2 ) >= Order)
return Standard_True;
Standard_Real TolC0 = Max(0.001, 1.5*BRep_Tool::Tolerance(theEdge));
#include <ChFiDS_Stripe.hxx>
#include <ChFiDS_SurfData.hxx>
#include <Geom2d_Curve.hxx>
+#include <Geom2d_Line.hxx>
+#include <GCE2d_MakeLine.hxx>
#include <Geom_Surface.hxx>
#include <gp_Pnt2d.hxx>
#include <Precision.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
+//#include <BRepAlgoAPI_Fuse.hxx>
+#include <BOPAlgo_Builder.hxx>
#include <TopOpeBRepBuild_HBuilder.hxx>
#include <TopOpeBRepDS_BuildTool.hxx>
#include <TopOpeBRepDS_Curve.hxx>
#include <TopOpeBRepDS_PointIterator.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
+#include <TopTools_MapOfOrientedShape.hxx>
+#include <BRepTools_ReShape.hxx>
+#include <BRepTools.hxx>
#ifdef OCCT_DEBUG
#include <OSD_Chronometer.hxx>
#endif
+//=======================================================================
+//function : NearestWholePeriod
+//purpose :
+//=======================================================================
+
+Standard_Real NearestWholePeriod(const Standard_Real theValue,
+ const Standard_Real thePeriod,
+ const Standard_Boolean theFromBelow)
+{
+ Standard_Real Result = 0.;
+ Standard_Real Sign = (theValue < 0.)? -1 : 1;
+
+ while (Abs(Result - theValue) > thePeriod)
+ Result += Sign * thePeriod;
+
+ if (Result > theValue && theFromBelow)
+ Result -= thePeriod;
+
+ return Result;
+}
+
+//=======================================================================
+//function : FindPeriod
+//purpose :
+//=======================================================================
+
+Standard_Real FindPeriod(const TopoDS_Face& theFace,
+ const Standard_Boolean theIsUdirection)
+{
+ Standard_Real aPeriod = 0.;
+
+ BRepAdaptor_Surface BAsurf(theFace, Standard_False);
+ if (theIsUdirection)
+ {
+ if (BAsurf.IsUPeriodic())
+ aPeriod = BAsurf.UPeriod();
+ else
+ {
+ Standard_Real Umin = BAsurf.FirstUParameter(),
+ Umax = BAsurf.LastUParameter();
+ aPeriod = Umax - Umin;
+ }
+ }
+ else
+ {
+ //temporary
+ }
+
+ return aPeriod;
+}
+
+//=======================================================================
+//function : ContainsEdge
+//purpose :
+//=======================================================================
+
+Standard_Boolean ContainsEdge(const TopoDS_Shape& theShape,
+ const TopoDS_Shape& theEdge)
+{
+ TopExp_Explorer Explo(theShape, TopAbs_EDGE);
+ for (; Explo.More(); Explo.Next())
+ {
+ const TopoDS_Shape& anEdge = Explo.Current();
+ if (anEdge.IsSame(theEdge))
+ return Standard_True;
+ }
+
+ return Standard_False;
+}
+
+//=======================================================================
+//function : FindProperSubShape
+//purpose :
+//=======================================================================
+
+TopoDS_Shape FindProperSubShape(const TopoDS_Shape& theNewFace,
+ const TopoDS_Shape& theShape)
+{
+ TopoDS_Shape NullShape;
+
+ TopTools_IndexedMapOfShape Emap;
+ TopExp::MapShapes(theNewFace, TopAbs_EDGE, Emap);
+
+ TopoDS_Iterator iter(theShape);
+ for (; iter.More(); iter.Next())
+ {
+ const TopoDS_Shape& aShape = iter.Value();
+ if (aShape.ShapeType() == TopAbs_FACE)
+ {
+ TopExp_Explorer Explo(aShape, TopAbs_EDGE);
+ for (; Explo.More(); Explo.Next())
+ {
+ const TopoDS_Shape& anEdge = Explo.Current();
+ if (Emap.Contains(anEdge))
+ return theShape;
+ }
+ }
+ else
+ {
+ TopoDS_Shape aResult = FindProperSubShape(theNewFace, aShape);
+ if (!aResult.IsNull())
+ return aResult;
+ }
+ }
+
+ return NullShape;
+}
+
+//=======================================================================
+//function : DeleteEdgesFromMap
+//purpose :
+//=======================================================================
+
+void DeleteEdgesFromMap(TopTools_IndexedDataMapOfShapeListOfShape& theVEmap,
+ const TopTools_SequenceOfShape& theEdges,
+ //const TopoDS_Edge& theCurEdge,
+ const TopoDS_Edge& theNextEdge,
+ const TopoDS_Vertex& theVertex,
+ const Standard_Integer theIndOr)
+{
+ for (Standard_Integer i = 1; i <= theEdges.Length(); i++)
+ {
+ const TopoDS_Edge& anEdge = TopoDS::Edge(theEdges(i));
+ if (anEdge == theNextEdge)
+ continue;
+ TopoDS_Vertex VV [2];
+ TopExp::Vertices(anEdge, VV[0], VV[1], Standard_True);
+ if (VV[theIndOr].IsSame(theVertex))
+ {
+ //theDeletedEdges.Append(anEdge);
+ for (Standard_Integer j = 1; j <= theVEmap.Extent(); j++)
+ {
+ TopoDS_Vertex aVertex = TopoDS::Vertex(theVEmap.FindKey(j));
+ TopTools_ListIteratorOfListOfShape itl(theVEmap(j));
+ for (; itl.More(); itl.Next())
+ {
+ if (anEdge == itl.Value())
+ {
+ theVEmap(j).Remove(itl);
+ break;
+ }
+ }
+ }
+ }
+ }
+}
+
+//=======================================================================
+//function : BuildNewWire
+//purpose :
+//=======================================================================
+
+TopoDS_Wire BuildNewWire(const TopoDS_Wire& theWire,
+ TopTools_IndexedDataMapOfShapeListOfShape& theVEmap,
+ //const TopoDS_Compound& theNewEdges,
+ const TopTools_IndexedMapOfShape& theNewEdges,
+ const TopoDS_Face& theFace)
+{
+ //Temporary
+ BRep_Builder BB;
+ TopoDS_Compound aNE;
+ BB.MakeCompound(aNE);
+ for (Standard_Integer ind = 1; ind <= theNewEdges.Extent(); ind++)
+ {
+ const TopoDS_Shape& aNewEdge = theNewEdges(ind);
+ BB.Add(aNE, aNewEdge);
+ }
+ ///////////
+
+ Standard_Boolean Uclosed, Vclosed;
+ Standard_Real Uperiod = 0., Vperiod = 0.;
+ BRepTools::DetectClosedness(theFace, Uclosed, Vclosed);
+ if (Uclosed)
+ Uperiod = FindPeriod(theFace, Standard_True);
+ if (Vclosed)
+ Vperiod = FindPeriod(theFace, Standard_False);
+
+ TopTools_IndexedMapOfShape OldVertices;
+ TopExp::MapShapes(theWire, TopAbs_VERTEX, OldVertices);
+ //TopExp::MapShapes(theNewEdges, TopAbs_EDGE, NewEdges);
+
+ //Find <StartEdge>, <StartVertex> and calculate minimum distance
+ //between extremities of edge in 2d
+ TopoDS_Vertex StartVertex;
+ TopoDS_Edge StartEdge, SecondEdge;
+ Standard_Real MinDist = RealLast();
+ TopTools_ListIteratorOfListOfShape itl;
+ TopTools_MapOfOrientedShape Emap;
+ for (Standard_Integer i = 1; i <= OldVertices.Extent(); i++)
+ {
+ TopoDS_Vertex aVertex = TopoDS::Vertex(OldVertices(i));
+ const TopTools_ListOfShape& Elist = theVEmap.FindFromKey(aVertex);
+ for (itl.Initialize(Elist); itl.More(); itl.Next())
+ {
+ const TopoDS_Edge& anEdge = TopoDS::Edge(itl.Value());
+ if (!Emap.Add(anEdge))
+ continue;
+ if (StartEdge.IsNull() &&
+ theNewEdges.Contains(anEdge))
+ {
+ //StartEdge = anEdge;
+ Standard_Integer anIndex = theNewEdges.FindIndex(anEdge);
+ StartEdge = TopoDS::Edge(theNewEdges(anIndex));
+ StartVertex = aVertex;
+ }
+ BRepAdaptor_Curve2d BAcurve(anEdge, theFace);
+ gp_Pnt2d aFirstPoint = BAcurve.Value(BAcurve.FirstParameter());
+ gp_Pnt2d aLastPoint = BAcurve.Value(BAcurve.LastParameter());
+ Standard_Real aDist = aFirstPoint.SquareDistance(aLastPoint);
+ if (aDist < MinDist)
+ MinDist = aDist;
+ }
+ }
+
+ if (StartEdge.IsNull())
+ return theWire;
+
+ TopoDS_Wire NewWire;
+ //BRep_Builder BB;
+ BB.MakeWire(NewWire);
+
+ BB.Add(NewWire, StartEdge);
+
+ //Define the direction of loop: forward or reversed
+ TopAbs_Orientation Direction;
+ Standard_Integer IndOr;
+ //Here and further orientation of edge is taken into account
+ TopoDS_Vertex V1 = TopExp::FirstVertex(StartEdge, Standard_True);
+ if (V1.IsSame(StartVertex))
+ {
+ Direction = TopAbs_FORWARD;
+ IndOr = 0;
+ }
+ else
+ {
+ Direction = TopAbs_REVERSED;
+ IndOr = 1;
+ }
+
+ BRepAdaptor_Curve2d StartBAcurve(StartEdge, theFace);
+ Standard_Real StartParam = BRep_Tool::Parameter(StartVertex, StartEdge);
+ gp_Pnt2d StartPoint = StartBAcurve.Value(StartParam);
+
+ //Find second edge;
+ TopTools_SequenceOfShape Candidates; //, DeletedEdges;
+ TopoDS_Vertex VV [2];
+
+ //Main loop
+ TopoDS_Edge CurEdge = StartEdge, PrevEdge;
+ TopoDS_Vertex CurVertex = (Direction == TopAbs_FORWARD)?
+ TopExp::LastVertex(CurEdge, Standard_True) :
+ TopExp::FirstVertex(CurEdge, Standard_True);
+ BRepAdaptor_Curve2d CurCurve(CurEdge, theFace);
+ Standard_Real CurParam = BRep_Tool::Parameter(CurVertex, CurEdge);
+ gp_Pnt2d CurPoint = CurCurve.Value(CurParam);
+ Standard_Boolean IsPrevSeamJustBuilt = Standard_False;
+ for (;;)
+ {
+ const TopTools_ListOfShape& Elist = theVEmap.FindFromKey(CurVertex);
+ Candidates.Clear();
+ Standard_Boolean ToAdd = Standard_True;
+ //Standard_Boolean IsPrevEdgeCorrect = Standard_True;
+
+ //Candidates are the edges close to <CurPoint> in 2d
+ for (itl.Initialize(Elist); itl.More(); itl.Next())
+ {
+ const TopoDS_Edge& anEdge = TopoDS::Edge(itl.Value());
+ if (anEdge.IsSame(CurEdge))
+ continue;
+ BRepAdaptor_Curve2d BAcurve(anEdge, theFace);
+ gp_Pnt2d aPoint = BAcurve.Value(BAcurve.FirstParameter());
+ Standard_Real aDist = CurPoint.SquareDistance(aPoint);
+ if (aDist < MinDist)
+ Candidates.Append(anEdge);
+ else
+ {
+ aPoint = BAcurve.Value(BAcurve.LastParameter());
+ aDist = CurPoint.SquareDistance(aPoint);
+ if (aDist < MinDist)
+ Candidates.Append(anEdge);
+ }
+ }
+
+ TopoDS_Edge NextEdge, aCandidate;
+ if (Candidates.IsEmpty()) //hanging edge
+ {
+ //need to build additional edges
+ Standard_Real fpar, lpar;
+ if (BRep_Tool::Degenerated(CurEdge) &&
+ !BRep_Tool::Degenerated(PrevEdge))
+ {
+ //enlarge current degenerated edge
+ TopoDS_Vertex OtherVertex = CurVertex;
+ OtherVertex.Reverse();
+ Standard_Real OtherParam = BRep_Tool::Parameter(OtherVertex, CurEdge);
+ gp_Pnt2d OtherPoint = CurCurve.Value(OtherParam);
+
+ if (Uclosed)
+ {
+ Standard_Real DirOfCurEdge = CurPoint.X() - OtherPoint.X();
+ Standard_Boolean FromBelow = (DirOfCurEdge < 0.);
+ Standard_Real NewX = NearestWholePeriod( CurPoint.X(), Uperiod, FromBelow );
+ CurPoint.SetX(NewX);
+ }
+ Handle(Geom2d_Line) aLine;
+ if (CurEdge.Orientation() == TopAbs_FORWARD)
+ aLine = GCE2d_MakeLine(OtherPoint, CurPoint);
+ else
+ aLine = GCE2d_MakeLine(CurPoint, OtherPoint);
+ BB.UpdateEdge(CurEdge, aLine, theFace, 0.);
+ BB.Range(CurEdge, 0., CurPoint.Distance(OtherPoint));
+ NextEdge = CurEdge;
+ IsPrevSeamJustBuilt = Standard_False;
+ ToAdd = Standard_False;
+ }
+ else if (IsPrevSeamJustBuilt)
+ {
+ //Find degenerated edge and enlarge it
+ for (itl.Initialize(Elist); itl.More(); itl.Next())
+ {
+ TopoDS_Edge anEdge = TopoDS::Edge(itl.Value());
+ if (anEdge.IsSame(CurEdge))
+ continue;
+ if (BRep_Tool::Degenerated(anEdge))
+ {
+ //enlarge found degenerated edge
+ TopoDS_Vertex OtherVertex = CurVertex;
+ if (anEdge.Orientation() == TopAbs_FORWARD)
+ OtherVertex.Reverse();
+ Standard_Real OtherParam = BRep_Tool::Parameter(OtherVertex, anEdge);
+ BRepAdaptor_Curve2d aCurve(anEdge, theFace);
+ gp_Pnt2d OtherPoint = aCurve.Value(OtherParam);
+
+ Handle(Geom2d_Line) aLine;
+ if (anEdge.Orientation() == TopAbs_FORWARD)
+ aLine = GCE2d_MakeLine(OtherPoint, CurPoint);
+ else
+ aLine = GCE2d_MakeLine(CurPoint, OtherPoint);
+ BB.UpdateEdge(anEdge, aLine, theFace, 0.);
+ BB.Range(anEdge, 0., CurPoint.Distance(OtherPoint));
+ NextEdge = anEdge;
+ IsPrevSeamJustBuilt = Standard_False;
+ }
+ }
+ }
+ else
+ {
+ //build additional seam edge from existing edge
+ for (itl.Initialize(Elist); itl.More(); itl.Next())
+ {
+ TopoDS_Edge anEdge = TopoDS::Edge(itl.Value());
+ if (anEdge.IsSame(CurEdge))
+ continue;
+ TopExp::Vertices(anEdge, VV[0], VV[1], Standard_True);
+ if (VV[1-IndOr].IsSame(CurVertex))
+ {
+ if (!BRep_Tool::IsClosed(anEdge, theFace))
+ {
+ Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface(anEdge, theFace, fpar, lpar);
+ Standard_Real aParam = BRep_Tool::Parameter(CurVertex, anEdge);
+ gp_Pnt2d aPoint = aPCurve->Value(aParam);
+ gp_Vec2d Offset(0.,0.);
+ if (Uclosed)
+ Offset.SetX( CurPoint.X() - aPoint.X() );
+ else
+ Offset.SetY( CurPoint.Y() - aPoint.Y() );
+ Handle(Geom2d_Curve) aPCurve2 = Handle(Geom2d_Curve)::DownCast(aPCurve->Translated(Offset));
+ BB.UpdateEdge(anEdge, aPCurve, aPCurve2, theFace, 0.);
+ }
+ NextEdge = TopoDS::Edge(anEdge.Reversed());
+ IsPrevSeamJustBuilt = Standard_True;
+ break;
+ }
+ }
+ }
+ }
+
+ for (Standard_Integer i = 1; i <= Candidates.Length(); i++)
+ {
+ IsPrevSeamJustBuilt = Standard_False;
+ const TopoDS_Edge& anEdge = TopoDS::Edge(Candidates(i));
+ if (theNewEdges.Contains(anEdge))
+ {
+ TopExp::Vertices(anEdge, VV[0], VV[1], Standard_True);
+ if (VV[IndOr].IsSame(CurVertex))
+ {
+ BRepAdaptor_Curve2d BAcurve(anEdge, theFace);
+ Standard_Real aParam = BRep_Tool::Parameter(CurVertex, anEdge);
+ gp_Pnt2d aPoint = BAcurve.Value(aParam);
+ Standard_Real aDist = CurPoint.SquareDistance(aPoint);
+ if (aDist < MinDist)
+ {
+ NextEdge = anEdge;
+ break;
+ }
+ }
+ else //previous edge is incorrect
+ {
+ //error ?
+
+ //remove previous edge from wire
+ //build additional edges
+ //NextEdge = anEdge;
+ }
+ }
+ else if (aCandidate.IsNull())
+ {
+ TopExp::Vertices(anEdge, VV[0], VV[1], Standard_True);
+ if (VV[IndOr].IsSame(CurVertex))
+ {
+ BRepAdaptor_Curve2d BAcurve(anEdge, theFace);
+ Standard_Real aParam = BRep_Tool::Parameter(VV[IndOr], anEdge);
+ gp_Pnt2d aPoint = BAcurve.Value(aParam);
+ Standard_Real aDist = CurPoint.SquareDistance(aPoint);
+ if (aDist < MinDist)
+ aCandidate = anEdge;
+ }
+ }
+ }
+ if (NextEdge.IsNull())
+ NextEdge = aCandidate;
+
+ DeleteEdgesFromMap(theVEmap, Candidates, NextEdge, CurVertex, 1-IndOr);
+
+ PrevEdge = CurEdge;
+ CurEdge = NextEdge;
+ CurVertex = (Direction == TopAbs_FORWARD)?
+ TopExp::LastVertex(CurEdge, Standard_True) :
+ TopExp::FirstVertex(CurEdge, Standard_True);
+ CurCurve.Initialize(CurEdge, theFace);
+ CurParam = BRep_Tool::Parameter(CurVertex, CurEdge);
+ CurPoint = CurCurve.Value(CurParam);
+
+ if (ToAdd)
+ BB.Add(NewWire, CurEdge);
+
+ if (CurVertex.IsSame(StartVertex) &&
+ CurPoint.SquareDistance(StartPoint) < MinDist)
+ break;
+ }
+
+ return NewWire;
+}
+
//=======================================================================
//function : CompleteDS
//purpose :
if (done) {
- BRep_Builder B1;
+ BRep_Builder BB;
CompleteDS(DStr,myShape);
//Update tolerances on vertex to max adjacent edges or
//Update tolerances on degenerated edge to max of adjacent vertexes.
if( tolc < tolv ) tolc = tolv + 0.00001;
}
if(degen && tolc < tolv) tolc = tolv;
- else if(tolc>tolv) B1.UpdateVertex(v,tolc);
+ else if(tolc>tolv) BB.UpdateVertex(v,tolc);
}
else if(gk == TopOpeBRepDS_POINT){
TopOpeBRepDS_Point& p = DStr.ChangePoint(gi);
}
if(degen) c.Tolerance(tolc);
}
+
+ //jgv
+
+ //for (on modified faces)
+ //compound of wires from each face
+ //compound of new edges for this face
+ //general fuse (compound of wires from a face, compound of new edges for this face)
+ //method building new face from old and new edges
+ //assembling of resulting shape from modified and unmodified faces.
+
+ TopTools_ListOfShape aChFiFaces;
+ TopTools_IndexedDataMapOfShapeShape aFacesModifiedFaces;
+
+ TopTools_IndexedMapOfShape MapNewEdges;
+ //TopTools_DataMapOfShapeListOfShape FaceListEdges;
+ NCollection_DataMap<TopoDS_Shape, TopTools_IndexedMapOfShape> FaceMapEdges;
+
+ BOPAlgo_Builder GenFuse;
+
+ for (Standard_Integer i = 1; i <= myNewFaces.Extent(); i++)
+ {
+ TopoDS_Face aFace = TopoDS::Face(myNewFaces(i));
+ //TopAbs_Orientation anOrOfFace = aFace.Orientation();
+ aFace.Orientation(TopAbs_FORWARD);
+
+ TopTools_IndexedMapOfShape* aEmap = FaceMapEdges.Bound(aFace, TopTools_IndexedMapOfShape());
+
+ //TopoDS_Compound aNewEdges;
+ //BB.MakeCompound(aNewEdges);
+ //TopTools_ListOfShape ListNewEdges;
+
+ //ChFi3d_ListIteratorOfListOfQualifiedEdge itl(myFaceNewEdges.FindFromKey(i));
+ TColStd_ListIteratorOfListOfInteger itl(myFaceNewEdges.FindFromKey(i));
+ for (; itl.More(); itl.Next())
+ {
+ Standard_Integer aSignedIndex = itl.Value();
+ Standard_Integer anIndex = Abs(aSignedIndex);
+ TopoDS_Shape aNewEdge = myNewEdges(anIndex);
+ TopAbs_Orientation anOr = (aSignedIndex > 0)?
+ TopAbs_FORWARD : TopAbs_REVERSED;
+ aNewEdge.Orientation(anOr);
+ //BB.Add(aNewEdges, aNewEdge);
+ //ListNewEdges.Append(aNewEdge);
+ aEmap->Add(aNewEdge);
+ }
+
+ if (myIndsChFiFaces.Contains(i)) //absolutely new face
+ {
+ }
+ else //a modified old face
+ {
+ GenFuse.AddArgument(aFace);
+ //TopTools_ListIteratorOfListOfShape itl(ListNewEdges);
+ //for (; itl.More(); itl.Next())
+ //MapNewEdges.Add(itl.Value());
+ for (Standard_Integer iedge = 1; iedge <= aEmap->Extent(); iedge++)
+ MapNewEdges.Add(aEmap->FindKey(iedge));
+ }
+ }
+
+ //Fusing
+ //GenFuse.AddArgument(aNewEdges);
+ for (Standard_Integer i = 1; i <= MapNewEdges.Extent(); i++)
+ GenFuse.AddArgument(MapNewEdges(i));
+ GenFuse.Perform();
+ //Temporary
+ const TopoDS_Shape& aResFuse = GenFuse.Shape();
+ ///////////
+ const TopTools_DataMapOfShapeListOfShape& ModifiedShapes = GenFuse.Images();
+
+ for (Standard_Integer i = 1; i <= myNewFaces.Extent(); i++)
+ {
+ TopoDS_Face aFace = TopoDS::Face(myNewFaces(i));
+ TopAbs_Orientation anOrOfFace = aFace.Orientation();
+ aFace.Orientation(TopAbs_FORWARD);
+
+ if (myIndsChFiFaces.Contains(i)) //absolutely new face
+ {
+ TopoDS_Wire aWire;
+ BB.MakeWire(aWire);
+ for (Standard_Integer iedge = 1; iedge <= FaceMapEdges(aFace).Extent(); iedge++)
+ {
+ const TopoDS_Shape& anEdge = FaceMapEdges(aFace).FindKey(iedge);
+ TopAbs_Orientation anOr = anEdge.Orientation();
+ if (ModifiedShapes.IsBound(anEdge))
+ {
+ const TopTools_ListOfShape& aListOfSplits = ModifiedShapes(anEdge);
+ TopTools_ListIteratorOfListOfShape itl(aListOfSplits);
+ for (; itl.More(); itl.Next())
+ BB.Add(aWire, itl.Value().Oriented(anOr));
+ }
+ else
+ BB.Add(aWire, anEdge);
+ }
+ BB.Add(aFace, aWire);
+ aFace.Orientation(anOrOfFace);
+ aChFiFaces.Append(aFace);
+ }
+ else //modify old face
+ {
+ //Build compound for construction of new face
+ const TopTools_ListOfShape& aListOfModifiedFromFace = ModifiedShapes(aFace);
+ TopoDS_Compound ResFuseForFace;
+ BB.MakeCompound(ResFuseForFace);
+ TopTools_ListIteratorOfListOfShape itl(aListOfModifiedFromFace);
+ for (; itl.More(); itl.Next())
+ BB.Add(ResFuseForFace, itl.Value());
+
+ //Update FaceMapEdges(aFace)
+ TopTools_ListOfShape ToDelete, ToAdd;
+ for (Standard_Integer ind = 1; ind <= FaceMapEdges(aFace).Extent(); ind++)
+ {
+ const TopoDS_Shape& aNewEdgeOfFace = FaceMapEdges(aFace)(ind);
+ TopAbs_Orientation anOr = aNewEdgeOfFace.Orientation();
+ if (ModifiedShapes.IsBound(aNewEdgeOfFace))
+ {
+ const TopTools_ListOfShape& aListOfSplits = ModifiedShapes(aNewEdgeOfFace);
+ for (itl.Initialize(aListOfSplits); itl.More(); itl.Next())
+ ToAdd.Append(itl.Value().Oriented(anOr));
+ ToDelete.Append(aNewEdgeOfFace);
+ }
+ }
+ for (itl.Initialize(ToDelete); itl.More(); itl.Next())
+ FaceMapEdges(aFace).RemoveKey(itl.Value());
+ for (itl.Initialize(ToAdd); itl.More(); itl.Next())
+ FaceMapEdges(aFace).Add(itl.Value());
+
+ //Build the map of splits for edges of old face
+ TopTools_MapOfShape Splits;
+ TopExp_Explorer Explo(aFace, TopAbs_EDGE);
+ for (; Explo.More(); Explo.Next())
+ {
+ const TopoDS_Shape& anEdge = Explo.Current();
+ if (ModifiedShapes.IsBound(anEdge))
+ {
+ const TopTools_ListOfShape& aListOfSplits = ModifiedShapes(anEdge);
+ for (itl.Initialize(aListOfSplits); itl.More(); itl.Next())
+ Splits.Add(itl.Value());
+ }
+ }
+
+ ToDelete.Clear();
+ for (Standard_Integer ind = 1; ind <= FaceMapEdges(aFace).Extent(); ind++)
+ {
+ const TopoDS_Shape& aNewEdgeOfFace = FaceMapEdges(aFace)(ind);
+ if (Splits.Contains(aNewEdgeOfFace))
+ {
+ ToDelete.Append(aNewEdgeOfFace);
+ continue;
+ }
+ TopAbs_Orientation anOr = aNewEdgeOfFace.Orientation();
+ if (ModifiedShapes.IsBound(aNewEdgeOfFace))
+ {
+ const TopTools_ListOfShape& aListOfModifiedFromEdge = ModifiedShapes(aNewEdgeOfFace);
+ for (itl.Initialize(aListOfModifiedFromEdge); itl.More(); itl.Next())
+ {
+ const TopoDS_Shape& aModifiedNewEdgeOfFace = itl.Value();
+ if (!ContainsEdge(ResFuseForFace, aModifiedNewEdgeOfFace))
+ BB.Add(ResFuseForFace, aModifiedNewEdgeOfFace.Oriented(anOr));
+ }
+ }
+ else
+ BB.Add(ResFuseForFace, aNewEdgeOfFace);
+ }
+ for (itl.Initialize(ToDelete); itl.More(); itl.Next())
+ FaceMapEdges(aFace).RemoveKey(itl.Value());
+
+ TopTools_IndexedDataMapOfShapeListOfShape VEmapOfNewFace;
+ TopExp::MapShapesAndUniqueAncestors(ResFuseForFace, TopAbs_VERTEX, TopAbs_EDGE,
+ VEmapOfNewFace, Standard_True); //with orientation
+
+ TopoDS_Shape aNewFace = aFace.EmptyCopied();
+ TopoDS_Iterator itw(aFace);
+ for (; itw.More(); itw.Next())
+ {
+ const TopoDS_Shape& aWire = itw.Value();
+ TopTools_ListOfShape ListOfWires;
+ if (ModifiedShapes.IsBound(aWire))
+ {
+ const TopTools_ListOfShape& aListOfModified = ModifiedShapes(aWire);
+ for (itl.Initialize(aListOfModified); itl.More(); itl.Next())
+ ListOfWires.Append(itl.Value());
+ }
+ else
+ ListOfWires.Append(aWire);
+ for (itl.Initialize(ListOfWires); itl.More(); itl.Next())
+ {
+ const TopoDS_Wire& aModifiedWire = TopoDS::Wire(itl.Value());
+#ifdef OCCT_DEBUG
+ std::cout << "a Modified Wire ..." << std::endl;
+#endif
+ //Temporary
+ TopoDS_Face TmpFace = TopoDS::Face(aFace.EmptyCopied());
+ BB.Add(TmpFace, aModifiedWire);
+ ///////////
+ //TopoDS_Wire aNewWire = BuildNewWire(aModifiedWire, VEmapOfNewFace, aNewEdges, aFace);
+ TopoDS_Wire aNewWire = BuildNewWire(aModifiedWire, VEmapOfNewFace, FaceMapEdges(aFace), aFace);
+#ifdef OCCT_DEBUG
+ std::cout << "a New Wire ..." << std::endl;
+#endif
+ BB.Add(aNewFace, aNewWire);
+#ifdef OCCT_DEBUG
+ std::cout << "a New Face ..." << std::endl;
+#endif
+ aFacesModifiedFaces.Add(aFace, aNewFace);
+ }
+ }
+ }
+ }
+
+ //Update ChFiFaces
+ /*
+ TopTools_ListOfShape ModifiedChFiFaces;
+ TopTools_ListIteratorOfListOfShape itl(aChFiFaces);
+ while (itl.More())
+ {
+ TopoDS_Shape aChFiFace = itl.Value();
+ TopAbs_Orientation anOrOfFace = aChFiFace.Orientation();
+ aChFiFace.Orientation(TopAbs_FORWARD);
+ BRepTools_Substitution aSubstitutor;
+ TopExp_Explorer Explo(aChFiFace, TopAbs_EDGE);
+ for (; Explo.More(); Explo.Next())
+ {
+ const TopoDS_Shape& anEdge = Explo.Current();
+ if (!ModifiedShapes.IsBound(anEdge))
+ continue;
+ const TopTools_ListOfShape& aListOfSplits = ModifiedShapes(anEdge);
+ TopTools_ListIteratorOfListOfShape itspl(aListOfSplits);
+ for (; itspl.More(); itspl.Next())
+ {
+ const TopoDS_Shape& aSplit = itspl.Value();
+ cout<<"a Split..."<<endl;
+ }
+ aSubstitutor.Substitute(anEdge.Oriented(TopAbs_FORWARD), aListOfSplits);
+ }
+ aSubstitutor.Build(aChFiFace);
+ if (aSubstitutor.IsCopied(aChFiFace))
+ {
+ const TopTools_ListOfShape& listSh = aSubstitutor.Copy(aChFiFace);
+ TopoDS_Shape aNewChFiFace = listSh.First();
+ aNewChFiFace.Orientation(anOrOfFace);
+ ModifiedChFiFaces.Append(aNewChFiFace);
+ aChFiFaces.Remove(itl);
+ }
+ else
+ itl.Next();
+ }
+ aChFiFaces.Append(ModifiedChFiFaces);
+ */
+
+ /*
+ else //a modified old face
+ {
+ //BRepAlgoAPI_Fuse aFuse(aWires, aNewEdges);
+
+ //BOPAlgo_Builder GenFuse;
+ //GenFuse.AddArgument(aFace);
+ GenFuse.AddArgument(aNewEdges);
+ GenFuse.Perform();
+ TopoDS_Shape aNewFace = aFace.EmptyCopied();
+ const TopoDS_Shape& aResFuse = GenFuse.Shape();
+ //const BOPCol_DataMapOfShapeListOfShape& ModifiedShapes = GenFuse.Images();
+ const TopTools_DataMapOfShapeListOfShape& ModifiedShapes = GenFuse.Images();
+ TopTools_IndexedDataMapOfShapeListOfShape VEmapOfNewFace;
+ TopExp::MapShapesAndAncestors(aResFuse, TopAbs_VERTEX, TopAbs_EDGE, VEmapOfNewFace);
+ TopoDS_Iterator itw(aFace);
+ for (; itw.More(); itw.Next())
+ {
+ const TopoDS_Shape& aWire = itw.Value();
+ if (!ModifiedShapes.IsBound(aWire))
+ continue;
+ const TopTools_ListOfShape& aListOfModified = ModifiedShapes(aWire);
+ TopTools_ListIteratorOfListOfShape itwm(aListOfModified);
+ for (; itwm.More(); itwm.Next())
+ {
+ const TopoDS_Wire& aModifiedWire = TopoDS::Wire(itwm.Value());
+ cout<<"a Modified Wire ..."<<endl;
+ TopoDS_Wire aNewWire = BuildNewWire(aModifiedWire, VEmapOfNewFace, aNewEdges, aFace);
+ cout<<"a New Wire ..."<<endl;
+ BB.Add(aNewFace, aNewWire);
+ cout<<"a New Face ..."<<endl;
+ aFacesModifiedFaces.Add(aFace, aNewFace);
+ //Temporary
+ BB.Add(aShell, aNewFace);
+ }
+ }
+ }
+ */
+
+
+ //Modify the original shape using ReShape
+ BRepTools_ReShape aReshape;
+ for (Standard_Integer i = 1; i <= aFacesModifiedFaces.Extent(); i++)
+ {
+ const TopoDS_Shape& aFace = aFacesModifiedFaces.FindKey(i);
+ const TopoDS_Shape& aNewFace = aFacesModifiedFaces(i);
+ aReshape.Replace(aFace, aNewFace);
+ }
+ myShapeResult = aReshape.Apply(myShape);
+ //Add ChFiFaces
+ while (!aChFiFaces.IsEmpty())
+ {
+ TopTools_ListIteratorOfListOfShape itl(aChFiFaces);
+ while (itl.More())
+ {
+ const TopoDS_Shape& aChFiFace = itl.Value();
+ TopoDS_Shape aTargetShape = FindProperSubShape(aChFiFace, myShapeResult); //recursive method
+ if (!aTargetShape.IsNull())
+ {
+ aTargetShape.Free(Standard_True);
+ aTargetShape.Orientation(TopAbs_FORWARD);
+ BB.Add(aTargetShape, aChFiFace);
+ aChFiFaces.Remove(itl);
+ }
+ else
+ itl.Next();
+ }
+ }
+ /////////////////////////////////////////
+
+ /*
myCoup->Perform(myDS);
+ //jgv//
+
TColStd_MapIteratorOfMapOfInteger It(MapIndSo);
for(; It.More(); It.Next()){
Standard_Integer indsol = It.Key();
for (; exv.More(); exv.Next() ) {
const TopoDS_Vertex& v = TopoDS::Vertex(exv.Current());
Standard_Real tolv = BRep_Tool::Tolerance(v);
- if (tole>tolv) B1.UpdateVertex(v,tole);
+ if (tole>tolv) BB.UpdateVertex(v,tole);
}
}
}
if (!hasresult) {
- B1.MakeCompound(TopoDS::Compound(myShapeResult));
+ BB.MakeCompound(TopoDS::Compound(myShapeResult));
for(It.Reset(); It.More(); It.Next()){
Standard_Integer indsol = It.Key();
const TopoDS_Shape& curshape = DStr.Shape(indsol);
TopTools_ListIteratorOfListOfShape
its = myCoup->Merged(curshape,TopAbs_IN);
- if(!its.More()) B1.Add(myShapeResult,curshape);
+ if(!its.More()) BB.Add(myShapeResult,curshape);
else {
//If the old type of Shape is Shell, Shell is placed instead of Solid,
//However there is a problem for compound of open Shell.
TopExp_Explorer expsh2(its.Value(),TopAbs_SHELL);
const TopoDS_Shape& cursh = expsh2.Current();
TopoDS_Shape tt = cursh;
- B1.Add(myShapeResult,cursh);
+ BB.Add(myShapeResult,cursh);
its.Next();
}
else {
- B1.Add(myShapeResult,its.Value());
+ BB.Add(myShapeResult,its.Value());
its.Next();
}
}
}
else {
done=Standard_False;
- B1.MakeCompound(TopoDS::Compound(badShape));
+ BB.MakeCompound(TopoDS::Compound(badShape));
for(It.Reset(); It.More(); It.Next()){
Standard_Integer indsol = It.Key();
const TopoDS_Shape& curshape = DStr.Shape(indsol);
TopTools_ListIteratorOfListOfShape
its = myCoup->Merged(curshape,TopAbs_IN);
- if(!its.More()) B1.Add(badShape,curshape);
+ if(!its.More()) BB.Add(badShape,curshape);
else {
while (its.More()) {
- B1.Add(badShape,its.Value());
+ BB.Add(badShape,its.Value());
its.Next();
}
}
}
}
+ */
+
#ifdef OCCT_DEBUG //perf
ChFi3d_ResultChron(cl_reconstruction ,t_reconstruction);
ChFi3d_InitChron(cl_setregul);
// if it is necessary
if (IsDone())
{
+ //Temporary
+ /*
Standard_Real SameParTol = Precision::Confusion();
Standard_Integer aNbSurfaces, iF;
TopTools_ListIteratorOfListOfShape aIt;
ShapeFix::SameParameter(aF, Standard_False, SameParTol);
}
}
+ */
}
}
TColStd_ListIteratorOfListOfInteger IL;
for(IL.Initialize(L); IL.More(); IL.Next()){
Standard_Integer I = IL.Value();
- const TopTools_ListOfShape& LS = myCoup->NewFaces(I);
+ //const TopTools_ListOfShape& LS = myCoup->NewFaces(I);
+ const TopoDS_Face& aNewFace = TopoDS::Face(myNewFaces(I));
+ /*
TopTools_ListIteratorOfListOfShape ILS;
- for(ILS.Initialize(LS); ILS.More(); ILS.Next()){
+ for(ILS.Initialize(LS); ILS.More(); ILS.Next())
myGenerated.Append(ILS.Value());
- }
+ */
+ myGenerated.Append(aNewFace);
}
}
return myGenerated;
#include <TopTools_ListOfShape.hxx>
#include <TopTools_DataMapOfShapeListOfInteger.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <TColStd_MapOfInteger.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
#include <ChFiDS_ErrorStatus.hxx>
#include <math_Vector.hxx>
#include <TopAbs_Orientation.hxx>
+//#include <BRepOffset_Type.hxx>
#include <ChFiDS_SequenceOfSurfData.hxx>
#include <TopAbs_State.hxx>
class AppBlend_Approx;
class Geom2d_Curve;
+struct QualifiedEdge
+{
+ Standard_Integer Index;
+ TopAbs_Orientation Orientation;
+ //BRepOffset_Type Convexity;
+
+ QualifiedEdge(Standard_Integer theIndex,
+ TopAbs_Orientation theOrientation)
+ : Index(theIndex),
+ Orientation(theOrientation)
+ {
+ }
+};
+
+typedef NCollection_List<QualifiedEdge> ChFi3d_ListOfQualifiedEdge;
+typedef ChFi3d_ListOfQualifiedEdge::Iterator ChFi3d_ListIteratorOfListOfQualifiedEdge;
//! Root class for calculation of surfaces (fillets,
//! chamfers) destined to smooth edges of
const Handle(Adaptor3d_HSurface)& S1,
const Handle(Adaptor3d_HSurface)& S2,
const TopAbs_Orientation Or1,
+ const Standard_Integer theIndOfFace2,
const Standard_Boolean Gd1,
const Standard_Boolean Gd2,
const Standard_Boolean Gf1,
const Handle(Adaptor3d_HSurface)& S1,
const Handle(Adaptor3d_HSurface)& S2,
const TopAbs_Orientation Or1,
+ const Standard_Integer theIndOfFace2,
const Standard_Boolean Gd1,
const Standard_Boolean Gd2,
const Standard_Boolean Gf1,
ChFiDS_Map myVFMap;
ChFiDS_Map myVEMap;
Handle(TopOpeBRepDS_HDataStructure) myDS;
+ //TopTools_IndexedDataMapOfShapeListOfShape myFaceNewEdges;
+ NCollection_IndexedDataMap<Standard_Integer, TColStd_ListOfInteger> myFaceNewEdges;
+ //NCollection_IndexedDataMap<Standard_Integer, ChFi3d_ListOfQualifiedEdge> myFaceNewEdges;
+ TopTools_IndexedMapOfShape myNewFaces;
+ TopTools_IndexedMapOfShape myNewEdges;
+ TColStd_MapOfInteger myIndsChFiFaces;
Handle(TopOpeBRepBuild_HBuilder) myCoup;
ChFiDS_ListOfStripe myListStripe;
ChFiDS_StripeMap myVDataMap;
#include <BRepTools.hxx>
#include <BRepTools_WireExplorer.hxx>
#include <BRepLib.hxx>
+#include <BRepLib_MakeVertex.hxx>
#include <BRepLib_MakeEdge.hxx>
#include <BRepLib_MakeWire.hxx>
#include <BRepLib_MakeFace.hxx>
#include <BRepAdaptor_HSurface.hxx>
#include <TopOpeBRepDS_SurfaceCurveInterference.hxx>
+
+//=======================================================================
+//function : ChFi3d_IsFirstInside
+//purpose :
+//=======================================================================
+Standard_Boolean ChFi3d_IsFirstInside(const Standard_Real theVal1,
+ const Standard_Real theVal2,
+ const Standard_Real theMin,
+ const Standard_Real theMax)
+{
+ Standard_Real IsFirstInside = (theMin < theVal1 && theVal1 < theMax);
+ Standard_Real IsSecondInside = (theMin < theVal2 && theVal2 < theMax);
+ if (IsFirstInside && !IsSecondInside)
+ return Standard_True;
+ if (!IsFirstInside && IsSecondInside)
+ return Standard_False;
+
+ if (IsFirstInside && IsSecondInside)
+ {
+ Standard_Real MinDistForFirst = Min(theVal1 - theMin, theMax - theVal1);
+ Standard_Real MinDistForSecond = Min(theVal2 - theMin, theMax - theVal2);
+ return (MinDistForFirst > MinDistForSecond);
+ }
+ else
+ {
+#ifdef OCCT_DEBUG
+ std::cout << std::endl << "Both points outside!" << std::endl;
+#endif
+ return Standard_True;
+ }
+}
+
+//=======================================================================
+//function : ChFi3d_AdjustPCurve
+//purpose :
+//=======================================================================
+void ChFi3d_AdjustPCurve(Geom2dAdaptor_Curve& thePCurve,
+ const Standard_Real theCoordOnPCurve,
+ const Standard_Real theRefCoord,
+ const Standard_Real thePeriod,
+ const Standard_Boolean theInUdirection)
+{
+ Standard_Real aCoord = theCoordOnPCurve;
+ Standard_Real Sign = (aCoord < theRefCoord)? 1 : -1;
+
+ while (Abs(aCoord - theRefCoord) > thePeriod/2)
+ aCoord += Sign * thePeriod;
+
+ Standard_Real Offset = aCoord - theCoordOnPCurve;
+ gp_Vec2d OffsetVector;
+ if (theInUdirection)
+ OffsetVector.SetCoord(Offset, 0.);
+ else
+ OffsetVector.SetCoord(0., Offset);
+
+ Handle(Geom2d_Curve) aPCurve = thePCurve.Curve();
+ aPCurve->Translate(OffsetVector);
+ thePCurve.Load(aPCurve);
+}
+
//=======================================================================
//function : ChFi3d_InPeriod
//purpose :
if ( u < UFirst) u = UFirst;
return u;
}
+
+//=======================================================================
+//function : ChFi3d_AdjustSecondPointToFirstPoint
+//purpose :
+//=======================================================================
+void ChFi3d_AdjustSecondPointToFirstPoint(const gp_Pnt2d& theFirstPoint,
+ gp_Pnt2d& theSecondPoint,
+ const BRepAdaptor_Surface& theSurf)
+{
+ if (theSurf.IsUPeriodic())
+ {
+ Standard_Real UPeriod = theSurf.UPeriod();
+ Standard_Real NewU = ElCLib::InPeriod(theSecondPoint.X(),
+ theFirstPoint.X() - UPeriod/2,
+ theFirstPoint.X() + UPeriod/2);
+ theSecondPoint.SetX(NewU);
+ }
+ if (theSurf.IsVPeriodic())
+ {
+ Standard_Real VPeriod = theSurf.VPeriod();
+ Standard_Real NewV = ElCLib::InPeriod(theSecondPoint.Y(),
+ theFirstPoint.Y() - VPeriod/2,
+ theFirstPoint.Y() + VPeriod/2);
+ theSecondPoint.SetY(NewV);
+ }
+}
+
+//=======================================================================
+//function : ChFi3d_SplitAndAdjust
+//purpose :
+//=======================================================================
+void ChFi3d_SplitAndAdjust(const TopTools_ListOfShape& theElist,
+ TopTools_ListOfShape& theNewElist,
+ const BRepAdaptor_Surface& theBAsurf)
+{
+ TopoDS_Face aFace = theBAsurf.Face();
+ Handle(Geom_Surface) aSurf, aBasisSurf;
+ TopLoc_Location aLoc;
+ aSurf = BRep_Tool::Surface(aFace, aLoc);
+ aBasisSurf = aSurf;
+ if (aSurf->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface)))
+ aBasisSurf = (Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurf))->BasisSurface();
+
+ if (!aBasisSurf->IsUClosed() && !aBasisSurf->IsVClosed())
+ return;
+
+ TColGeom2d_SequenceOfCurve Boundaries;
+ Standard_Real Ubounds [2], Vbounds [2];
+ aSurf->Bounds(Ubounds[0], Ubounds[1], Vbounds[0], Vbounds[1]);
+ for (Standard_Integer i = 0; i < 2; i++)
+ if (!Precision::IsInfinite(Ubounds[i]))
+ {
+ gp_Pnt2d Origin(Ubounds[i], 0.);
+ Handle(Geom2d_Curve) aLine = new Geom2d_Line(Origin, gp::DY2d());
+ if (!Precision::IsInfinite(Vbounds[0]) || !Precision::IsInfinite(Vbounds[1]))
+ aLine = new Geom2d_TrimmedCurve(aLine, Vbounds[0], Vbounds[1]);
+ Boundaries.Append(aLine);
+ }
+ for (Standard_Integer i = 0; i < 2; i++)
+ if (!Precision::IsInfinite(Vbounds[i]))
+ {
+ gp_Pnt2d Origin(0., Vbounds[i]);
+ Handle(Geom2d_Curve) aLine = new Geom2d_Line(Origin, gp::DX2d());
+ if (!Precision::IsInfinite(Ubounds[0]) || !Precision::IsInfinite(Ubounds[1]))
+ aLine = new Geom2d_TrimmedCurve(aLine, Ubounds[0], Ubounds[1]);
+ Boundaries.Append(aLine);
+ }
+
+ Geom2dInt_GInter Intersector;
+ BRep_Builder BB;
+ TopTools_ListIteratorOfListOfShape itl(theElist);
+ for (; itl.More(); itl.Next())
+ {
+ TopoDS_Edge anEdge = TopoDS::Edge(itl.Value());
+ TopAbs_Orientation anOr = anEdge.Orientation();
+ Standard_Real aTol = BRep_Tool::Tolerance(anEdge);
+ TColStd_SequenceOfReal Params;
+ Standard_Real fpar, lpar;
+ Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface(anEdge, aFace, fpar, lpar);
+ Geom2dAdaptor_Curve aGAcurve(aPCurve, fpar, lpar);
+ Standard_Real LeftTol = Precision::PConfusion(), RightTol = Precision::PConfusion();
+ BRepAdaptor_Curve BAcurve(anEdge);
+ gp_Pnt FirstPnt = BAcurve.Value(fpar);
+ gp_Pnt LastPnt = BAcurve.Value(lpar);
+ Standard_Real Offset = 0.01*(lpar - fpar);
+ gp_Pnt PntOffset = BAcurve.Value(fpar + Offset);
+ Standard_Real dist3d = FirstPnt.Distance(PntOffset);
+ if (dist3d > gp::Resolution())
+ LeftTol = Offset*aTol/dist3d;
+ PntOffset = BAcurve.Value(lpar - Offset);
+ dist3d = LastPnt.Distance(PntOffset);
+ if (dist3d > gp::Resolution())
+ RightTol = Offset*aTol/dist3d;
+ for (Standard_Integer i = 1; i <= Boundaries.Length(); i++)
+ {
+ Geom2dAdaptor_Curve aGAboundary(Boundaries(i));
+ Intersector.Perform(aGAcurve, aGAboundary,
+ Precision::PIntersection(),
+ Precision::PIntersection());
+ if (Intersector.IsDone() && !Intersector.IsEmpty())
+ {
+ for (Standard_Integer j = 1; j <= Intersector.NbPoints(); j++)
+ {
+ IntRes2d_IntersectionPoint int2d = Intersector.Point(j);
+ Standard_Real aParam = int2d.ParamOnFirst();
+ if (Abs(aParam - fpar) > LeftTol &&
+ Abs(aParam - lpar) > RightTol)
+ Params.Append(aParam);
+ }
+ for (Standard_Integer j = 1; j <= Intersector.NbSegments(); j++)
+ {
+ IntRes2d_IntersectionSegment seg2d = Intersector.Segment(j);
+ IntRes2d_IntersectionPoint int2d = seg2d.FirstPoint();
+ Standard_Real aParam = int2d.ParamOnFirst();
+ if (Abs(aParam - fpar) > LeftTol &&
+ Abs(aParam - lpar) > RightTol)
+ Params.Append(aParam);
+ int2d = seg2d.LastPoint();
+ aParam = int2d.ParamOnFirst();
+ if (Abs(aParam - fpar) > LeftTol &&
+ Abs(aParam - lpar) > RightTol)
+ Params.Append(aParam);
+ }
+ }
+ } //for (Standard_Integer i = 1; i <= Boundaries.Length(); i++)
+
+ //Sort parameters
+ for (Standard_Integer i = 1; i < Params.Length(); i++)
+ for (Standard_Integer j = i+1; j <= Params.Length(); j++)
+ if (Params(i) > Params(j))
+ { Standard_Real tmp = Params(i); Params(i) = Params(j); Params(j) = tmp; }
+ //Delete duplicating parameters
+ Standard_Real ParamTol = Max(LeftTol, RightTol);
+ Standard_Integer i = 2;
+ while (i <= Params.Length())
+ if (Params(i) - Params(i-1) > ParamTol)
+ Params.Remove(i);
+ else
+ i++;
+
+ //Split
+ TopoDS_Vertex FirstVertex = TopExp::FirstVertex(anEdge), LastVertex;
+ Standard_Real FirstPar = fpar, LastPar;
+ for (i = 1; i <= Params.Length(); i++)
+ {
+ LastPar = Params(i);
+ TopoDS_Edge aNewEdge = TopoDS::Edge(anEdge.EmptyCopied());
+ aNewEdge.Orientation(TopAbs_FORWARD);
+ BB.Range(aNewEdge, FirstPar, LastPar);
+ gp_Pnt aLastPnt = BAcurve.Value(LastPar);
+ LastVertex = BRepLib_MakeVertex(aLastPnt);
+ BB.UpdateVertex(LastVertex, ParamTol);
+ BB.Add(aNewEdge, FirstVertex.Oriented(TopAbs_FORWARD));
+ BB.Add(aNewEdge, LastVertex.Oriented(TopAbs_REVERSED));
+ aNewEdge.Orientation(anOr);
+ BB.UpdateEdge(aNewEdge, aTol);
+ theNewElist.Append(aNewEdge);
+ FirstVertex = LastVertex;
+ FirstPar = LastPar;
+ }
+ LastPar = lpar;
+ LastVertex = TopExp::LastVertex(anEdge);
+ TopoDS_Edge aNewEdge = TopoDS::Edge(anEdge.EmptyCopied());
+ aNewEdge.Orientation(TopAbs_FORWARD);
+ BB.Range(aNewEdge, FirstPar, LastPar);
+ BB.Add(aNewEdge, FirstVertex.Oriented(TopAbs_FORWARD));
+ BB.Add(aNewEdge, LastVertex.Oriented(TopAbs_REVERSED));
+ aNewEdge.Orientation(anOr);
+ BB.UpdateEdge(aNewEdge, aTol);
+ theNewElist.Append(aNewEdge);
+ }
+
+ if (theNewElist.IsEmpty())
+ theNewElist.Assign(theElist);
+
+ //Adjust
+ for (itl.Initialize(theNewElist); itl.More(); itl.Next())
+ {
+ TopoDS_Edge anEdge = TopoDS::Edge(itl.Value());
+ Standard_Real fpar, lpar;
+ Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface(anEdge, aFace, fpar, lpar);
+ gp_Pnt2d MidP2d = aPCurve->Value(0.5*(fpar + lpar));
+ Standard_Real aU = MidP2d.X(), aV = MidP2d.Y();
+ if (aU < Ubounds[0] || aU > Ubounds[1])
+ {
+ Standard_Real Period = Ubounds[1] - Ubounds[0];
+ Standard_Real Sign = (aU < Ubounds[0])? 1 : -1;
+ while (aU < Ubounds[0] || aU > Ubounds[1])
+ aU += Sign*Period;
+ }
+ if (aV < Vbounds[0] || aV > Vbounds[1]) //??? sphere? cone?
+ {
+ Standard_Real Period = Vbounds[1] - Vbounds[0];
+ Standard_Real Sign = (aV < Vbounds[0])? 1 : -1;
+ while (aV < Vbounds[0] || aV > Vbounds[1])
+ aV += Sign*Period;
+ }
+ if (aU != MidP2d.X() || aV != MidP2d.Y())
+ {
+ gp_Vec2d OffsetVec(aU - MidP2d.X(), aV - MidP2d.Y());
+ aPCurve->Translate(OffsetVec);
+ }
+ }
+}
+
//=======================================================================
//function : Box
//purpose : Calculation of min/max uv of the fillet to intersect.
gp_Pnt2d P2d;
if (Check2dDistance)
P2d = BRep_Tool::Parameters( Vtx, face );
- if(ChFi3d_IntTraces(fd1,pref1,p1,jf1,sens1,fd2,pref2,p2,jf2,sens2,P2d,Check2dDistance,enlarge)) {
+ if(ChFi3d_IntTraces(fd1,pref1,p1,jf1,sens1,
+ fd2,pref2,p2,jf2,sens2,
+ face,P2d,Check2dDistance,enlarge)) {
u1 = p1; u2 = p2; ss = sameside; j1 = jf1; j2 = jf2; ff = face;
ok = 1;
}
gp_Pnt2d P2d;
if (Check2dDistance)
P2d = BRep_Tool::Parameters( Vtx, face );
- if(ChFi3d_IntTraces(fd1,pref1,p1,jf1,sens1,fd2,pref2,p2,jf2,sens2,P2d,Check2dDistance,enlarge)) {
+ if(ChFi3d_IntTraces(fd1,pref1,p1,jf1,sens1,
+ fd2,pref2,p2,jf2,sens2,
+ face,P2d,Check2dDistance,enlarge)) {
Standard_Boolean restore =
ok && ((j1 == jf1 && sens1*(p1 - u1) > 0.) ||
(j2 == jf2 && sens2*(p2 - u2) > 0.));
gp_Pnt2d P2d;
if (Check2dDistance)
P2d = BRep_Tool::Parameters( Vtx, face );
- if(ChFi3d_IntTraces(fd1,pref1,p1,jf1,sens1,fd2,pref2,p2,jf2,sens2,P2d,Check2dDistance,enlarge)) {
+ if(ChFi3d_IntTraces(fd1,pref1,p1,jf1,sens1,
+ fd2,pref2,p2,jf2,sens2,
+ face,P2d,Check2dDistance,enlarge)) {
Standard_Boolean restore =
ok && ((j1 == jf1 && sens1*(p1 - u1) > 0.) ||
(j2 == jf2 && sens2*(p2 - u2) > 0.));
gp_Pnt2d P2d;
if (Check2dDistance)
P2d = BRep_Tool::Parameters( Vtx, face );
- if(ChFi3d_IntTraces(fd1,pref1,p1,jf1,sens1,fd2,pref2,p2,jf2,sens2,P2d,Check2dDistance,enlarge)) {
+ if(ChFi3d_IntTraces(fd1,pref1,p1,jf1,sens1,
+ fd2,pref2,p2,jf2,sens2,
+ face,P2d,Check2dDistance,enlarge)) {
Standard_Boolean restore =
ok && ((j1 == jf1 && sens1*(p1 - u1) > 0.) ||
(j2 == jf2 && sens2*(p2 - u2) > 0.));
//purpose :
//=======================================================================
Standard_Boolean ChFi3d_IntTraces(const Handle(ChFiDS_SurfData)& fd1,
- const Standard_Real pref1,
- Standard_Real& p1,
- const Standard_Integer jf1,
- const Standard_Integer sens1,
- const Handle(ChFiDS_SurfData)& fd2,
- const Standard_Real pref2,
- Standard_Real& p2,
- const Standard_Integer jf2,
- const Standard_Integer sens2,
- const gp_Pnt2d& RefP2d,
- const Standard_Boolean Check2dDistance,
- const Standard_Boolean enlarge)
+ const Standard_Real pref1,
+ Standard_Real& p1,
+ const Standard_Integer jf1,
+ const Standard_Integer sens1,
+ const Handle(ChFiDS_SurfData)& fd2,
+ const Standard_Real pref2,
+ Standard_Real& p2,
+ const Standard_Integer jf2,
+ const Standard_Integer sens2,
+ const TopoDS_Face& theFace,
+ const gp_Pnt2d& RefP2d,
+ const Standard_Boolean Check2dDistance,
+ const Standard_Boolean enlarge)
{
Geom2dAdaptor_Curve C1;
Geom2dAdaptor_Curve C2;
Intersection.Perform(C1,C2,
Precision::PIntersection(),
Precision::PIntersection());
+
+ if (!Intersection.IsDone() || Intersection.IsEmpty())
+ {
+ BRepAdaptor_Surface BAsurf(theFace, Standard_False);
+ if (BAsurf.IsUPeriodic())
+ {
+ //put the pcurves in the same parametric context
+ Standard_Real Uperiod = BAsurf.UPeriod();
+ Standard_Real Umin = BAsurf.FirstUParameter();
+ Standard_Real Umax = BAsurf.LastUParameter();
+ gp_Pnt2d Origin1 = C1.Value(0.);
+ gp_Pnt2d Origin2 = C2.Value(0.);
+ Standard_Boolean IsFirstPointInside =
+ ChFi3d_IsFirstInside(Origin1.X(), Origin2.X(), Umin, Umax);
+ if (IsFirstPointInside)
+ ChFi3d_AdjustPCurve(C2, Origin2.X(), Origin1.X(), Uperiod, Standard_True);
+ else
+ ChFi3d_AdjustPCurve(C1, Origin1.X(), Origin2.X(), Uperiod, Standard_True);
+ }
+ }
}
if (Intersection.IsDone()) {
if (!Intersection.IsEmpty()) {
return nba;
}
+//=======================================================================
+//function : IsInSingularity
+//purpose :
+//
+//=======================================================================
+Standard_Boolean ChFi3d_IsInSingularity(const TopoDS_Vertex& Vtx,
+ const ChFiDS_Map& VEMap)
+{
+ TopTools_ListIteratorOfListOfShape ItE;
+ for (ItE.Initialize(VEMap(Vtx)); ItE.More(); ItE.Next())
+ {
+ const TopoDS_Edge& cur = TopoDS::Edge(ItE.Value());
+ if (BRep_Tool::Degenerated(cur))
+ return Standard_True;
+ }
+ return Standard_False;
+}
+
//=====================================================
// function cherche_vertex
// finds common vertex between two edges
const Standard_Real ULast,
const Standard_Real Eps);
+void ChFi3d_AdjustSecondPointToFirstPoint(const gp_Pnt2d& theFirstPoint,
+ gp_Pnt2d& theSecondPoint,
+ const BRepAdaptor_Surface& theSurf);
+
+void ChFi3d_SplitAndAdjust(const TopTools_ListOfShape& theElist,
+ TopTools_ListOfShape& theNewElist,
+ const BRepAdaptor_Surface& theBAsurf);
+
void ChFi3d_Boite(const gp_Pnt2d& p1,const gp_Pnt2d& p2,
Standard_Real& mu,Standard_Real& Mu,
Standard_Real& mv,Standard_Real& Mv);
Standard_Real& p2,
const Standard_Integer jf2,
const Standard_Integer sens2,
+ const TopoDS_Face& theFace,
const gp_Pnt2d& RefP2d,
const Standard_Boolean Check2dDistance = Standard_False,
const Standard_Boolean enlarge = Standard_False);
const ChFiDS_Map& VEMap,
const ChFiDS_Map& EFmap);
+Standard_Boolean ChFi3d_IsInSingularity(const TopoDS_Vertex& Vtx,
+ const ChFiDS_Map& VEMap);
+
void ChFi3d_cherche_vertex (const TopoDS_Edge & E1,
const TopoDS_Edge & E2,
TopoDS_Vertex & vertex,
Handle(ChFiDS_SurfData) SD = new ChFiDS_SurfData();
ChFiDS_SequenceOfSurfData LSD;
- if(!ChFiKPart_ComputeData::Compute(DStr,SD,HS1,HS2,Or1,Or2,Spine,iedge)){
+ if(!ChFiKPart_ComputeData::Compute(DStr,myNewFaces,myNewEdges,myFaceNewEdges,myIndsChFiFaces,
+ SD,HS1,HS2,Or1,Or2,Spine,iedge)){
#ifdef OCCT_DEBUG
std::cout<<"failed calculation KPart"<<std::endl;
#endif
// Modified by Sergey KHROMOV - Wed Feb 5 12:03:17 2003 Begin
// if(ChFi3d_IntTraces(prevsd,prevpar1,nprevpar1,1,1,
// nextsd,nextpar1,nnextpar1,1,-1,p2d)){
+ TopoDS_Face FaceOfPCurves = TopoDS::Face(DStr.Shape(prevsd->Index(1)));
if(ChFi3d_IntTraces(prevsd,prevpar1,nprevpar1,1,1,
- nextsd,nextpar1,nnextpar1,1,-1,p2d,
- Standard_False, Standard_True)){
+ nextsd,nextpar1,nnextpar1,1,-1,
+ FaceOfPCurves,p2d,Standard_False, Standard_True)){
// Modified by Sergey KHROMOV - Wed Feb 5 12:03:17 2003 End
previntf1.SetLastParameter(nprevpar1);
nextintf1.SetFirstParameter(nnextpar1);
// Modified by Sergey KHROMOV - Wed Feb 5 12:03:17 2003 Begin
// if(ChFi3d_IntTraces(prevsd,prevpar2,nprevpar2,2,1,
// nextsd,nextpar2,nnextpar2,2,-1,p2d)){
+ TopoDS_Face FaceOfPCurves = TopoDS::Face(DStr.Shape(prevsd->Index(2)));
if(ChFi3d_IntTraces(prevsd,prevpar2,nprevpar2,2,1,
- nextsd,nextpar2,nnextpar2,2,-1,p2d,
- Standard_False, Standard_True)){
+ nextsd,nextpar2,nnextpar2,2,-1,
+ FaceOfPCurves,p2d,Standard_False, Standard_True)){
// Modified by Sergey KHROMOV - Wed Feb 5 12:03:17 2003 End
previntf2.SetLastParameter(nprevpar2);
nextintf2.SetFirstParameter(nnextpar2);
TColStd_ListOfInteger li;
myEVIMap.Bind(Ej,li);
}
- myEVIMap.ChangeFind(Ej).Append(cursd->Surf());
+ //myEVIMap.ChangeFind(Ej).Append(cursd->Surf());
+ myEVIMap.ChangeFind(Ej).Append(cursd->IndexOfFace());
}
}
else if(IF < IL){
#include <TopOpeBRepDS_Surface.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
+#include <BRepLib_MakeEdge.hxx>
#include <stdio.h>
const Handle(Adaptor3d_HSurface)& S1,
const Handle(Adaptor3d_HSurface)& S2,
const TopAbs_Orientation Or1,
+ const Standard_Integer theIndOfFace2,
const Standard_Boolean Gd1,
const Standard_Boolean Gd2,
const Standard_Boolean Gf1,
#ifdef OCCT_DEBUG
approx.Dump(std::cout);
#endif
- return StoreData( Data, approx, lin, S1, S2, Or1, Gd1, Gd2, Gf1, Gf2, Reversed);
+ return StoreData( Data, approx, lin, S1, S2, Or1, theIndOfFace2, Gd1, Gd2, Gf1, Gf2, Reversed);
}
approx.Dump(std::cout);
#endif
- return StoreData(Data,approx,lin,S1,S2,Or,0,0,0,0,Reversed);
+ return StoreData(Data,approx,lin,S1,S2,Or,0,0,0,0,0,Reversed); //jgv 0???
}
approx.Dump(std::cout);
#endif
- return StoreData(Data,approx,lin,S1,S2,Or,0,0,0,0);
+ return StoreData(Data,approx,lin,S1,S2,Or,0,0,0,0,0); //jgv 0???
}
const Handle(Adaptor3d_HSurface)& S1,
const Handle(Adaptor3d_HSurface)& S2,
const TopAbs_Orientation Or1,
+ const Standard_Integer theIndOfFace2,
const Standard_Boolean Gd1,
const Standard_Boolean Gd2,
const Standard_Boolean Gf1,
BS1 = Handle(BRepAdaptor_HSurface)::DownCast(S1);
Handle(BRepAdaptor_HSurface)
BS2 = Handle(BRepAdaptor_HSurface)::DownCast(S2);
+ TopoDS_Face FaceOfS2;
Geom2dAPI_ProjectPointOnCurve projector;
Standard_Real Uon1 = UFirst, Uon2 = ULast;
if(Reversed) TraOn1 = ChFi3d_TrsfTrans(lin->TransitionOnS2());
else TraOn1 = ChFi3d_TrsfTrans(lin->TransitionOnS1());
Fint1.SetInterference(Index1OfCurve,TraOn1,PCurveOnFace,PCurveOnSurf);
+
+ //jgv
+ TopoDS_Edge Boundary1, Boundary2;
+ Boundary1 = BRepLib_MakeEdge(Crv3d1, pppdeb, pppfin);
+ BRep_Builder BB;
+ BB.UpdateEdge(Boundary1, tolcheck);
+ TopLoc_Location aLoc;
+ BB.UpdateEdge(Boundary1, PCurveOnSurf, Surf, aLoc, 0.);
+ BB.UpdateEdge(Boundary1, PCurveOnFace, BS1->ChangeSurface().Face(), 0.);
+ myNewEdges.Add(Boundary1);
+
+ Standard_Integer IndF1, IndF2;
+ if (!myNewFaces.Contains(BS1->ChangeSurface().Face()))
+ myNewFaces.Add(BS1->ChangeSurface().Face());
+ IndF1 = myNewFaces.FindIndex(BS1->ChangeSurface().Face());
+ if (!myFaceNewEdges.Contains(IndF1))
+ {
+ //ChFi3d_ListOfQualifiedEdge aList;
+ TColStd_ListOfInteger aList;
+ myFaceNewEdges.Add(IndF1, aList);
+ }
+ /////
// SurfData is filled in what concerns S2,
Handle(Geom_Curve) Crv3d2 = Surf->UIso(Uon2);
if(Reversed) TraOn2 = ChFi3d_TrsfTrans(lin->TransitionOnS1());
else TraOn2 = ChFi3d_TrsfTrans(lin->TransitionOnS2());
Fint2.SetInterference(Index2OfCurve,TraOn2,PCurveOnFace,PCurveOnSurf);
+
+ //jgv
+ Boundary2 = BRepLib_MakeEdge(Crv3d2, pppdeb, pppfin);
+ BB.UpdateEdge(Boundary2, tolcheck);
+ BB.UpdateEdge(Boundary2, PCurveOnSurf, Surf, aLoc, 0.);
+ if (BS2.IsNull())
+ FaceOfS2 = TopoDS::Face(myNewFaces(theIndOfFace2));
+ else
+ FaceOfS2 = BS2->ChangeSurface().Face();
+ //BB.UpdateEdge(Boundary2, PCurveOnFace, BS2->ChangeSurface().Face(), 0.);
+ BB.UpdateEdge(Boundary2, PCurveOnFace, FaceOfS2, 0.);
+ myNewEdges.Add(Boundary2);
+
+ if (!myNewFaces.Contains(FaceOfS2))
+ myNewFaces.Add(FaceOfS2);
+ IndF2 = myNewFaces.FindIndex(FaceOfS2);
+ if (!myFaceNewEdges.Contains(IndF2))
+ {
+ //ChFi3d_ListOfQualifiedEdge aList;
+ TColStd_ListOfInteger aList;
+ myFaceNewEdges.Add(IndF2, aList);
+ }
+ /////
}
else {
Handle(Geom2d_Curve) bidpc;
break;
}
// Modified by skv - Wed Jun 9 17:16:26 2004 OCC5898 End
+
+ //Add new face and its new edges in the maps
+ TopoDS_Face aNewFace;
+ BB.MakeFace(aNewFace);
+ BB.UpdateFace(aNewFace, Surf, aLoc, Precision::Confusion());
+ aNewFace.Orientation(Data->Orientation());
+ Standard_Integer IndNewFace = myNewFaces.Add(aNewFace);
+ myIndsChFiFaces.Add(IndNewFace);
+ //ChFi3d_ListOfQualifiedEdge aList;
+ TColStd_ListOfInteger aList;
+ myFaceNewEdges.Add(IndNewFace, aList);
+ Data->ChangeIndexOfFace(IndNewFace);
+
+ Standard_Integer IndE1 = myNewEdges.FindIndex(Boundary1);
+ Data->ChangeIndexOfE1(IndE1);
+ IndE1 *= -1;
+ myFaceNewEdges.ChangeFromKey(IndNewFace).Append(IndE1);
+ IndE1 *= -1;
+ if (Data->Orientation() != BS1->ChangeSurface().Face().Orientation())
+ IndE1 *= -1;
+ myFaceNewEdges.ChangeFromKey(IndF1).Append(IndE1);
+
+ Standard_Integer IndE2 = myNewEdges.FindIndex(Boundary2);
+ Data->ChangeIndexOfE2(IndE2);
+ myFaceNewEdges.ChangeFromKey(IndNewFace).Append(IndE2);
+ IndE2 *= -1;
+ if (Data->Orientation() != FaceOfS2.Orientation())
+ IndE2 *= -1;
+ myFaceNewEdges.ChangeFromKey(IndF2).Append(IndE2);
+ ////////////////////////
if(!Gd1 && !S1.IsNull())
ChFi3d_FilCommonPoint(lin->StartPointOnFirst(),lin->TransitionOnS1(),
#include <BRepBlend_Line.hxx>
#include <BRepExtrema_ExtCC.hxx>
#include <BRepLib_MakeEdge.hxx>
+#include <BRepLib_MakeVertex.hxx>
#include <BRepTools.hxx>
#include <BRepTopAdaptor_TopolTool.hxx>
#include <ChFi3d.hxx>
#include <TopOpeBRepDS_Transition.hxx>
#include <TopTools_Array1OfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
+//#include <BOPTools_AlgoTools2D.hxx>
#ifdef OCCT_DEBUG
# ifdef DRAW
}
Handle(ChFiDS_SurfData)& Fd = SeqFil.ChangeValue(num);
+ //jgv
+ Standard_Integer IndexOfNewFace = Fd->IndexOfFace();
+ /////
ChFiDS_CommonPoint& CV1 = Fd->ChangeVertex(isfirst,1);
ChFiDS_CommonPoint& CV2 = Fd->ChangeVertex(isfirst,2);
//To evaluate the new points.
BRepAdaptor_Surface& Bs = HBs->ChangeSurface();
BRepAdaptor_Surface& Bad = HBad->ChangeSurface();
BRepAdaptor_Surface& Bop = HBop->ChangeSurface();
+ TopoDS_Edge aNewEdge;
Handle(Geom_Curve) Cc;
Handle(Geom2d_Curve) Pc,Ps;
Standard_Real Ubid,Vbid;//,mu,Mu,mv,Mv;
Standard_Integer IFadArc = 1, IFopArc = 2;
Fop = TopoDS::Face(DStr.Shape(Fd->Index(IFopArc)));
TopExp_Explorer ex;
+ BRep_Builder BB;
#ifdef OCCT_DEBUG
ChFi3d_InitChron(ch); // init perf condition if (onsame)
TopoDS_Face FFv;
Standard_Real tol;
Standard_Integer prol=0;
- BRep_Builder BRE;
Handle(Geom_Surface ) Sface;
Sface=BRep_Tool::Surface(Fv);
ChFi3d_ExtendSurface(Sface,prol);
tol=BRep_Tool::Tolerance(Fv);
- BRE.MakeFace(FFv,Sface,tol);
+ BB.MakeFace(FFv,Sface,tol);
if (prol) {
Bs.Initialize(FFv,Standard_False);
DStr.SetNewSurface(Fv,Sface);
ChFiDS_FaceInterference& FiopArc = Fd->ChangeInterference(IFopArc);
ChFiDS_CommonPoint& CPadArc = Fd->ChangeVertex(isfirst,IFadArc);
ChFiDS_FaceInterference& FiadArc = Fd->ChangeInterference(IFadArc);
+ TopoDS_Vertex VerFopFad [3];
//the parameter of the vertex in the air is initialiced with the value of
//its opposite (point on arc).
Standard_Real wop = Fd->ChangeInterference(IFadArc).Parameter(isfirst);
inters = IntersUpdateOnSame (HGs,HBs,c3df,Fop,Fv,Arcprol,Vtx,isfirst,10*tolesp, // in
FiopArc,CPopArc,p2dbout,wop); // out
+ //jgv
+ for (Standard_Integer is = 1; is <= 2; is++)
+ {
+ ChFiDS_FaceInterference& Interf = Fd->ChangeInterference(is);
+ Standard_Integer IndEsurf = Fd->IndexOfEdge(is);
+ TopoDS_Edge EdgeSurf = TopoDS::Edge(myNewEdges(IndEsurf));
+ Standard_Real fpar, lpar;
+ Handle(Geom_Curve) CurveEdgeSurf = BRep_Tool::Curve(EdgeSurf, fpar, lpar);
+ //BRep_Tool::Range(EdgeSurf, fpar, lpar);
+ if (isfirst)
+ fpar = Interf.FirstParameter();
+ else
+ lpar = Interf.LastParameter();
+ BB.Range(EdgeSurf, fpar, lpar);
+ VerFopFad[is] = (isfirst)? TopExp::FirstVertex(EdgeSurf)
+ : TopExp::LastVertex(EdgeSurf);
+ gp_Pnt aPnt = CurveEdgeSurf->Value((isfirst)? fpar : lpar);
+ BB.UpdateVertex(VerFopFad[is], aPnt, 0.);
+ }
+ /////
Handle(BRepAdaptor_HCurve2d) pced = new BRepAdaptor_HCurve2d();
pced->ChangeCurve2d().Initialize(CPadArc.Arc(),Fv);
Update(HBs,pced,HGs,Fd->ChangeInterferenceOnS1(),CV1,isfirst);
pced->ChangeCurve2d().Initialize(CV2.Arc(),Fv);
Update(HBs,pced,HGs,Fd->ChangeInterferenceOnS2(),CV2,isfirst);
+ //jgv
+ for (Standard_Integer is = 1; is <= 2; is++)
+ {
+ const ChFiDS_FaceInterference& Interf = Fd->Interference(is);
+ Standard_Integer IndEsurf = Fd->IndexOfEdge(is);
+ TopoDS_Edge EdgeSurf = TopoDS::Edge(myNewEdges(IndEsurf));
+ EdgeSurf.Orientation(TopAbs_FORWARD);
+ Standard_Real fpar, lpar;
+ Handle(Geom_Curve) CurveEdgeSurf = BRep_Tool::Curve(EdgeSurf, fpar, lpar);
+ if (isfirst)
+ fpar = Interf.FirstParameter();
+ else
+ lpar = Interf.LastParameter();
+ BB.Range(EdgeSurf, fpar, lpar);
+ VerFopFad[is] = (isfirst)? TopExp::FirstVertex(EdgeSurf)
+ : TopExp::LastVertex(EdgeSurf);
+ gp_Pnt aPnt = CurveEdgeSurf->Value((isfirst)? fpar : lpar);
+ if (VerFopFad[is].IsNull())
+ {
+ VerFopFad[is] = BRepLib_MakeVertex(aPnt);
+ TopAbs_Orientation OrOfVer = TopAbs_FORWARD;
+ if (!isfirst)
+ OrOfVer = TopAbs_REVERSED;
+ BB.Add(EdgeSurf, VerFopFad[is].Oriented(OrOfVer));
+ }
+ else
+ BB.UpdateVertex(VerFopFad[is], aPnt, 0.);
+ }
+ /////
}
Hc2 = BRep_Tool::CurveOnSurface(CV2.Arc(),Fv,Ubid,Ubid);
pfac2 = Hc2->Value(CV2.ParameterOnArc());
}
+ //jgv
+ if (Bs.IsUPeriodic() || Bs.IsVPeriodic())
+ {
+ gp_Pnt Pnt1 = BRep_Tool::Pnt(VerFopFad[1]);
+ gp_Pnt Pnt2 = BRep_Tool::Pnt(VerFopFad[2]);
+ gp_Pnt MidPnt((Pnt1.XYZ() + Pnt2.XYZ())/2);
+ //Project middle point onto surface
+ Extrema_ExtPS ProjPS(MidPnt, Bs,
+ Precision::PConfusion(), Precision::PConfusion());
+ Standard_Integer indmin = 1;
+ for (Standard_Integer iext = 2; iext <= ProjPS.NbExt(); iext++)
+ if (ProjPS.SquareDistance(iext) < ProjPS.SquareDistance(indmin))
+ indmin = iext;
+ Standard_Real uu, vv;
+ ProjPS.Point(indmin).Parameter(uu,vv);
+ gp_Pnt2d MidPnt2d(uu, vv);
+ ChFi3d_AdjustSecondPointToFirstPoint(MidPnt2d, pfac1, Bs);
+ ChFi3d_AdjustSecondPointToFirstPoint(MidPnt2d, pfac2, Bs);
+ }
+ /////
if (Fi1.LineIndex() != 0) {
pfil1 = Fi1.PCurveOnSurf()->Value(Fi1.Parameter(isfirst));
}
Pc,tolesp,tol2d,tolreached))
throw Standard_Failure("OneCorner : echec calcul intersection");
+ //jgv
+ /*
+ gp_Pnt Pver, Pcur;
+ Pver = BRep_Tool::Pnt(VerFopFad[IFopArc]);
+ Pcur = Cc->Value(Cc->FirstParameter());
+ Standard_Real aDist = Pver.Distance(Pcur);
+ BB.UpdateVertex(VerFopFad[IFopArc], 1.01*aDist);
+ Pver = BRep_Tool::Pnt(VerFopFad[IFadArc]);
+ Pcur = Cc->Value(Cc->LastParameter());
+ aDist = Pver.Distance(Pcur);
+ BB.UpdateVertex(VerFopFad[IFadArc], 1.01*aDist);
+ */
+ Standard_Integer ind_first, ind_last;
+ if (onsame)
+ {
+ ind_first = IFopArc; ind_last = IFadArc;
+ }
+ else
+ {
+ ind_first = IFadArc; ind_last = IFopArc;
+ }
+ aNewEdge = BRepLib_MakeEdge(Cc,
+ VerFopFad[ind_first], VerFopFad[ind_last],
+ Cc->FirstParameter(), Cc->LastParameter());
+ BB.UpdateEdge(aNewEdge, tolreached);
+ TopLoc_Location aLoc;
+ BB.UpdateEdge(aNewEdge, Ps, DStr.Surface(Fd->Surf()).Surface(), aLoc, 0.);
+ /*
+ Handle(Geom2d_Curve) AdjustedPc;
+ BOPTools_AlgoTools2D::AdjustPCurveOnSurf(Bs, Cc->FirstParameter(), Cc->LastParameter(),
+ Pc, AdjustedPc);
+ Pc = AdjustedPc;
+ */
+ BB.UpdateEdge(aNewEdge, Pc, Bs.Face(), 0.);
+ myNewEdges.Add(aNewEdge);
+ /////
+
Udeb = Cc->FirstParameter();
Ufin = Cc->LastParameter();
break;
}
}
+ }
-//
-
-
+ Standard_Integer IndFv;
+ if (!myNewFaces.Contains(Fv))
+ myNewFaces.Add(Fv);
+ IndFv = myNewFaces.FindIndex(Fv);
+ if (!myFaceNewEdges.Contains(IndFv))
+ {
+ //ChFi3d_ListOfQualifiedEdge aList;
+ TColStd_ListOfInteger aList;
+ myFaceNewEdges.Add(IndFv, aList);
}
+ Standard_Integer IndE = myNewEdges.FindIndex(aNewEdge);
+ //QualifiedEdge aQE(IndE, Et);
+ if (Et == TopAbs_REVERSED)
+ IndE *= -1;
+ myFaceNewEdges.ChangeFromKey(IndFv).Append(IndE);
+ //Standard_Integer IndE_forNewFace = IndE;
+ Standard_Integer IndE_forNewFace = Abs(IndE);
+ //if (Fd->Orientation() == TopAbs_FORWARD)
+ if (!isfirst)
+ IndE_forNewFace *= -1;
+ //myFaceNewEdges.ChangeFromKey(IndexOfNewFace).Append(-IndE);
+ myFaceNewEdges.ChangeFromKey(IndexOfNewFace).Append(IndE_forNewFace);
#ifdef OCCT_DEBUG
ChFi3d_ResultChron(ch ,t_inter); //result perf condition if (inter)
Hc = BRep_Tool::CurveOnSurface(Arcprol,Fop,Ubid,Ubid);
pop1 = Hc->Value(parVtx);
pop2 = Fiop.PCurveOnFace()->Value(Fiop.Parameter(isfirst));
+ if (!ChFi3d_IsInSingularity(Vtx, myVEMap))
+ ChFi3d_AdjustSecondPointToFirstPoint(pop1, pop2, Bop);
Hc = BRep_Tool::CurveOnSurface(Arcprol,Fv,Ubid,Ubid);
pv1 = Hc->Value(parVtx);
pv2 = p2dbout;
zob2dv,tolesp,tol2d,tolreached))
throw Standard_Failure("OneCorner : echec calcul intersection");
+ //jgv
+ //TopoDS_Vertex CommonVertexForNewEdgeAndZobEdge = TopExp::FirstVertex(aNewEdge);
+ gp_Pnt aPnt = BRep_Tool::Pnt(Vtx);
+ gp_Pnt aPntFromCurve = zob3d->Value(zob3d->FirstParameter());
+ Standard_Real aDist = aPnt.Distance(aPntFromCurve);
+ BB.UpdateVertex(Vtx, 1.01*aDist);
+ TopoDS_Edge aZobEdge = BRepLib_MakeEdge(zob3d,
+ Vtx, VerFopFad[IFopArc],
+ zob3d->FirstParameter(), zob3d->LastParameter());
+ BB.UpdateEdge(aZobEdge, tolreached);
+ /*
+ Handle(Geom2d_Curve) AdjustedZob2dop;
+ BOPTools_AlgoTools2D::AdjustPCurveOnSurf(Bop, zob3d->FirstParameter(), zob3d->LastParameter(),
+ zob2dop, AdjustedZob2dop);
+ zob2dop = AdjustedZob2dop;
+ */
+ BB.UpdateEdge(aZobEdge, zob2dop, Bop.Face(), 0.);
+ /*
+ Handle(Geom2d_Curve) AdjustedZob2dv;
+ BOPTools_AlgoTools2D::AdjustPCurveOnSurf(Bs, zob3d->FirstParameter(), zob3d->LastParameter(),
+ zob2dv, AdjustedZob2dv);
+ zob2dv = AdjustedZob2dv;
+ */
+ BB.UpdateEdge(aZobEdge, zob2dv, Bs.Face(), 0.);
+ TopTools_ListOfShape aZobList, aNewZobList;
+ aZobList.Append(aZobEdge);
+ ChFi3d_SplitAndAdjust(aZobList, aNewZobList, Bop);
+ TopTools_ListIteratorOfListOfShape itl(aNewZobList);
+ for (; itl.More(); itl.Next())
+ myNewEdges.Add(itl.Value());
+
Udeb = zob3d->FirstParameter();
Ufin = zob3d->LastParameter();
TopOpeBRepDS_Curve Zob(zob3d,tolreached);
Standard_Integer IZob = DStr.AddCurve(Zob);
-// it is determined if Fop has an edge of sewing
-// it is determined if the curve has an intersection with the edge of sewing
+ Et = TopAbs::Reverse(TopAbs::Compose(OVtx,OArcprolv));
- //TopoDS_Edge edgecouture;
- //Standard_Boolean couture;
- ChFi3d_Couture(Fop,couture,edgecouture);
-
- if (couture && !BRep_Tool::Degenerated(edgecouture)) {
- BRepLib_MakeEdge Bedge (zob3d);
- TopoDS_Edge edg =Bedge. Edge();
- BRepExtrema_ExtCC extCC (edgecouture,edg);
- if (extCC.IsDone()&&extCC.NbExt()!=0) {
- for (Standard_Integer i=1; i<=extCC.NbExt()&&!intcouture;i++) {
- if (extCC.SquareDistance(i)<=1.e-8) {
- par1=extCC.ParameterOnE1(i);
- par2=extCC.ParameterOnE2(i);
- gp_Pnt P1=extCC.PointOnE1(i);
- TopOpeBRepDS_Point tpoint(P1,1.e-4);
- indpt=DStr.AddPoint(tpoint);
- intcouture=Standard_True;
- curv1 = new Geom_TrimmedCurve(zob3d,Udeb,par2);
- curv2 = new Geom_TrimmedCurve(zob3d,par2,Ufin);
- TopOpeBRepDS_Curve tcurv1(curv1,tolreached);
- TopOpeBRepDS_Curve tcurv2(curv2,tolreached);
- Icurv1=DStr.AddCurve(tcurv1);
- Icurv2=DStr.AddCurve(tcurv2);
- }
- }
- }
+ Standard_Integer IndFop;
+ if (!myNewFaces.Contains(Fop))
+ myNewFaces.Add(Fop);
+ IndFop = myNewFaces.FindIndex(Fop);
+ if (!myFaceNewEdges.Contains(IndFop))
+ {
+ //ChFi3d_ListOfQualifiedEdge aList;
+ TColStd_ListOfInteger aList;
+ myFaceNewEdges.Add(IndFop, aList);
}
- if (intcouture) {
-
-// interference of curv1 and curv2 on Ishape
- Et = TopAbs::Reverse(TopAbs::Compose(OVtx,OArcprolv));
- ComputeCurve2d(curv1,Fop,c2d1);
- Handle(TopOpeBRepDS_SurfaceCurveInterference)
- InterFv = ChFi3d_FilCurveInDS(Icurv1,IShape,/*zob2dv*/c2d1,Et);
- DStr.ChangeShapeInterferences(IShape).Append(InterFv);
- ComputeCurve2d(curv2,Fop,c2d2);
- InterFv = ChFi3d_FilCurveInDS(Icurv2,IShape,/*zob2dv*/c2d2,Et);
- DStr.ChangeShapeInterferences(IShape).Append(InterFv);
-
- // limitation of the sewing edge
- Standard_Integer Iarc=DStr.AddShape(edgecouture);
- Handle(TopOpeBRepDS_CurvePointInterference) Interfedge;
- TopAbs_Orientation ori;
- TopoDS_Vertex Vdeb,Vfin;
- Vdeb=TopExp::FirstVertex(edgecouture);
- Vfin=TopExp::LastVertex(edgecouture);
- Standard_Real pard,parf;
- pard=BRep_Tool::Parameter(Vdeb,edgecouture);
- parf=BRep_Tool::Parameter(Vfin,edgecouture);
- if (Abs(par1-pard)<Abs(parf-par1)) ori=TopAbs_REVERSED;
- else ori=TopAbs_FORWARD;
- Interfedge = ChFi3d_FilPointInDS(ori,Iarc,indpt,par1);
- DStr.ChangeShapeInterferences(Iarc).Append(Interfedge);
-
- // interference of curv1 and curv2 on Iop
- Standard_Integer Iop = DStr.AddShape(Fop);
- Et = TopAbs::Reverse(TopAbs::Compose(OVtx,OArcprolop));
- Handle(TopOpeBRepDS_SurfaceCurveInterference) Interfop;
- ComputeCurve2d(curv1,Fop,c2d1);
- Interfop = ChFi3d_FilCurveInDS(Icurv1,Iop,c2d1,Et);
- DStr.ChangeShapeInterferences(Iop).Append(Interfop);
- ComputeCurve2d(curv2,Fop,c2d2);
- Interfop = ChFi3d_FilCurveInDS(Icurv2,Iop,c2d2,Et);
- DStr.ChangeShapeInterferences(Iop).Append(Interfop);
- Handle(TopOpeBRepDS_CurvePointInterference)
- interfprol = ChFi3d_FilVertexInDS(TopAbs_FORWARD,Icurv1,IVtx,Udeb);
- DStr.ChangeCurveInterferences(Icurv1).Append(interfprol);
- interfprol = ChFi3d_FilPointInDS(TopAbs_REVERSED,Icurv1,indpt,par2);
- DStr.ChangeCurveInterferences(Icurv1).Append(interfprol);
- Standard_Integer icc = stripe->IndexPoint(isfirst,IFopArc);
- interfprol = ChFi3d_FilPointInDS(TopAbs_FORWARD,Icurv2,indpt,par2);
- DStr.ChangeCurveInterferences(Icurv2).Append(interfprol);
- interfprol = ChFi3d_FilPointInDS(TopAbs_REVERSED,Icurv2,icc,Ufin);
- DStr.ChangeCurveInterferences(Icurv2).Append(interfprol);
+ for (itl.Initialize(aNewZobList); itl.More(); itl.Next())
+ {
+ Standard_Integer IndZobE = myNewEdges.FindIndex(itl.Value());
+ //QualifiedEdge aQzobE(IndZobE, Et);
+ if (Et == TopAbs_REVERSED)
+ IndZobE *= -1;
+ myFaceNewEdges.ChangeFromKey(IndFv).Append(IndZobE);
+ //QualifiedEdge aQzopEonFop(IndZobE, TopAbs::Reverse(Et));
+ myFaceNewEdges.ChangeFromKey(IndFop).Append(-IndZobE);
}
- else {
- Et = TopAbs::Reverse(TopAbs::Compose(OVtx,OArcprolv));
- Handle(TopOpeBRepDS_SurfaceCurveInterference)
- InterFv = ChFi3d_FilCurveInDS(IZob,IShape,zob2dv,Et);
- DStr.ChangeShapeInterferences(IShape).Append(InterFv);
- Et = TopAbs::Reverse(TopAbs::Compose(OVtx,OArcprolop));
- Standard_Integer Iop = DStr.AddShape(Fop);
- Handle(TopOpeBRepDS_SurfaceCurveInterference)
- Interfop = ChFi3d_FilCurveInDS(IZob,Iop,zob2dop,Et);
- DStr.ChangeShapeInterferences(Iop).Append(Interfop);
- Handle(TopOpeBRepDS_CurvePointInterference) interfprol;
- #ifdef VARIANT1
- interfprol = ChFi3d_FilVertexInDS(TopAbs_FORWARD,IZob,IVtx,Udeb);
- #else
- {
- Standard_Integer IV2 = DStr.AddShape(V2); // VARIANT 2
- interfprol = ChFi3d_FilVertexInDS(TopAbs_FORWARD,IZob,IV2,Udeb);
- }
- #endif
- DStr.ChangeCurveInterferences(IZob).Append(interfprol);
- Standard_Integer icc = stripe->IndexPoint(isfirst,IFopArc);
- interfprol = ChFi3d_FilPointInDS(TopAbs_REVERSED,IZob,icc,Ufin);
- DStr.ChangeCurveInterferences(IZob).Append(interfprol);
- #ifdef VARIANT1
- {
- if (IFopArc == 1) box1.Add( zob3d->Value(Ufin) );
- else box2.Add( zob3d->Value(Ufin) );
- }
- #else
- {
- // cut off existing Arcprol
- Standard_Integer iArcprol = DStr.AddShape(Arcprol);
- interfprol = ChFi3d_FilPointInDS(OVtx,iArcprol,icc,Udeb);
- DStr.ChangeShapeInterferences(Arcprol).Append(interfprol);
- }
- #endif
+
+ Handle(TopOpeBRepDS_SurfaceCurveInterference)
+ InterFv = ChFi3d_FilCurveInDS(IZob,IShape,zob2dv,Et);
+ DStr.ChangeShapeInterferences(IShape).Append(InterFv);
+ Et = TopAbs::Reverse(TopAbs::Compose(OVtx,OArcprolop));
+ Standard_Integer Iop = DStr.AddShape(Fop);
+ Handle(TopOpeBRepDS_SurfaceCurveInterference)
+ Interfop = ChFi3d_FilCurveInDS(IZob,Iop,zob2dop,Et);
+ DStr.ChangeShapeInterferences(Iop).Append(Interfop);
+ Handle(TopOpeBRepDS_CurvePointInterference) interfprol;
+#ifdef VARIANT1
+ interfprol = ChFi3d_FilVertexInDS(TopAbs_FORWARD,IZob,IVtx,Udeb);
+#else
+ {
+ Standard_Integer IV2 = DStr.AddShape(V2); // VARIANT 2
+ interfprol = ChFi3d_FilVertexInDS(TopAbs_FORWARD,IZob,IV2,Udeb);
}
- }
+#endif
+ DStr.ChangeCurveInterferences(IZob).Append(interfprol);
+ Standard_Integer icc = stripe->IndexPoint(isfirst,IFopArc);
+ interfprol = ChFi3d_FilPointInDS(TopAbs_REVERSED,IZob,icc,Ufin);
+ DStr.ChangeCurveInterferences(IZob).Append(interfprol);
+#ifdef VARIANT1
+ {
+ if (IFopArc == 1) box1.Add( zob3d->Value(Ufin) );
+ else box2.Add( zob3d->Value(Ufin) );
+ }
+#else
+ {
+ // cut off existing Arcprol
+ Standard_Integer iArcprol = DStr.AddShape(Arcprol);
+ interfprol = ChFi3d_FilPointInDS(OVtx,iArcprol,icc,Udeb);
+ DStr.ChangeShapeInterferences(Arcprol).Append(interfprol);
+ }
+#endif
+ } //if (onsame && inters)
+
ChFi3d_EnlargeBox(DStr,stripe,Fd,box1,box2,isfirst);
if (CV1.IsOnArc()) {
ChFi3d_EnlargeBox(CV1.Arc(),myEFMap(CV1.Arc()),CV1.ParameterOnArc(),box1);
#include <TopOpeBRepDS_Surface.hxx>
#include <TopOpeBRepDS_SurfaceCurveInterference.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <BRepLib_MakeEdge.hxx>
+#include <BRepLib_MakeVertex.hxx>
static void Reduce(const Standard_Real& p1,
const Standard_Real& p2,
done = 0;
const TopoDS_Vertex& Vtx = myVDataMap.FindKey(Index);
TopOpeBRepDS_DataStructure& DStr = myDS->ChangeDS();
+ BRep_Builder BB;
+ TopoDS_Vertex Vertices [3];
//Information on fillets is extracted
//------------------------------------------------------
ChFiDS_SequenceOfSurfData& SeqFil1 =
Corner1->ChangeSetOfSurfData()->ChangeSequence();
Handle(ChFiDS_SurfData)& Fd1 = SeqFil1.ChangeValue(IFd1);
+ //jgv
+ Standard_Integer IndexOfNewFace1 = Fd1->IndexOfFace();
+ /////
//the second
//----------
ChFiDS_SequenceOfSurfData& SeqFil2 =
Corner2->ChangeSetOfSurfData()->ChangeSequence();
Handle(ChFiDS_SurfData)& Fd2 = SeqFil2.ChangeValue(IFd2);
+ //jgv
+ Standard_Integer IndexOfNewFace2 = Fd2->IndexOfFace();
+ /////
// The concavities are analysed in case of differents concavities,
// preview an evolutionary connection of type ThreeCorner of R to 0.
}
gp_Pnt psp1 = Hpivot->Value(parCP1);
gp_Pnt psp2 = Hpivot->Value(parCP2);
- Standard_Real sameparam = (psp1.Distance(psp2) < 10 * tolesp);
+ Standard_Boolean sameparam = (psp1.Distance(psp2) < 10 * tolesp);
TopoDS_Face FF1 = TopoDS::Face(DStr.Shape(Fd1->Index(IFaArc1)));
TopoDS_Face FF2 = TopoDS::Face(DStr.Shape(Fd2->Index(IFaArc2)));
// CornerData are updated with results of the intersection.
Standard_Real WFirst = Gc->FirstParameter();
Standard_Real WLast = Gc->LastParameter();
+
+ //jgv
+ ChFiDS_FaceInterference& InterfArc1 = Fd1->ChangeInterference(IFaArc1);
+ Standard_Integer IndEarc1 = Fd1->IndexOfEdge(IFaArc1);
+ TopoDS_Edge EdgeArc1 = TopoDS::Edge(myNewEdges(IndEarc1));
+ EdgeArc1.Orientation(TopAbs_FORWARD);
+ Standard_Real fpar, lpar;
+ Handle(Geom_Curve) CurveEdgeArc1 = BRep_Tool::Curve(EdgeArc1, fpar, lpar);
+ if (isfirst1)
+ fpar = InterfArc1.FirstParameter();
+ else
+ lpar = InterfArc1.LastParameter();
+ BB.Range(EdgeArc1, fpar, lpar);
+ Vertices[1] = (isfirst1)? TopExp::FirstVertex(EdgeArc1)
+ : TopExp::LastVertex(EdgeArc1);
+ gp_Pnt aPnt = CurveEdgeArc1->Value((isfirst1)? fpar : lpar);
+ if (Vertices[1].IsNull())
+ {
+ Vertices[1] = BRepLib_MakeVertex(aPnt);
+ TopAbs_Orientation OrOfVer = TopAbs_FORWARD;
+ if (!isfirst1)
+ OrOfVer = TopAbs_REVERSED;
+ BB.Add(EdgeArc1, Vertices[1].Oriented(OrOfVer));
+ }
+ else
+ BB.UpdateVertex(Vertices[1], aPnt, 0.);
+
+ ChFiDS_FaceInterference& InterfArc2 = Fd2->ChangeInterference(IFaArc2);
+ Standard_Integer IndEarc2 = Fd2->IndexOfEdge(IFaArc2);
+ TopoDS_Edge EdgeArc2 = TopoDS::Edge(myNewEdges(IndEarc2));
+ EdgeArc2.Orientation(TopAbs_FORWARD);
+ Handle(Geom_Curve) CurveEdgeArc2 = BRep_Tool::Curve(EdgeArc2, fpar, lpar);
+ if (isfirst2)
+ fpar = InterfArc2.FirstParameter();
+ else
+ lpar = InterfArc2.LastParameter();
+ BB.Range(EdgeArc2, fpar, lpar);
+ TopoDS_Vertex aVertexArc2 = (isfirst2)? TopExp::FirstVertex(EdgeArc2)
+ : TopExp::LastVertex(EdgeArc2);
+ if (!aVertexArc2.IsSame(Vertices[1]))
+ {
+ BB.Remove(EdgeArc2, aVertexArc2);
+ TopAbs_Orientation OrOfVer = TopAbs_FORWARD;
+ if (!isfirst2)
+ OrOfVer = TopAbs_REVERSED;
+ BB.Add(EdgeArc2, Vertices[1].Oriented(OrOfVer));
+ }
+ /////
Standard_Integer Ipoin1;
Standard_Integer Ipoin2;
ChFiDS_CommonPoint& cpco1 = Fd1->ChangeVertex(isfirst1,IFaCo1);
cpco1.SetPoint(PFaCo);
cpco1.SetTolerance(Max(tolreached,tolpco));
Fd1->ChangeInterference(IFaCo1).SetParameter(UIntPC1,isfirst1);
+ //jgv
+ ChFiDS_FaceInterference& Interf1 = Fd1->ChangeInterference(IFaCo1);
+ Standard_Integer IndEsurf1 = Fd1->IndexOfEdge(IFaCo1);
+ TopoDS_Edge EdgeSurf1 = TopoDS::Edge(myNewEdges(IndEsurf1));
+ EdgeSurf1.Orientation(TopAbs_FORWARD);
+ Handle(Geom_Curve) CurveEdgeSurf1 = BRep_Tool::Curve(EdgeSurf1, fpar, lpar);
+ //BRep_Tool::Range(EdgeSurf, fpar, lpar);
+ if (isfirst1)
+ fpar = Interf1.FirstParameter();
+ else
+ lpar = Interf1.LastParameter();
+ BB.Range(EdgeSurf1, fpar, lpar);
+ Vertices[2] = (isfirst1)? TopExp::FirstVertex(EdgeSurf1)
+ : TopExp::LastVertex(EdgeSurf1);
+ aPnt = CurveEdgeSurf1->Value((isfirst1)? fpar : lpar);
+ if (Vertices[2].IsNull())
+ {
+ Vertices[2] = BRepLib_MakeVertex(aPnt);
+ TopAbs_Orientation OrOfVer = TopAbs_FORWARD;
+ if (!isfirst1)
+ OrOfVer = TopAbs_REVERSED;
+ BB.Add(EdgeSurf1, Vertices[2].Oriented(OrOfVer));
+ }
+ else
+ BB.UpdateVertex(Vertices[2], aPnt, 0.);
+ /////
tolparc = Max(tolparc,tolreached);
cparc1.SetTolerance(Max(tolparc,tolreached));
Ipoin1 = ChFi3d_IndexPointInDS(Fd1->Vertex(isfirst1,1),DStr);
Corner2->SetCurve(ICurv,isfirst2);
Corner2->ChangePCurve(isfirst2) = PGc2;
Fd2->ChangeInterference(IFaCo2).SetParameter(UIntPC2,isfirst2);
+ //jgv
+ ChFiDS_FaceInterference& Interf2 = Fd2->ChangeInterference(IFaCo2);
+ Standard_Integer IndEsurf2 = Fd2->IndexOfEdge(IFaCo2);
+ TopoDS_Edge EdgeSurf2 = TopoDS::Edge(myNewEdges(IndEsurf2));
+ EdgeSurf2.Orientation(TopAbs_FORWARD);
+ Handle(Geom_Curve) CurveEdgeSurf2 = BRep_Tool::Curve(EdgeSurf2, fpar, lpar);
+ //BRep_Tool::Range(EdgeSurf, fpar, lpar);
+ if (isfirst2)
+ fpar = Interf2.FirstParameter();
+ else
+ lpar = Interf2.LastParameter();
+ BB.Range(EdgeSurf2, fpar, lpar);
+ TopoDS_Vertex aVertex2 = (isfirst2)? TopExp::FirstVertex(EdgeSurf2)
+ : TopExp::LastVertex(EdgeSurf2);
+ if (!aVertex2.IsSame(Vertices[2]))
+ {
+ BB.Remove(EdgeSurf2, aVertex2);
+ TopAbs_Orientation OrOfVer = TopAbs_FORWARD;
+ if (!isfirst2)
+ OrOfVer = TopAbs_REVERSED;
+ BB.Add(EdgeSurf2, Vertices[2].Oriented(OrOfVer));
+ }
+
+ //Create new edge
+ gp_Pnt aPntVer = BRep_Tool::Pnt(Vertices[IFaArc1]);
+ gp_Pnt aPntFromCurve = Gc->Value(WFirst);
+ Standard_Real aDist = aPntVer.Distance(aPntFromCurve);
+ BB.UpdateVertex(Vertices[IFaArc1], 1.01*aDist);
+ TopoDS_Edge aNewEdge = BRepLib_MakeEdge(Gc,
+ Vertices[IFaArc1], Vertices[IFaCo1],
+ WFirst, WLast);
+ BB.UpdateEdge(aNewEdge, tolreached);
+ TopLoc_Location aLoc;
+ BB.UpdateEdge(aNewEdge, PGc1, DStr.Surface(Fd1->Surf()).Surface(), aLoc, 0.);
+ BB.UpdateEdge(aNewEdge, PGc2, DStr.Surface(Fd2->Surf()).Surface(), aLoc, 0.);
+ myNewEdges.Add(aNewEdge);
+ //Temporary
+ //TopAbs_Orientation Or1 = Fd1->Orientation();
+ //TopAbs_Orientation Or2 = Fd2->Orientation();
+ ///////////
+ Standard_Integer IndE = myNewEdges.FindIndex(aNewEdge);
+ Standard_Boolean IsFirstArcForward = Standard_True;
+ const TColStd_ListOfInteger& Elist = myFaceNewEdges.FindFromKey(IndexOfNewFace1);
+ TColStd_ListIteratorOfListOfInteger itl(Elist);
+ for (; itl.More(); itl.Next())
+ {
+ Standard_Integer anIndexOfEdge = itl.Value();
+ if (Abs(anIndexOfEdge) == IndEarc1)
+ {
+ IsFirstArcForward = (anIndexOfEdge > 0);
+ break;
+ }
+ }
+ if ((isfirst1 && IFaArc1 == 1 && IsFirstArcForward) ||
+ (!isfirst1 && IFaArc1 == 2 && IsFirstArcForward))
+ IndE *= -1;
+ //QualifiedEdge aQE(IndE, Et);
+ myFaceNewEdges.ChangeFromKey(IndexOfNewFace1).Append(IndE);
+ Standard_Integer IndE_forNewFace2 = IndE;
+ if (Fd1->Orientation() == Fd2->Orientation())
+ IndE_forNewFace2 *= -1;
+ myFaceNewEdges.ChangeFromKey(IndexOfNewFace2).Append(IndE_forNewFace2);
+ /////
Fd2->ChangeVertex(isfirst2,IFaCo2) = Fd1->Vertex(isfirst1,IFaCo1);
Fd2->ChangeVertex(isfirst2,IFaArc2) = Fd1->Vertex(isfirst1,IFaArc1);
if (IFaCo1!=IFaCo2) Corner2->SetOrientation(TopAbs_REVERSED,isfirst2);
Standard_Integer IFaCoBig, IFaCoSma, IFaArcBig, IFaArcSma;
Standard_Boolean isfirstBig, isfirstSma;
Standard_Real UIntPCBig, UIntPCSma;
+ Standard_Integer IndexOfSmaNewFace, IndexOfBigNewFace;
if((parcrois && parCP2 > parCP1) || (!parcrois && parCP2 < parCP1)){
UIntPCBig = UIntPC2; UIntPCSma = UIntPC1;
IFaCoBig = IFaCo2; IFaCoSma = IFaCo1;
IFaArcBig = IFaArc2; IFaArcSma = IFaArc1;
isfirstBig = isfirst2; isfirstSma = isfirst1;
+ IndexOfSmaNewFace = IndexOfNewFace1; IndexOfBigNewFace = IndexOfNewFace2;
}
else{
UIntPCBig = UIntPC1, UIntPCSma = UIntPC2;
IFaCoBig = IFaCo1; IFaCoSma = IFaCo2;
IFaArcBig = IFaArc1; IFaArcSma = IFaArc2;
isfirstBig = isfirst1; isfirstSma = isfirst2;
+ IndexOfSmaNewFace = IndexOfNewFace2; IndexOfBigNewFace = IndexOfNewFace1;
}
//Intersection of the big with the small :
psmaco.SetPoint(PFaCo);
psmaco.SetTolerance(Max(tolpco,tolreached));
SmaFD->ChangeInterference(IFaCoSma).SetParameter(UIntPCSma,isfirstSma);
+ //jgv
+ ChFiDS_FaceInterference& SmaInterf = SmaFD->ChangeInterference(IFaCoSma);
+ Standard_Integer IndEsmall = SmaFD->IndexOfEdge(IFaCoSma);
+ TopoDS_Edge EdgeSmall = TopoDS::Edge(myNewEdges(IndEsmall));
+ EdgeSmall.Orientation(TopAbs_FORWARD);
+ Standard_Real fpar, lpar;
+ Handle(Geom_Curve) CurveEdgeSma = BRep_Tool::Curve(EdgeSmall, fpar, lpar);
+ //BRep_Tool::Range(EdgeSmall, fpar, lpar);
+ if (isfirstSma)
+ fpar = SmaInterf.FirstParameter();
+ else
+ lpar = SmaInterf.LastParameter();
+ BB.Range(EdgeSmall, fpar, lpar);
+ Vertices[2] = (isfirstSma)? TopExp::FirstVertex(EdgeSmall)
+ : TopExp::LastVertex(EdgeSmall);
+ gp_Pnt aPnt = CurveEdgeSma->Value((isfirstSma)? fpar : lpar);
+ if (Vertices[2].IsNull())
+ {
+ Vertices[2] = BRepLib_MakeVertex(aPnt);
+ TopAbs_Orientation OrOfVer = TopAbs_FORWARD;
+ if (!isfirstSma)
+ OrOfVer = TopAbs_REVERSED;
+ BB.Add(EdgeSmall, Vertices[2].Oriented(OrOfVer));
+ }
+ else
+ BB.UpdateVertex(Vertices[2], aPnt, 0.);
+ /////
psmamil.Reset();
psmamil.SetPoint(PMil);
psmamil.SetTolerance(Max(tolpmil,tolreached));
SmaFD->ChangeInterference(IFaArcSma).SetParameter(wi,isfirstSma);
+ //jgv
+ ChFiDS_FaceInterference& SmaArcInterf = SmaFD->ChangeInterference(IFaArcSma);
+ Standard_Integer IndEarcsmall = SmaFD->IndexOfEdge(IFaArcSma);
+ TopoDS_Edge EdgeArcSmall = TopoDS::Edge(myNewEdges(IndEarcsmall));
+ EdgeArcSmall.Orientation(TopAbs_FORWARD);
+ Handle(Geom_Curve) CurveEdgeArcSma = BRep_Tool::Curve(EdgeArcSmall, fpar, lpar);
+ if (isfirstSma)
+ fpar = SmaArcInterf.FirstParameter();
+ else
+ lpar = SmaArcInterf.LastParameter();
+ BB.Range(EdgeArcSmall, fpar, lpar);
+ Vertices[1] = (isfirstSma)? TopExp::FirstVertex(EdgeArcSmall)
+ : TopExp::LastVertex(EdgeArcSmall);
+ aPnt = CurveEdgeArcSma->Value((isfirstSma)? fpar : lpar);
+ if (Vertices[1].IsNull())
+ {
+ Vertices[1] = BRepLib_MakeVertex(aPnt);
+ TopAbs_Orientation OrOfVer = TopAbs_FORWARD;
+ if (!isfirstSma)
+ OrOfVer = TopAbs_REVERSED;
+ BB.Add(EdgeArcSmall, Vertices[1].Oriented(OrOfVer));
+ }
+ else
+ BB.UpdateVertex(Vertices[1], aPnt, 0.);
+ /////
IpointCo = ChFi3d_IndexPointInDS(psmaco,DStr);
SmaCD->SetIndexPoint(IpointCo,isfirstSma,IFaCoSma);
IpointMil = ChFi3d_IndexPointInDS(psmamil,DStr);
BigCD->SetIndexPoint(IpointCo,isfirstBig,IFaCoBig);
BigFD->ChangeVertex(isfirstBig,IFaCoBig) = psmaco;
BigFD->ChangeInterference(IFaCoBig).SetParameter(UIntPCBig,isfirstBig);
+ //jgv
+ ChFiDS_FaceInterference& BigInterf = BigFD->ChangeInterference(IFaCoBig);
+ Standard_Integer IndEbig = BigFD->IndexOfEdge(IFaCoBig);
+ TopoDS_Edge EdgeBig = TopoDS::Edge(myNewEdges(IndEbig));
+ EdgeBig.Orientation(TopAbs_FORWARD);
+
+ //???
+ TopoDS_Vertex BigVer [3];
+ Handle(Geom_Curve) CurveEdgeBig = BRep_Tool::Curve(EdgeBig, fpar, lpar);
+ //BRep_Tool::Range(EdgeBig, fpar, lpar);
+ if (isfirstBig)
+ fpar = BigInterf.FirstParameter();
+ else
+ lpar = BigInterf.LastParameter();
+ BB.Range(EdgeBig, fpar, lpar);
+ BigVer[2] = (isfirstBig)? TopExp::FirstVertex(EdgeBig)
+ : TopExp::LastVertex(EdgeBig);
+ aPnt = CurveEdgeBig->Value((isfirstBig)? fpar : lpar);
+ //if (BigVer[2].IsNull())
+ if (!BigVer[2].IsSame(Vertices[2]))
+ {
+ //BigVer[2] = BRepLib_MakeVertex(aPnt);
+ BB.Remove(EdgeBig, BigVer[2]);
+ TopAbs_Orientation OrOfVer = TopAbs_FORWARD;
+ if (!isfirstBig)
+ OrOfVer = TopAbs_REVERSED;
+ BB.Add(EdgeBig, Vertices[2].Oriented(OrOfVer));
+ }
+ /////
+
+ ChFiDS_FaceInterference& BigArcInterf = BigFD->ChangeInterference(IFaArcBig);
+ Standard_Integer IndEarcbig = BigFD->IndexOfEdge(IFaArcBig);
+ TopoDS_Edge EdgeArcBig = TopoDS::Edge(myNewEdges(IndEarcbig));
+ EdgeArcBig.Orientation(TopAbs_FORWARD);
+
+ //???
+ Handle(Geom_Curve) CurveEdgeArcBig = BRep_Tool::Curve(EdgeArcBig, fpar, lpar);
+ if (isfirstBig)
+ fpar = BigArcInterf.FirstParameter();
+ else
+ lpar = BigArcInterf.LastParameter();
+ BB.Range(EdgeArcBig, fpar, lpar);
+ BigVer[1] = (isfirstBig)? TopExp::FirstVertex(EdgeArcBig)
+ : TopExp::LastVertex(EdgeArcBig);
+ aPnt = CurveEdgeArcBig->Value((isfirstBig)? fpar : lpar);
+ if (BigVer[1].IsNull())
+ {
+ BigVer[1] = BRepLib_MakeVertex(aPnt);
+ TopAbs_Orientation OrOfVer = TopAbs_FORWARD;
+ if (!isfirstBig)
+ OrOfVer = TopAbs_REVERSED;
+ BB.Add(EdgeArcBig, BigVer[1].Oriented(OrOfVer));
+ }
+ else
+ BB.UpdateVertex(BigVer[1], aPnt, 0.);
+ /////
+
+ //Create new edge
+ gp_Pnt aPntVer = BRep_Tool::Pnt(Vertices[2]);
+ gp_Pnt aPntFromCurve = Gc->Value(WFirst);
+ Standard_Real aDist = aPntVer.Distance(aPntFromCurve);
+ BB.UpdateVertex(Vertices[2], 1.01*aDist);
+ TopoDS_Edge aNewEdge = BRepLib_MakeEdge(Gc,
+ Vertices[2], Vertices[1],
+ WFirst, WLast);
+ BB.UpdateEdge(aNewEdge, tolreached);
+ TopLoc_Location aLoc;
+ BB.UpdateEdge(aNewEdge, PGc1, DStr.Surface(SmaFD->Surf()).Surface(), aLoc, 0.);
+ BB.UpdateEdge(aNewEdge, PGc2, DStr.Surface(BigFD->Surf()).Surface(), aLoc, 0.);
+ myNewEdges.Add(aNewEdge);
+ Standard_Integer IndE = myNewEdges.FindIndex(aNewEdge);
+ if (isfirstSma && IFaArcSma == 1 ||
+ !isfirstSma && IFaArcSma == 2)
+ IndE *= -1;
+ //QualifiedEdge aQE(IndE, Et);
+ myFaceNewEdges.ChangeFromKey(IndexOfSmaNewFace).Append(IndE);
+ Standard_Integer IndE_forBigNewFace = IndE;
+ if (SmaFD->Orientation() == BigFD->Orientation())
+ IndE_forBigNewFace *= -1;
+ myFaceNewEdges.ChangeFromKey(IndexOfBigNewFace).Append(IndE_forBigNewFace);
+ /////
TopOpeBRepDS_ListOfInterference& Li = DStr.ChangeCurveInterferences(ICurv);
Handle(TopOpeBRepDS_CurvePointInterference) Interfp;
// End of update of the BigCD and the DS.
WFirst = Gc->FirstParameter();
WLast = Gc->LastParameter();
+
+ //Create additional new edge
+ TopoDS_Edge anAdditionalNewEdge = BRepLib_MakeEdge(Gc,
+ Vertices[1], BigVer[1],
+ WFirst, WLast);
+ BB.UpdateEdge(anAdditionalNewEdge, tolreached);
+ BB.UpdateEdge(anAdditionalNewEdge, PGc1, F, 0.);
+ BB.UpdateEdge(anAdditionalNewEdge, PGc2, DStr.Surface(BigFD->Surf()).Surface(), aLoc, 0.);
+ myNewEdges.Add(anAdditionalNewEdge);
+ IndE = myNewEdges.FindIndex(anAdditionalNewEdge);
+ if (IndE_forBigNewFace < 0)
+ IndE *= -1;
+ //QualifiedEdge aQE(IndE, Et);
+ myFaceNewEdges.ChangeFromKey(IndexOfBigNewFace).Append(IndE);
+ Standard_Integer IndE_forOldFace = IndE;
+ if (BigFD->Orientation() == F.Orientation())
+ IndE_forOldFace *= -1;
+
+ Standard_Integer IndF;
+ if (!myNewFaces.Contains(F))
+ myNewFaces.Add(F);
+ IndF = myNewFaces.FindIndex(F);
+ if (!myFaceNewEdges.Contains(IndF))
+ {
+ //ChFi3d_ListOfQualifiedEdge aList;
+ TColStd_ListOfInteger aList;
+ myFaceNewEdges.Add(IndF, aList);
+ }
+ myFaceNewEdges.ChangeFromKey(IndF).Append(IndE_forOldFace);
+ /////
+
ICurv = DStr.AddCurve(TopOpeBRepDS_Curve(Gc,tolreached));
cpend.SetTolerance(Max(cpend.Tolerance(),tolreached));
IpointArc = ChFi3d_IndexPointInDS(cpend,DStr);
#include <BRepAdaptor_HSurface.hxx>
#include <BRepAlgo_NormalProjection.hxx>
#include <BRepBlend_Line.hxx>
+#include <BRepLib_MakeVertex.hxx>
#include <BRepLib_MakeEdge.hxx>
#include <BRepLib_MakeFace.hxx>
+#include <BRepLib_CheckCurveOnSurface.hxx>
#include <BRepTools.hxx>
#include <BRepTopAdaptor_TopolTool.hxx>
#include <ChFi3d_Builder.hxx>
extern void ChFi3d_ResultChron(OSD_Chronometer & ch,Standard_Real& time);
#endif
+//=======================================================================
+//function : UpdateEdgeTolerance
+//purpose :
+//=======================================================================
+
+static void UpdateEdgeTolerance(const TopoDS_Edge& theEdge,
+ const TopoDS_Face& theFace)
+{
+ BRep_Builder BB;
+ BRepLib_CheckCurveOnSurface aCS(theEdge, theFace);
+ aCS.Perform();
+ if (aCS.IsDone())
+ {
+ Standard_Real aMaxDist = aCS.MaxDistance();
+ BB.UpdateEdge(theEdge, aMaxDist);
+ }
+}
//=======================================================================
//function : Indices
CD.SetValue(0,cnext);
Index.SetValue(0,ChFi3d_IndexOfSurfData(V1,cnext,sense));
sens.SetValue(0,sense);
+ //jgv
+ //const Handle(ChFiDS_SurfData)& SDfa = CD(0)->SetOfSurfData()->Value(Index.Value(0));
+ //Standard_Integer indfa = SDfa->IndexOfFace();
+ //const TopoDS_Face& aFace = TopoDS::Face(myNewFaces(indfa));
+ /////
numfa.SetValue(0 ,1,SurfIndex(CD, 0, Index.Value(0), FACE2));
numfa.SetValue(1 ,0, numfa.Value(0 ,1));
Fcur=TopoDS::Face(DStr.Shape(numfa.Value(0,1)));
// declaration for plate
GeomPlate_BuildPlateSurface PSurf(3,10,3,tol2d,tolesp,angular);
-// calculation of curves on surface for each stripe
+// calculation of curves on surface for each stripe
+
+ //jgv
+ BRep_Builder BB;
+ ChFiDS_SequenceOfSurfData SeqSD;
+ TopTools_Array1OfShape aVertices(0, nedge), aNewEdges(0, nedge);
+ /////
for (ic=0;ic<nedge;ic++) {
gp_Pnt2d p2d1, p2d2;
if (!sharp.Value(ic)) {
Calcul_P2dOnSurf(CD.Value(ic),jfp,i.Value(ic,icmoins),p.Value(ic,icmoins),p2d1);
Calcul_P2dOnSurf(CD.Value(ic),jf.Value(ic),i.Value(ic,icplus),p.Value(ic,icplus),p2d2);
// if (i[ic][icplus]!= i[ic][icmoins]) std::cout<<"probleme surface"<<std::endl;
- indice= SurfIndex(CD, ic, i.Value(ic,icplus), ChFiSURFACE);
+ //jgv
+ const Handle(ChFiDS_SurfData)& aSD = CD(ic)->SetOfSurfData()->Value(i.Value(ic,icplus));
+ SeqSD.Append(aSD);
+ Standard_Integer ind_surf = aSD->IndexOfFace();
+ const TopoDS_Face& FaceSurf = TopoDS::Face(myNewFaces(ind_surf));
+ /////
+ indice = SurfIndex(CD, ic, i.Value(ic,icplus), ChFiSURFACE);
Handle (GeomAdaptor_HSurface) Asurf =
new GeomAdaptor_HSurface(DStr.Surface(indice).Surface());
// calculation of curve 2d
isfirst=(sens.Value(ic)==1);
GeomLib::BuildCurve3d(tolapp,CurvOnS,CurvOnS.FirstParameter(),
CurvOnS.LastParameter(),Curv3d,maxapp,avedev);
+ //jgv
+ Standard_Integer IndE1 = aSD->IndexOfEdge(jfp);
+ Standard_Integer IndE2 = aSD->IndexOfEdge(jf.Value(ic));
+ const TopoDS_Edge& EdgeOnS1 = TopoDS::Edge(myNewEdges(IndE1));
+ const TopoDS_Edge& EdgeOnS2 = TopoDS::Edge(myNewEdges(IndE2));
+
+ TopoDS_Vertex VertexOnE1, VertexOnE2;
+
+ TopoDS_Vertex FirstVonE1, LastVonE1, FirstVonE2, LastVonE2;
+ TopExp::Vertices(EdgeOnS1, FirstVonE1, LastVonE1);
+ if (isfirst && !FirstVonE1.IsNull())
+ {
+ VertexOnE1 = FirstVonE1;
+ //aVertices(ic) = FirstVonE1;
+ }
+ else if (!isfirst && !LastVonE1.IsNull())
+ {
+ VertexOnE1 = LastVonE1;
+ //aVertices(ic) = LastVonE1;
+ }
+ TopExp::Vertices(EdgeOnS2, FirstVonE2, LastVonE2);
+ if (isfirst && !FirstVonE2.IsNull())
+ {
+ VertexOnE2 = FirstVonE2;
+ //aVertices(ic+1) = FirstVonE2;
+ }
+ else if (!isfirst && !LastVonE2.IsNull())
+ {
+ VertexOnE2 = LastVonE2;
+ //aVertices(ic+1) = LastVonE2;
+ }
+
+ TopoDS_Edge aNewEdge;
+ BB.MakeEdge(aNewEdge, Curv3d, maxapp);
+ BB.UpdateEdge(aNewEdge, pcurve, FaceSurf, Precision::Confusion());
+ BB.Range(aNewEdge, CurvOnS.FirstParameter(), CurvOnS.LastParameter());
+
+ gp_Pnt FirstPnt = Curv3d->Value(CurvOnS.FirstParameter());
+ gp_Pnt LastPnt = Curv3d->Value(CurvOnS.LastParameter());
+ //TopoDS_Vertex aV1, aV2;
+ //gp_Pnt PntForV1, PntForV2;
+ Standard_Real fpar, lpar, fpar2, lpar2;
+ BRep_Tool::Range(EdgeOnS1, fpar, lpar);
+ BRep_Tool::Range(EdgeOnS2, fpar2, lpar2);
+
+ if (!VertexOnE1.IsNull())
+ BB.UpdateVertex(VertexOnE1, FirstPnt, Precision::Confusion());
+ if (!VertexOnE2.IsNull())
+ BB.UpdateVertex(VertexOnE2, LastPnt, Precision::Confusion());
+
+ if (aVertices(ic).IsNull())
+ {
+ if (VertexOnE1.IsNull())
+ aVertices(ic) = BRepLib_MakeVertex(FirstPnt);
+ else
+ aVertices(ic) = VertexOnE1;
+ }
+ else
+ {
+ const TopoDS_Vertex& aV1 = TopoDS::Vertex(aVertices(ic));
+ gp_Pnt aPnt = BRep_Tool::Pnt(aV1);
+ gp_Pnt MidPnt((aPnt.XYZ() + FirstPnt.XYZ())/2);
+ BB.UpdateVertex(aV1, MidPnt, 1.001*aPnt.Distance(MidPnt));
+ }
+ if (aVertices(ic+1).IsNull())
+ {
+ if (VertexOnE2.IsNull())
+ aVertices(ic+1) = BRepLib_MakeVertex(LastPnt);
+ else
+ aVertices(ic+1) = VertexOnE2;
+ }
+ else
+ {
+ const TopoDS_Vertex& aV2 = TopoDS::Vertex(aVertices(ic+1));
+ gp_Pnt aPnt = BRep_Tool::Pnt(aV2);
+ gp_Pnt MidPnt((aPnt.XYZ() + LastPnt.XYZ())/2);
+ BB.UpdateVertex(aV2, MidPnt, 1.001*aPnt.Distance(MidPnt));
+ }
+
+ TopoDS_Edge F_EdgeOnS1 = EdgeOnS1;
+ F_EdgeOnS1.Orientation(TopAbs_FORWARD);
+ TopoDS_Edge F_EdgeOnS2 = EdgeOnS2;
+ F_EdgeOnS2.Orientation(TopAbs_FORWARD);
+ if (isfirst)
+ {
+ BB.Range(F_EdgeOnS1, p.Value(ic,icmoins), lpar);
+ if (VertexOnE1.IsNull())
+ BB.Add(F_EdgeOnS1, aVertices(ic).Oriented(TopAbs_FORWARD));
+ //else
+ //BB.UpdateVertex(VertexOnE1, );
+ BB.Range(F_EdgeOnS2, p.Value(ic,icplus), lpar2);
+ if (VertexOnE2.IsNull())
+ BB.Add(F_EdgeOnS2, aVertices(ic+1).Oriented(TopAbs_FORWARD));
+ //else
+ }
+ else
+ {
+ BB.Range(F_EdgeOnS1, fpar, p.Value(ic,icmoins));
+ if (VertexOnE1.IsNull())
+ BB.Add(F_EdgeOnS1, aVertices(ic).Oriented(TopAbs_REVERSED));
+ //else
+ BB.Range(F_EdgeOnS2, fpar2, p.Value(ic,icplus));
+ if (VertexOnE2.IsNull())
+ BB.Add(F_EdgeOnS2, aVertices(ic+1).Oriented(TopAbs_REVERSED));
+ //else
+ }
+
+ BB.Add(aNewEdge, aVertices(ic).Oriented(TopAbs_FORWARD));
+ BB.Add(aNewEdge, aVertices(ic+1).Oriented(TopAbs_REVERSED));
+ if (ic == 0)
+ aVertices(nedge) = aVertices(0);
+ myNewEdges.Add(aNewEdge);
+ aNewEdges(ic) = aNewEdge;
+ //Standard_Integer IndNewEdge = myNewEdges.FindIndex(aNewEdge);
+ //myFaceNewEdges.ChangeFromKey(ind_surf).Append(IndNewEdge);
+ /////
TopOpeBRepDS_Curve tcurv3d( Curv3d,maxapp);
indcurve3d.SetValue(n3d,DStr.AddCurve(tcurv3d));
gp_Pnt point1,point2;
}
p2d2 = curv2d2 ->Value(p.Value(icplus,ic));
- Asurf = new GeomAdaptor_HSurface(BRep_Tool::Surface(TopoDS::Face(Fvive.Value(ic,icplus))));
+ //jgv
+ const TopoDS_Face& Aface = TopoDS::Face(Fvive.Value(ic,icplus));
+ //Standard_Integer IndAface = myNewFaces.FindIndex(Aface);
+ /////
+ //Asurf = new GeomAdaptor_HSurface(BRep_Tool::Surface(TopoDS::Face(Fvive.Value(ic,icplus))));
+ Asurf = new GeomAdaptor_HSurface(BRep_Tool::Surface(Aface));
Standard_Real tolu,tolv,ratio;
tolu=Asurf->Surface().UResolution(1.e-3);
tolv=Asurf->Surface().VResolution(1.e-3);
parfin= CurvOnS.LastParameter();
curveint= new Geom_TrimmedCurve(Curv3d,pardeb,parfin);
}
+ //jgv
+ else
+ {
+ pardeb = curveint->FirstParameter();
+ parfin = curveint->LastParameter();
+ }
+ /////
+
+ //jgv
+ TopoDS_Edge aNewEdge;
+ BB.MakeEdge(aNewEdge, curveint, maxapp1);
+ BB.UpdateEdge(aNewEdge, pcurve, Aface, Precision::Confusion());
+ BB.Range(aNewEdge, pardeb, parfin);
+ gp_Pnt Pnts [2];
+ Pnts[0] = curveint->Value(pardeb);
+ Pnts[1] = curveint->Value(parfin);
+ TopoDS_Vertex aVV [2];
+ for (Standard_Integer indv = 0; indv < 2; indv++)
+ {
+ if (aVertices(ic + indv).IsNull())
+ aVV[indv] = BRepLib_MakeVertex(Pnts[indv]);
+ else
+ {
+ aVV[indv] = TopoDS::Vertex(aVertices(ic + indv));
+ gp_Pnt aPnt = BRep_Tool::Pnt(aVV[indv]);
+ gp_Pnt MidPnt((aPnt.XYZ() + Pnts[indv].XYZ())/2);
+ BB.UpdateVertex(aVV[indv], MidPnt, 1.001*aPnt.Distance(MidPnt));
+ }
+ aVertices(ic + indv) = aVV[indv];
+ }
+ BB.Add(aNewEdge, aVV[0].Oriented(TopAbs_FORWARD));
+ BB.Add(aNewEdge, aVV[1].Oriented(TopAbs_REVERSED));
+ myNewEdges.Add(aNewEdge);
+ aNewEdges(ic) = aNewEdge;
+ //Standard_Integer IndNewEdge = myNewEdges.FindIndex(aNewEdge);
+ //myFaceNewEdges.ChangeFromKey(IndAface).Append(IndNewEdge);
+ /////
//storage in the DS
TopOpeBRepDS_Curve tcurv3d( curveint,maxapp1);
// if (scal>0) orplate=orsurfdata;
// else orplate=TopAbs::Reverse(orsurfdata);
orplate = PlateOrientation(Surf,PSurf.Curves2d(),SumFaceNormalAtV1);
+
+ //jgv
+ TopoDS_Face aNewFace;
+ BB.MakeFace(aNewFace);
+ TopLoc_Location aLoc;
+ BB.UpdateFace(aNewFace, Surf, aLoc, Precision::Confusion());
+ aNewFace.Orientation(orplate);
+ Standard_Integer IndNewFace = myNewFaces.Add(aNewFace);
+ myIndsChFiFaces.Add(IndNewFace);
+ TColStd_ListOfInteger aList;
+ myFaceNewEdges.Add(IndNewFace, aList);
+ /////
// creation of solidinterderence for Plate
Handle(TopOpeBRepDS_SolidSurfaceInterference) SSI =
Indices(nedge,ic,icplus,icmoins);
isfirst=(sens.Value(ic)==1);
- // calculate curves interference relative to stripes
+ //jgv
+ const Handle(ChFiDS_SurfData)& aSD = CD(ic)->SetOfSurfData()->Value(i.Value(ic,icplus));
+ Standard_Integer ind_surf = aSD->IndexOfFace();
+ //const TopoDS_Face& FaceSurf = TopoDS::Face(myNewFaces(ind_surf));
+ /////
+
+ // calculate curves interference relative to stripes
apperror=Mapp.CriterionError()*coef;
pardeb=CD.Value(ic)->PCurve(isfirst)->FirstParameter();
parfin=CD.Value(ic)->PCurve(isfirst)->LastParameter();
TopOpeBRepDS_Point& tpt1= DStr.ChangePoint(indpoint(ic,0));
TopOpeBRepDS_Point& tpt2= DStr.ChangePoint(indpoint(ic,1));
tpt1.Tolerance (tpt1.Tolerance()+apperror);
- tpt2.Tolerance (tpt2.Tolerance()+apperror );
+ tpt2.Tolerance (tpt2.Tolerance()+apperror );
+
+ //jgv
+ Handle(Geom2d_Curve) aPCurve = PSurf.Curves2d()->Value(n3d);
+ BB.UpdateEdge(TopoDS::Edge(aNewEdges(ic)), aPCurve, aNewFace, Precision::Confusion());
+ UpdateEdgeTolerance(TopoDS::Edge(aNewEdges(ic)), aNewFace);
+
+ Standard_Integer IndE = myNewEdges.FindIndex(aNewEdges(ic));
+ //Temporary
+ IndE *= -1;
+ ///////////
+ myFaceNewEdges.ChangeFromKey(IndNewFace).Append(IndE);
+ IndE *= -1;
+ if (orplate != aSD->Orientation())
+ IndE *= -1;
+ myFaceNewEdges.ChangeFromKey(ind_surf).Append(IndE);
+ /////
// calculate surfaceinterference
Interfc=ChFi3d_FilCurveInDS(indcurve3d.Value(n3d),Isurf,
// actual connection
if (!moresurf.Value(ic)){
n3d++;
+
+ //jgv
+ const TopoDS_Face& Aface = TopoDS::Face(Fvive.Value(ic,icplus));
+ Standard_Integer IndAface = myNewFaces.FindIndex(Aface);
+
+ Handle(Geom2d_Curve) aPCurve = PSurf.Curves2d()->Value(n3d);
+ BB.UpdateEdge(TopoDS::Edge(aNewEdges(ic)), aPCurve, aNewFace, Precision::Confusion());
+ UpdateEdgeTolerance(TopoDS::Edge(aNewEdges(ic)), aNewFace);
+
+ Standard_Integer IndE = myNewEdges.FindIndex(aNewEdges(ic));
+ //Temporary
+ IndE *= -1;
+ ///////////
+ myFaceNewEdges.ChangeFromKey(IndNewFace).Append(IndE);
+ IndE *= -1;
+ if (orplate != Aface.Orientation())
+ IndE *= -1;
+ myFaceNewEdges.ChangeFromKey(IndAface).Append(IndE);
+ /////
+
TopOpeBRepDS_Curve& tcourb1 = DStr.ChangeCurve(indcurve3d.Value(n3d));
tcourb1.Tolerance(tcourb1.Tolerance()+apperror);
if (!deuxconges) {
Inside,Appro,Forward,Soldep,intf,intl,
gd1,gd2,gf1,gf2,RecOnS1,RecOnS2);
if(!done) return Standard_False; // ratrappage possible PMN 14/05/1998
- done = CompleteData(Data,*pFunc,lin,S1,S2,Or,gd1,gd2,gf1,gf2);
+ done = CompleteData(Data,*pFunc,lin,S1,S2,Or,0,gd1,gd2,gf1,gf2); //jgv 0???
if(!done) throw Standard_Failure("PerformSurf : Fail of approximation!");
}
else if (chsp->IsChamfer() == ChFiDS_TwoDist) {
Inside,Appro,Forward,Soldep,intf,intl,
gd1,gd2,gf1,gf2,RecOnS1,RecOnS2);
if(!done) return Standard_False; // ratrappage possible PMN 14/05/1998
- done = CompleteData(Data,*pFunc,lin,S1,S2,Or,gd1,gd2,gf1,gf2);
+ done = CompleteData(Data,*pFunc,lin,S1,S2,Or,0,gd1,gd2,gf1,gf2); //jgv 0???
if(!done) throw Standard_Failure("PerformSurf : Fail of approximation!");
}
else { //distance and angle
gd1,gd2,gf1,gf2,RecOnS1,RecOnS2);
if(!done) return Standard_False; // ratrappage possible PMN 14/05/1998
- done = CompleteData(Data,Func,lin,S1,S2,Or,gd1,gd2,gf1,gf2);
+ done = CompleteData(Data,Func,lin,S1,S2,Or,0,gd1,gd2,gf1,gf2); //jgv 0???
if(!done) throw Standard_Failure("PerformSurf : Fail of approximation!");
}
ChFi3d_InitChron(ch);// init perf CompleteData
#endif
- done = CompleteData(Data,Func,lin,S1,S2,Or,gd1,gd2,gf1,gf2);
+ done = CompleteData(Data,Func,lin,S1,S2,Or,0,gd1,gd2,gf1,gf2); //jgv 0???
#ifdef OCCT_DEBUG
ChFi3d_ResultChron(ch , t_completedata);// result perf CompleteData
ChFi3d_InitChron(ch);// init perf CompleteData
#endif
- done = CompleteData(Data,Func,lin,S1,S2,Or,gd1,gd2,gf1,gf2);
+ done = CompleteData(Data,Func,lin,S1,S2,Or,0,gd1,gd2,gf1,gf2); //jgv 0???
#ifdef OCCT_DEBUG
ChFi3d_ResultChron(ch , t_completedata);// result perf CompleteData
#include <TopOpeBRepDS_DataStructure.hxx>
#include <TopOpeBRepDS_HDataStructure.hxx>
#include <TopOpeBRepDS_Surface.hxx>
+#include <BRep_Builder.hxx>
+#include <TopExp.hxx>
#ifdef DRAW
#include <DrawTrSurf.hxx>
Handle(ChFiDS_SurfData)&
fdpiv = CD[pivot]->ChangeSetOfSurfData()->ChangeValue(i[pivot][deb]);
+ //jgv
+ Standard_Integer IndexOfNewFaceDeb = fddeb->IndexOfFace();
+ Standard_Integer IndexOfNewFaceFin = fdfin->IndexOfFace();
+ Standard_Integer IndexOfNewFacePiv = fdpiv->IndexOfFace();
+ const TopoDS_Face& FaceDeb = TopoDS::Face(myNewFaces(IndexOfNewFaceDeb));
+ const TopoDS_Face& FaceFin = TopoDS::Face(myNewFaces(IndexOfNewFaceFin));
+ const TopoDS_Face& FacePiv = TopoDS::Face(myNewFaces(IndexOfNewFacePiv));
+ /////
// HSurfaces and other suitable tools are constructed.
// ----------------------------------------------------------
const ChFiDS_FaceInterference& bid2 = CD[pivot]->SetOfSurfData()->
Value(i[pivot][deb])->InterferenceOnS2();
ppp2 = bid2.PCurveOnSurf()->Value(bid2.LastParameter());
- Standard_Real uu1 = ppp1.X(), uu2 = ppp2.X(), vv1 = ppp1.Y(), vv2 = ppp2.Y();
+ Standard_Real uu1 = ppp1.X(), uu2 = ppp2.X(), vv1 = ppp1.Y(), vv2 = ppp2.Y();
+
GeomAdaptor_Surface
gasurf((DStr.Surface(CD[pivot]->SetOfSurfData()->
Value(i[pivot][deb])->Surf())).Surface(),
uu1, uu2, vv1, vv2);
+
+ //jgv
+ Standard_Integer IndOfSurf = CD[pivot]->SetOfSurfData()->Value(i[pivot][deb])->IndexOfFace();
+ /////
+
GeomAbs_SurfaceType styp = gasurf.GetType();
if(styp == GeomAbs_Cylinder){
Standard_Real h = vv2 - vv1;
vv1 -= 0.5*h;
vv2 += 0.5*h;
+
gasurf.Load((DStr.Surface(CD[pivot]->SetOfSurfData()->
Value(i[pivot][deb])->Surf())).Surface(),
uu1, uu2, vv1, vv2);
Standard_Real h = uu2 - uu1;
uu1 -= 0.1*h;
uu2 += 0.1*h;
+
gasurf.Load((DStr.Surface(CD[pivot]->SetOfSurfData()->
Value(i[pivot][deb])->Surf())).Surface(),
uu1, uu2, vv1, vv2);
Handle(GeomAdaptor_HSurface) Surf = new GeomAdaptor_HSurface(gasurf);
// Handle(BRepTopAdaptor_TopolTool) IFac = new BRepTopAdaptor_TopolTool(Fac);
// Try to not classify on the face for cases of reentering fillets which naturally depass
- // the border.
+ // the border.
+
+ //jgv
+ /*
Handle(GeomAdaptor_HSurface)
bidsurf = new GeomAdaptor_HSurface(Fac->ChangeSurface().Surface());
Handle(Adaptor3d_TopolTool)
IFac = new Adaptor3d_TopolTool(bidsurf);
+ */
+ Handle(Adaptor3d_TopolTool) IFac = new Adaptor3d_TopolTool(Fac);
+ /////
+
// end of the attempt.
Handle(Adaptor3d_TopolTool) ISurf = new Adaptor3d_TopolTool(Surf);
Handle(ChFiDS_Stripe) corner = new ChFiDS_Stripe();
#ifdef OCCT_DEBUG
ChFi3d_InitChron(ch); // init perf case torus
-#endif
+#endif
+
+ BRepAdaptor_Surface BASpiv(FacePiv);
+ Handle(BRepAdaptor_HSurface) BAHSpiv = new BRepAdaptor_HSurface(BASpiv);
// Direct Construction.
// ---------------------
done = ChFiKPart_ComputeData::ComputeCorner
- (DStr,coin,Fac,Surf,oo1,oo2,o1,o2,Rdeb,Rdp,pfac1,pfac2,psurf1,psurf2);
+ //(DStr,coin,Fac,Surf,oo1,oo2,o1,o2,Rdeb,Rdp,pfac1,pfac2,psurf1,psurf2);
+ (DStr,myNewFaces,myNewEdges,myFaceNewEdges,myIndsChFiFaces,
+ coin,Fac,BAHSpiv,oo1,oo2,o1,o2,Rdeb,Rdp,pfac1,pfac2,psurf1,psurf2);
#ifdef OCCT_DEBUG
ChFi3d_ResultChron(ch , t_torique); // result perf case torus
if(ChFi3d_GetcontextFORCEFILLING()) done = 0;
#endif
if(done && Gf2){
- done = CompleteData(coin,func,lin,Fac,Surf,OFac,Gd1,0,Gf1,0);
+ done = CompleteData(coin,func,lin,Fac,Surf,OFac,IndOfSurf,Gd1,0,Gf1,0);
filling = !done;
}
else filling = 1;
if(ChFi3d_GetcontextFORCEFILLING()) done = 0;
#endif
if(done && Gf2){
- done = CompleteData(coin,func,lin,Fac,Surf,OFac,Gd1,0,Gf1,0);
+ done = CompleteData(coin,func,lin,Fac,Surf,OFac,IndOfSurf,Gd1,0,Gf1,0);
filling = !done;
}
else filling = 1;
DStr.Surface(coin->Surf()).Surface(),C3d,
corner->ChangeFirstPCurve(),P1deb,P2deb,
tolesp,tol2d,tolreached,0);
+ //jgv
+ Standard_Integer IndexOfCorner = coin->IndexOfFace();
+
+ Standard_Integer IndexOfE1 = coin->IndexOfEdge(1);
+ Standard_Integer IndexOfE2 = coin->IndexOfEdge(2);
+ TopoDS_Edge Bound1ofNewFace = TopoDS::Edge(myNewEdges(IndexOfE1));
+ TopoDS_Edge Bound2ofNewFace = TopoDS::Edge(myNewEdges(IndexOfE2));
+ TopoDS_Vertex VfirstOfBound1, VlastOfBound1, VfirstOfBound2, VlastOfBound2;
+ TopExp::Vertices(Bound1ofNewFace, VfirstOfBound1, VlastOfBound1);
+ TopExp::Vertices(Bound2ofNewFace, VfirstOfBound2, VlastOfBound2);
+
+ Standard_Integer IndOfCorner = coin->IndexOfFace();
+ const TopoDS_Face& CornerFace = TopoDS::Face(myNewFaces(IndOfCorner));
+ BRep_Builder BB;
+
+ TopoDS_Edge EdgeOnFaceDeb;
+ BB.MakeEdge(EdgeOnFaceDeb, C3d, tolreached);
+ BB.UpdateEdge(EdgeOnFaceDeb, corner->FirstPCurve(), CornerFace, 0.);
+ BB.Range(EdgeOnFaceDeb, P1deb,P2deb);
+ VfirstOfBound1.Orientation(TopAbs_FORWARD);
+ VfirstOfBound2.Orientation(TopAbs_REVERSED);
+ BB.Add(EdgeOnFaceDeb, VfirstOfBound1);
+ BB.Add(EdgeOnFaceDeb, VfirstOfBound2);
+
+ gp_Pnt2d aPnt;
+ gp_Vec2d aTangent;
+ corner->FirstPCurve()->D1(P1deb, aPnt, aTangent);
+ aTangent.Normalize();
+ Standard_Boolean IsVerticalPCurveOnEdeb = (aTangent * gp::DY2d() > 0.9);
+
+ Standard_Integer IndEdeb = myNewEdges.Add(EdgeOnFaceDeb);
+ if (IsVerticalPCurveOnEdeb)
+ IndEdeb *= -1;
+ myFaceNewEdges.ChangeFromKey(IndexOfCorner).Append(IndEdeb);
+ IndEdeb *= -1;
+ if (fddeb->Orientation() != coin->Orientation())
+ IndEdeb *= -1;
+ myFaceNewEdges.ChangeFromKey(IndexOfNewFaceDeb).Append(IndEdeb);
+ /////
+
TopOpeBRepDS_Curve Tcurv1(C3d,tolreached);
Icf = DStr.AddCurve(Tcurv1);
regdeb.SetCurve(Icf);
DStr.Surface(coin->Surf()).Surface(),C3d,
corner->ChangeLastPCurve(),P1fin,P2fin,
tolesp,tol2d,tolreached,0);
+ //jgv
+ TopoDS_Edge EdgeOnFaceFin;
+ BB.MakeEdge(EdgeOnFaceFin, C3d, tolreached);
+ BB.UpdateEdge(EdgeOnFaceFin, corner->LastPCurve(), CornerFace, 0.);
+ BB.Range(EdgeOnFaceFin, P1fin,P2fin);
+ VlastOfBound1.Orientation(TopAbs_FORWARD);
+ VlastOfBound2.Orientation(TopAbs_REVERSED);
+ BB.Add(EdgeOnFaceFin, VlastOfBound1);
+ BB.Add(EdgeOnFaceFin, VlastOfBound2);
+
+ Standard_Integer IndEfin = myNewEdges.Add(EdgeOnFaceFin);
+ if (!IsVerticalPCurveOnEdeb)
+ IndEfin *= -1;
+ myFaceNewEdges.ChangeFromKey(IndexOfCorner).Append(IndEfin);
+ IndEfin *= -1;
+ if (fdfin->Orientation() != coin->Orientation())
+ IndEfin *= -1;
+ myFaceNewEdges.ChangeFromKey(IndexOfNewFaceFin).Append(IndEfin);
+ /////
+
TopOpeBRepDS_Curve Tcurv2(C3d,tolreached);
Icl = DStr.AddCurve(Tcurv2);
regfin.SetCurve(Icl);
fddeb->ChangeVertex(isfirst,isurf2) = Pf2;
fddeb->ChangeInterferenceOnS1().SetParameter(parpp1,isfirst);
fddeb->ChangeInterferenceOnS2().SetParameter(parpp2,isfirst);
+
+ //jgv
+ Standard_Integer IndEarc1 = fddeb->IndexOfEdge(isurf1);
+ Standard_Integer IndEarc2 = fddeb->IndexOfEdge(isurf2);
+ TopoDS_Edge EdgeArc1 = TopoDS::Edge(myNewEdges(IndEarc1));
+ EdgeArc1.Orientation(TopAbs_FORWARD);
+ TopoDS_Edge EdgeArc2 = TopoDS::Edge(myNewEdges(IndEarc2));
+ EdgeArc2.Orientation(TopAbs_FORWARD);
+ Standard_Real fpar1, lpar1, fpar2, lpar2;
+ BRep_Tool::Range(EdgeArc1, fpar1, lpar1);
+ BRep_Tool::Range(EdgeArc2, fpar2, lpar2);
+ if (isfirst)
+ {
+ fpar1 = parpp1;
+ fpar2 = parpp2;
+ VfirstOfBound1.Orientation(TopAbs_FORWARD);
+ VfirstOfBound2.Orientation(TopAbs_FORWARD);
+ }
+ else
+ {
+ lpar1 = parpp1;
+ lpar2 = parpp2;
+ VfirstOfBound1.Orientation(TopAbs_REVERSED);
+ VfirstOfBound2.Orientation(TopAbs_REVERSED);
+ }
+ BB.Range(EdgeArc1, fpar1, lpar1);
+ BB.Range(EdgeArc2, fpar2, lpar2);
+ BB.Add(EdgeArc1, VfirstOfBound1);
+ BB.Add(EdgeArc2, VfirstOfBound2);
+ /////
+
TopOpeBRepDS_Curve& tcdeb = DStr.ChangeCurve(Icf);
Handle(Geom_Curve) crefdeb = tcdeb.Curve();
Standard_Real tolrdeb;
DStr.Surface(fddeb->Surf()).Surface(),
P1deb,P2deb,tolesp,tolrdeb,rev);
tcdeb.Tolerance(Max(tolrdeb,tcdeb.Tolerance()));
+ //jgv
+ BB.UpdateEdge(EdgeOnFaceDeb, CD[deb]->PCurve(isfirst), FaceDeb, Max(tolrdeb,tcdeb.Tolerance()));
+ /////
if(rev) ChFi3d_EnlargeBox(DStr,CD[deb],fddeb,*pbf2,*pbf1,isfirst);
else ChFi3d_EnlargeBox(DStr,CD[deb],fddeb,*pbf1,*pbf2,isfirst);
fdfin->ChangeVertex(isfirst,isurf2) = Pl2;
fdfin->ChangeInterferenceOnS1().SetParameter(parpp1,isfirst);
fdfin->ChangeInterferenceOnS2().SetParameter(parpp2,isfirst);
+
+ //jgv
+ IndEarc1 = fdfin->IndexOfEdge(isurf1);
+ IndEarc2 = fdfin->IndexOfEdge(isurf2);
+ EdgeArc1 = TopoDS::Edge(myNewEdges(IndEarc1));
+ EdgeArc1.Orientation(TopAbs_FORWARD);
+ EdgeArc2 = TopoDS::Edge(myNewEdges(IndEarc2));
+ EdgeArc2.Orientation(TopAbs_FORWARD);
+ BRep_Tool::Range(EdgeArc1, fpar1, lpar1);
+ BRep_Tool::Range(EdgeArc2, fpar2, lpar2);
+ if (isfirst)
+ {
+ fpar1 = parpp1;
+ fpar2 = parpp2;
+ VlastOfBound1.Orientation(TopAbs_FORWARD);
+ VlastOfBound2.Orientation(TopAbs_FORWARD);
+ }
+ else
+ {
+ lpar1 = parpp1;
+ lpar2 = parpp2;
+ VlastOfBound1.Orientation(TopAbs_REVERSED);
+ VlastOfBound2.Orientation(TopAbs_REVERSED);
+ }
+ BB.Range(EdgeArc1, fpar1, lpar1);
+ BB.Range(EdgeArc2, fpar2, lpar2);
+ BB.Add(EdgeArc1, VlastOfBound1);
+ BB.Add(EdgeArc2, VlastOfBound2);
+ /////
+
TopOpeBRepDS_Curve& tcfin = DStr.ChangeCurve(Icl);
Handle(Geom_Curve) creffin = tcfin.Curve();
Standard_Real tolrfin;
DStr.Surface(fdfin->Surf()).Surface(),
P1fin,P2fin,tolesp,tolrfin,rev);
tcfin.Tolerance(Max(tolrfin,tcfin.Tolerance()));
+ //jgv
+ BB.UpdateEdge(EdgeOnFaceFin, CD[fin]->PCurve(isfirst), FaceFin, Max(tolrfin,tcfin.Tolerance()));
+ /////
if(rev) ChFi3d_EnlargeBox(DStr,CD[fin],fdfin,*pbl2,*pbl1,isfirst);
else ChFi3d_EnlargeBox(DStr,CD[fin],fdfin,*pbl1,*pbl2,isfirst);
fdpiv->ChangeVertex(isfirst,isurf2) = Pl2;
fdpiv->ChangeInterference(isurf1).SetParameter(p[pivot][deb],isfirst);
fdpiv->ChangeInterference(isurf2).SetParameter(p[pivot][fin],isfirst);
+
+ //jgv
+ IndEarc1 = fdpiv->IndexOfEdge(isurf1);
+ IndEarc2 = fdpiv->IndexOfEdge(isurf2);
+ EdgeArc1 = TopoDS::Edge(myNewEdges(IndEarc1));
+ EdgeArc1.Orientation(TopAbs_FORWARD);
+ EdgeArc2 = TopoDS::Edge(myNewEdges(IndEarc2));
+ EdgeArc2.Orientation(TopAbs_FORWARD);
+ BRep_Tool::Range(EdgeArc1, fpar1, lpar1);
+ BRep_Tool::Range(EdgeArc2, fpar2, lpar2);
+ if (isfirst)
+ {
+ fpar1 = p[pivot][deb]; //parpp1;
+ fpar2 = p[pivot][fin]; //parpp2;
+ VfirstOfBound2.Orientation(TopAbs_FORWARD);
+ VlastOfBound2.Orientation(TopAbs_FORWARD);
+ }
+ else
+ {
+ lpar1 = p[pivot][deb]; //parpp1;
+ lpar2 = p[pivot][fin]; //parpp2;
+ VfirstOfBound2.Orientation(TopAbs_REVERSED);
+ VlastOfBound2.Orientation(TopAbs_REVERSED);
+ }
+ BB.Range(EdgeArc1, fpar1, lpar1);
+ BB.Range(EdgeArc2, fpar2, lpar2);
+ BB.Add(EdgeArc1, VfirstOfBound2);
+ BB.Add(EdgeArc2, VlastOfBound2);
+ /////
+
CD[pivot]->InDS(isfirst); // filDS already does it from the corner.
if(rev) ChFi3d_EnlargeBox(DStr,CD[pivot],fdpiv,*pbl2,*pbf2,isfirst);
else ChFi3d_EnlargeBox(DStr,CD[pivot],fdpiv,*pbf2,*pbl2,isfirst);
IMPLEMENT_STANDARD_RTTIEXT(ChFiDS_SurfData,Standard_Transient)
-ChFiDS_SurfData::ChFiDS_SurfData () :
-indexOfS1(0),indexOfS2(0),indexOfConge(0),
-isoncurv1(0),isoncurv2(0),twistons1(0),twistons2(0)
+ChFiDS_SurfData::ChFiDS_SurfData ()
+: indexOfS1(0),indexOfS2(0),
+ indexOfE1(0),indexOfE2(0),
+ indexOfConge(0),
+ isoncurv1(0),isoncurv2(0),twistons1(0),twistons2(0)
{}
//=======================================================================
{
indexOfS1 = Other->indexOfS1;
indexOfS2 = Other->indexOfS2;
+indexOfE1 = Other->indexOfE1;
+indexOfE2 = Other->indexOfE2;
indexOfConge = Other->indexOfConge;
orientation = Other->orientation;
intf1 = Other->intf1;
else return indexOfS2;
}
+//=======================================================================
+//function : IndexOfEdge
+//purpose :
+//=======================================================================
+
+inline Standard_Integer ChFiDS_SurfData::IndexOfEdge(const Standard_Integer OnS) const
+{
+ if (OnS == 1)
+ return indexOfE1;
+ else
+ return indexOfE2;
+}
+
//=======================================================================
//function : Interference
//purpose :
else return intf2;
}
-
//=======================================================================
-//function : Interference
+//function : ChangeInterference
//purpose :
//=======================================================================
void ChangeIndexOfS2 (const Standard_Integer Index);
+ void ChangeIndexOfFace (const Standard_Integer Index);
+
+ void ChangeIndexOfE1 (const Standard_Integer Index);
+
+ void ChangeIndexOfE2 (const Standard_Integer Index);
+
void ChangeSurf (const Standard_Integer Index);
void SetIndexOfC1 (const Standard_Integer Index);
Standard_EXPORT ChFiDS_FaceInterference& ChangeInterference (const Standard_Integer OnS);
+ Standard_EXPORT Standard_Integer IndexOfFace () const;
+
Standard_EXPORT Standard_Integer Index (const Standard_Integer OfS) const;
+ Standard_EXPORT Standard_Integer IndexOfEdge(const Standard_Integer OfS) const;
+
//! returns one of the four vertices wether First is true
//! or wrong and OnS equals 1 or 2.
Standard_EXPORT const ChFiDS_CommonPoint& Vertex (const Standard_Boolean First, const Standard_Integer OnS) const;
Standard_Integer indexOfC1;
Standard_Integer indexOfS2;
Standard_Integer indexOfC2;
+ Standard_Integer indexOfE1;
+ Standard_Integer indexOfE2;
+ Standard_Integer indexOfFace;
Standard_Integer indexOfConge;
+
Standard_Boolean isoncurv1;
Standard_Boolean isoncurv2;
Standard_Boolean twistons1;
isoncurv2 = (theIndex != 0);
}
+//=======================================================================
+//function : IndexOfFace
+//purpose :
+//=======================================================================
+
+inline Standard_Integer ChFiDS_SurfData::IndexOfFace()const
+{
+ return indexOfFace;
+}
+
//=======================================================================
//function : Surf
//purpose :
indexOfS2 = Index;
}
+//=======================================================================
+//function : ChangeIndexOfFace
+//purpose :
+//=======================================================================
+
+inline void ChFiDS_SurfData::ChangeIndexOfFace(const Standard_Integer Index)
+{
+ indexOfFace = Index;
+}
+
+//=======================================================================
+//function : ChangeIndexOfE1
+//purpose :
+//=======================================================================
+
+inline void ChFiDS_SurfData::ChangeIndexOfE1(const Standard_Integer Index)
+{
+ indexOfE1 = Index;
+}
+
+//=======================================================================
+//function : ChangeIndexOfE2
+//purpose :
+//=======================================================================
+
+inline void ChFiDS_SurfData::ChangeIndexOfE2(const Standard_Integer Index)
+{
+ indexOfE2 = Index;
+}
+
//=======================================================================
//function : ChangeSurf
//purpose :
#include <TopOpeBRepDS_Curve.hxx>
#include <TopOpeBRepDS_DataStructure.hxx>
#include <TopOpeBRepDS_Surface.hxx>
+#include <TColStd_ListOfInteger.hxx>
+#include <TColStd_MapOfInteger.hxx>
+#include <BRep_Builder.hxx>
+#include <BRepLib_MakeVertex.hxx>
//#include <BRepAdaptor_Curve2d.hxx>
//#include <BRepAdaptor_HCurve2d.hxx>
//=======================================================================
Standard_Boolean ChFiKPart_ComputeData::Compute
(TopOpeBRepDS_DataStructure& DStr,
+ TopTools_IndexedMapOfShape& theNewFaces,
+ TopTools_IndexedMapOfShape& theNewEdges,
+ NCollection_IndexedDataMap<Standard_Integer, TColStd_ListOfInteger>& theFaceNewEdges,
+ TColStd_MapOfInteger& theIndsChFiFaces,
Handle(ChFiDS_SurfData)& Data,
- const Handle(Adaptor3d_HSurface)& S1,
- const Handle(Adaptor3d_HSurface)& S2,
+ //const Handle(Adaptor3d_HSurface)& S1,
+ //const Handle(Adaptor3d_HSurface)& S2,
+ const Handle(BRepAdaptor_HSurface)& S1,
+ const Handle(BRepAdaptor_HSurface)& S2,
const TopAbs_Orientation Or1,
const TopAbs_Orientation Or2,
const Handle(ChFiDS_Spine)& Sp,
// Return orientations.
TopAbs_Orientation OrFace1 = TopAbs_FORWARD, OrFace2 = TopAbs_FORWARD;
- Handle(BRepAdaptor_HSurface) HS = Handle(BRepAdaptor_HSurface)::DownCast(S1);
- if (!HS.IsNull()) OrFace1 = HS->ChangeSurface().Face().Orientation();
- HS = Handle(BRepAdaptor_HSurface)::DownCast(S2);
- if (!HS.IsNull()) OrFace2 = HS->ChangeSurface().Face().Orientation();
+ //Handle(BRepAdaptor_HSurface) HS = Handle(BRepAdaptor_HSurface)::DownCast(S1);
+ OrFace1 = S1->ChangeSurface().Face().Orientation();
+ //HS = Handle(BRepAdaptor_HSurface)::DownCast(S2);
+ OrFace2 = S2->ChangeSurface().Face().Orientation();
if(!Spine.IsNull()){
Standard_Real Radius = Spine->Radius(Iedge);
if ( typ1 == GeomAbs_Plane && typ2 == GeomAbs_Plane ){
- surfok = ChFiKPart_MakeFillet(DStr,Data,S1->Plane(),S2->Plane(),
+ surfok = ChFiKPart_MakeFillet(DStr,theNewFaces,theNewEdges,theFaceNewEdges,theIndsChFiFaces,
+ Data,S1,S2,
Or1,Or2,Radius,Spine->Line(),
Wref,OrFace1);
}
Or1,Or2,Radius,Spine->Line(),
Wref,OrFace1,Standard_True);
else
- surfok = ChFiKPart_MakeFillet(DStr,Data,S1->Plane(),S2->Cylinder(),
+ surfok = ChFiKPart_MakeFillet(DStr,theNewFaces,theNewEdges,theFaceNewEdges,theIndsChFiFaces,
+ Data,S1,S2,
S2->FirstUParameter(),S2->LastUParameter(),
Or1,Or2,Radius,Spine->Circle(),
Wref,OrFace1,Standard_True);
Or2,Or1,Radius,Spine->Line(),
Wref,OrFace2,Standard_False);
else
- surfok = ChFiKPart_MakeFillet(DStr,Data,S2->Plane(),S1->Cylinder(),
+ surfok = ChFiKPart_MakeFillet(DStr,theNewFaces,theNewEdges,theFaceNewEdges,theIndsChFiFaces,
+ Data,S2,S1,
S1->FirstUParameter(),S1->LastUParameter(),
Or2,Or1,Radius,Spine->Circle(),
Wref,OrFace2,Standard_False);
Standard_Boolean ChFiKPart_ComputeData::ComputeCorner
(TopOpeBRepDS_DataStructure& DStr,
+ TopTools_IndexedMapOfShape& theNewFaces,
+ TopTools_IndexedMapOfShape& theNewEdges,
+ NCollection_IndexedDataMap<Standard_Integer, TColStd_ListOfInteger>& theFaceNewEdges,
+ TColStd_MapOfInteger& theIndsChFiFaces,
const Handle(ChFiDS_SurfData)& Data,
- const Handle(Adaptor3d_HSurface)& S1,
- const Handle(Adaptor3d_HSurface)& S2,
+ //const Handle(Adaptor3d_HSurface)& S1,
+ //const Handle(Adaptor3d_HSurface)& S2,
+ const Handle(BRepAdaptor_HSurface)& S1,
+ const Handle(BRepAdaptor_HSurface)& S2,
const TopAbs_Orientation OrFace1,
const TopAbs_Orientation,
const TopAbs_Orientation Or1,
fu = First;
lu = Last;
}
- surfok = ChFiKPart_MakeFillet(DStr,Data,S1->Plane(),cyl,
- fu,lu,Or1,Or2,minRad,circ,
- First,OrFace1,Standard_True);
+ surfok = ChFiKPart_MakeFillet(DStr,theNewFaces,theNewEdges,theFaceNewEdges,theIndsChFiFaces,
+ Data,S1,S2,/*S1->Plane(),cyl,*/
+ fu,lu,Or1,Or2,minRad,circ,
+ First,OrFace1,Standard_True);
if(surfok){
if ( typ2 != GeomAbs_Cylinder ){
Data->ChangeInterferenceOnS2().ChangePCurveOnFace() =
Data->ChangeInterferenceOnS1().SetLastParameter(Last);
Data->ChangeInterferenceOnS2().SetFirstParameter(First);
Data->ChangeInterferenceOnS2().SetLastParameter(Last);
+
+ //jgv
+ Standard_Integer IndexOfE1 = Data->IndexOfEdge(1);
+ Standard_Integer IndexOfE2 = Data->IndexOfEdge(2);
+ TopoDS_Edge Bound1 = TopoDS::Edge(theNewEdges(IndexOfE1));
+ TopoDS_Edge Bound2 = TopoDS::Edge(theNewEdges(IndexOfE2));
+ BRep_Builder BB;
+ BB.Range(Bound1, First, Last);
+ BB.Range(Bound2, First, Last);
+ if (!BRep_Tool::Degenerated(Bound1))
+ {
+ BRepAdaptor_Curve BAcurve(Bound1);
+ gp_Pnt aPnt = BAcurve.Value(First);
+ TopoDS_Vertex V1 = BRepLib_MakeVertex(aPnt);
+ BB.Add(Bound1, V1);
+ aPnt = BAcurve.Value(Last);
+ TopoDS_Vertex V2 = BRepLib_MakeVertex(aPnt);
+ V2.Reverse();
+ BB.Add(Bound1, V2);
+ }
+ BRepAdaptor_Curve BAcurve(Bound2);
+ gp_Pnt aPnt = BAcurve.Value(First);
+ TopoDS_Vertex V1 = BRepLib_MakeVertex(aPnt);
+ BB.Add(Bound2, V1);
+ aPnt = BAcurve.Value(Last);
+ TopoDS_Vertex V2 = BRepLib_MakeVertex(aPnt);
+ V2.Reverse();
+ BB.Add(Bound2, V2);
+ /////
+
return Standard_True;
}
return Standard_False;
#include <TopAbs_Orientation.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Real.hxx>
+
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <NCollection_IndexedDataMap.hxx>
+#include <TColStd_ListOfInteger.hxx>
+#include <TColStd_MapOfInteger.hxx>
+
class TopOpeBRepDS_DataStructure;
class ChFiDS_SurfData;
class Adaptor3d_HSurface;
+class BRepAdaptor_HSurface;
class ChFiDS_Spine;
class gp_Pnt2d;
//! Computes a simple fillet in several particular
//! cases.
- Standard_EXPORT static Standard_Boolean Compute (TopOpeBRepDS_DataStructure& DStr, Handle(ChFiDS_SurfData)& Data, const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_HSurface)& S2, const TopAbs_Orientation Or1, const TopAbs_Orientation Or2, const Handle(ChFiDS_Spine)& Sp, const Standard_Integer Iedge);
+ Standard_EXPORT static Standard_Boolean Compute (TopOpeBRepDS_DataStructure& DStr,
+ TopTools_IndexedMapOfShape& theNewFaces,
+ TopTools_IndexedMapOfShape& theNewEdges,
+ NCollection_IndexedDataMap<Standard_Integer, TColStd_ListOfInteger>& theFaceNewEdges,
+ TColStd_MapOfInteger& theIndsChFiFaces,
+ Handle(ChFiDS_SurfData)& Data,
+ //const Handle(Adaptor3d_HSurface)& S1,
+ //const Handle(Adaptor3d_HSurface)& S2,
+ const Handle(BRepAdaptor_HSurface)& S1,
+ const Handle(BRepAdaptor_HSurface)& S2,
+ const TopAbs_Orientation Or1,
+ const TopAbs_Orientation Or2,
+ const Handle(ChFiDS_Spine)& Sp,
+ const Standard_Integer Iedge);
//! Computes a toric or spheric corner fillet.
- Standard_EXPORT static Standard_Boolean ComputeCorner (TopOpeBRepDS_DataStructure& DStr, const Handle(ChFiDS_SurfData)& Data, const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_HSurface)& S2, const TopAbs_Orientation OrFace1, const TopAbs_Orientation OrFace2, const TopAbs_Orientation Or1, const TopAbs_Orientation Or2, const Standard_Real minRad, const Standard_Real majRad, const gp_Pnt2d& P1S1, const gp_Pnt2d& P2S1, const gp_Pnt2d& P1S2, const gp_Pnt2d& P2S2);
+ Standard_EXPORT static Standard_Boolean ComputeCorner (TopOpeBRepDS_DataStructure& DStr,
+ TopTools_IndexedMapOfShape& theNewFaces,
+ TopTools_IndexedMapOfShape& theNewEdges,
+ NCollection_IndexedDataMap<Standard_Integer, TColStd_ListOfInteger>& theFaceNewEdges,
+ TColStd_MapOfInteger& theIndsChFiFaces,
+ const Handle(ChFiDS_SurfData)& Data,
+ //const Handle(Adaptor3d_HSurface)& S1,
+ //const Handle(Adaptor3d_HSurface)& S2,
+ const Handle(BRepAdaptor_HSurface)& S1,
+ const Handle(BRepAdaptor_HSurface)& S2,
+ const TopAbs_Orientation OrFace1,
+ const TopAbs_Orientation OrFace2,
+ const TopAbs_Orientation Or1,
+ const TopAbs_Orientation Or2,
+ const Standard_Real minRad,
+ const Standard_Real majRad,
+ const gp_Pnt2d& P1S1,
+ const gp_Pnt2d& P2S1,
+ const gp_Pnt2d& P1S2,
+ const gp_Pnt2d& P2S2);
//! Computes spheric corner fillet with non iso pcurve on S2.
- Standard_EXPORT static Standard_Boolean ComputeCorner (TopOpeBRepDS_DataStructure& DStr, const Handle(ChFiDS_SurfData)& Data, const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_HSurface)& S2, const TopAbs_Orientation OrFace1, const TopAbs_Orientation OrFace2, const TopAbs_Orientation Or1, const TopAbs_Orientation Or2, const Standard_Real Rad, const gp_Pnt2d& PS1, const gp_Pnt2d& P1S2, const gp_Pnt2d& P2S2);
+ Standard_EXPORT static Standard_Boolean ComputeCorner (TopOpeBRepDS_DataStructure& DStr,
+ const Handle(ChFiDS_SurfData)& Data,
+ const Handle(Adaptor3d_HSurface)& S1,
+ const Handle(Adaptor3d_HSurface)& S2,
+ const TopAbs_Orientation OrFace1,
+ const TopAbs_Orientation OrFace2,
+ const TopAbs_Orientation Or1,
+ const TopAbs_Orientation Or2,
+ const Standard_Real Rad,
+ const gp_Pnt2d& PS1,
+ const gp_Pnt2d& P1S2,
+ const gp_Pnt2d& P2S2);
//! Computes a toric corner rotule.
- Standard_EXPORT static Standard_Boolean ComputeCorner (TopOpeBRepDS_DataStructure& DStr, const Handle(ChFiDS_SurfData)& Data, const Handle(Adaptor3d_HSurface)& S, const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_HSurface)& S2, const TopAbs_Orientation OfS, const TopAbs_Orientation OS, const TopAbs_Orientation OS1, const TopAbs_Orientation OS2, const Standard_Real Radius);
+ Standard_EXPORT static Standard_Boolean ComputeCorner (TopOpeBRepDS_DataStructure& DStr,
+ const Handle(ChFiDS_SurfData)& Data,
+ const Handle(Adaptor3d_HSurface)& S,
+ const Handle(Adaptor3d_HSurface)& S1,
+ const Handle(Adaptor3d_HSurface)& S2,
+ const TopAbs_Orientation OfS,
+ const TopAbs_Orientation OS,
+ const TopAbs_Orientation OS1,
+ const TopAbs_Orientation OS2,
+ const Standard_Real Radius);
#include <IntAna_QuadQuadGeo.hxx>
#include <Precision.hxx>
#include <TopOpeBRepDS_DataStructure.hxx>
+#include <BRepAdaptor_HSurface.hxx>
+#include <BRep_Builder.hxx>
+#include <BRepLib_MakeVertex.hxx>
//=======================================================================
//function : MakeFillet
//=======================================================================
Standard_Boolean ChFiKPart_MakeFillet(TopOpeBRepDS_DataStructure& DStr,
+ TopTools_IndexedMapOfShape& theNewFaces,
+ TopTools_IndexedMapOfShape& theNewEdges,
+ NCollection_IndexedDataMap<Standard_Integer, TColStd_ListOfInteger>& theFaceNewEdges,
+ TColStd_MapOfInteger& theIndsChFiFaces,
const Handle(ChFiDS_SurfData)& Data,
- const gp_Pln& Pln,
- const gp_Cylinder& Cyl,
+ //const gp_Pln& Pln,
+ //const gp_Cylinder& Cyl,
+ const Handle(BRepAdaptor_HSurface)& Spln,
+ const Handle(BRepAdaptor_HSurface)& Scyl,
const Standard_Real fu,
const Standard_Real lu,
const TopAbs_Orientation Or1,
const TopAbs_Orientation Or2,
const Standard_Real Radius,
const gp_Circ& Spine,
- const Standard_Real First,
+ const Standard_Real First,
const TopAbs_Orientation Ofpl,
const Standard_Boolean plandab)
{
+ Standard_Integer IndFpln, IndFcyl;
+ const TopoDS_Face& FacePln = Spln->ChangeSurface().Face();
+ const TopoDS_Face& FaceCyl = Scyl->ChangeSurface().Face();
+
+ if (!theNewFaces.Contains(FacePln))
+ theNewFaces.Add(FacePln);
+ IndFpln = theNewFaces.FindIndex(FacePln);
+ if (!theFaceNewEdges.Contains(IndFpln))
+ {
+ //ChFi3d_ListOfQualifiedEdge aList;
+ TColStd_ListOfInteger aList;
+ theFaceNewEdges.Add(IndFpln, aList);
+ }
+ if (!theNewFaces.Contains(FaceCyl))
+ theNewFaces.Add(FaceCyl);
+ IndFcyl = theNewFaces.FindIndex(FaceCyl);
+ if (!theFaceNewEdges.Contains(IndFcyl))
+ {
+ //ChFi3d_ListOfQualifiedEdge aList;
+ TColStd_ListOfInteger aList;
+ theFaceNewEdges.Add(IndFcyl, aList);
+ }
+
+ gp_Pln Pln = Spln->Plane();
+ gp_Cylinder Cyl = Scyl->Cylinder();
//calculation of the fillet (torus or sphere).
Standard_Boolean c1sphere = Standard_False;
gp_Ax3 FilAx3(Or,Dz,Dx);
if (FilAx3.YDirection().Dot(Dy) <= 0.){ FilAx3.YReverse(); }
- if(c1sphere) {
- Handle(Geom_SphericalSurface)
- gsph = new Geom_SphericalSurface(FilAx3,Radius);
- Data->ChangeSurf(ChFiKPart_IndexSurfaceInDS(gsph,DStr));
- }
- else{
- Handle(Geom_ToroidalSurface)
- gtor = new Geom_ToroidalSurface(FilAx3,Rad,Radius);
- Data->ChangeSurf(ChFiKPart_IndexSurfaceInDS(gtor,DStr));
- }
+ Handle(Geom_Surface) NewSurf;
+
+ if(c1sphere)
+ NewSurf = new Geom_SphericalSurface(FilAx3,Radius);
+ else
+ NewSurf = new Geom_ToroidalSurface(FilAx3,Rad,Radius);
+
+ Data->ChangeSurf(ChFiKPart_IndexSurfaceInDS(NewSurf, DStr));
+
// It is checked if the orientation of the fillet is the same as of faces.
gp_Pnt P,PP;
SetInterference(ChFiKPart_IndexCurveInDS(GCircCyl,DStr),
trans,GLin2dCyl,GLin2dFil2);
}
+
+ //Add new face and its new edges in the maps
+ BRep_Builder BB;
+ TopLoc_Location aLoc;
+ TopoDS_Face aNewFace;
+ BB.MakeFace(aNewFace);
+ BB.UpdateFace(aNewFace, NewSurf, aLoc, Precision::Confusion());
+ aNewFace.Orientation(Data->Orientation());
+ Standard_Integer IndNewFace = theNewFaces.Add(aNewFace);
+ theIndsChFiFaces.Add(IndNewFace);
+ TColStd_ListOfInteger aList;
+ theFaceNewEdges.Add(IndNewFace, aList);
+ Data->ChangeIndexOfFace(IndNewFace);
+
+ TopoDS_Edge Boundary1, Boundary2;
+ BB.MakeEdge(Boundary1);
+ BB.UpdateEdge(Boundary1, GLin2dFil1, aNewFace, 0.);
+ if (GCircPln.IsNull())
+ {
+ BB.Degenerated(Boundary1, Standard_True);
+ gp_Pnt2d aPnt2d = GLin2dFil1->Value(First);
+ gp_Pnt aPnt = NewSurf->Value(aPnt2d.X(), aPnt2d.Y());
+ TopoDS_Vertex aVertex = BRepLib_MakeVertex(aPnt);
+ BB.Add(Boundary1, aVertex);
+ aVertex.Reverse();
+ BB.Add(Boundary1, aVertex);
+ }
+ else
+ {
+ BB.UpdateEdge(Boundary1, GCircPln, 0.);
+ BB.UpdateEdge(Boundary1, GCirc2dPln, FacePln, 0.);
+ }
+ theNewEdges.Add(Boundary1);
+
+ Standard_Integer IndE1 = theNewEdges.FindIndex(Boundary1);
+ Data->ChangeIndexOfE1(IndE1);
+ theFaceNewEdges.ChangeFromKey(IndNewFace).Append(IndE1);
+ if (!GCircPln.IsNull()) //<Boundary1> is not degenerated
+ {
+ IndE1 *= -1;
+ if (Data->Orientation() != FacePln.Orientation())
+ IndE1 *= -1;
+ theFaceNewEdges.ChangeFromKey(IndFpln).Append(IndE1);
+ }
+
+ BB.MakeEdge(Boundary2);
+ BB.UpdateEdge(Boundary2, GCircCyl, 0.);
+ BB.UpdateEdge(Boundary2, GLin2dCyl, FaceCyl, 0.);
+ BB.UpdateEdge(Boundary2, GLin2dFil2, aNewFace, 0.);
+ theNewEdges.Add(Boundary2);
+
+ Standard_Integer IndE2 = theNewEdges.FindIndex(Boundary2);
+ Data->ChangeIndexOfE2(IndE2);
+ IndE2 *= -1;
+ theFaceNewEdges.ChangeFromKey(IndNewFace).Append(IndE2);
+ IndE2 *= -1;
+ if (Data->Orientation() != FaceCyl.Orientation())
+ IndE2 *= -1;
+ theFaceNewEdges.ChangeFromKey(IndFcyl).Append(IndE2);
+
return Standard_True;
}
const Standard_Boolean plandab);
Standard_Boolean ChFiKPart_MakeFillet(TopOpeBRepDS_DataStructure& DStr,
+ TopTools_IndexedMapOfShape& theNewFaces,
+ TopTools_IndexedMapOfShape& theNewEdges,
+ NCollection_IndexedDataMap<Standard_Integer, TColStd_ListOfInteger>& theFaceNewEdges,
+ TColStd_MapOfInteger& theIndsChFiFaces,
const Handle(ChFiDS_SurfData)& Data,
- const gp_Pln& Pln,
- const gp_Cylinder& Cyl,
+ //const gp_Pln& Pln,
+ //const gp_Cylinder& Cyl,
+ const Handle(BRepAdaptor_HSurface)& Spln,
+ const Handle(BRepAdaptor_HSurface)& Scyl,
const Standard_Real fu,
const Standard_Real lu,
const TopAbs_Orientation Or1,
// commercial license or contractual agreement.
-#include <Adaptor3d_HSurface.hxx>
+//#include <Adaptor3d_HSurface.hxx>
+#include <BRepAdaptor_HSurface.hxx>
#include <ChFiDS_Spine.hxx>
#include <ChFiDS_SurfData.hxx>
#include <ChFiKPart_ComputeData.hxx>
#include <IntAna_QuadQuadGeo.hxx>
#include <Precision.hxx>
#include <TopOpeBRepDS_DataStructure.hxx>
+#include <TColStd_ListOfInteger.hxx>
+#include <TColStd_MapOfInteger.hxx>
+#include <BRep_Builder.hxx>
+#include <BRepLib_MakeEdge.hxx>
//=======================================================================
//function : MakeFillet
//Purpose : cas plan/plan.
//=======================================================================
Standard_Boolean ChFiKPart_MakeFillet(TopOpeBRepDS_DataStructure& DStr,
+ TopTools_IndexedMapOfShape& theNewFaces,
+ TopTools_IndexedMapOfShape& theNewEdges,
+ NCollection_IndexedDataMap<Standard_Integer, TColStd_ListOfInteger>& theFaceNewEdges,
+ TColStd_MapOfInteger& theIndsChFiFaces,
const Handle(ChFiDS_SurfData)& Data,
- const gp_Pln& Pl1,
- const gp_Pln& Pl2,
+ //const gp_Pln& Pl1,
+ //const gp_Pln& Pl2,
+ const Handle(BRepAdaptor_HSurface)& S1,
+ const Handle(BRepAdaptor_HSurface)& S2,
const TopAbs_Orientation Or1,
const TopAbs_Orientation Or2,
const Standard_Real Radius,
const Standard_Real First,
const TopAbs_Orientation Of1)
{
+ Standard_Integer IndF1, IndF2;
+ const TopoDS_Face& F1 = S1->ChangeSurface().Face();
+ const TopoDS_Face& F2 = S2->ChangeSurface().Face();
+
+ if (!theNewFaces.Contains(F1))
+ theNewFaces.Add(F1);
+ IndF1 = theNewFaces.FindIndex(F1);
+ if (!theFaceNewEdges.Contains(IndF1))
+ {
+ //ChFi3d_ListOfQualifiedEdge aList;
+ TColStd_ListOfInteger aList;
+ theFaceNewEdges.Add(IndF1, aList);
+ }
+ if (!theNewFaces.Contains(F2))
+ theNewFaces.Add(F2);
+ IndF2 = theNewFaces.FindIndex(F2);
+ if (!theFaceNewEdges.Contains(IndF2))
+ {
+ //ChFi3d_ListOfQualifiedEdge aList;
+ TColStd_ListOfInteger aList;
+ theFaceNewEdges.Add(IndF2, aList);
+ }
+
+ gp_Pln Pl1 = S1->Plane();
+ gp_Pln Pl2 = S2->Plane();
//calcul du cylindre
gp_Ax3 Pos1 = Pl1.Position();
Data->ChangeInterferenceOnS2().
SetInterference(ChFiKPart_IndexCurveInDS(GLinPln2,DStr),
trans,GLin2dPln2,GLin2dCyl2);
+
+ //Add new face and its new edges in the maps
+ BRep_Builder BB;
+ TopLoc_Location aLoc;
+ TopoDS_Face aNewFace;
+ BB.MakeFace(aNewFace);
+ BB.UpdateFace(aNewFace, gcyl, aLoc, Precision::Confusion());
+ aNewFace.Orientation(Data->Orientation());
+ Standard_Integer IndNewFace = theNewFaces.Add(aNewFace);
+ theIndsChFiFaces.Add(IndNewFace);
+ //ChFi3d_ListOfQualifiedEdge aList;
+ TColStd_ListOfInteger aList;
+ theFaceNewEdges.Add(IndNewFace, aList);
+ Data->ChangeIndexOfFace(IndNewFace);
+
+ TopoDS_Edge Boundary1, Boundary2;
+ Boundary1 = BRepLib_MakeEdge(GLinPln1);
+ BB.UpdateEdge(Boundary1, GLin2dPln1, F1, 0.);
+ BB.UpdateEdge(Boundary1, GLin2dCyl1, aNewFace, 0.);
+ theNewEdges.Add(Boundary1);
+
+ /*
+ Standard_Integer IndE1 = theNewEdges.FindIndex(Boundary1);
+ Data->ChangeIndexOfE1(IndE1);
+ //QualifiedEdge aQE1(IndE1, Et);
+ if (Data->Orientation() == TopAbs_REVERSED)
+ IndE1 *= -1;
+ theFaceNewEdges.ChangeFromKey(IndF1).Append(IndE1);
+ Standard_Integer IndE1_forNewFace = IndE1;
+ if (Data->Orientation() == TopAbs_FORWARD)
+ IndE1_forNewFace *= -1;
+ //theFaceNewEdges.ChangeFromKey(IndNewFace).Append(-IndE1);
+ theFaceNewEdges.ChangeFromKey(IndNewFace).Append(IndE1_forNewFace);
+ */
+
+ Standard_Integer IndE1 = theNewEdges.FindIndex(Boundary1);
+ Data->ChangeIndexOfE1(IndE1);
+ IndE1 *= -1;
+ theFaceNewEdges.ChangeFromKey(IndNewFace).Append(IndE1);
+ IndE1 *= -1;
+ if (Data->Orientation() != F1.Orientation())
+ IndE1 *= -1;
+ theFaceNewEdges.ChangeFromKey(IndF1).Append(IndE1);
+
+ Boundary2 = BRepLib_MakeEdge(GLinPln2);
+ BB.UpdateEdge(Boundary2, GLin2dPln2, F2, 0.);
+ BB.UpdateEdge(Boundary2, GLin2dCyl2, aNewFace, 0.);
+ theNewEdges.Add(Boundary2);
+
+ /*
+ Standard_Integer IndE2 = theNewEdges.FindIndex(Boundary2);
+ Data->ChangeIndexOfE2(IndE2);
+ IndE2 *= -1;
+ if (Data->Orientation() == TopAbs_REVERSED)
+ IndE2 *= -1;
+ theFaceNewEdges.ChangeFromKey(IndF2).Append(IndE2);
+ Standard_Integer IndE2_forNewFace = IndE2;
+ if (Data->Orientation() == TopAbs_FORWARD)
+ IndE2_forNewFace *= -1;
+ //theFaceNewEdges.ChangeFromKey(IndNewFace).Append(-IndE2);
+ theFaceNewEdges.ChangeFromKey(IndNewFace).Append(IndE2_forNewFace);
+ */
+
+ Standard_Integer IndE2 = theNewEdges.FindIndex(Boundary2);
+ Data->ChangeIndexOfE2(IndE2);
+ theFaceNewEdges.ChangeFromKey(IndNewFace).Append(IndE2);
+ IndE2 *= -1;
+ if (Data->Orientation() != F2.Orientation())
+ IndE2 *= -1;
+ theFaceNewEdges.ChangeFromKey(IndF2).Append(IndE2);
+
return Standard_True;
}
#define ChFiKPart_ComputeData_PlnPln_HeaderFile
Standard_Boolean ChFiKPart_MakeFillet(TopOpeBRepDS_DataStructure& DStr,
+ TopTools_IndexedMapOfShape& theNewFaces,
+ TopTools_IndexedMapOfShape& theNewEdges,
+ NCollection_IndexedDataMap<Standard_Integer, TColStd_ListOfInteger>& theFaceNewEdges,
+ TColStd_MapOfInteger& theIndsChFiFaces,
const Handle(ChFiDS_SurfData)& Data,
- const gp_Pln& Pl1,
- const gp_Pln& Pl2,
+ //const gp_Pln& Pl1,
+ //const gp_Pln& Pl2,
+ const Handle(BRepAdaptor_HSurface)& S1,
+ const Handle(BRepAdaptor_HSurface)& S2,
const TopAbs_Orientation Or1,
const TopAbs_Orientation Or2,
const Standard_Real Radius,
ChFi3d_FilCommonPoint(lin->EndPointOnSecond(),lin->TransitionOnS2(),
Standard_False, Data->ChangeVertexLastOnS2(), tolesp);
}
- done = CompleteData(Data,Func,lin,S1,S2,Or,0,0,0,0);
+ done = CompleteData(Data,Func,lin,S1,S2,Or,0,0,0,0,0); //jgv 0???
if(!done) throw Standard_Failure("PerformSurf : Failed approximation!");
// maybesingular = (Func.GetMinimalDistance()<=100*tolapp3d);
Standard_Boolean ok = Standard_False;
005 tolblend_buildvol
006 complex
007 encoderegularity
+008 seam_and_degenerated
\ No newline at end of file
--- /dev/null
+puts "=========================================================================================================================="
+puts "OCC26907: ChFi3d_Builder algorithm uses old Boolean operations: wrong processing of shapes with seam and degenerated edges"
+puts "=========================================================================================================================="
+puts ""
+
+set maxtol 5.e-5
+set volume 3.66429e+006
+
+restore [locate_data_file HollowedBall.brep] a
+explode a e
+
+blend result a 5 a_1
+
+checknbshapes result -solid 1 -shell 1 -face 5 -wire 5 -edge 14 -vertex 9
--- /dev/null
+puts "=========================================================================================================================="
+puts "OCC26907: ChFi3d_Builder algorithm uses old Boolean operations: wrong processing of shapes with seam and degenerated edges"
+puts "=========================================================================================================================="
+puts ""
+
+set maxtol 5.e-5
+set volume 3.66337e+006
+
+restore [locate_data_file HollowedBall.brep] a
+explode a e
+
+blend result a 5 a_1 5 a_3
+
+checknbshapes result -solid 1 -shell 1 -face 6 -wire 6 -edge 17 -vertex 11
--- /dev/null
+puts "=========================================================================================================================="
+puts "OCC26907: ChFi3d_Builder algorithm uses old Boolean operations: wrong processing of shapes with seam and degenerated edges"
+puts "=========================================================================================================================="
+puts ""
+
+set maxtol 5.e-5
+set volume 3.66482e+006
+
+restore [locate_data_file HollowedBall.brep] a
+explode a e
+
+blend result a 5 a_3 5 a_8
+
+checknbshapes result -solid 1 -shell 1 -face 6 -wire 6 -edge 18 -vertex 12
--- /dev/null
+puts "=========================================================================================================================="
+puts "OCC26907: ChFi3d_Builder algorithm uses old Boolean operations: wrong processing of shapes with seam and degenerated edges"
+puts "=========================================================================================================================="
+puts ""
+
+set maxtol 5.e-5
+set volume 3.66337e+006
+
+restore [locate_data_file HollowedBall.brep] a
+explode a e
+
+blend result a 5 a_1 5 a_6
+
+checknbshapes result -solid 1 -shell 1 -face 6 -wire 6 -edge 15 -vertex 10
--- /dev/null
+puts "=========================================================================================================================="
+puts "OCC26907: ChFi3d_Builder algorithm uses old Boolean operations: wrong processing of shapes with seam and degenerated edges"
+puts "=========================================================================================================================="
+puts ""
+
+set maxtol 5.e-5
+set volume 3.66337e+006
+
+restore [locate_data_file HollowedBall.brep] a
+explode a e
+
+blend result a 5 a_3 5 a_6
+
+checknbshapes result -solid 1 -shell 1 -face 6 -wire 6 -edge 16 -vertex 10
--- /dev/null
+puts "=========================================================================================================================="
+puts "OCC26907: ChFi3d_Builder algorithm uses old Boolean operations: wrong processing of shapes with seam and degenerated edges"
+puts "=========================================================================================================================="
+puts ""
+
+set maxtol 5.e-5
+set volume 3.66244e+006
+
+restore [locate_data_file HollowedBall.brep] a
+explode a e
+
+blend result a 5 a_1 5 a_3 5 a_6
+
+checknbshapes result -solid 1 -shell 1 -face 7 -wire 7 -edge 15 -vertex 9
--- /dev/null
+puts "=========================================================================================================================="
+puts "OCC26907: ChFi3d_Builder algorithm uses old Boolean operations: wrong processing of shapes with seam and degenerated edges"
+puts "=========================================================================================================================="
+puts ""
+
+set maxtol 5.e-7
+set volume 3.66592e+006
+
+restore [locate_data_file HollowedBall.brep] a
+explode a e
+
+blend result a 3 a_7 5 a_8
+
+checknbshapes result -solid 1 -shell 1 -face 6 -wire 6 -edge 17 -vertex 11
--- /dev/null
+puts "=========================================================================================================================="
+puts "OCC26907: ChFi3d_Builder algorithm uses old Boolean operations: wrong processing of shapes with seam and degenerated edges"
+puts "=========================================================================================================================="
+puts ""
+
+set maxtol 5.e-7
+set volume 3.66592e+006
+
+restore [locate_data_file HollowedBall.brep] a
+explode a e
+
+blend result a 5 a_7 3 a_8
+
+checknbshapes result -solid 1 -shell 1 -face 6 -wire 6 -edge 17 -vertex 11
--- /dev/null
+puts "=========================================================================================================================="
+puts "OCC26907: ChFi3d_Builder algorithm uses old Boolean operations: wrong processing of shapes with seam and degenerated edges"
+puts "=========================================================================================================================="
+puts ""
+
+set maxtol 5.e-7
+set volume 3.66592e+006
+
+restore [locate_data_file HollowedBall.brep] a
+explode a e
+
+blend result a 3 a_7 5 a_9
+
+checknbshapes result -solid 1 -shell 1 -face 6 -wire 6 -edge 16 -vertex 10
--- /dev/null
+puts "=========================================================================================================================="
+puts "OCC26907: ChFi3d_Builder algorithm uses old Boolean operations: wrong processing of shapes with seam and degenerated edges"
+puts "=========================================================================================================================="
+puts ""
+
+set maxtol 5.e-7
+set volume 3.66592e+006
+
+restore [locate_data_file HollowedBall.brep] a
+explode a e
+
+blend result a 5 a_7 3 a_9
+
+checknbshapes result -solid 1 -shell 1 -face 6 -wire 6 -edge 16 -vertex 10
--- /dev/null
+puts "=========================================================================================================================="
+puts "OCC26907: ChFi3d_Builder algorithm uses old Boolean operations: wrong processing of shapes with seam and degenerated edges"
+puts "=========================================================================================================================="
+puts ""
+
+set maxtol 5.e-7
+set volume 3.66592e+006
+
+restore [locate_data_file HollowedBall.brep] a
+explode a e
+
+blend result a 3 a_8 5 a_9
+
+checknbshapes result -solid 1 -shell 1 -face 6 -wire 6 -edge 16 -vertex 10
--- /dev/null
+puts "=========================================================================================================================="
+puts "OCC26907: ChFi3d_Builder algorithm uses old Boolean operations: wrong processing of shapes with seam and degenerated edges"
+puts "=========================================================================================================================="
+puts ""
+
+set maxtol 5.e-7
+set volume 3.66592e+006
+
+restore [locate_data_file HollowedBall.brep] a
+explode a e
+
+blend result a 5 a_8 3 a_9
+
+checknbshapes result -solid 1 -shell 1 -face 6 -wire 6 -edge 16 -vertex 10
--- /dev/null
+puts "=========================================================================================================================="
+puts "OCC26907: ChFi3d_Builder algorithm uses old Boolean operations: wrong processing of shapes with seam and degenerated edges"
+puts "=========================================================================================================================="
+puts ""
+
+set maxtol 5.e-4
+set volume 3.66397e+006
+
+restore [locate_data_file HollowedBall.brep] a
+explode a e
+
+blend result a 3 a_1 5 a_3
+
+checknbshapes result -solid 1 -shell 1 -face 6 -wire 6 -edge 19 -vertex 13
--- /dev/null
+puts "=========================================================================================================================="
+puts "OCC26907: ChFi3d_Builder algorithm uses old Boolean operations: wrong processing of shapes with seam and degenerated edges"
+puts "=========================================================================================================================="
+puts ""
+
+set maxtol 5.e-4
+set volume 3.66397e+006
+
+restore [locate_data_file HollowedBall.brep] a
+explode a e
+
+blend result a 5 a_1 3 a_3
+
+checknbshapes result -solid 1 -shell 1 -face 6 -wire 6 -edge 19 -vertex 13
--- /dev/null
+puts "=========================================================================================================================="
+puts "OCC26907: ChFi3d_Builder algorithm uses old Boolean operations: wrong processing of shapes with seam and degenerated edges"
+puts "=========================================================================================================================="
+puts ""
+
+set maxtol 5.e-5
+set volume 3.66397e+006
+
+restore [locate_data_file HollowedBall.brep] a
+explode a e
+
+blend result a 3 a_1 5 a_6
+
+checknbshapes result -solid 1 -shell 1 -face 6 -wire 6 -edge 17 -vertex 12
--- /dev/null
+puts "=========================================================================================================================="
+puts "OCC26907: ChFi3d_Builder algorithm uses old Boolean operations: wrong processing of shapes with seam and degenerated edges"
+puts "=========================================================================================================================="
+puts ""
+
+set maxtol 5.e-5
+set volume 3.66397e+006
+
+restore [locate_data_file HollowedBall.brep] a
+explode a e
+
+blend result a 5 a_1 3 a_6
+
+checknbshapes result -solid 1 -shell 1 -face 6 -wire 6 -edge 17 -vertex 12
--- /dev/null
+puts "=========================================================================================================================="
+puts "OCC26907: ChFi3d_Builder algorithm uses old Boolean operations: wrong processing of shapes with seam and degenerated edges"
+puts "=========================================================================================================================="
+puts ""
+
+set maxtol 5.e-4
+set volume 3.66397e+006
+
+restore [locate_data_file HollowedBall.brep] a
+explode a e
+
+blend result a 3 a_3 5 a_6
+
+checknbshapes result -solid 1 -shell 1 -face 6 -wire 6 -edge 18 -vertex 12
--- /dev/null
+puts "=========================================================================================================================="
+puts "OCC26907: ChFi3d_Builder algorithm uses old Boolean operations: wrong processing of shapes with seam and degenerated edges"
+puts "=========================================================================================================================="
+puts ""
+
+set maxtol 5.e-4
+set volume 3.66397e+006
+
+restore [locate_data_file HollowedBall.brep] a
+explode a e
+
+blend result a 5 a_3 3 a_6
+
+checknbshapes result -solid 1 -shell 1 -face 6 -wire 6 -edge 18 -vertex 12
--- /dev/null
+puts "=========================================================================================================================="
+puts "OCC26907: ChFi3d_Builder algorithm uses old Boolean operations: wrong processing of shapes with seam and degenerated edges"
+puts "=========================================================================================================================="
+puts ""
+
+set maxtol 0.05
+set volume 3.66484e+06
+
+restore [locate_data_file HollowedBall.brep] a
+explode a e
+
+blend result a 5 a_3 5 a_9
+
+checknbshapes result -solid 1 -shell 1 -face 7 -wire 7 -edge 19 -vertex 12
--- /dev/null
+puts "=========================================================================================================================="
+puts "OCC26907: ChFi3d_Builder algorithm uses old Boolean operations: wrong processing of shapes with seam and degenerated edges"
+puts "=========================================================================================================================="
+puts ""
+
+set maxtol 5.e-5
+set volume 3.66429e+006
+
+restore [locate_data_file HollowedBall.brep] a
+explode a e
+
+blend result a 5 a_3
+
+checknbshapes result -solid 1 -shell 1 -face 5 -wire 5 -edge 14 -vertex 9
--- /dev/null
+puts "=========================================================================================================================="
+puts "OCC26907: ChFi3d_Builder algorithm uses old Boolean operations: wrong processing of shapes with seam and degenerated edges"
+puts "=========================================================================================================================="
+puts ""
+
+set maxtol 4.e-7
+set volume 3.66701e+06
+
+restore [locate_data_file HollowedBall.brep] a
+explode a e
+
+blend result a 5 a_7 5 a_8 6 a_9
+
+checknbshapes result -solid 1 -shell 1 -face 8 -wire 8 -edge 21 -vertex 13
--- /dev/null
+puts "=========================================================================================================================="
+puts "OCC26907: ChFi3d_Builder algorithm uses old Boolean operations: wrong processing of shapes with seam and degenerated edges"
+puts "=========================================================================================================================="
+puts ""
+
+set maxtol 4.e-7
+set volume 3.66678e+06
+
+restore [locate_data_file HollowedBall.brep] a
+explode a e
+
+blend result a 5 a_7 5 a_8 5 a_9
+
+checknbshapes result -solid 1 -shell 1 -face 8 -wire 8 -edge 21 -vertex 12
--- /dev/null
+puts "=========================================================================================================================="
+puts "OCC26907: ChFi3d_Builder algorithm uses old Boolean operations: wrong processing of shapes with seam and degenerated edges"
+puts "=========================================================================================================================="
+puts ""
+
+set maxtol 4.e-6
+set volume 3.66724e+06
+
+restore [locate_data_file HollowedBall.brep] a
+explode a e
+
+blend result a 6 a_7 5 a_8 6 a_9
+
+checknbshapes result -solid 1 -shell 1 -face 8 -wire 8 -edge 21 -vertex 13
--- /dev/null
+puts "=========================================================================================================================="
+puts "OCC26907: ChFi3d_Builder algorithm uses old Boolean operations: wrong processing of shapes with seam and degenerated edges"
+puts "=========================================================================================================================="
+puts ""
+
+set maxtol 5.e-5
+set volume 3.66429e+006
+
+restore [locate_data_file HollowedBall.brep] a
+explode a e
+
+blend result a 5 a_6
+
+checknbshapes result -solid 1 -shell 1 -face 5 -wire 5 -edge 14 -vertex 9
--- /dev/null
+puts "=========================================================================================================================="
+puts "OCC26907: ChFi3d_Builder algorithm uses old Boolean operations: wrong processing of shapes with seam and degenerated edges"
+puts "=========================================================================================================================="
+puts ""
+
+set maxtol 5.e-7
+set volume 3.66573e+006
+
+restore [locate_data_file HollowedBall.brep] a
+explode a e
+
+blend result a 5 a_7
+
+checknbshapes result -solid 1 -shell 1 -face 5 -wire 5 -edge 13 -vertex 8
--- /dev/null
+puts "=========================================================================================================================="
+puts "OCC26907: ChFi3d_Builder algorithm uses old Boolean operations: wrong processing of shapes with seam and degenerated edges"
+puts "=========================================================================================================================="
+puts ""
+
+set maxtol 5.e-7
+set volume 3.66573e+006
+
+restore [locate_data_file HollowedBall.brep] a
+explode a e
+
+blend result a 5 a_8
+
+checknbshapes result -solid 1 -shell 1 -face 5 -wire 5 -edge 13 -vertex 8
--- /dev/null
+puts "=========================================================================================================================="
+puts "OCC26907: ChFi3d_Builder algorithm uses old Boolean operations: wrong processing of shapes with seam and degenerated edges"
+puts "=========================================================================================================================="
+puts ""
+
+set maxtol 5.e-7
+set volume 3.66573e+006
+
+restore [locate_data_file HollowedBall.brep] a
+explode a e
+
+blend result a 5 a_9
+
+checknbshapes result -solid 1 -shell 1 -face 5 -wire 5 -edge 12 -vertex 7
--- /dev/null
+puts "=========================================================================================================================="
+puts "OCC26907: ChFi3d_Builder algorithm uses old Boolean operations: wrong processing of shapes with seam and degenerated edges"
+puts "=========================================================================================================================="
+puts ""
+
+set maxtol 5.e-7
+set volume 3.66625e+006
+
+restore [locate_data_file HollowedBall.brep] a
+explode a e
+
+blend result a 5 a_7 5 a_8
+
+checknbshapes result -solid 1 -shell 1 -face 6 -wire 6 -edge 16 -vertex 10
--- /dev/null
+puts "=========================================================================================================================="
+puts "OCC26907: ChFi3d_Builder algorithm uses old Boolean operations: wrong processing of shapes with seam and degenerated edges"
+puts "=========================================================================================================================="
+puts ""
+
+set maxtol 5.e-7
+set volume 3.66625e+006
+
+restore [locate_data_file HollowedBall.brep] a
+explode a e
+
+blend result a 5 a_7 5 a_9
+
+checknbshapes result -solid 1 -shell 1 -face 6 -wire 6 -edge 15 -vertex 9
--- /dev/null
+puts "=========================================================================================================================="
+puts "OCC26907: ChFi3d_Builder algorithm uses old Boolean operations: wrong processing of shapes with seam and degenerated edges"
+puts "=========================================================================================================================="
+puts ""
+
+set maxtol 5.e-7
+set volume 3.66625e+006
+
+restore [locate_data_file HollowedBall.brep] a
+explode a e
+
+blend result a 5 a_8 5 a_9
+
+checknbshapes result -solid 1 -shell 1 -face 6 -wire 6 -edge 15 -vertex 9
--- /dev/null
+puts "=========================================================================================================================="
+puts "OCC26907: ChFi3d_Builder algorithm uses old Boolean operations: wrong processing of shapes with seam and degenerated edges"
+puts "=========================================================================================================================="
+puts ""
+
+set maxtol 2.e-7
+set volume 215678
+
+box b 60 60 60
+explode b e
+
+blend result b 5 b_10
+
+checknbshapes result -solid 1 -shell 1 -face 7 -wire 7 -edge 15 -vertex 10
--- /dev/null
+puts "=========================================================================================================================="
+puts "OCC26907: ChFi3d_Builder algorithm uses old Boolean operations: wrong processing of shapes with seam and degenerated edges"
+puts "=========================================================================================================================="
+puts ""
+
+set maxtol 2.e-7
+set volume 215230
+
+box b 60 60 60
+explode b e
+
+blend result b 5 b_10 6 b_6
+
+checknbshapes result -solid 1 -shell 1 -face 8 -wire 8 -edge 18 -vertex 12
--- /dev/null
+puts "=========================================================================================================================="
+puts "OCC26907: ChFi3d_Builder algorithm uses old Boolean operations: wrong processing of shapes with seam and degenerated edges"
+puts "=========================================================================================================================="
+puts ""
+
+set maxtol 2.e-7
+set volume 214916
+
+box b 60 60 60
+explode b e
+
+blend result b 5 b_10 5 b_5 6 b_6
+
+checknbshapes result -solid 1 -shell 1 -face 10 -wire 10 -edge 22 -vertex 14
--- /dev/null
+set depsilon 1.e-7
--- /dev/null
+set tolres [checkmaxtol result]
+
+if { ${tolres} > ${maxtol}} {
+ puts "Error: bad tolerance of result"
+}
+
+checkprops result -v ${volume} -deps ${depsilon}
+
+# to end a test script
+puts "TEST COMPLETED"