1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

Compare commits

...

4 Commits

Author SHA1 Message Date
jgv
843b34734c Next version 2018-10-24 16:38:18 +03:00
jgv
86dde6d92b Next version 2018-10-24 14:42:38 +03:00
jgv
7507557e68 Update of last version 2018-10-23 15:58:48 +03:00
jgv
6b6a49ceee Another version. 2018-10-22 17:40:05 +03:00
9 changed files with 900 additions and 134 deletions

View File

@@ -68,6 +68,8 @@
#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>
@@ -79,6 +81,8 @@
#include <TopOpeBRepDS_PointIterator.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_MapOfOrientedShape.hxx>
#include <BRepTools_ReShape.hxx>
#ifdef OCCT_DEBUG
#include <OSD_Chronometer.hxx>
@@ -106,6 +110,223 @@ extern void ChFi3d_ResultChron(OSD_Chronometer & ch, Standard_Real& time);
extern Standard_Boolean ChFi3d_GettraceCHRON();
#endif
//=======================================================================
//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 : BuildNewWire
//purpose :
//=======================================================================
TopoDS_Wire BuildNewWire(const TopoDS_Wire& theWire,
const TopTools_IndexedDataMapOfShapeListOfShape& theVEmap,
const TopoDS_Compound& theNewEdges,
const TopoDS_Face& theFace)
{
TopTools_IndexedMapOfShape OldVertices, NewEdges;
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() &&
NewEdges.Contains(anEdge))
{
//StartEdge = anEdge;
Standard_Integer anIndex = NewEdges.FindIndex(anEdge);
StartEdge = TopoDS::Edge(NewEdges(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;
TopoDS_Vertex VV [2];
//Main loop
TopoDS_Edge CurEdge = StartEdge, NextEdge;
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);
for (;;)
{
const TopTools_ListOfShape& Elist = theVEmap.FindFromKey(CurVertex);
Candidates.Clear();
//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);
}
}
if (Candidates.IsEmpty()) //hanging new edge
{
//need to build additional edges
}
TopoDS_Edge NextEdge, aCandidate;
for (Standard_Integer i = 1; i <= Candidates.Length(); i++)
{
const TopoDS_Edge& anEdge = TopoDS::Edge(Candidates(i));
if (NewEdges.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
{
//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;
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);
BB.Add(NewWire, CurEdge);
if (CurVertex.IsSame(StartVertex) &&
CurPoint.SquareDistance(StartPoint) < MinDist)
break;
}
return NewWire;
}
//=======================================================================
//function : CompleteDS
@@ -372,7 +593,7 @@ void ChFi3d_Builder::Compute()
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.
@@ -398,7 +619,7 @@ void ChFi3d_Builder::Compute()
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);
@@ -409,7 +630,122 @@ void ChFi3d_Builder::Compute()
}
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;
//Temporary
TopoDS_Shell aShell;
BB.MakeShell(aShell);
for (Standard_Integer i = 1; i <= myNewFaces.Extent(); i++)
{
TopoDS_Face aFace = TopoDS::Face(myNewFaces(i));
aFace.Orientation(TopAbs_FORWARD);
TopoDS_Compound aNewEdges;
BB.MakeCompound(aNewEdges);
//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);
}
if (myIndsChFiFaces.Contains(i)) //absolutely new face
{
TopoDS_Wire aWire;
BB.MakeWire(aWire);
TopoDS_Iterator iter(aNewEdges);
for (; iter.More(); iter.Next())
BB.Add(aWire, iter.Value());
BB.Add(aFace, aWire);
aChFiFaces.Append(aFace);
//Temporary
BB.Add(aShell, aFace);
}
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())
{
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();
@@ -431,18 +767,18 @@ void ChFi3d_Builder::Compute()
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.
@@ -452,11 +788,11 @@ void ChFi3d_Builder::Compute()
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();
}
}
@@ -465,16 +801,16 @@ void ChFi3d_Builder::Compute()
}
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();
}
}

View File

@@ -30,11 +30,14 @@
#include <ChFiDS_Regularities.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_DataMapOfShapeListOfInteger.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 TopOpeBRepDS_HDataStructure;
@@ -70,6 +73,22 @@ class TopoDS_Face;
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
@@ -304,6 +323,12 @@ protected:
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;
@@ -346,7 +371,11 @@ private:
Standard_EXPORT void StartSol (const Handle(ChFiDS_Stripe)& S, const Handle(ChFiDS_HElSpine)& HGuide, Handle(BRepAdaptor_HSurface)& HS1, Handle(BRepAdaptor_HSurface)& HS2, Handle(BRepTopAdaptor_TopolTool)& I1, Handle(BRepTopAdaptor_TopolTool)& I2, gp_Pnt2d& P1, gp_Pnt2d& P2, Standard_Real& First) const;
Standard_EXPORT void ConexFaces (const Handle(ChFiDS_Spine)& Sp, const Standard_Integer IEdge, const Standard_Integer RefChoix, Handle(BRepAdaptor_HSurface)& HS1, Handle(BRepAdaptor_HSurface)& HS2) const;
Standard_EXPORT void ConexFaces (const Handle(ChFiDS_Spine)& Sp,
const Standard_Integer IEdge,
const Standard_Integer RefChoix,
Handle(BRepAdaptor_HSurface)& HS1,
Handle(BRepAdaptor_HSurface)& HS2) const;
TopoDS_Shape myShape;

