#include <TopTools_HArray2OfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
+#include <GeomLib_CheckCurveOnSurface.hxx>
#include <stdio.h>
//#include <BRepFill_TrimCorner.hxx>
return Standard_True;
}
+//=======================================================================
+//function : CheckSameParameterExact
+//purpose : Check a posteriori that sameparameter has worked correctly
+// with exact calculation method of edge tolerance
+//=======================================================================
+static Standard_Boolean CheckSameParameterExact
+(const Handle(Adaptor3d_Curve)& C3d,
+ const Handle(Adaptor3d_CurveOnSurface)& curveOnSurface,
+ const Standard_Real tol3d,
+ Standard_Real& tolreached)
+{
+ GeomLib_CheckCurveOnSurface aCheckCurveOnSurface(C3d);
+ aCheckCurveOnSurface.SetParallel(Standard_False);
+ aCheckCurveOnSurface.Perform(curveOnSurface);
+
+ tolreached = aCheckCurveOnSurface.MaxDistance();
+
+ if (tolreached > tol3d) {
+ return Standard_False;
+ }
+ else
+ {
+ tolreached = Max(tolreached, Precision::Confusion());
+ tolreached *= 1.05;
+ }
+ return Standard_True;
+}
+
//=======================================================================
//function : SameParameter
//purpose : Encapsulation of Sameparameter
return Standard_False;
}
- ResTol = sp.TolReached();
- if(ResTol > tolreached ){
+ Handle(Adaptor3d_Curve) curve3d = sp.Curve3d();
+ Handle(Adaptor3d_CurveOnSurface) curveOnSurface = sp.CurveOnSurface();
+
+ if (!CheckSameParameterExact(curve3d, curveOnSurface, tol3d, ResTol) && ResTol > tolreached) {
#ifdef OCCT_DEBUG
std::cout<<"SameParameter : Tolerance not reached!"<<std::endl;
std::cout<<"tol visee : "<<tol3d<<" tol obtained : "<<ResTol<<std::endl;
Tang = T1 + T2; //Average direction
gp_Dir NormalOfBisPlane = Tang;
-
+ gp_Vec anIntersectPointCrossDirection = T1.Crossed(T2);
if (isTangent) {
Sortant -= Tang.Dot(Tang)*Tang;
}
}
}
- BRepFill_TrimShellCorner aTrim(aFaces, Transition, AxeOfBisPlane);
+ BRepFill_TrimShellCorner aTrim(aFaces, Transition, AxeOfBisPlane, anIntersectPointCrossDirection);
aTrim.AddBounds(Bounds);
aTrim.AddUEdges(aUEdges);
aTrim.AddVEdges(myVEdges, Index);
static Standard_Boolean FindCommonVertex(const BOPDS_PDS& theDS,
const Standard_Integer theEIndex1,
const Standard_Integer theEIndex2,
+ const gp_Vec& theCrossDirection,
TopoDS_Vertex& theCommonVertex,
Standard_Real& theParamOnE1,
Standard_Real& theParamOnE2);
static Standard_Boolean SplitUEdges(const Handle(TopTools_HArray2OfShape)& theUEdges,
const BOPDS_PDS& theDS,
+ const gp_Vec& theCrossDirection,
TopTools_DataMapOfShapeListOfShape& theHistMap);
static void StoreVedgeInHistMap(const Handle(TopTools_HArray1OfShape)& theVEdges,
// ===========================================================================================
BRepFill_TrimShellCorner::BRepFill_TrimShellCorner(const Handle(TopTools_HArray2OfShape)& theFaces,
const BRepFill_TransitionStyle theTransition,
- const gp_Ax2& theAxeOfBisPlane) :
+ const gp_Ax2& theAxeOfBisPlane,
+ const gp_Vec& theIntPointCrossDir) :
myTransition(theTransition),
myAxeOfBisPlane(theAxeOfBisPlane),
+ myIntPointCrossDir(theIntPointCrossDir),
myDone(Standard_False),
myHasSection(Standard_False)
{
BOPDS_VectorOfInterfFF& aFFs = theDS->InterfFF();
Standard_Integer aNbFFs = aFFs.Length();
- if(!SplitUEdges(myUEdges, theDS, myHistMap)) {
+ if(!SplitUEdges(myUEdges, theDS, myIntPointCrossDir, myHistMap)) {
return;
}
Standard_Real apar1 = 0., apar2 = 0.;
Standard_Boolean bvertexfound =
- FindCommonVertex(theDS, anIndex1, anIndex2, aCommonVertex, apar1, apar2);
+ FindCommonVertex(theDS, anIndex1, anIndex2, myIntPointCrossDir, aCommonVertex, apar1, apar2);
// search common vertex between bounds. end
Handle(BRepTools_ReShape) aSubstitutor = new BRepTools_ReShape();
TopoDS_Vertex FirstVertex, LastVertex;
Standard_Real ParamOnLeftE1, ParamOnLeftE2, ParamOnRightE1, ParamOnRightE2;
- FindCommonVertex(theDS, IndexOfLeftE1, IndexOfLeftE2,
+ FindCommonVertex(theDS, IndexOfLeftE1, IndexOfLeftE2, myIntPointCrossDir,
FirstVertex, ParamOnLeftE1, ParamOnLeftE2);
- FindCommonVertex(theDS, IndexOfRightE1, IndexOfRightE2,
+ FindCommonVertex(theDS, IndexOfRightE1, IndexOfRightE2, myIntPointCrossDir,
LastVertex, ParamOnRightE1, ParamOnRightE2);
TopoDS_Shape SecWire;
// purpose:
// ------------------------------------------------------------------------------------------
Standard_Boolean SplitUEdges(const Handle(TopTools_HArray2OfShape)& theUEdges,
- const BOPDS_PDS& theDS,
+ const BOPDS_PDS& theDS,
+ const gp_Vec& theCrossDirection,
TopTools_DataMapOfShapeListOfShape& theHistMap) {
const BOPDS_VectorOfInterfVV& aVVs = theDS->InterfVV();
TopoDS_Vertex aCommonVertex;
Standard_Real apar1 = 0., apar2 = 0.;
Standard_Boolean bvertexfound =
- FindCommonVertex(theDS, anEIndex1, anEIndex2, aCommonVertex, apar1, apar2);
+ FindCommonVertex(theDS, anEIndex1, anEIndex2, theCrossDirection, aCommonVertex, apar1, apar2);
//
if(!bvertexfound) {
TopoDS_Vertex V1 = TopExp::LastVertex(TopoDS::Edge(aE1));
Standard_Boolean FindCommonVertex(const BOPDS_PDS& theDS,
const Standard_Integer theEIndex1,
const Standard_Integer theEIndex2,
+ const gp_Vec& theCrossDirection,
TopoDS_Vertex& theCommonVertex,
Standard_Real& theParamOnE1,
Standard_Real& theParamOnE2) {
TopoDS_Vertex aCommonVertex;
Standard_Integer eeit = 0;
+ TopoDS_Edge theE1 = TopoDS::Edge(theDS->Shape(theEIndex1));
+ TopoDS_Edge theE2 = TopoDS::Edge(theDS->Shape(theEIndex2));
+ BRepAdaptor_Curve aBC1(theE1), aBC2(theE2);
+
Standard_Integer aNbEEs;
aNbEEs = aEEs.Length();
for(eeit = 0; eeit < aNbEEs; ++eeit) {
IntTools_Tools::VertexParameters(aCP, theParamOnE1, theParamOnE2);
else
IntTools_Tools::VertexParameters(aCP, theParamOnE2, theParamOnE1);
-
- //
- bvertexfound = Standard_True;
- break;
+
+ gp_Pnt aPt;
+ gp_Vec aDirOnE1, aDirOnE2;
+ gp_Dir aIntersectPointCrossDir;
+
+ // intersect point aDirOnE1.cross(aDirOnE2) should same direction with path theCrossDirection
+ aBC1.D1(theParamOnE1, aPt, aDirOnE1);
+ aBC2.D1(theParamOnE2, aPt, aDirOnE2);
+ aIntersectPointCrossDir = aDirOnE1.Crossed(aDirOnE2);
+
+ if (aIntersectPointCrossDir.Dot(theCrossDirection) > Precision::SquareConfusion())
+ {
+ bvertexfound = Standard_True;
+ break;
+ }
}
}
}