View File

@@ -90,6 +90,7 @@
#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>
@@ -192,6 +193,211 @@ Standard_Real ChFi3d_InPeriod(const Standard_Real U,
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 LastPnt = BAcurve.Value(LastPar);
LastVertex = BRepLib_MakeVertex(LastPnt);
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.
@@ -4743,6 +4949,24 @@ Standard_Integer ChFi3d_NumberOfSharpEdges(const TopoDS_Vertex& Vtx,
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

View File

@@ -81,6 +81,14 @@ Standard_Real ChFi3d_InPeriod(const Standard_Real U,
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);
@@ -565,6 +573,9 @@ Standard_Integer ChFi3d_NumberOfSharpEdges(const TopoDS_Vertex& Vtx,
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,

View File

@@ -98,6 +98,7 @@
#include <TopOpeBRepDS_Surface.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <BRepLib_MakeEdge.hxx>
#include <stdio.h>
@@ -714,6 +715,19 @@ Standard_Boolean ChFi3d_Builder::StoreData(Handle(ChFiDS_SurfData)& Data,
}
Data->ChangeSurf(DStr.AddSurface(TopOpeBRepDS_Surface(Surf,tolget3d)));
//jgv
BRep_Builder BB;
TopoDS_Face aNewFace;
BB.MakeFace(aNewFace);
TopLoc_Location aLoc;
BB.UpdateFace(aNewFace, Surf, aLoc, Precision::Confusion());
Standard_Integer IndNewFace = myNewFaces.Add(aNewFace);
myIndsChFiFaces.Add(IndNewFace);
//ChFi3d_ListOfQualifiedEdge aList;
TColStd_ListOfInteger aList;
myFaceNewEdges.Add(IndNewFace, aList);
Data->ChangeIndexOfFace(IndNewFace);
/////
#ifdef DRAW
ChFi3d_SettraceDRAWFIL(Standard_True);
@@ -795,6 +809,33 @@ Standard_Boolean ChFi3d_Builder::StoreData(Handle(ChFiDS_SurfData)& Data,
if(Reversed) TraOn1 = ChFi3d_TrsfTrans(lin->TransitionOnS2());
else TraOn1 = ChFi3d_TrsfTrans(lin->TransitionOnS1());
Fint1.SetInterference(Index1OfCurve,TraOn1,PCurveOnFace,PCurveOnSurf);
//jgv
TopoDS_Edge Boundary1 = BRepLib_MakeEdge(Crv3d1, pppdeb, pppfin);
BB.UpdateEdge(Boundary1, tolcheck);
BB.UpdateEdge(Boundary1, PCurveOnSurf, Surf, aLoc, 0.);
BB.UpdateEdge(Boundary1, PCurveOnFace, BS1->ChangeSurface().Face(), 0.);
myNewEdges.Add(Boundary1);
Standard_Integer IndF1;
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);
}
Standard_Integer IndE1 = myNewEdges.FindIndex(Boundary1);
Data->ChangeIndexOfE1(IndE1);
TopAbs_Orientation Et = (Reversed)? TopAbs_REVERSED : TopAbs_FORWARD;
//QualifiedEdge aQE1(IndE1, Et);
if (Et == TopAbs_REVERSED)
IndE1 *= -1;
myFaceNewEdges.ChangeFromKey(IndF1).Append(IndE1);
myFaceNewEdges.ChangeFromKey(IndNewFace).Append(-IndE1);
/////
// SurfData is filled in what concerns S2,
Handle(Geom_Curve) Crv3d2 = Surf->UIso(Uon2);
@@ -848,6 +889,33 @@ Standard_Boolean ChFi3d_Builder::StoreData(Handle(ChFiDS_SurfData)& Data,
if(Reversed) TraOn2 = ChFi3d_TrsfTrans(lin->TransitionOnS1());
else TraOn2 = ChFi3d_TrsfTrans(lin->TransitionOnS2());
Fint2.SetInterference(Index2OfCurve,TraOn2,PCurveOnFace,PCurveOnSurf);
//jgv
TopoDS_Edge Boundary2 = BRepLib_MakeEdge(Crv3d2, pppdeb, pppfin);
BB.UpdateEdge(Boundary2, tolcheck);
BB.UpdateEdge(Boundary2, PCurveOnSurf, Surf, aLoc, 0.);
BB.UpdateEdge(Boundary2, PCurveOnFace, BS2->ChangeSurface().Face(), 0.);
myNewEdges.Add(Boundary2);
Standard_Integer IndF2;
if (!myNewFaces.Contains(BS2->ChangeSurface().Face()))
myNewFaces.Add(BS2->ChangeSurface().Face());
IndF2 = myNewFaces.FindIndex(BS2->ChangeSurface().Face());
if (!myFaceNewEdges.Contains(IndF2))
{
//ChFi3d_ListOfQualifiedEdge aList;
TColStd_ListOfInteger aList;
myFaceNewEdges.Add(IndF2, aList);
}
Standard_Integer IndE2 = myNewEdges.FindIndex(Boundary2);
Data->ChangeIndexOfE2(IndE2);
//QualifiedEdge aQE2(IndE2, TopAbs::Reverse(Et));
TopAbs_Orientation RevEt = TopAbs::Reverse(Et);
if (RevEt == TopAbs_REVERSED)
IndE2 *= -1;
myFaceNewEdges.ChangeFromKey(IndF2).Append(IndE2);
myFaceNewEdges.ChangeFromKey(IndNewFace).Append(-IndE2);
/////
}
else {
Handle(Geom2d_Curve) bidpc;

View File

@@ -140,6 +140,7 @@
#include <TopOpeBRepDS_Transition.hxx>
#include <TopTools_Array1OfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
//#include <BOPTools_AlgoTools2D.hxx>
#ifdef OCCT_DEBUG
# ifdef DRAW
@@ -598,6 +599,9 @@ void ChFi3d_Builder::PerformOneCorner(const Standard_Integer Index,
}
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.
@@ -621,6 +625,7 @@ void ChFi3d_Builder::PerformOneCorner(const Standard_Integer Index,
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;
@@ -631,6 +636,7 @@ void ChFi3d_Builder::PerformOneCorner(const Standard_Integer Index,
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)
@@ -731,12 +737,11 @@ void ChFi3d_Builder::PerformOneCorner(const Standard_Integer Index,
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);
@@ -753,6 +758,7 @@ void ChFi3d_Builder::PerformOneCorner(const Standard_Integer Index,
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);
@@ -768,6 +774,26 @@ void ChFi3d_Builder::PerformOneCorner(const Standard_Integer Index,
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);
@@ -857,6 +883,23 @@ void ChFi3d_Builder::PerformOneCorner(const Standard_Integer Index,
Pc,tolesp,tol2d,tolreached))
throw Standard_Failure("OneCorner : echec calcul intersection");
//jgv
aNewEdge = BRepLib_MakeEdge(Cc,
VerFopFad[IFopArc], VerFopFad[IFadArc],
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();
@@ -933,12 +976,25 @@ void ChFi3d_Builder::PerformOneCorner(const Standard_Integer Index,
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);
myFaceNewEdges.ChangeFromKey(IndexOfNewFace).Append(-IndE);
#ifdef OCCT_DEBUG
ChFi3d_ResultChron(ch ,t_inter); //result perf condition if (inter)
ChFi3d_InitChron(ch); // init perf condition if (onsame && inters)
@@ -1246,6 +1302,8 @@ void ChFi3d_Builder::PerformOneCorner(const Standard_Integer Index,
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;
@@ -1268,127 +1326,97 @@ void ChFi3d_Builder::PerformOneCorner(const Standard_Integer Index,
zob2dv,tolesp,tol2d,tolreached))
throw Standard_Failure("OneCorner : echec calcul intersection");
//jgv
//TopoDS_Vertex CommonVertexForNewEdgeAndZobEdge = TopExp::FirstVertex(aNewEdge);
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);

View File

@@ -24,9 +24,11 @@
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)
{}
//=======================================================================
@@ -38,6 +40,8 @@ void ChFiDS_SurfData::Copy(const Handle(ChFiDS_SurfData)& Other)
{
indexOfS1 = Other->indexOfS1;
indexOfS2 = Other->indexOfS2;
indexOfE1 = Other->indexOfE1;
indexOfE2 = Other->indexOfE2;
indexOfConge = Other->indexOfConge;
orientation = Other->orientation;
intf1 = Other->intf1;
@@ -75,6 +79,19 @@ Standard_Integer ChFiDS_SurfData::Index(const Standard_Integer OfS) const
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 :
@@ -87,9 +104,8 @@ const ChFiDS_FaceInterference& ChFiDS_SurfData::Interference
else return intf2;
}
//=======================================================================
//function : Interference
//function : ChangeInterference
//purpose :
//=======================================================================

View File

@@ -81,6 +81,12 @@ public:
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);
@@ -105,8 +111,12 @@ public:
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;
@@ -187,7 +197,11 @@ private:
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;

View File

@@ -98,6 +98,16 @@ inline void ChFiDS_SurfData::SetIndexOfC2 (const Standard_Integer theIndex)
isoncurv2 = (theIndex != 0);
}
//=======================================================================
//function : IndexOfFace
//purpose :
//=======================================================================
inline Standard_Integer ChFiDS_SurfData::IndexOfFace()const
{
return indexOfFace;
}
//=======================================================================
//function : Surf
//purpose :
@@ -201,6 +211,36 @@ inline void ChFiDS_SurfData::ChangeIndexOfS2(const Standard_Integer Index)
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 :