1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

Compare commits

..

13 Commits

Author SHA1 Message Date
msv
280a080587 The test case "perf modalg bug453_2" has been corrected. Now the area is computed the same on both Linux and Windows. 2017-10-26 11:04:57 +03:00
msv
c3d250cc97 # reduce enlarging by half to avoid regressions on some blend tests. 2017-10-25 17:49:10 +03:00
msv
07045ddcf5 0029257: GeomPlate generates surface in unexpected place
Treatment of the parameter EnlargeCoeff in the constructor of GeomPlate_MakeApprox has been corrected. Now the bounds of the result surface are correctly enlarged.

The new draw command 'pullupface' has been implemented to check behavior of GeomPlate.
2017-10-24 20:48:07 +03:00
apn
72bcf3c7be 0029247: Tests, CheckCommands.tcl - Tcl exception "expected integer but got 3dviewer" in test cases on macOS
Test cases on macOS (using native tcl from /usr/lib) fail when $lst starts with numeral, because upvar guesses that its first parameter is level rather than otherVar.
The fix is to explicitly supply level to 1 (default value if uplevel is omitted) to avoid tcl exception "expected integer but got 3dviewer".
2017-10-19 12:27:45 +03:00
ifv
47a2717138 0029183: Result of general fuse of shell and edge produces a shape with too large tolerance
Adjusting parameters on approximation (boundary condition) for case when projected curve is far from surface
Test case is created
2017-10-19 12:26:52 +03:00
msv
6da5b3004c 0029157: Modeling - suspicious pass-through of case labels in switch statements
Suspicious passes through case labels have been resolved either by using Standard_FALLTHROUGH macro or by redesigning the code.
2017-10-19 12:26:50 +03:00
msv
56c62737ee 0029182: BOPAlgo_PaveFiller sometimes raises exception in parallel mode
Data races have been prevented in the code of BOPAlgo_PaveFiller that makes pcurves of edges on faces. For that:
- Put into treatment only unique edge-face pairs.
- If the same edge is treated with different faces in different threads simultaneously this also causes data races. To avoid this make the edge's copy in each thread and update the copy. The original edge is updated only after finishing parallel processing.

The new method BOPTools_AlgoTools::CopyEdge has been added to make a copy of an edge with vertices.

Big screenshot in the test script tests/bugs/modalg_7/bug28200 has been replaced with a small one.
2017-10-19 12:26:47 +03:00
oan
5fbe3d01e6 0029186: Move AddTool(), SetTools(), Tools() and other common methods of BOP tools to separate interface class
Methods AddTool(), SetTools(), Tools() have been moved to BOPAlgo_ToolsProvider class;
BOPAlgo_BOP and BOPAlgo_Splitter are now successors of BOPAlgo_ToolsProvider
2017-10-19 12:26:45 +03:00
kgv
744d9c0d22 0029228: Coding Rules - define rule for avoiding header inclusion list pollution 2017-10-19 12:26:43 +03:00
dbv
4ea76aea75 0029229: Crash at Poly_Triangulation::Normal
Fixed creation of returning gp_Dir
2017-10-19 12:26:41 +03:00
emv
4b1a240135 0028763: Projection of a short line segment on a polar surface causes exception
Test case for the issue.
The problem has been fixed by the fix for the issue 0028150
2017-10-19 12:26:39 +03:00
kgv
82be4141b6 0029225: Visualization - Font_FTFont::AdvanceX() retrieves kerning value for incorrect characters pair
Fixed FT_Get_Kerning misuse within Font_FTFont::AdvanceX()/Font_FTFont::AdvanceY().
Font_FTFont::loadGlyph() has been corrected to not return TRUE
in case if method called with 0 argument second+ time.
2017-10-16 17:56:14 +03:00
emv
bc4a38670e 0029188: Null shape is produced by 3D offset algorithm (mode="Complete", Join Type="Intersection")
The following improvements have been made in the 3D offset algorithm for mode "Complete" and Join type "Intersection":
- RemoveInsideFaces() - Removal of the invalid parts outside of the solids built from the splits of offset faces is now performed. It helps to avoid their rebuilding and speed-up the computation.
- FindVerticesToAvoid() - Strengthening the criteria for the vertices to be avoided in the new splits.

Test cases for the issue.
Adjustment of the test cases to current behavior.
2017-10-16 17:54:42 +03:00
67 changed files with 1544 additions and 640 deletions

View File

@@ -479,6 +479,8 @@ Inclusion of class header on top verifies consistency of the header (e.g. that h
An exception to the rule is ordering system headers generating a macros declaration conflicts (like "windows.h" or "X11/Xlib.h") - these headers should be placed in the way solving the conflict.
The source or header file should include only minimal set of headers necessary for compilation, without duplicates (considering nested includes).
~~~~~{.cpp}
// the header file of implemented class
#include <PackageName_ClassName.hxx>

View File

@@ -71,10 +71,7 @@ static
//purpose :
//=======================================================================
BOPAlgo_BOP::BOPAlgo_BOP()
:
BOPAlgo_Builder(),
myTools(myAllocator),
myMapTools(100, myAllocator)
: BOPAlgo_ToolsProvider()
{
Clear();
}
@@ -82,12 +79,8 @@ BOPAlgo_BOP::BOPAlgo_BOP()
//function :
//purpose :
//=======================================================================
BOPAlgo_BOP::BOPAlgo_BOP
(const Handle(NCollection_BaseAllocator)& theAllocator)
:
BOPAlgo_Builder(theAllocator),
myTools(myAllocator),
myMapTools(100, myAllocator)
BOPAlgo_BOP::BOPAlgo_BOP(const Handle(NCollection_BaseAllocator)& theAllocator)
: BOPAlgo_ToolsProvider(theAllocator)
{
Clear();
}
@@ -105,12 +98,10 @@ BOPAlgo_BOP::~BOPAlgo_BOP()
void BOPAlgo_BOP::Clear()
{
myOperation=BOPAlgo_UNKNOWN;
myTools.Clear();
myMapTools.Clear();
myDims[0]=-1;
myDims[1]=-1;
//
BOPAlgo_Builder::Clear();
BOPAlgo_ToolsProvider::Clear();
}
//=======================================================================
//function : SetOperation
@@ -129,31 +120,6 @@ BOPAlgo_Operation BOPAlgo_BOP::Operation()const
return myOperation;
}
//=======================================================================
//function : AddTool
//purpose :
//=======================================================================
void BOPAlgo_BOP::AddTool(const TopoDS_Shape& theShape)
{
if (myMapTools.Add(theShape)) {
myTools.Append(theShape);
}
}
//=======================================================================
//function : SetTools
//purpose :
//=======================================================================
void BOPAlgo_BOP::SetTools(const BOPCol_ListOfShape& theShapes)
{
BOPCol_ListIteratorOfListOfShape aIt;
//
myTools.Clear();
aIt.Initialize(theShapes);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS = aIt.Value();
AddTool(aS);
}
}
//=======================================================================
//function : CheckData
//purpose :
//=======================================================================

View File

@@ -24,7 +24,7 @@
#include <TopoDS_Shape.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPCol_MapOfShape.hxx>
#include <BOPAlgo_Builder.hxx>
#include <BOPAlgo_ToolsProvider.hxx>
#include <BOPCol_BaseAllocator.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <Standard_Boolean.hxx>
@@ -66,7 +66,7 @@ class BOPAlgo_PaveFiller;
//! - *BOPAlgo_AlertSolidBuilderFailed* - in case the BuilderSolid algorithm failed to
//! produce the Fused solid.
//!
class BOPAlgo_BOP : public BOPAlgo_Builder
class BOPAlgo_BOP : public BOPAlgo_ToolsProvider
{
public:
@@ -75,18 +75,13 @@ public:
//! Empty constructor
Standard_EXPORT BOPAlgo_BOP();
Standard_EXPORT virtual ~BOPAlgo_BOP();
Standard_EXPORT virtual ~BOPAlgo_BOP();
Standard_EXPORT BOPAlgo_BOP(const BOPCol_BaseAllocator& theAllocator);
//! Clears internal fields and arguments
Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
//! Adds Tool argument of the operation
Standard_EXPORT virtual void AddTool (const TopoDS_Shape& theShape);
Standard_EXPORT virtual void SetTools (const BOPCol_ListOfShape& theShapes);
Standard_EXPORT void SetOperation (const BOPAlgo_Operation theOperation);
Standard_EXPORT BOPAlgo_Operation Operation() const;
@@ -116,16 +111,11 @@ protected:
//! all shapes in one of the groups are empty shapes.
Standard_EXPORT Standard_Boolean TreatEmptyShape();
protected:
BOPAlgo_Operation myOperation;
Standard_Integer myDims[2];
TopoDS_Shape myRC;
BOPCol_ListOfShape myTools;
BOPCol_MapOfShape myMapTools;
private:
Standard_Integer myDims[2];
TopoDS_Shape myRC;
};
#endif // _BOPAlgo_BOP_HeaderFile

View File

@@ -593,7 +593,7 @@ void BOPAlgo_BuilderFace::PerformAreas()
// 5.2. Add unused holes to the original face
if (aNbHoles != aNbInOutMap) {
Bnd_Box aBoxF;
BRepBndLib::AddOptimal(myFace, aBoxF, Standard_True, Standard_True);
BRepBndLib::Add(myFace, aBoxF);
if (aBoxF.IsOpenXmin() || aBoxF.IsOpenXmax() ||
aBoxF.IsOpenYmin() || aBoxF.IsOpenYmax() ||
aBoxF.IsOpenZmin() || aBoxF.IsOpenZmax()) {
@@ -810,6 +810,7 @@ Standard_Boolean IsInside(const TopoDS_Shape& theHole,
Handle(IntTools_Context)& theContext)
{
Standard_Boolean bRet;
Standard_Real aT, aU, aV;
TopAbs_State aState;
TopExp_Explorer aExp;
@@ -823,19 +824,20 @@ Standard_Boolean IsInside(const TopoDS_Shape& theHole,
BOPTools::MapShapes(aF2, TopAbs_EDGE, aME2);//AA
//
aExp.Init(theHole, TopAbs_EDGE);
if (aExp.More())
{
const TopoDS_Edge& aE = (*(TopoDS_Edge *) (&aExp.Current()));
if (aME2.Contains(aE))
{
if (aExp.More()) {
const TopoDS_Edge& aE =(*(TopoDS_Edge *)(&aExp.Current()));
if (aME2.Contains(aE)) {
return bRet;
}
if (!BRep_Tool::Degenerated(aE))
{
if (!BRep_Tool::Degenerated(aE)) {
//
gp_Pnt aP3D;
BOPTools_AlgoTools::PointOnEdge(aE, BOPTools_AlgoTools2D::IntermediatePoint(aE), aP3D);
bRet = theContext->IsPointInFace(aP3D, aF2, BRep_Tool::Tolerance(aE));
aT=BOPTools_AlgoTools2D::IntermediatePoint(aE);
BOPTools_AlgoTools2D::PointOnSurface(aE, aF2, aT, aU, aV, theContext);
aP2D.SetCoord(aU, aV);
//
IntTools_FClass2d& aClsf=theContext->FClass2d(aF2);
aState=aClsf.Perform(aP2D);
bRet=(aState==TopAbs_IN);
}
}
//

View File

@@ -600,7 +600,7 @@ void BOPAlgo_BuilderSolid::PerformAreas()
const TopoDS_Shape& aShell = aItLS.Value();
aSB.SetShape(aShell);
//
BRepBndLib::AddOptimal(aShell, aBox, Standard_True, Standard_True);
BRepBndLib::Add(aShell, aBox);
bIsHole=Standard_False;
//
bIsGrowth=IsGrowthShell(aShell, aMHF);
@@ -834,7 +834,7 @@ void BOPAlgo_BuilderSolid::PerformInternalShapes()
const BOPAlgo_FacePnt& aFP=aVFP(k);
const TopoDS_Face& aF=aFP.Face();
//
BRepBndLib::AddOptimal(aF, aBox, Standard_True, Standard_True);
BRepBndLib::Add(aF, aBox);
aTreeFiller.Add(k, aBox);
}
//

View File

@@ -577,7 +577,7 @@ void BOPAlgo_Builder::FillIn3DParts
continue;
}
Bnd_Box aBox;
BRepBndLib::AddOptimal(aSx, aBox, Standard_True, Standard_True);
BRepBndLib::Add(aSx, aBox);
aBox.SetGap(aBox.GetGap() + Precision::Confusion());
//
BOPAlgo_ShapeBox& aSB=aVSB.Append1();

View File

@@ -97,7 +97,7 @@ void BOPAlgo_PaveFiller::UpdateEdgeTolerance (const Standard_Integer nE,
const TopoDS_Edge& aE = *(TopoDS_Edge*)&myDS->Shape(nE);
aBB.UpdateEdge(aE, aTol);
Bnd_Box& aBoxE=aSIE.ChangeBox();
BRepBndLib::AddOptimal(aE, aBoxE, Standard_True, Standard_True);
BRepBndLib::Add(aE, aBoxE);
aBoxE.SetGap(aBoxE.GetGap() + Precision::Confusion());
//
aIt.Initialize(aLI);
@@ -113,7 +113,7 @@ void BOPAlgo_PaveFiller::UpdateEdgeTolerance (const Standard_Integer nE,
aBB.UpdateVertex(aV, aTol);
BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nV);
Bnd_Box& aBoxV = aSIV.ChangeBox();
BRepBndLib::AddOptimal(aV, aBoxV, Standard_True, Standard_True);
BRepBndLib::Add(aV, aBoxV);
aBoxV.SetGap(aBoxV.GetGap() + Precision::Confusion());
}
}
@@ -141,7 +141,7 @@ Standard_Integer BOPAlgo_PaveFiller::UpdateVertex
aBB.UpdateVertex(aVSD, aTolNew);
BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nVNew);
Bnd_Box& aBoxV = aSIV.ChangeBox();
BRepBndLib::AddOptimal(aVSD, aBoxV, Standard_True, Standard_True);
BRepBndLib::Add(aVSD, aBoxV);
aBoxV.SetGap(aBoxV.GetGap() + Precision::Confusion());
}
return nVNew;
@@ -165,7 +165,7 @@ Standard_Integer BOPAlgo_PaveFiller::UpdateVertex
// bounding box for the new vertex
BOPDS_ShapeInfo& aSIDS = myDS->ChangeShapeInfo(nVNew);
Bnd_Box& aBoxDS = aSIDS.ChangeBox();
BRepBndLib::AddOptimal(aVNew, aBoxDS, Standard_True, Standard_True);
BRepBndLib::Add(aVNew, aBoxDS);
aBoxDS.SetGap(aBoxDS.GetGap() + Precision::Confusion());
//
// add vertex to SD map

View File

@@ -630,7 +630,7 @@ void BOPAlgo_PaveFiller::MakeBlocks()
BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nV1);
Bnd_Box& aBoxDS=aSIDS.ChangeBox();
aBoxDS = Bnd_Box();
BRepBndLib::AddOptimal(aV, aBoxDS, Standard_True, Standard_True);
BRepBndLib::Add(aV, aBoxDS);
aBoxDS.SetGap(aBoxDS.GetGap() + Precision::Confusion());
//
if (aDMVLV.IsBound(nV1))
@@ -680,9 +680,6 @@ void BOPAlgo_PaveFiller::MakeBlocks()
// into all faces, not participated in creation of that edge, as IN edge
PutSEInOtherFaces();
//
myDS->FilterOfCommonBlocks();
//-----------------------------------------------------scope t
aMVStick.Clear();
aMPBOnIn.Clear();
@@ -1536,7 +1533,7 @@ void BOPAlgo_PaveFiller::PutBoundPaveOnCurve(const TopoDS_Face& aF1,
//
BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nVn);
Bnd_Box& aBoxDS=aSIDS.ChangeBox();
BRepBndLib::AddOptimal(aVn, aBoxDS, Standard_True, Standard_True);
BRepBndLib::Add(aVn, aBoxDS);
aBoxDS.SetGap(aBoxDS.GetGap() + Precision::Confusion());
//
aLVB.Append(nVn);
@@ -2154,7 +2151,7 @@ void BOPAlgo_PaveFiller::PutPaveOnCurve
//
BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nV);
Bnd_Box& aBoxDS=aSIDS.ChangeBox();
BRepBndLib::AddOptimal(aV, aBoxDS, Standard_True, Standard_True);
BRepBndLib::Add(aV, aBoxDS);
aBoxDS.SetGap(aBoxDS.GetGap() + Precision::Confusion());
}
}

View File

@@ -29,6 +29,7 @@
#include <BOPDS_Interf.hxx>
#include <BOPDS_Iterator.hxx>
#include <BOPDS_ListOfPaveBlock.hxx>
#include <BOPDS_MapOfPair.hxx>
#include <BOPDS_MapOfPaveBlock.hxx>
#include <BOPDS_Pave.hxx>
#include <BOPDS_PaveBlock.hxx>
@@ -142,7 +143,7 @@ class BOPAlgo_SplitEdge : public BOPAlgo_Algo {
myV1, myT1,
myV2, myT2,
myESp);
BRepBndLib::AddOptimal(myESp, myBox, Standard_True, Standard_True);
BRepBndLib::Add(myESp, myBox);
myBox.SetGap(myBox.GetGap() + Precision::Confusion());
}
//
@@ -246,28 +247,42 @@ class BOPAlgo_MPC : public BOPAlgo_Algo {
{
OCC_CATCH_SIGNALS
Standard_Integer iErr;
//
iErr=1;
if (!myEz.IsNull()) {
TopoDS_Edge aSpz;
//
BOPTools_AlgoTools::MakeSplitEdge(myEz,myV1, myT1,
myV2, myT2, aSpz);
//
iErr=
BOPTools_AlgoTools2D::AttachExistingPCurve(aSpz,
myE,
myF,
myContext);
// Check if edge has pcurve. If no then make its copy to avoid data races,
// and use it to build pcurve.
TopoDS_Edge aCopyE = myE;
Standard_Real f, l;
Handle(Geom2d_Curve) aC2d = BRep_Tool::CurveOnSurface(aCopyE, myF, f, l);
if (aC2d.IsNull())
{
aCopyE = BOPTools_AlgoTools::CopyEdge(aCopyE);
Standard_Integer iErr = 1;
if (!myEz.IsNull())
{
// Attach pcurve from the original edge
TopoDS_Edge aSpz;
BOPTools_AlgoTools::MakeSplitEdge(myEz, myV1, myT1,
myV2, myT2, aSpz);
iErr = BOPTools_AlgoTools2D::AttachExistingPCurve(aSpz,
aCopyE,
myF,
myContext);
}
if (iErr)
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aCopyE, myF, myContext);
myNewC2d = BRep_Tool::CurveOnSurface(aCopyE, myF, f, l);
if (myNewC2d.IsNull())
{
AddError(new BOPAlgo_AlertBuildingPCurveFailed(TopoDS_Shape()));
return;
}
else
myNewTol = BRep_Tool::Tolerance(aCopyE);
}
//
if (iErr) {
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(myE, myF, myContext);
}
//
if (myFlag) {
UpdateVertices(myE, myF);
UpdateVertices(aCopyE, myF);
}
}
catch (Standard_Failure)
@@ -275,7 +290,17 @@ class BOPAlgo_MPC : public BOPAlgo_Algo {
AddError(new BOPAlgo_AlertBuildingPCurveFailed(TopoDS_Shape()));
}
}
//
const Handle(Geom2d_Curve)& GetNewPCurve() const
{
return myNewC2d;
}
Standard_Real GetNewTolerance() const
{
return myNewTol;
}
protected:
Standard_Boolean myFlag;
TopoDS_Edge myE;
@@ -285,6 +310,8 @@ class BOPAlgo_MPC : public BOPAlgo_Algo {
Standard_Real myT1;
TopoDS_Vertex myV2;
Standard_Real myT2;
Handle(Geom2d_Curve) myNewC2d;
Standard_Real myNewTol;
//
Handle(IntTools_Context) myContext;
};
@@ -525,7 +552,7 @@ Standard_Integer BOPAlgo_PaveFiller::SplitEdge(const Standard_Integer nE,
aSI.SetShape(aSp);
//
Bnd_Box& aBox=aSI.ChangeBox();
BRepBndLib::AddOptimal(aSp, aBox, Standard_True, Standard_True);
BRepBndLib::Add(aSp, aBox);
aBox.SetGap(aBox.GetGap() + Precision::Confusion());
//
nSp=myDS->Append(aSI);
@@ -541,7 +568,7 @@ void BOPAlgo_PaveFiller::MakePCurves()
(!mySectionAttribute.PCurveOnS1() && !mySectionAttribute.PCurveOnS2()))
return;
Standard_Boolean bHasPC;
Standard_Integer i, nF1, nF2, aNbC, k, nE, aNbFF, aNbFI, nEx;
Standard_Integer i, nF1, aNbC, k, nE, aNbFF, aNbFI, nEx;
Standard_Integer j, aNbPBIn, aNbPBOn;
BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
TopoDS_Face aF1F, aF2F;
@@ -637,44 +664,52 @@ void BOPAlgo_PaveFiller::MakePCurves()
}
}// for (i=0; i<aNbFI; ++i) {
//
// 2. Process section edges
// 2. Process section edges. P-curves on them must already be computed.
// However, we must provide the call to UpdateVertices.
Standard_Boolean bPCurveOnS[2];
Standard_Integer m;
TopoDS_Face aFf[2];
//
bPCurveOnS[0]=mySectionAttribute.PCurveOnS1();
bPCurveOnS[1]=mySectionAttribute.PCurveOnS2();
//
if (bPCurveOnS[0] || bPCurveOnS[1]) {
// container to remember already added edge-face pairs
BOPDS_MapOfPair anEFPairs;
BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
aNbFF=aFFs.Extent();
for (i=0; i<aNbFF; ++i) {
const BOPDS_InterfFF& aFF=aFFs(i);
aFF.Indices(nF1, nF2);
const BOPDS_VectorOfCurve& aVNC = aFF.Curves();
aNbC = aVNC.Extent();
if (aNbC == 0)
continue;
Standard_Integer nF[2];
aFF.Indices(nF[0], nF[1]);
//
aFf[0]=(*(TopoDS_Face *)(&myDS->Shape(nF1)));
TopoDS_Face aFf[2];
aFf[0] = (*(TopoDS_Face *)(&myDS->Shape(nF[0])));
aFf[0].Orientation(TopAbs_FORWARD);
//
aFf[1]=(*(TopoDS_Face *)(&myDS->Shape(nF2)));
aFf[1]=(*(TopoDS_Face *)(&myDS->Shape(nF[1])));
aFf[1].Orientation(TopAbs_FORWARD);
//
const BOPDS_VectorOfCurve& aVNC=aFF.Curves();
aNbC=aVNC.Extent();
for (k=0; k<aNbC; ++k) {
for (k=0; k<aNbC; ++k)
{
const BOPDS_Curve& aNC=aVNC(k);
const BOPDS_ListOfPaveBlock& aLPB=aNC.PaveBlocks();
aItLPB.Initialize(aLPB);
for(; aItLPB.More(); aItLPB.Next()) {
for(; aItLPB.More(); aItLPB.Next())
{
const Handle(BOPDS_PaveBlock)& aPB=aItLPB.Value();
nE=aPB->Edge();
const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&myDS->Shape(nE)));
//
for (m=0; m<2; ++m) {
if (bPCurveOnS[m]) {
BOPAlgo_MPC& aMPC=aVMPC.Append1();
for (Standard_Integer m = 0; m<2; ++m)
{
if (bPCurveOnS[m] && anEFPairs.Add(BOPDS_Pair(nE, nF[m])))
{
BOPAlgo_MPC& aMPC = aVMPC.Append1();
aMPC.SetEdge(aE);
aMPC.SetFace(aFf[m]);
aMPC.SetFlag(bPCurveOnS[m]);
aMPC.SetFlag(Standard_True);
aMPC.SetProgressIndicator(myProgressIndicator);
}
}
@@ -687,18 +722,27 @@ void BOPAlgo_PaveFiller::MakePCurves()
BOPAlgo_MPCCnt::Perform(myRunParallel, aVMPC, myContext);
//======================================================
// Add warnings of the failed projections
// Add warnings of the failed projections and update edges with new pcurves
Standard_Integer aNb = aVMPC.Extent();
for (i = 0; i < aNb; ++i)
{
if (aVMPC(i).HasErrors())
const BOPAlgo_MPC& aMPC = aVMPC(i);
if (aMPC.HasErrors())
{
TopoDS_Compound aWC;
BRep_Builder().MakeCompound(aWC);
BRep_Builder().Add(aWC, aVMPC(i).Edge());
BRep_Builder().Add(aWC, aVMPC(i).Face());
BRep_Builder().Add(aWC, aMPC.Edge());
BRep_Builder().Add(aWC, aMPC.Face());
AddWarning(new BOPAlgo_AlertBuildingPCurveFailed(aWC));
}
else
{
const Handle(Geom2d_Curve)& aNewPC = aMPC.GetNewPCurve();
// if aNewPC is null we do not need to update the edge because it already contains
// valid p-curve, and only vertices have been updated.
if (!aNewPC.IsNull())
BRep_Builder().UpdateEdge(aMPC.Edge(), aNewPC, aMPC.Face(), aMPC.GetNewTolerance());
}
}
}
//=======================================================================

View File

@@ -22,22 +22,15 @@
//purpose :
//=======================================================================
BOPAlgo_Splitter::BOPAlgo_Splitter()
:
BOPAlgo_Builder(),
myTools(myAllocator),
myMapTools(100, myAllocator)
: BOPAlgo_ToolsProvider()
{
}
//=======================================================================
//function :
//purpose :
//=======================================================================
BOPAlgo_Splitter::BOPAlgo_Splitter
(const Handle(NCollection_BaseAllocator)& theAllocator)
:
BOPAlgo_Builder(theAllocator),
myTools(myAllocator),
myMapTools(100, myAllocator)
BOPAlgo_Splitter::BOPAlgo_Splitter(const Handle(NCollection_BaseAllocator)& theAllocator)
: BOPAlgo_ToolsProvider(theAllocator)
{
}
//=======================================================================
@@ -47,39 +40,6 @@ BOPAlgo_Splitter::BOPAlgo_Splitter
BOPAlgo_Splitter::~BOPAlgo_Splitter()
{
}
//=======================================================================
//function : Clear
//purpose :
//=======================================================================
void BOPAlgo_Splitter::Clear()
{
BOPAlgo_Builder::Clear();
myTools.Clear();
myMapTools.Clear();
}
//=======================================================================
//function : AddTool
//purpose :
//=======================================================================
void BOPAlgo_Splitter::AddTool(const TopoDS_Shape& theShape)
{
if (myMapTools.Add(theShape)) {
myTools.Append(theShape);
}
}
//=======================================================================
//function : SetTools
//purpose :
//=======================================================================
void BOPAlgo_Splitter::SetTools(const BOPCol_ListOfShape& theShapes)
{
myTools.Clear();
BOPCol_ListIteratorOfListOfShape aIt(theShapes);
for (; aIt.More(); aIt.Next()) {
AddTool(aIt.Value());
}
}
//=======================================================================
// function: CheckData
// purpose:

View File

@@ -19,7 +19,7 @@
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <BOPAlgo_Builder.hxx>
#include <BOPAlgo_ToolsProvider.hxx>
//! The **Splitter algorithm** is the algorithm for splitting a group of
//! arbitrary shapes by the other group of arbitrary shapes.<br>
@@ -47,7 +47,7 @@
//! into result, does not have to be overridden, because its native implementation
//! performs the necessary actions for the Splitter algorithm - it adds
//! the split parts of only Objects into result, avoiding the split parts of Tools.
class BOPAlgo_Splitter : public BOPAlgo_Builder
class BOPAlgo_Splitter : public BOPAlgo_ToolsProvider
{
public:
@@ -59,35 +59,13 @@ public:
Standard_EXPORT BOPAlgo_Splitter(const BOPCol_BaseAllocator& theAllocator);
//! Clears internal fields and arguments
Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
//! Adds Tool argument of the operation
Standard_EXPORT virtual void AddTool(const TopoDS_Shape& theShape);
//! Adds the Tool arguments of the operation
Standard_EXPORT virtual void SetTools(const BOPCol_ListOfShape& theShapes);
//! Returns the Tool arguments of the operation
const BOPCol_ListOfShape& Tools() const
{
return myTools;
}
//! Performs the operation
Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
protected:
//! Checks the input data
Standard_EXPORT virtual void CheckData() Standard_OVERRIDE;
BOPCol_ListOfShape myTools;
BOPCol_MapOfShape myMapTools;
private:
};
#endif // _BOPAlgo_Splitter_HeaderFile

View File

@@ -0,0 +1,76 @@
// Created by: Oleg AGASHIN
// Copyright (c) 2017 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BOPAlgo_ToolsProvider.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Alerts.hxx>
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
BOPAlgo_ToolsProvider::BOPAlgo_ToolsProvider()
:
BOPAlgo_Builder(),
myTools(myAllocator),
myMapTools(100, myAllocator)
{
}
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
BOPAlgo_ToolsProvider::BOPAlgo_ToolsProvider
(const Handle(NCollection_BaseAllocator)& theAllocator)
:
BOPAlgo_Builder(theAllocator),
myTools(myAllocator),
myMapTools(100, myAllocator)
{
}
//=======================================================================
//function : Clear
//purpose :
//=======================================================================
void BOPAlgo_ToolsProvider::Clear()
{
BOPAlgo_Builder::Clear();
myTools.Clear();
myMapTools.Clear();
}
//=======================================================================
//function : AddTool
//purpose :
//=======================================================================
void BOPAlgo_ToolsProvider::AddTool(const TopoDS_Shape& theShape)
{
if (myMapTools.Add(theShape))
myTools.Append(theShape);
}
//=======================================================================
//function : SetTools
//purpose :
//=======================================================================
void BOPAlgo_ToolsProvider::SetTools(const BOPCol_ListOfShape& theShapes)
{
myTools.Clear();
BOPCol_ListIteratorOfListOfShape aIt(theShapes);
for (; aIt.More(); aIt.Next())
AddTool(aIt.Value());
}

View File

@@ -0,0 +1,57 @@
// Created by: Oleg AGASHIN
// Copyright (c) 2017 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _BOPAlgo_ToolsProvider_HeaderFile
#define _BOPAlgo_ToolsProvider_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <BOPAlgo_Builder.hxx>
//! Auxiliary class providing API to operate tool arguments.
class BOPAlgo_ToolsProvider : public BOPAlgo_Builder
{
public:
DEFINE_STANDARD_ALLOC
//! Empty constructor
Standard_EXPORT BOPAlgo_ToolsProvider();
Standard_EXPORT BOPAlgo_ToolsProvider(const BOPCol_BaseAllocator& theAllocator);
//! Clears internal fields and arguments
Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
//! Adds Tool argument of the operation
Standard_EXPORT virtual void AddTool(const TopoDS_Shape& theShape);
//! Adds the Tool arguments of the operation
Standard_EXPORT virtual void SetTools(const BOPCol_ListOfShape& theShapes);
//! Returns the Tool arguments of the operation
const BOPCol_ListOfShape& Tools() const
{
return myTools;
}
protected:
BOPCol_ListOfShape myTools;
BOPCol_MapOfShape myMapTools;
};
#endif // _BOPAlgo_ToolsProvider_HeaderFile

View File

@@ -3,6 +3,8 @@ BOPAlgo_Algo.hxx
BOPAlgo_ArgumentAnalyzer.cxx
BOPAlgo_ArgumentAnalyzer.hxx
BOPAlgo_ArgumentAnalyzer.lxx
BOPAlgo_ToolsProvider.cxx
BOPAlgo_ToolsProvider.hxx
BOPAlgo_BOP.cxx
BOPAlgo_BOP.hxx
BOPAlgo_Builder.cxx

View File

@@ -463,7 +463,7 @@ void BOPDS_DS::Init(const Standard_Real theFuzz)
}
//
Bnd_Box& aBox=aSI.ChangeBox();
BRepBndLib::AddOptimal(aE, aBox, Standard_True, Standard_True);
BRepBndLib::Add(aE, aBox);
//
const BOPCol_ListOfInteger& aLV=aSI.SubShapes();
aIt1.Initialize(aLV);
@@ -490,7 +490,7 @@ void BOPDS_DS::Init(const Standard_Real theFuzz)
const TopoDS_Shape& aS=aSI.Shape();
//
Bnd_Box& aBox=aSI.ChangeBox();
BRepBndLib::AddOptimal(aS, aBox, Standard_True, Standard_True);
BRepBndLib::Add(aS, aBox);
//
BOPCol_ListOfInteger& aLW=aSI.ChangeSubShapes();
aIt1.Initialize(aLW);
@@ -1786,7 +1786,7 @@ void BOPDS_DS::UpdateEdgeTolerance(const Standard_Integer nE,
aBB.UpdateEdge(aE, aTol);
BOPDS_ShapeInfo& aSIE=ChangeShapeInfo(nE);
Bnd_Box& aBoxE=aSIE.ChangeBox();
BRepBndLib::AddOptimal(aE, aBoxE, Standard_True, Standard_True);
BRepBndLib::Add(aE, aBoxE);
aBoxE.SetGap(aBoxE.GetGap() + aTolAdd);
//
const BOPCol_ListOfInteger& aLI = aSIE.SubShapes();
@@ -2106,43 +2106,4 @@ Standard_Boolean BOPDS_DS::IsValidShrunkData(const Handle(BOPDS_PaveBlock)& theP
}
}
return Standard_True;
}
//=======================================================================
//function : FilterOfCommonBlocks
//purpose :
//=======================================================================
void BOPDS_DS::FilterOfCommonBlocks()
{
NCollection_DataMap<TopoDS_Edge, Handle(BOPDS_CommonBlock)> aMapEC;
BOPDS_VectorOfListOfPaveBlock& aPBP = ChangePaveBlocksPool();
Standard_Integer aNbPBP = aPBP.Extent();
//
for (Standard_Integer i = 0; i < aNbPBP; ++i)
{
BOPDS_ListOfPaveBlock& aLPB = aPBP(i);
BOPDS_ListIteratorOfListOfPaveBlock aItPB;
aItPB.Initialize(aLPB);
for (; aItPB.More(); aItPB.Next())
{
const Handle(BOPDS_PaveBlock) &aPB = aItPB.Value();
if (!IsCommonBlock(aPB))
continue;
const Standard_Integer anEIdx = aPB->Edge();
const TopoDS_Edge &anE = TopoDS::Edge(Shape(anEIdx));
Handle(BOPDS_CommonBlock) *aCB = aMapEC.ChangeSeek(anE);
if (!aCB)
{
aCB = aMapEC.Bound(anE, CommonBlock(aPB));
continue;
}
myMapPBCB.UnBind(aPB);
(*aCB)->AddPaveBlock(aPB);
SetCommonBlock(aPB, *aCB);
}
}
}
}

View File

@@ -468,9 +468,6 @@ Standard_EXPORT virtual ~BOPDS_DS();
//! of the existing vertices have been increased.
Standard_EXPORT Standard_Boolean IsValidShrunkData(const Handle(BOPDS_PaveBlock)& thePB);
//! Combines the common-blocks and removes excess common-blocks
Standard_EXPORT void FilterOfCommonBlocks();
protected:

View File

@@ -1657,10 +1657,6 @@ Standard_Boolean FindFacePairs (const TopoDS_Edge& theE,
}
}
//
if(aLCEFx.IsEmpty())
return Standard_False;
// F2
BOPTools_AlgoTools::GetFaceOff(aE1, aF1, aLCEFx, aF2, theContext);
//

View File

@@ -248,7 +248,9 @@ public:
//! Compute a 3D-point on the edge <aEdge> at parameter <aPrm>
Standard_EXPORT static void PointOnEdge (const TopoDS_Edge& aEdge, const Standard_Real aPrm, gp_Pnt& aP);
//! Makes a copy of <theEdge> with vertices.
Standard_EXPORT static TopoDS_Edge CopyEdge(const TopoDS_Edge& theEdge);
//! Make the edge from base edge <aE1> and two vertices <aV1,aV2>
//! at parameters <aP1,aP2>

View File

@@ -655,7 +655,7 @@ void BOPTools_AlgoTools2D::MakePCurveOnFace
aTR = Min(aMaxTol, 0.1*TolReached2d);
aMaxSegments = 100;
aMaxDist = 1.e3*TolReached2d;
if(!isAnaSurf)
if(!isAnaSurf || TolReached2d > 1.)
{
aBndPnt = AppParCurves_PassPoint;
}

View File

@@ -132,6 +132,20 @@ void BOPTools_AlgoTools::MakeSectEdge(const IntTools_Curve& aIC,
}
//=======================================================================
// function: CopyEdge
// purpose:
//=======================================================================
TopoDS_Edge BOPTools_AlgoTools::CopyEdge(const TopoDS_Edge& theEdge)
{
TopoDS_Edge aNewEdge = TopoDS::Edge(theEdge.Oriented(TopAbs_FORWARD));
aNewEdge.EmptyCopy();
for (TopoDS_Iterator it(theEdge, Standard_False); it.More(); it.Next())
BRep_Builder().Add(aNewEdge, it.Value());
aNewEdge.Orientation(theEdge.Orientation());
return aNewEdge;
}
//=======================================================================
// function: MakeSplitEdge
// purpose:
@@ -143,9 +157,6 @@ void BOPTools_AlgoTools::MakeSplitEdge(const TopoDS_Edge& aE,
const Standard_Real aP2,
TopoDS_Edge& aNewEdge)
{
Standard_Real aTol;//f, l,
aTol=BRep_Tool::Tolerance(aE);
//
TopoDS_Edge E = TopoDS::Edge(aE.Oriented(TopAbs_FORWARD));
E.EmptyCopy();
//
@@ -157,7 +168,6 @@ void BOPTools_AlgoTools::MakeSplitEdge(const TopoDS_Edge& aE,
BB.Add (E, aV2);
}
BB.Range(E, aP1, aP2);
BB.UpdateEdge(E, aTol);
aNewEdge=E;
aNewEdge.Orientation(aE.Orientation());
}

View File

@@ -63,6 +63,10 @@
#include <IntTools_Context.hxx>
#include <IntTools_ShrunkRange.hxx>
#ifdef OFFSET_DEBUG
#include <BRepAlgoAPI_Check.hxx>
#endif
typedef NCollection_DataMap
<TopoDS_Shape, TopTools_MapOfShape, TopTools_ShapeMapHasher> BRepOffset_DataMapOfShapeMapOfShape;
@@ -247,6 +251,13 @@ static
BOPAlgo_Builder& theBuilder,
TopTools_DataMapOfShapeListOfShape& theSSInterfs);
static
void RemoveHangingParts(const BOPAlgo_MakerVolume& theMV,
const TopTools_DataMapOfShapeShape& theDMFImF,
const TopTools_IndexedMapOfShape& theMFInv,
const TopTools_IndexedMapOfShape& theInvEdges,
TopTools_MapOfShape& theMFToRem);
static
void RemoveValidSplits(const TopTools_MapOfShape& theSpRem,
TopTools_IndexedDataMapOfShapeListOfShape& theImages,
@@ -349,7 +360,10 @@ static
void FindVerticesToAvoid(const TopTools_IndexedDataMapOfShapeListOfShape& theDMEFInv,
const TopTools_IndexedMapOfShape& theInvEdges,
const TopTools_IndexedMapOfShape& theValidEdges,
TopTools_DataMapOfShapeListOfShape& theDMVEFull,
const TopTools_MapOfShape& theInvertedEdges,
const TopTools_DataMapOfShapeListOfShape& theDMVEFull,
const TopTools_DataMapOfShapeListOfShape& theOEImages,
const TopTools_DataMapOfShapeListOfShape& theOEOrigins,
TopTools_MapOfShape& theMVRInv);
static
@@ -823,6 +837,14 @@ void BuildSplitsOfFaces(const TopTools_ListOfShape& theLF,
continue;
}
//
#ifdef OFFSET_DEBUG
// check the found edges on self-intersection
BRepAlgoAPI_Check aChecker(aCE);
if (!aChecker.IsValid())
{
cout << "Offset_i_c Error: set of edges to build faces is self-intersecting\n";
}
#endif
// build splits
TopTools_ListOfShape aLFImages;
BuildSplitsOfFace(aF, aCE, theFacesOrigins, aLFImages);
@@ -1250,7 +1272,8 @@ Standard_Boolean GetEdges(const TopoDS_Face& theFace,
// the resulting edges
TopoDS_Compound anEdges;
aBB.MakeCompound(anEdges);
//
// Fence map
TopTools_MapOfShape aMEFence;
// the edges by which the offset face should be split
const TopTools_ListOfShape& aLE = theAsDes->Descendant(theFace);
TopTools_ListIteratorOfListOfShape aItLE(aLE);
@@ -1267,6 +1290,9 @@ Standard_Boolean GetEdges(const TopoDS_Face& theFace,
for (; aItLEIm.More(); aItLEIm.Next()) {
const TopoDS_Edge& aEIm = TopoDS::Edge(aItLEIm.Value());
//
if (!aMEFence.Add(aEIm))
continue;
if (theInvEdges.Contains(aEIm)) {
theInv.Add(aEIm);
if (!bUpdate) {
@@ -2876,7 +2902,12 @@ void RemoveInsideFaces(TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
if (aMV.HasDeleted()) {
TopTools_IndexedMapOfShape aMEHoles;
TopExp::MapShapes(theFHoles, TopAbs_EDGE, aMEHoles);
//
// Map edges of the solids to check the connectivity
// of the removed invalid splits
TopTools_IndexedMapOfShape aMESols;
TopExp::MapShapes(aSols, TopAbs_EDGE, aMESols);
// perform additional check on faces
aNb = theFImages.Extent();
for (i = 1; i <= aNb; ++i) {
@@ -2884,7 +2915,13 @@ void RemoveInsideFaces(TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
if (aLFIm.IsEmpty()) {
continue;
}
//
const TopoDS_Shape& aF = theFImages.FindKey(i);
Standard_Boolean bInvalid = theInvFaces.Contains(aF);
// For invalid faces it is allowed to be at least connected
// to the solids, otherwise the solids are considered as broken
Standard_Boolean bConnected = Standard_False;
Standard_Boolean bFaceKept = Standard_False;
aItLF.Initialize(aLFIm);
for (; aItLF.More(); aItLF.Next()) {
@@ -2901,10 +2938,12 @@ void RemoveInsideFaces(TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
aMFToRem.Add(aFIm);
break;
}
if (!bFaceKept && bInvalid && !bConnected)
bConnected = aMESols.Contains(aExpE.Current());
}
}
//
if (!bFaceKept) {
if (!bFaceKept && !bConnected) {
return;
}
}
@@ -3020,8 +3059,11 @@ void RemoveInsideFaces(TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
for (; aItM.More(); aItM.Next()) {
aMFToRem.Remove(aItM.Value());
}
//
// remove newly found internal faces
// Remove the invalid hanging parts external to the solids
RemoveHangingParts(aMV, aDMFImF, aMFInv, theInvEdges, aMFToRem);
// Remove newly found internal and hanging faces
RemoveValidSplits(aMFToRem, theFImages, aMV, theMERemoved);
RemoveInvalidSplits(aMFToRem, theArtInvFaces, theInvEdges, theInvFaces, aMV, theMERemoved);
//
@@ -3197,6 +3239,179 @@ void ShapesConnections(const TopTools_IndexedDataMapOfShapeListOfShape& theInvFa
}
}
//=======================================================================
//function : RemoveHangingParts
//purpose : Remove isolated invalid hanging parts
//=======================================================================
void RemoveHangingParts(const BOPAlgo_MakerVolume& theMV,
const TopTools_DataMapOfShapeShape& theDMFImF,
const TopTools_IndexedMapOfShape& theMFInv,
const TopTools_IndexedMapOfShape& theInvEdges,
TopTools_MapOfShape& theMFToRem)
{
// Map the faces of the result solids to filter them from avoided faces
TopTools_IndexedMapOfShape aMFS;
TopExp::MapShapes(theMV.Shape(), TopAbs_FACE, aMFS);
BRep_Builder aBB;
// Build compound of all faces not included into solids
TopoDS_Compound aCFHangs;
aBB.MakeCompound(aCFHangs);
// Tool for getting the splits of faces
const BOPCol_DataMapOfShapeListOfShape& aMVIms = theMV.Images();
TopTools_ListIteratorOfListOfShape aItLArgs(theMV.Arguments());
for (; aItLArgs.More(); aItLArgs.Next())
{
TopExp_Explorer anExpF(aItLArgs.Value(), TopAbs_FACE);
for (; anExpF.More(); anExpF.Next())
{
const TopoDS_Shape& aF = anExpF.Current();
const BOPCol_ListOfShape* pLFIm = aMVIms.Seek(aF);
if (pLFIm)
{
TopTools_ListIteratorOfListOfShape aItLFIm(*pLFIm);
for (; aItLFIm.More(); aItLFIm.Next())
{
const TopoDS_Shape& aFIm = aItLFIm.Value();
if (!aMFS.Contains(aFIm))
aBB.Add(aCFHangs, aFIm);
}
}
else
{
if (!aMFS.Contains(aF))
aBB.Add(aCFHangs, aF);
}
}
}
// Make connexity blocks of all hanging parts and check that they are isolated
BOPCol_ListOfShape aLCBHangs;
BOPTools_AlgoTools::MakeConnexityBlocks(aCFHangs, TopAbs_EDGE, TopAbs_FACE, aLCBHangs);
if (aLCBHangs.IsEmpty())
return;
// To be removed, the block should contain invalid splits of offset faces and should
// meet one of the following conditions:
// 1. The block should not be connected to any invalid parts (Faces or Edges)
// contained in solids;
// 2. The block should be isolated from other faces, i.e. it should consist of
// the splits of the single offset face.
// Map the edges and vertices of the result solids to check connectivity
// of the hanging blocks to invalid parts contained in solids
TopTools_IndexedDataMapOfShapeListOfShape aDMEF, aDMVE;
TopExp::MapShapesAndAncestors(theMV.Shape(), TopAbs_EDGE , TopAbs_FACE, aDMEF);
TopExp::MapShapesAndAncestors(theMV.Shape(), TopAbs_VERTEX, TopAbs_EDGE, aDMVE);
// Update invalid edges with intersection results
TopTools_MapOfShape aMEInv;
Standard_Integer i, aNbE = theInvEdges.Extent();
for (i = 1; i <= aNbE; ++i) {
const TopoDS_Shape& aEInv = theInvEdges(i);
const BOPCol_ListOfShape *pLEIm = aMVIms.Seek(aEInv);
if (pLEIm)
{
BOPCol_ListIteratorOfListOfShape aItLEIm(*pLEIm);
for (; aItLEIm.More(); aItLEIm.Next())
aMEInv.Add(aItLEIm.Value());
}
else
aMEInv.Add(aEInv);
}
// Tool for getting the origins of the splits
const BOPCol_DataMapOfShapeListOfShape& aMVOrs = theMV.Origins();
BOPCol_ListIteratorOfListOfShape aItLCBH(aLCBHangs);
for (; aItLCBH.More(); aItLCBH.Next())
{
const TopoDS_Shape& aCBH = aItLCBH.Value();
// Check the block to contain invalid split
Standard_Boolean bHasInvalidFace = Standard_False;
// Check connectivity to invalid parts
Standard_Boolean bIsConnected = Standard_False;
TopTools_IndexedMapOfShape aBlockME;
TopExp::MapShapes(aCBH, TopAbs_EDGE, aBlockME);
// Map to collect all original faces
TopTools_MapOfShape aMOffsetF;
TopExp_Explorer anExpF(aCBH, TopAbs_FACE);
for (; anExpF.More(); anExpF.Next())
{
const TopoDS_Shape& aF = anExpF.Current();
// Check block to contain invalid face
if (!bHasInvalidFace)
bHasInvalidFace = theMFInv.Contains(aF);
// Check block for connectivity to invalid parts
if (!bIsConnected)
{
// check edges
TopExp_Explorer anExpE(aF, TopAbs_EDGE);
for (; anExpE.More() && !bIsConnected; anExpE.Next())
{
const TopoDS_Shape& aE = anExpE.Current();
const TopTools_ListOfShape *pLF = aDMEF.Seek(aE);
if (pLF)
{
TopTools_ListIteratorOfListOfShape aItLF(*pLF);
for (; aItLF.More() && !bIsConnected; aItLF.Next())
bIsConnected = theMFInv.Contains(aItLF.Value());
}
}
// check vertices
TopExp_Explorer anExpV(aF, TopAbs_VERTEX);
for (; anExpV.More() && !bIsConnected; anExpV.Next())
{
const TopoDS_Shape& aV = anExpV.Current();
const TopTools_ListOfShape *pLE = aDMVE.Seek(aV);
if (pLE)
{
TopTools_ListIteratorOfListOfShape aItLE(*pLE);
for (; aItLE.More() && !bIsConnected; aItLE.Next())
bIsConnected = !aBlockME.Contains(aItLE.Value()) &&
aMEInv .Contains(aItLE.Value());
}
}
}
// Check block to be isolated
const BOPCol_ListOfShape* pLFOr = aMVOrs.Seek(aF);
if (pLFOr)
{
TopTools_ListIteratorOfListOfShape aItLFOr(*pLFOr);
for (; aItLFOr.More(); aItLFOr.Next())
{
const TopoDS_Shape* pFOffset = theDMFImF.Seek(aItLFOr.Value());
if (pFOffset)
aMOffsetF.Add(*pFOffset);
}
}
else
{
const TopoDS_Shape* pFOffset = theDMFImF.Seek(aF);
if (pFOffset)
aMOffsetF.Add(*pFOffset);
}
}
Standard_Boolean bRemove = bHasInvalidFace &&
(!bIsConnected || aMOffsetF.Extent() == 1);
if (bRemove)
{
// remove the block
anExpF.Init(aCBH, TopAbs_FACE);
for (; anExpF.More(); anExpF.Next())
theMFToRem.Add(anExpF.Current());
}
}
}
//=======================================================================
//function : RemoveValidSplits
//purpose : Removing valid splits according to results of intersection
@@ -3793,7 +4008,8 @@ void IntersectFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theFToRebui
// edges adjacent to this vertex must be either invalid
// or contained in invalid faces
TopTools_MapOfShape aMVRInv = theVertsToAvoid;
FindVerticesToAvoid(aDMEFInv, theInvEdges, theValidEdges, aDMVEFull, aMVRInv);
FindVerticesToAvoid(aDMEFInv, theInvEdges, theValidEdges, theInvertedEdges,
aDMVEFull, theOEImages, theOEOrigins, aMVRInv);
//
// The faces should be intersected selectively -
// intersect only faces neighboring to the same invalid face
@@ -4129,13 +4345,20 @@ void IntersectFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theFToRebui
IntersectAndTrimEdges(theFToRebuild, aMFInt, aMEToInt, aDMEETrim, aME, aMECV,
aMVInv, aMVRInv, aMECheckExt, aMVBounds, aEImages);
//
TopTools_ListOfShape aLEToInt;
Standard_Integer iE, aNbEToInt = aMEToInt.Extent();
for (iE = 1; iE <= aNbEToInt; ++iE)
aLEToInt.Append(aMEToInt(iE));
TopExp_Explorer aExpE(aCBELoc, TopAbs_EDGE);
for (; aExpE.More(); aExpE.Next())
aDMOENEdges.Add(aExpE.Current(), aLEToInt);
{
const TopoDS_Shape& aEInt = aMEToInt(iE);
TopExp_Explorer anExpE(aCBELoc, TopAbs_EDGE);
for (; anExpE.More(); anExpE.Next())
{
const TopoDS_Shape& aE = anExpE.Current();
TopTools_ListOfShape* pLEToInt = aDMOENEdges.ChangeSeek(aE);
if (!pLEToInt)
pLEToInt = &aDMOENEdges(aDMOENEdges.Add(aE, TopTools_ListOfShape()));
AppendToList(*pLEToInt, aEInt);
}
}
}
}
}
@@ -4246,7 +4469,10 @@ void PrepareFacesForIntersection(const TopTools_IndexedDataMapOfShapeListOfShape
void FindVerticesToAvoid(const TopTools_IndexedDataMapOfShapeListOfShape& theDMEFInv,
const TopTools_IndexedMapOfShape& theInvEdges,
const TopTools_IndexedMapOfShape& theValidEdges,
TopTools_DataMapOfShapeListOfShape& theDMVEFull,
const TopTools_MapOfShape& theInvertedEdges,
const TopTools_DataMapOfShapeListOfShape& theDMVEFull,
const TopTools_DataMapOfShapeListOfShape& theOEImages,
const TopTools_DataMapOfShapeListOfShape& theOEOrigins,
TopTools_MapOfShape& theMVRInv)
{
TopTools_MapOfShape aMFence;
@@ -4261,24 +4487,66 @@ void FindVerticesToAvoid(const TopTools_IndexedDataMapOfShapeListOfShape& theDME
if (!theInvEdges.Contains(aE) || theValidEdges.Contains(aE)) {
continue;
}
//
TopExp_Explorer aExp(aE, TopAbs_VERTEX);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aV = aExp.Current();
TopTools_ListOfShape *pLE = theDMVEFull.ChangeSeek(aV);
if (!aMFence.Add(aE))
continue;
TopTools_IndexedDataMapOfShapeListOfShape aMVEEdges;
// Do not check the splitting vertices, but check only the ending ones
const TopTools_ListOfShape *pLEOr = theOEOrigins.Seek(aE);
if (pLEOr)
{
TopTools_ListIteratorOfListOfShape aItLEOr(*pLEOr);
for (; aItLEOr.More(); aItLEOr.Next())
{
const TopTools_ListOfShape& aLEIm = theOEImages.Find(aItLEOr.Value());
TopTools_ListIteratorOfListOfShape aItLEIm(aLEIm);
for (; aItLEIm.More(); aItLEIm.Next())
{
aMFence.Add(aItLEIm.Value());
TopExp::MapShapesAndAncestors(aItLEIm.Value(), TopAbs_VERTEX, TopAbs_EDGE, aMVEEdges);
}
}
}
else
{
TopExp::MapShapesAndAncestors(aE, TopAbs_VERTEX, TopAbs_EDGE, aMVEEdges);
}
Standard_Integer j, aNbV = aMVEEdges.Extent();
for (j = 1; j <= aNbV; ++j)
{
if (aMVEEdges(j).Extent() != 1)
continue;
const TopoDS_Shape& aV = aMVEEdges.FindKey(j);
if (!aMFence.Add(aV))
continue;
const TopTools_ListOfShape *pLE = theDMVEFull.Seek(aV);
if (!pLE) {
// isolated vertex
theMVRInv.Add(aV);
continue;
}
//
// If all edges sharing the vertex are either invalid or
// the vertex is connected to at least two inverted edges
// mark the vertex to be avoided in the new splits
Standard_Integer iNbEInverted = 0;
Standard_Boolean bAllEdgesInv = Standard_True;
TopTools_ListIteratorOfListOfShape aItLE(*pLE);
for (; aItLE.More(); aItLE.Next()) {
const TopoDS_Shape& aEV = aItLE.Value();
if (!theInvEdges.Contains(aEV) && !theDMEFInv.Contains(aEV)) {
break;
}
if (theInvertedEdges.Contains(aEV))
++iNbEInverted;
if (bAllEdgesInv)
bAllEdgesInv = theInvEdges.Contains(aEV);
}
if (!aItLE.More()) {
if (iNbEInverted > 1 || bAllEdgesInv)
{
theMVRInv.Add(aV);
}
}

View File

@@ -42,6 +42,8 @@
#include <BRepAdaptor_Surface.hxx>
#include <BRepAdaptor_Curve2d.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <BRepExtrema_DistShapeShape.hxx>
#include <BRepTools.hxx>
#include <BRepTest.hxx>
#include <DBRep.hxx>
#include <Adaptor3d_HCurveOnSurface.hxx>
@@ -64,12 +66,15 @@
#include <GeomPlate_PointConstraint.hxx>
#include <GeomAdaptor_HSurface.hxx>
#include <Geom_Surface.hxx>
#include <GCPnts_AbscissaPoint.hxx>
#include <GCPnts_QuasiUniformAbscissa.hxx>
#include <TopoDS_Wire.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <BRepBuilderAPI_WireError.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <TColGeom2d_HArray1OfCurve.hxx>
#include <AdvApp2Var_ApproxAFunc2Var.hxx>
@@ -92,6 +97,7 @@
#include <Extrema_ExtPS.hxx>
#include <Extrema_POnSurf.hxx>
#include <Geom_Plane.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
#include <BRepOffsetAPI_MakeFilling.hxx>
#include <TCollection_AsciiString.hxx>
#include <Geom2d_TrimmedCurve.hxx>
@@ -694,7 +700,311 @@ static Standard_Integer fillingparam( Draw_Interpretor & di, Standard_Integer n,
}
//=======================================================================
//function : addPointsOnCurveOnSurfaceConstraints
//purpose :
//=======================================================================
static void addPointsOnCurveOnSurfaceConstraints(GeomPlate_BuildPlateSurface& thePlate,
const TopoDS_Edge &theEdge,
const TopoDS_Face &theFace,
const TopoDS_Shape& theAvoidEdges,
const Standard_Real theAvoidRadius,
const Standard_Real theStep,
const Standard_Real theTol3d,
const Standard_Real theTolAng,
const Standard_Integer theOrder,
TopoDS_Compound& thePoints)
{
BRepAdaptor_Curve2d anAC2d(theEdge, theFace);
BRepAdaptor_Curve anAC(theEdge, theFace);
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(theFace);
// discretize the curve
Standard_Real aLen = GCPnts_AbscissaPoint::Length(anAC);
Standard_Integer npt = Max(2, (Standard_Integer)(aLen / theStep));
GCPnts_QuasiUniformAbscissa aDiscr(anAC, npt);
if (!aDiscr.IsDone())
Standard_Failure::Raise("Failure discretization of an edge");
// do not take last point to avoid confusion with first point of the next edge
Standard_Integer aBegin = 1, anEnd = aDiscr.NbPoints();
if (theEdge.Orientation() == TopAbs_FORWARD)
anEnd--;
else
aBegin++;
for (Standard_Integer i = aBegin; i <= anEnd; i++)
{
Standard_Real aCPar = aDiscr.Parameter(i);
gp_Pnt2d aP2d = anAC2d.Value(aCPar);
// evaluate distance to avoid vertices
gp_Pnt aPnt = aSurf->Value(aP2d.X(), aP2d.Y());
TopoDS_Vertex aVert = BRepBuilderAPI_MakeVertex(aPnt);
Standard_Real aDist = RealLast();
if (!theAvoidEdges.IsNull())
{
BRepExtrema_DistShapeShape aDistSS(theAvoidEdges, aVert);
if (!aDistSS.IsDone())
Standard_Failure::Raise("Failure computation of distance between edges and vertex");
aDist = aDistSS.Value();
}
if (aDist > theAvoidRadius)
{
if (theOrder > 0)
thePlate.Add(new GeomPlate_PointConstraint
(aP2d.X(), aP2d.Y(), aSurf, theOrder, theTol3d, theTolAng));
else
thePlate.Add(new GeomPlate_PointConstraint(aPnt, 0, theTol3d));
BRep_Builder().Add(thePoints, aVert);
}
}
}
//=======================================================================
//function : addPointsOnCurveOnSurfaceConstraints
//purpose :
//=======================================================================
static void addPointsOnSurfaceConstraints(GeomPlate_BuildPlateSurface& thePlate,
const TopoDS_Face& theFace,
const TopoDS_Shape& theAvoidEdges,
const Standard_Real theAvoidRadius,
const Standard_Real theStep,
const Standard_Real theTol3d,
TopoDS_Compound& thePoints)
{
// make adapted surface with UV bounds
BRepAdaptor_Surface anASurf(theFace, Standard_True);
Standard_Real aU1 = anASurf.FirstUParameter();
Standard_Real aU2 = anASurf.LastUParameter();
Standard_Real aV1 = anASurf.FirstVParameter();
Standard_Real aV2 = anASurf.LastVParameter();
// get middle iso lines
Standard_Real aMidU = (aU1 + aU2) * 0.5;
Standard_Real aMidV = (aV1 + aV2) * 0.5;
Handle(Geom_Curve) aUIso = anASurf.Surface().Surface()->UIso(aMidU);
Handle(Geom_Curve) aVIso = anASurf.Surface().Surface()->VIso(aMidV);
// compute their length to decide which one to discretize
Standard_Real aUIsoLen = GCPnts_AbscissaPoint::Length(GeomAdaptor_Curve(aUIso, aV1, aV2));
Standard_Real aVIsoLen = GCPnts_AbscissaPoint::Length(GeomAdaptor_Curve(aVIso, aU1, aU2));
Standard_Boolean isUDiscr = aUIsoLen > aVIsoLen;
// discretize the longest iso line
Standard_Real aLongPar1 = aV1, aLongPar2 = aV2, anOrtPar1 = aU1, anOrtPar2 = aU2;
if (!isUDiscr)
{
aLongPar1 = aU1;
aLongPar2 = aU2;
anOrtPar1 = aV1;
anOrtPar2 = aV2;
}
GeomAdaptor_Curve anACLongIso(isUDiscr ? aUIso : aVIso);
Standard_Real aLongLen = (isUDiscr ? aUIsoLen : aVIsoLen);
Standard_Integer aLongNpt = Max(3, (Standard_Integer)(aLongLen / theStep));
GCPnts_QuasiUniformAbscissa aDiscr(anACLongIso, aLongNpt, aLongPar1, aLongPar2);
if (!aDiscr.IsDone())
Standard_Failure::Raise("Failure discretization of an iso line");
// do not take first and last points to avoid confusion with boundary
for (Standard_Integer i = 2; i <= aDiscr.NbPoints() - 1; i++)
{
Standard_Real anIsoPar = aDiscr.Parameter(i);
// get orthogonal iso line at this parameter
Handle(Geom_Curve) anOrtIso = (isUDiscr ? anASurf.Surface().Surface()->VIso(anIsoPar)
: anASurf.Surface().Surface()->UIso(anIsoPar));
// discretize the ort iso line
GeomAdaptor_Curve anACOrtIso(anOrtIso, anOrtPar1, anOrtPar2);
Standard_Real anOrtLen = GCPnts_AbscissaPoint::Length(anACOrtIso);
Standard_Integer anOrtNpt = Max(3, (Standard_Integer)(anOrtLen / theStep));
GCPnts_QuasiUniformAbscissa aDiscrOrt(anACOrtIso, anOrtNpt);
if (!aDiscrOrt.IsDone())
Standard_Failure::Raise("Failure discretization of an iso line");
// do not take first and last points to avoid confusion with boundary
for (Standard_Integer j = 2; j <= aDiscrOrt.NbPoints() - 1; j++)
{
Standard_Real anOrtPar = aDiscrOrt.Parameter(j);
gp_Pnt aPnt = anACOrtIso.Value(anOrtPar);
// evaluate distance between the point and avoid edges
TopoDS_Vertex aVert = BRepBuilderAPI_MakeVertex(aPnt);
BRepExtrema_DistShapeShape aDistSS(theAvoidEdges, aVert);
if (!aDistSS.IsDone())
Standard_Failure::Raise("Failure computation of distance between edges and vertex");
Standard_Real aDist = aDistSS.Value();
if (aDist > theAvoidRadius)
{
thePlate.Add(new GeomPlate_PointConstraint(aPnt, 0, theTol3d));
BRep_Builder().Add(thePoints, aVert);
}
}
}
}
//=======================================================================
//function : pullupface
//purpose :
//=======================================================================
static Standard_Integer pullupface(Draw_Interpretor& theDI,
Standard_Integer theArgc,
const char** theArgv)
{
if (theArgc < 6)
{
cout << "incorrect usage, see help" << endl;
return 1;
}
TopoDS_Face aFace = TopoDS::Face(DBRep::Get(theArgv[2], TopAbs_FACE));
if (aFace.IsNull())
{
cout << "no such face " << theArgv[2] << endl;
return 1;
}
TopoDS_Shape anOldEdges = DBRep::Get(theArgv[3]);
if (anOldEdges.IsNull())
{
cout << "no such shape " << theArgv[3] << endl;
return 1;
}
TopoDS_Shape aNewEdges = DBRep::Get(theArgv[4]);
if (aNewEdges.IsNull())
{
cout << "no such shape " << theArgv[4] << endl;
return 1;
}
TopoDS_Face anOtherFace = TopoDS::Face(DBRep::Get(theArgv[5], TopAbs_FACE));
if (anOtherFace.IsNull())
{
cout << "no such face " << theArgv[5] << endl;
return 1;
}
Standard_Real aModifRadius = 0.1;
Standard_Integer anOrder = 1, aDegree = 3;
Standard_Real aTol2d = 0.00001, aTol3d = 0.0001, aTolAng = 0.01;
Standard_Real aStep = 0.1, anEnlargeCoeff = 1.01;
Standard_Integer anAppDegree = 8, anAppSegments = 9;
Standard_Boolean bAddInner = Standard_False, bAddBnd = Standard_False;
Standard_Boolean isOutputPnts = Standard_False;
for (Standard_Integer i = 6; i < theArgc; i++)
{
if (strcmp(theArgv[i], "-mr") == 0)
aModifRadius = Draw::Atof(theArgv[++i]);
else if (strcmp(theArgv[i], "-order") == 0)
anOrder = Draw::Atoi(theArgv[++i]);
else if (strcmp(theArgv[i], "-deg") == 0)
aDegree = Draw::Atoi(theArgv[++i]);
else if (strcmp(theArgv[i], "-step") == 0)
aStep = Draw::Atof(theArgv[++i]);
else if (strcmp(theArgv[i], "-tol2d") == 0)
aTol2d = Draw::Atof(theArgv[++i]);
else if (strcmp(theArgv[i], "-tol3d") == 0)
aTol3d = Draw::Atof(theArgv[++i]);
else if (strcmp(theArgv[i], "-tolang") == 0)
aTolAng = Draw::Atof(theArgv[++i]);
else if (strcmp(theArgv[i], "-appdeg") == 0)
anAppDegree = Draw::Atoi(theArgv[++i]);
else if (strcmp(theArgv[i], "-appsegs") == 0)
anAppSegments = Draw::Atoi(theArgv[++i]);
else if (strcmp(theArgv[i], "-enlarge") == 0)
anEnlargeCoeff = Draw::Atof(theArgv[++i]);
else if (strcmp(theArgv[i], "-inner") == 0)
bAddInner = Standard_True;
else if (strcmp(theArgv[i], "-bnd") == 0)
bAddBnd = Standard_True;
else if (strcmp(theArgv[i], "-pnts") == 0)
isOutputPnts = Standard_True;
else
{
cout << "invalid option " << theArgv[i] << endl;
return 1;
}
}
// Init plate builder
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
Standard_Real aU1, aU2, aV1, aV2;
BRepTools::UVBounds(aFace, aU1, aU2, aV1, aV2);
aSurf = new Geom_RectangularTrimmedSurface(aSurf, aU1, aU2, aV1, aV2);
Standard_Integer aNbIter = 1, aNbPtsOnCur = 10;
GeomPlate_BuildPlateSurface aPlate(aDegree, aNbPtsOnCur, aNbIter, aTol2d, aTol3d, aTolAng);
aPlate.LoadInitSurface(aSurf);
TopTools_IndexedMapOfShape anOldEMap;
TopExp::MapShapes(anOldEdges, TopAbs_EDGE, anOldEMap);
TopoDS_Compound aPoints;
BRep_Builder().MakeCompound(aPoints);
if (bAddBnd)
{
// Add face boundary constraints
for (TopExp_Explorer ex(aFace, TopAbs_EDGE); ex.More(); ex.Next())
{
TopoDS_Edge aE = TopoDS::Edge(ex.Current());
if (anOldEMap.Contains(aE))
{
// edge to be replaced, skip it
continue;
}
TopoDS_Vertex aV1, aV2;
TopExp::Vertices(aE, aV1, aV2);
addPointsOnCurveOnSurfaceConstraints(aPlate, aE, aFace, anOldEdges, aModifRadius,
aStep, aTol3d, aTolAng, anOrder, aPoints);
}
}
// add constraints of the replaced edges
for (TopExp_Explorer ex(aNewEdges, TopAbs_EDGE); ex.More(); ex.Next())
{
TopoDS_Edge aE = TopoDS::Edge(ex.Current());
//addPointsOnCurveConstraints(aPlate, aE, aStep, aTol3d, aPoints);
addPointsOnCurveOnSurfaceConstraints(aPlate, aE, anOtherFace, TopoDS_Shape(), 0.,
aStep, aTol3d, aTolAng, anOrder, aPoints);
}
if (bAddInner)
{
// add face inner constraints
addPointsOnSurfaceConstraints(aPlate, aFace, anOldEdges, aModifRadius, aStep, aTol3d, aPoints);
}
if (isOutputPnts)
{
DBRep::Set("pnts", aPoints);
theDI << "compound pnts is drawn\n";
}
// perform plate
aPlate.Perform();
if (!aPlate.IsDone())
{
theDI << "plate is not done";
return 0;
}
// build plate surface
Handle(GeomPlate_Surface) aPlateSurf = aPlate.Surface();
Standard_Real aDMax = Max(aTol3d, 10. * aPlate.G0Error());
TColgp_SequenceOfXY aS2d;
TColgp_SequenceOfXYZ aS3d;
aPlate.Disc2dContour(4, aS2d);
aPlate.Disc3dContour(4, 0, aS3d);
GeomPlate_PlateG0Criterion aCriterion(aS2d, aS3d, aDMax);
GeomPlate_MakeApprox anApprox(aPlateSurf, aCriterion, aTol3d,
anAppSegments, anAppDegree, GeomAbs_C1, anEnlargeCoeff);
Handle(Geom_BSplineSurface) aNewSurf = anApprox.Surface();
// make new face
BRepBuilderAPI_MakeFace aFMaker(aNewSurf, Precision::Confusion());
TopoDS_Face aNewFace = aFMaker.Face();
DBRep::Set(theArgv[1], aNewFace);
theDI << "Done";
return 0;
}
void BRepTest::FillingCommands(Draw_Interpretor& theCommands)
{
@@ -738,4 +1048,21 @@ void BRepTest::FillingCommands(Draw_Interpretor& theCommands)
fillingparam,
g) ;
theCommands.Add("pullupface",
"result face old_edges new_edges modif_face [options]\n"
"\t\tPull up the surface to new replacement edges. Options:\n"
"\t\t-mr val Modification radius [default 0.1]\n"
"\t\t-bnd Use face boundary constraints\n"
"\t\t-inner Use face inner points constraints\n"
"\t\t-step val Step of discretization [0.1]\n"
"\t\t-order val Order of continuity of point constraints (0/1) [1]\n"
"\t\t-deg val Degree of resolution for Plate (>=2) [3]\n"
"\t\t-pnts Output point constraints in the compound of vertices pnts\n"
"\t\t-tol2d val Tolerance to compare points in space of initial surface [1e-5]\n"
"\t\t-tol3d val Tolerance to compare points in 3d space [1e-4]\n"
"\t\t-tolang val Tolerance to compare normals of two points [1e-2]\n"
"\t\t-appdeg val Maximal degree for approximation of the surface [8]\n"
"\t\t-appsegs val Maximal number of bezier pieces in output surface [9]"
"\t\t-enlarge val Enlarge coefficient to extend boundaries of result surface [1.01]",
__FILE__, pullupface, g);
}

View File

@@ -473,7 +473,7 @@ proc _check_args { args {options {}} {command_name ""}} {
set get_value [lindex ${option} 2]
set local_value ""
if { [_check_arg ${option_name} local_value ${get_value}] } {
upvar ${variable_to_save_value} ${variable_to_save_value}
upvar 1 ${variable_to_save_value} ${variable_to_save_value}
set ${variable_to_save_value} ${local_value}
set toContinue 1
}

View File

@@ -35,7 +35,6 @@ Font_FTFont::Font_FTFont (const Handle(Font_FTLibrary)& theFTLib)
myWidthScaling(1.0),
myLoadFlags (FT_LOAD_NO_HINTING | FT_LOAD_TARGET_NORMAL),
myIsSingleLine(false),
myKernAdvance (new FT_Vector()),
myUChar (0U)
{
if (myFTLib.IsNull())
@@ -51,7 +50,6 @@ Font_FTFont::Font_FTFont (const Handle(Font_FTLibrary)& theFTLib)
Font_FTFont::~Font_FTFont()
{
Release();
delete myKernAdvance;
}
// =======================================================================
@@ -136,7 +134,7 @@ bool Font_FTFont::loadGlyph (const Standard_Utf32Char theUChar)
{
if (myUChar == theUChar)
{
return true;
return myUChar != 0;
}
myGlyphImg.Clear();
@@ -239,8 +237,8 @@ float Font_FTFont::LineSpacing() const
// function : AdvanceX
// purpose :
// =======================================================================
float Font_FTFont::AdvanceX (const Standard_Utf32Char theUChar,
const Standard_Utf32Char theUCharNext)
float Font_FTFont::AdvanceX (Standard_Utf32Char theUChar,
Standard_Utf32Char theUCharNext)
{
loadGlyph (theUChar);
return AdvanceX (theUCharNext);
@@ -250,49 +248,65 @@ float Font_FTFont::AdvanceX (const Standard_Utf32Char theUChar,
// function : AdvanceY
// purpose :
// =======================================================================
float Font_FTFont::AdvanceY (const Standard_Utf32Char theUChar,
const Standard_Utf32Char theUCharNext)
float Font_FTFont::AdvanceY (Standard_Utf32Char theUChar,
Standard_Utf32Char theUCharNext)
{
loadGlyph (theUChar);
return AdvanceY (theUCharNext);
}
bool Font_FTFont::getKerning (FT_Vector& theKern,
Standard_Utf32Char theUCharCurr,
Standard_Utf32Char theUCharNext) const
{
theKern.x = 0;
theKern.y = 0;
if (theUCharNext != 0 && FT_HAS_KERNING(myFTFace) != 0)
{
const FT_UInt aCharCurr = FT_Get_Char_Index (myFTFace, theUCharCurr);
const FT_UInt aCharNext = FT_Get_Char_Index (myFTFace, theUCharNext);
if (aCharCurr == 0 || aCharNext == 0
|| FT_Get_Kerning (myFTFace, aCharCurr, aCharNext, FT_KERNING_UNFITTED, &theKern) != 0)
{
theKern.x = 0;
theKern.y = 0;
return false;
}
return true;
}
return false;
}
// =======================================================================
// function : AdvanceX
// purpose :
// =======================================================================
float Font_FTFont::AdvanceX (const Standard_Utf32Char theUCharNext)
float Font_FTFont::AdvanceX (Standard_Utf32Char theUCharNext) const
{
if (myUChar == 0)
{
return 0.0f;
}
if (FT_HAS_KERNING (myFTFace) == 0 || theUCharNext == 0
|| FT_Get_Kerning (myFTFace, myUChar, theUCharNext, FT_KERNING_UNFITTED, myKernAdvance) != 0)
{
return myWidthScaling * fromFTPoints<float> (myFTFace->glyph->advance.x);
}
return myWidthScaling * fromFTPoints<float> (myKernAdvance->x + myFTFace->glyph->advance.x);
FT_Vector aKern;
getKerning (aKern, myUChar, theUCharNext);
return myWidthScaling * fromFTPoints<float> (myFTFace->glyph->advance.x + aKern.x);
}
// =======================================================================
// function : AdvanceY
// purpose :
// =======================================================================
float Font_FTFont::AdvanceY (const Standard_Utf32Char theUCharNext)
float Font_FTFont::AdvanceY (Standard_Utf32Char theUCharNext) const
{
if (myUChar == 0)
{
return 0.0f;
}
if (FT_HAS_KERNING (myFTFace) == 0 || theUCharNext == 0
|| FT_Get_Kerning (myFTFace, myUChar, theUCharNext, FT_KERNING_UNFITTED, myKernAdvance) != 0)
{
return fromFTPoints<float> (myFTFace->glyph->advance.y);
}
return fromFTPoints<float> (myKernAdvance->y + myFTFace->glyph->advance.y);
FT_Vector aKern;
getKerning (aKern, myUChar, theUCharNext);
return fromFTPoints<float> (myFTFace->glyph->advance.y + aKern.y);
}
// =======================================================================

View File

@@ -114,23 +114,29 @@ public:
myWidthScaling = theScaleFactor;
}
//! Compute advance to the next character with kerning applied when applicable.
//! Compute horizontal advance to the next character with kerning applied when applicable.
//! Assuming text rendered horizontally.
Standard_EXPORT float AdvanceX (const Standard_Utf32Char theUCharNext);
//! @param theUCharNext the next character to compute advance from current one
Standard_EXPORT float AdvanceX (Standard_Utf32Char theUCharNext) const;
//! Compute advance to the next character with kerning applied when applicable.
//! Compute horizontal advance to the next character with kerning applied when applicable.
//! Assuming text rendered horizontally.
Standard_EXPORT float AdvanceX (const Standard_Utf32Char theUChar,
const Standard_Utf32Char theUCharNext);
//! @param theUChar the character to be loaded as current one
//! @param theUCharNext the next character to compute advance from current one
Standard_EXPORT float AdvanceX (Standard_Utf32Char theUChar,
Standard_Utf32Char theUCharNext);
//! Compute advance to the next character with kerning applied when applicable.
//! Compute vertical advance to the next character with kerning applied when applicable.
//! Assuming text rendered vertically.
Standard_EXPORT float AdvanceY (const Standard_Utf32Char theUCharNext);
//! @param theUCharNext the next character to compute advance from current one
Standard_EXPORT float AdvanceY (Standard_Utf32Char theUCharNext) const;
//! Compute advance to the next character with kerning applied when applicable.
//! Compute vertical advance to the next character with kerning applied when applicable.
//! Assuming text rendered vertically.
Standard_EXPORT float AdvanceY (const Standard_Utf32Char theUChar,
const Standard_Utf32Char theUCharNext);
//! @param theUChar the character to be loaded as current one
//! @param theUCharNext the next character to compute advance from current one
Standard_EXPORT float AdvanceY (Standard_Utf32Char theUChar,
Standard_Utf32Char theUCharNext);
//! @return glyphs number in this font.
Standard_EXPORT Standard_Integer GlyphsNumber() const;
@@ -166,6 +172,11 @@ protected:
//! Load glyph without rendering it.
Standard_EXPORT bool loadGlyph (const Standard_Utf32Char theUChar);
//! Wrapper for FT_Get_Kerning - retrieve kerning values.
Standard_EXPORT bool getKerning (FT_Vector& theKern,
Standard_Utf32Char theUCharCurr,
Standard_Utf32Char theUCharNext) const;
protected:
Handle(Font_FTLibrary) myFTLib; //!< handle to the FT library object
@@ -177,7 +188,6 @@ protected:
bool myIsSingleLine; //!< single stroke font flag, FALSE by default
Image_PixMap myGlyphImg; //!< cached glyph plane
FT_Vector* myKernAdvance; //!< buffer variable
Standard_Utf32Char myUChar; //!< currently loaded unicode character
public:

View File

@@ -129,13 +129,14 @@ Handle(GeomFill_TrihedronLaw) GeomFill_Frenet::Copy() const
case GeomAbs_Parabola:
case GeomAbs_Line:
{
// No probleme
isSngl = Standard_False;
// No probleme
isSngl = Standard_False;
break;
}
default :
{
// We have to search singulaties
Init();
// We have to search singulaties
Init();
}
}
}

View File

@@ -257,10 +257,12 @@ GeomPlate_MakeApprox::GeomPlate_MakeApprox(const Handle(GeomPlate_Surface)& Surf
Standard_Real U0=0., U1=0., V0=0., V1=0.;
myPlate->RealBounds(U0, U1, V0, V1);
U0 = EnlargeCoeff * U0;
U1 = EnlargeCoeff * U1;
V0 = EnlargeCoeff * V0;
V1 = EnlargeCoeff * V1;
Standard_Real aDU = (U1 - U0) * (EnlargeCoeff - 1) * 0.5;
Standard_Real aDV = (V1 - V0) * (EnlargeCoeff - 1) * 0.5;
U0 = U0 - aDU;
U1 = U1 + aDU;
V0 = V0 - aDV;
V1 = V1 + aDV;
Standard_Integer nb1 = 0, nb2 = 0, nb3 = 1;
Handle(TColStd_HArray1OfReal) nul1 =
@@ -351,10 +353,12 @@ GeomPlate_MakeApprox::GeomPlate_MakeApprox(const Handle(GeomPlate_Surface)& Surf
Standard_Real U0=0., U1=0., V0=0., V1=0.;
myPlate->RealBounds(U0, U1, V0, V1);
U0 = EnlargeCoeff * U0;
U1 = EnlargeCoeff * U1;
V0 = EnlargeCoeff * V0;
V1 = EnlargeCoeff * V1;
Standard_Real aDU = (U1 - U0) * (EnlargeCoeff - 1);
Standard_Real aDV = (V1 - V0) * (EnlargeCoeff - 1);
U0 = U0 - aDU;
U1 = U1 + aDU;
V0 = V0 - aDV;
V1 = V1 + aDV;
Standard_Real seuil = Tol3d;
if (CritOrder==0&&Tol3d<10*dmax) {

View File

@@ -916,6 +916,7 @@ void IntCurveSurface_Inter::PerformConicSurf(const gp_Lin& Line,
GeomAbs_SurfaceType SurfaceType = TheSurfaceTool::GetType(surface);
Standard_Boolean isAnaProcessed = Standard_True;
switch(SurfaceType) {
case GeomAbs_Plane:
{
@@ -937,94 +938,99 @@ void IntCurveSurface_Inter::PerformConicSurf(const gp_Lin& Line,
}
case GeomAbs_Torus:
{
IntAna_IntLinTorus intlintorus(Line,TheSurfaceTool::Torus(surface));
if(intlintorus.IsDone()) {
Standard_Integer nbp = intlintorus.NbPoints();
Standard_Real fi,theta,w;
for(Standard_Integer i = 1; i<= nbp; i++) {
const gp_Pnt aDebPnt(intlintorus.Value(i));
(void )aDebPnt;
w = intlintorus.ParamOnLine(i);
intlintorus.ParamOnTorus(i,fi,theta);
AppendPoint(curve,w,surface,fi,theta);
}
break;
IntAna_IntLinTorus intlintorus(Line, TheSurfaceTool::Torus(surface));
if (intlintorus.IsDone()) {
Standard_Integer nbp = intlintorus.NbPoints();
Standard_Real fi, theta, w;
for (Standard_Integer i = 1; i <= nbp; i++) {
const gp_Pnt aDebPnt(intlintorus.Value(i));
(void)aDebPnt;
w = intlintorus.ParamOnLine(i);
intlintorus.ParamOnTorus(i, fi, theta);
AppendPoint(curve, w, surface, fi, theta);
}
}
} //-- Si Done retourne False, On passe dans Default !!
else
isAnaProcessed = Standard_False;
break;
}
case GeomAbs_Cone:
{
//OCC516(apo)->
const Standard_Real correction = 1.E+5*Precision::Angular();
gp_Cone cn = TheSurfaceTool::Cone(surface);
if(Abs(cn.SemiAngle()) < M_PI/2.0 - correction){
IntAna_IntConicQuad LinCone(Line,cn);
AppendIntAna(curve,surface,LinCone);
break;
}//<-OCC516(apo)
}
default:
{
Standard_Integer nbsu,nbsv;
nbsu = TheSurfaceTool::NbSamplesU(surface,U1,U2);
nbsv = TheSurfaceTool::NbSamplesV(surface,V1,V2);
if(Abs(cn.SemiAngle()) < M_PI/2.0 - correction) {
IntAna_IntConicQuad LinCone(Line, cn);
AppendIntAna(curve, surface, LinCone);
}
else
isAnaProcessed = Standard_False;
break;
}
default:
isAnaProcessed = Standard_False;
}
if (!isAnaProcessed)
{
Standard_Integer nbsu,nbsv;
nbsu = TheSurfaceTool::NbSamplesU(surface,U1,U2);
nbsv = TheSurfaceTool::NbSamplesV(surface,V1,V2);
Standard_Boolean U1inf = Precision::IsInfinite(U1);
Standard_Boolean U2inf = Precision::IsInfinite(U2);
Standard_Boolean V1inf = Precision::IsInfinite(V1);
Standard_Boolean V2inf = Precision::IsInfinite(V2);
Standard_Boolean U1inf = Precision::IsInfinite(U1);
Standard_Boolean U2inf = Precision::IsInfinite(U2);
Standard_Boolean V1inf = Precision::IsInfinite(V1);
Standard_Boolean V2inf = Precision::IsInfinite(V2);
Standard_Real U1new=U1, U2new=U2, V1new=V1, V2new=V2;
Standard_Real U1new=U1, U2new=U2, V1new=V1, V2new=V2;
Standard_Boolean NoIntersection = Standard_False;
Standard_Boolean NoIntersection = Standard_False;
if(U1inf || U2inf || V1inf || V2inf ) {
if(U1inf || U2inf || V1inf || V2inf ) {
if(SurfaceType == GeomAbs_SurfaceOfExtrusion) {
if(SurfaceType == GeomAbs_SurfaceOfExtrusion) {
EstLimForInfExtr(Line, surface, Standard_False, nbsu,
U1inf, U2inf, V1inf, V2inf,
U1new, U2new, V1new, V2new, NoIntersection);
}
else if(SurfaceType == GeomAbs_SurfaceOfRevolution) {
EstLimForInfRevl(Line, surface,
U1inf, U2inf, V1inf, V2inf,
U1new, U2new, V1new, V2new, NoIntersection);
}
else if(SurfaceType == GeomAbs_OffsetSurface) {
EstLimForInfOffs(Line, surface, nbsu,
U1inf, U2inf, V1inf, V2inf,
U1new, U2new, V1new, V2new, NoIntersection);
}
else {
EstLimForInfSurf(U1new, U2new, V1new, V2new);
}
EstLimForInfExtr(Line, surface, Standard_False, nbsu,
U1inf, U2inf, V1inf, V2inf,
U1new, U2new, V1new, V2new, NoIntersection);
}
else if (SurfaceType == GeomAbs_SurfaceOfRevolution) {
EstLimForInfRevl(Line, surface,
U1inf, U2inf, V1inf, V2inf,
U1new, U2new, V1new, V2new, NoIntersection);
if(NoIntersection) return;
// modified by NIZHNY-OFV Mon Aug 20 14:56:47 2001 (60963 begin)
if(nbsu<20) nbsu=20;
if(nbsv<20) nbsv=20;
// modified by NIZHNY-OFV Mon Aug 20 14:57:06 2001 (60963 end)
IntCurveSurface_ThePolyhedron polyhedron(surface,nbsu,nbsv,U1new,V1new,U2new,V2new);
Intf_Tool bndTool;
Bnd_Box boxLine;
bndTool.LinBox(Line,polyhedron.Bounding(),boxLine);
for(Standard_Integer nbseg=1; nbseg<= bndTool.NbSegments(); nbseg++) {
Standard_Real pinf = bndTool.BeginParam(nbseg);
Standard_Real psup = bndTool.EndParam(nbseg);
if((psup - pinf)<1e-10) { pinf-=1e-10; psup+=1e-10; }
IntCurveSurface_ThePolygon polygon(curve, pinf,psup,2);
InternalPerform(curve,polygon,surface,polyhedron,U1new,V1new,U2new,V2new);
}
else if (SurfaceType == GeomAbs_OffsetSurface) {
EstLimForInfOffs(Line, surface, nbsu,
U1inf, U2inf, V1inf, V2inf,
U1new, U2new, V1new, V2new, NoIntersection);
}
else {
EstLimForInfSurf(U1new, U2new, V1new, V2new);
}
}
if(NoIntersection) return;
// modified by NIZHNY-OFV Mon Aug 20 14:56:47 2001 (60963 begin)
if(nbsu<20) nbsu=20;
if(nbsv<20) nbsv=20;
// modified by NIZHNY-OFV Mon Aug 20 14:57:06 2001 (60963 end)
IntCurveSurface_ThePolyhedron polyhedron(surface,nbsu,nbsv,U1new,V1new,U2new,V2new);
Intf_Tool bndTool;
Bnd_Box boxLine;
bndTool.LinBox(Line,polyhedron.Bounding(),boxLine);
for(Standard_Integer nbseg=1; nbseg<= bndTool.NbSegments(); nbseg++) {
Standard_Real pinf = bndTool.BeginParam(nbseg);
Standard_Real psup = bndTool.EndParam(nbseg);
if((psup - pinf)<1e-10) { pinf-=1e-10; psup+=1e-10; }
IntCurveSurface_ThePolygon polygon(curve, pinf,psup,2);
InternalPerform(curve,polygon,surface,polyhedron,U1new,V1new,U2new,V2new);
}
}
}

View File

@@ -32,8 +32,6 @@
#include <gp.hxx>
#include <gp_Vec2d.hxx>
#include <Precision.hxx>
//======================================================================
#define EPSDIST Tol
#define EPSNUL TolConf
@@ -166,15 +164,8 @@ void IntImpParGen_Intersector::And_Domaine_Objet1_Intersections(const ImpTool& T
Resultat2.SetValue(NbResultats, Inter2_And_Domain2.Value(indice_2));
}
else { //====== la borne2 et la borne1 sont hors domaine =====
const Standard_Real aParF = TheImpCurveDomain.HasFirstPoint() ?
TheImpCurveDomain.FirstParameter() :
-Precision::Infinite();
const Standard_Real aParL = TheImpCurveDomain.HasLastPoint() ?
TheImpCurveDomain.LastParameter() :
Precision::Infinite();
if (param1<aParF && param2>aParL)
{
if (param1<TheImpCurveDomain.FirstParameter()
&& param2>TheImpCurveDomain.LastParameter()) {
Standard_Real t;
NbResultats++;
t = TheImpCurveDomain.FirstParameter();

View File

@@ -1337,19 +1337,14 @@ void IntTools_BeanFaceIntersector::ComputeRangeFromStartPoint(const Standard_Boo
if(BoundaryCondition && (isboundaryindex || !isvalidindex))
break;
}
else
{
else {
aDeltaRestrictor = aDelta;
}
// if point found decide to increase aDelta using derivative of distance function
//
// (aDelta*2) and (aDelta/(3/2)).
// Use of constants 2 and 0.5 leads to infinite loop
// connected with the sequence: pointfound == TRUE ==>
// aDelta *= 2.0 ==> pointfound == FALSE ==> aDelta *= 0.5 ...
aDelta *= (pointfound) ? 2.0 : 0.6667;
aDelta = (pointfound) ? (aDelta * 2.) : (aDelta * 0.5);
aDelta = (aDelta < aDeltaRestrictor) ? aDelta : aDeltaRestrictor;
aCurPar = (ToIncreaseParameter) ? (aPrevPar + aDelta) : (aPrevPar - aDelta);

View File

@@ -199,7 +199,7 @@ Bnd_Box& IntTools_Context::BndBox(const TopoDS_Shape& aS)
new (pBox) Bnd_Box();
//
Bnd_Box &aBox=*pBox;
BRepBndLib::AddOptimal(aS, aBox, Standard_True, Standard_True);
BRepBndLib::Add(aS, aBox);
//
anAdr=(Standard_Address)pBox;
myBndBoxDataMap.Bind(aS, anAdr);

View File

@@ -1168,6 +1168,7 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
break;
}
}
Standard_FALLTHROUGH
case IntWalk_OK:
case IntWalk_ArretSurPoint://006
{
@@ -1653,69 +1654,10 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
Standard_Boolean IntWalk_PWalking::ExtendLineInCommonZone(const IntImp_ConstIsoparametric theChoixIso,
const Standard_Boolean theDirectionFlag)
{
// Caro1 and Caro2
const Handle(Adaptor3d_HSurface)& Caro1 = myIntersectionOn2S.Function().AuxillarSurface1();
const Handle(Adaptor3d_HSurface)& Caro2 = myIntersectionOn2S.Function().AuxillarSurface2();
//
const Standard_Real UFirst1 = Adaptor3d_HSurfaceTool::FirstUParameter(Caro1);
const Standard_Real VFirst1 = Adaptor3d_HSurfaceTool::FirstVParameter(Caro1);
const Standard_Real ULast1 = Adaptor3d_HSurfaceTool::LastUParameter(Caro1);
const Standard_Real VLast1 = Adaptor3d_HSurfaceTool::LastVParameter(Caro1);
const Standard_Real UFirst2 = Adaptor3d_HSurfaceTool::FirstUParameter(Caro2);
const Standard_Real VFirst2 = Adaptor3d_HSurfaceTool::FirstVParameter(Caro2);
const Standard_Real ULast2 = Adaptor3d_HSurfaceTool::LastUParameter(Caro2);
const Standard_Real VLast2 = Adaptor3d_HSurfaceTool::LastVParameter(Caro2);
Standard_Boolean bOutOfTangentZone = Standard_False;
TColStd_Array1OfReal Param(1,4);
previousPoint.Parameters(Param(1), Param(2), Param(3), Param(4));
// If the point is already in the boundary
// we avoid extension (see bug #29093).
if (Param(1) - UFirst1 < ResoU1)
{
return bOutOfTangentZone;
}
if (Param(2) - VFirst1 < ResoV1)
{
return bOutOfTangentZone;
}
if (Param(3) - UFirst2 < ResoU2)
{
return bOutOfTangentZone;
}
if (Param(4) - VFirst2 < ResoV2)
{
return bOutOfTangentZone;
}
if (Param(1) - ULast1 > -ResoU1)
{
return bOutOfTangentZone;
}
if (Param(2) - VLast1 > -ResoV1)
{
return bOutOfTangentZone;
}
if (Param(3) - ULast2 > -ResoU2)
{
return bOutOfTangentZone;
}
if (Param(4) - VLast2 > -ResoV2)
{
return bOutOfTangentZone;
}
Standard_Boolean bStop = !myIntersectionOn2S.IsTangent();
Standard_Integer dIncKey = 1;
TColStd_Array1OfReal Param(1,4);
IntWalk_StatusDeflection aStatus = IntWalk_OK;
Standard_Integer nbIterWithoutAppend = 0;
Standard_Integer nbEqualPoints = 0;
@@ -1723,8 +1665,7 @@ Standard_Boolean IntWalk_PWalking::ExtendLineInCommonZone(const IntImp_ConstIsop
Standard_Integer uvit = 0;
IntSurf_SequenceOfPntOn2S aSeqOfNewPoint;
while (!bStop)
{
while (!bStop) {
nbIterWithoutAppend++;
if((nbIterWithoutAppend > 20) || (nbEqualPoints > 20)) {

View File

@@ -296,17 +296,16 @@ void Poly_Triangulation::SetNormal (const Standard_Integer theIndex, const gp_Di
//purpose :
//=======================================================================
const gp_Dir Poly_Triangulation::Normal (const Standard_Integer theIndex) const
gp_Dir Poly_Triangulation::Normal (const Standard_Integer theIndex) const
{
if (myNormals.IsNull() || theIndex < 1 || theIndex > myNodes.Size())
{
throw Standard_NullObject ("Poly_Triangulation::Normal : empty array or index out of range");
}
gp_Dir N;
N.SetX(myNormals->Value(theIndex * 3 - 2));
N.SetY(myNormals->Value(theIndex * 3 - 1));
N.SetZ(myNormals->Value(theIndex * 3));
gp_Dir N(myNormals->Value(theIndex * 3 - 2),
myNormals->Value(theIndex * 3 - 1),
myNormals->Value(theIndex * 3));
return N;
}

View File

@@ -189,7 +189,7 @@ public:
//! @return normal at the given index.
//! Raises Standard_OutOfRange exception.
Standard_EXPORT const gp_Dir Normal (const Standard_Integer theIndex) const;
Standard_EXPORT gp_Dir Normal (const Standard_Integer theIndex) const;
//! Changes normal at the given index.
//! Raises Standard_OutOfRange exception.

View File

@@ -2,8 +2,7 @@ puts "============"
puts "OCC24181 Render text as BRep (check alphabet)"
puts "============"
puts ""
pload MODELING
pload VISUALIZATION
pload MODELING VISUALIZATION
vfont add [locate_data_file DejaVuSans.ttf] SansFont
@@ -18,6 +17,7 @@ asdfghjkl;'
ASDFGHJKL:"
zxcvbnm,./
ZXCVBNM<>?<3F>
AVATAR Y.
}
text2brep aBTextN $THE_TEXT -font $THE_FONT_NAME -height $THE_FONT_SIZE -aspect regular -composite off
@@ -26,12 +26,12 @@ checkshape aBTextN
checkshape aBTextC
ttranslate aBTextC 220 0 0
vsetdispmode 1
vtop
vdisplay aBTextN
vdisplay aBTextC
vclear
vinit View1
vtop
vdisplay -dispMode 1 aBTextN aBTextC
vfit
vglinfo
checkview -screenshot -3d -path ${imagedir}/${test_image}.png
vdump ${imagedir}/${casename}.png

View File

@@ -33,7 +33,7 @@ donly result
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}_1.png
left
smallview -Y+Z
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}_2.png

View File

@@ -0,0 +1,18 @@
puts "======="
puts "0028763"
puts "======="
puts ""
##################################################
# Projection of a short line segment on a polar surface causes exception
##################################################
beziersurf s 2 2 0 0 0 0 1 0 1 0 0 1 1 0
line c 0 0 0 1 1 0
trim c c 0 1e-6
project result c s
if {![regexp "Trimmed curve" [dump result]]} {
puts "Error: Projection not done"
}
checklength result -l 1.e-6

View File

@@ -0,0 +1,24 @@
puts "========"
puts "OCC29182"
puts "========"
puts ""
#################################################
# BOPAlgo_PaveFiller sometimes raises exception in parallel mode
#################################################
binrestore [locate_data_file bug29182_access_violation.bin] a
explode a So
bclearobjects
bcleartools
baddobjects a_1
baddtools a_2 a_3 a_4 a_5 a_6 a_7 a_8 a_9 a_10 a_11 a_12
brunparallel 1
bfillds
bbuild result
checknbshapes result -m result -shell 17 -solid 17
checkprops result -v 1.18596e+006 -s 1.28028e+006
checkshape result
if ![regexp "This shape seems to be OK" [bopcheck result]] {
puts "Error: result is self-intersected"
}

View File

@@ -0,0 +1,41 @@
puts "========"
puts "OCC29182"
puts "========"
puts ""
#################################################
# BOPAlgo_PaveFiller sometimes raises exception in parallel mode
#################################################
# This is synthetic case reproducing the bug.
# Make a set of cylindrical surface patches intersecting in the same
# 3d line and run bfillds on them repeatedly 100 times.
cylinder c 0 10 0 1 0 0 10
mkface fc c pi/3 2*pi/3 -10 10
shape a C
add fc a
don a
for {set i 1} {$i <= 10} {incr i} {
copy fc f1
trotate f1 0 0 0 1 0 0 $i*5
add f1 a
}
brunparallel 1
bclearobjects
bcleartools
baddcompound a
for {set i 1} {$i <= 100} {incr i} {
puts "pass $i"
set info [string trim [bfillds]]
if {$info != "" && [regexp "2D curve" $info]} {
break
}
}
if {$i <= 100} {
puts "Error: the bug with failure building 2D curve of edge on face is reproduced"
}

View File

@@ -0,0 +1,30 @@
puts "========"
puts "OCC29183"
puts "========"
puts ""
#################################################
# Result of general fuse of shell and edge
# produces a shape with too large tolerance
#################################################
set MaxTol 30
restore [locate_data_file bug29183_shapes.brep] ss
bclearobjects
bcleartools
baddcompound ss
bfillds
bbuild r
regexp {Tolerance MAX=([-0-9.+eE]+)} [tolerance r] full toler
if {$toler > $MaxTol} {
puts "Error: Tolerance after fusing is too large"
}
checknbshapes r -m "Fusing result" -edge 18 -face 7
smallview
don r
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}_1.png

View File

@@ -0,0 +1,61 @@
puts "========"
puts "OCC29257"
puts "========"
puts ""
#################################################
# GeomPlate generates surface in unexpected place
#################################################
set MaxDist 0.05
restore [locate_data_file bug29257_plate_26_307.brep] a
explode a
# numbers of edges in a_1 to be replaced
set old_edges_num {3}
# get modified surface from a_2
mksurface su a_2
# create compounds of old edges and their replacements new edges
shape old_edges C
shape new_edges C
foreach i $old_edges_num {
# get old edge and its curve 3d
subshape a_1 e $i
mkcurve c a_1_$i
# project it on modified surface, result is curve 2d
project cp c su -t 1e-2
# create 3d curve of projection
approxcurveonsurf ca cp su
# make new edge with pcurve
mkedge e ca
addpcurve e cp a_2
add a_1_$i old_edges
add e new_edges
}
don a_1 new_edges
# compute plate surface
pullupface r a_1 old_edges new_edges a_2 -bnd -order 1 -mr 0.4 -step 0.4 -deg 3 -enlarge 1.1
checkprops r -s 286.683
# check distance from vertices of the initial face to the new face
foreach v [explode a_1 v] {
distmini d $v r
set dist [dval d_val]
if {$dist > $MaxDist} {
puts "Error: distance from vertex $v to the result is $dist, which is > $MaxDist"
}
}
smallview
don r a_1
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}_1.png

View File

@@ -0,0 +1,61 @@
puts "========"
puts "OCC29257"
puts "========"
puts ""
#################################################
# GeomPlate generates surface in unexpected place
#################################################
set MaxDist 0.1
restore [locate_data_file bug29257_plate_8_3.brep] a
explode a
# numbers of edges in a_1 to be replaced
set old_edges_num {2}
# get modified surface from a_2
mksurface su a_2
# create compounds of old edges and their replacements new edges
shape old_edges C
shape new_edges C
foreach i $old_edges_num {
# get old edge and its curve 3d
subshape a_1 e $i
mkcurve c a_1_$i
# project it on modified surface, result is curve 2d
project cp c su -t 1e-2
# create 3d curve of projection
approxcurveonsurf ca cp su
# make new edge with pcurve
mkedge e ca
addpcurve e cp a_2
add a_1_$i old_edges
add e new_edges
}
don a_1 new_edges
# compute plate surface
pullupface r a_1 old_edges new_edges a_2 -bnd -order 1 -mr 0.4 -step 0.2 -deg 3 -enlarge 1.1
checkprops r -s 9.02637
# check distance from vertices of the initial face to the new face
foreach v [explode a_1 v] {
distmini d $v r
set dist [dval d_val]
if {$dist > $MaxDist} {
puts "Error: distance from vertex $v to the result is $dist, which is > $MaxDist"
}
}
smallview
don r a_1
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}_1.png

View File

@@ -1,5 +1,6 @@
puts "TODO CR27414 ALL: Error : The area of result shape is"
puts "TODO CR27414 ALL: Error : The volume of result shape is"
puts "TODO OCC27414 ALL: Error: The command cannot be built"
puts "TODO OCC27414 ALL: gives an empty result"
puts "TODO OCC27414 ALL: TEST INCOMPLETE"
restore [locate_data_file bug26917_dom-7724_trim3.brep] s

View File

@@ -1,5 +1,6 @@
puts "TODO CR27414 ALL: Error : The area of result shape is"
puts "TODO CR27414 ALL: Error : The volume of result shape is"
puts "TODO OCC27414 ALL: Error: The command cannot be built"
puts "TODO OCC27414 ALL: gives an empty result"
puts "TODO OCC27414 ALL: TEST INCOMPLETE"
restore [locate_data_file bug26917_dom-7724_trim9.brep] s

View File

@@ -0,0 +1,12 @@
restore [locate_data_file bug29188_offset.input.fail_2.brep] s
offsetparameter 1.e-7 c i r
offsetload s 1
offsetperform result
checkprops result -s 3.8337e+006 -v 9.03404e+007
unifysamedom result_unif result
checknbshapes result_unif -vertex 2424 -edge 3636 -wire 1214 -face 1214 -shell 1
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,12 @@
restore [locate_data_file bug29188_offset.input.fail_2.brep] s
offsetparameter 1.e-7 c i r
offsetload s 2
offsetperform result
checkprops result -s 3.78989e+006 -v 9.41523e+007
unifysamedom result_unif result
checknbshapes result_unif -vertex 2414 -edge 3621 -wire 1209 -face 1209 -shell 1
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,12 @@
restore [locate_data_file bug29188_offset.input.fail_2.brep] s
offsetparameter 1.e-7 c i r
offsetload s 4
offsetperform result
checkprops result -s 3.59077e+006 -v 1.01607e+008
unifysamedom result_unif result
checknbshapes result_unif -vertex 760 -edge 1140 -wire 382 -face 382 -shell 1
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,12 @@
restore [locate_data_file bug29188_offset.input.fail_2_trim1.brep] s
offsetparameter 1.e-7 c i r
offsetload s 1
offsetperform result
checkprops result -s 14593.4 -v 73831.6
unifysamedom result_unif result
checknbshapes result_unif -vertex 18 -edge 27 -wire 11 -face 11 -shell 1
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,12 @@
restore [locate_data_file bug29188_offset.input.fail_2_trim1.brep] s
offsetparameter 1.e-7 c i r
offsetload s 2
offsetperform result
checkprops result -s 15689.6 -v 88931
unifysamedom result_unif result
checknbshapes result_unif -vertex 12 -edge 18 -wire 8 -face 8 -shell 1
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,12 @@
restore [locate_data_file bug29188_offset.input.fail_2_trim1.brep] s
offsetparameter 1.e-7 c i r
offsetload s 15
offsetperform result
checkprops result -s 38954.1 -v 435324
unifysamedom result_unif result
checknbshapes result_unif -vertex 12 -edge 18 -wire 8 -face 8 -shell 1
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,12 @@
restore [locate_data_file bug29188_offset.input.fail_2_trim2.brep] s
offsetparameter 1.e-7 c i r
offsetload s 1
offsetperform result
checkprops result -s 7573.52 -v 22082
unifysamedom result_unif result
checknbshapes result_unif -vertex 16 -edge 24 -wire 10 -face 10 -shell 1
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,12 @@
restore [locate_data_file bug29188_offset.input.fail_2_trim2.brep] s
offsetparameter 1.e-7 c i r
offsetload s 4
offsetperform result
checkprops result -s 11270.1 -v 50239.3
unifysamedom result_unif result
checknbshapes result_unif -vertex 14 -edge 21 -wire 9 -face 9 -shell 1
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,12 @@
restore [locate_data_file bug29188_offset.input.fail_2_trim2.brep] s
offsetparameter 1.e-7 c i r
offsetload s 15
offsetperform result
checkprops result -s 29345 -v 268160
unifysamedom result_unif result
checknbshapes result_unif -vertex 12 -edge 18 -wire 8 -face 8 -shell 1
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,27 @@
restore [locate_data_file bug29188_xm6_trim.brep] s
offsetparameter 1.e-7 c i r
offsetload s 4
foreach f [explode s f] {
mksurface surf $f
set found [regexp {Axis :([-0-9.+eE]*), ([-0-9.+eE]*), ([-0-9.+eE]*)} [dump surf] full x y z]
if {$found && abs(abs($z) - 1) < 1.e-7} {
offsetonface $f 3
} else {
if { y < -0.7 } {
offsetonface $f 5
} else {
if { y > 0.7 } {
offsetonface $f 3
}
}
}
}
offsetperform result
checkprops result -s 34789.1 -v 364306
unifysamedom result_unif result
checknbshapes result_unif -vertex 26 -edge 39 -wire 15 -face 15 -shell 1
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,19 @@
restore [locate_data_file bug29188_xb4_trim.brep] s
offsetparameter 1.e-7 c i r
offsetload s 10
foreach f [explode s f] {
mksurface surf $f
set found [regexp {Axis :([-0-9.+eE]*), ([-0-9.+eE]*), ([-0-9.+eE]*)} [dump surf] full x y z]
if {$found && abs(abs($z) - 1) < 1.e-7} {
offsetonface $f 0
}
}
offsetperform result
checkprops result -s 83647.4 -v 1.00827e+006
unifysamedom result_unif result
checknbshapes result_unif -vertex 31 -edge 47 -wire 18 -face 18 -shell 1
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,12 @@
restore [locate_data_file bug29188_zt8_trim.brep] s
offsetparameter 1.e-7 c i r
offsetload s 5
offsetperform result
checkprops result -s 43255.5 -v 461843
unifysamedom result_unif result
checknbshapes result_unif -vertex 14 -edge 21 -wire 9 -face 9 -shell 1
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,12 @@
restore [locate_data_file bug29188_zt8_trim.brep] s
offsetparameter 1.e-7 c i r
offsetload s 10
offsetperform result
checkprops result -s 56967.2 -v 711670
unifysamedom result_unif result
checknbshapes result_unif -vertex 14 -edge 21 -wire 9 -face 9 -shell 1
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png

View File

@@ -1,12 +1,12 @@
puts "TODO OCC27414 ALL: Error: The command cannot be built"
puts "TODO OCC27414 ALL: gives an empty result"
puts "TODO OCC27414 ALL: TEST INCOMPLETE"
restore [locate_data_file bug26917_t114_c2.recipe.brep] s
OFFSETSHAPE 35 {} $calcul $type
offsetparameter 1.e-7 c i r
offsetload s 35
offsetperform result
checkprops result -v 7.93275e+008
checkprops result -s 6.15377e+006
checkprops result -s 6.15377e+006 -v 7.93275e+008
checknbshapes result -shell 1
unifysamedom result_unif result
checknbshapes result_unif -vertex 64 -edge 96 -wire 34 -face 34 -shell 1
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png

View File

@@ -1,12 +1,12 @@
puts "TODO OCC27414 ALL: Error: The command cannot be built"
puts "TODO OCC27414 ALL: gives an empty result"
puts "TODO OCC27414 ALL: TEST INCOMPLETE"
restore [locate_data_file bug26917_t115_c2.recipe.brep] s
OFFSETSHAPE 35 {} $calcul $type
offsetparameter 1.e-7 c i r
offsetload s 35
offsetperform result
checkprops result -v 7.93275e+008
checkprops result -s 6.15377e+006
checkprops result -s 6.15377e+006 -v 7.93275e+008
checknbshapes result -shell 1
unifysamedom result_unif result
checknbshapes result_unif -vertex 64 -edge 96 -wire 34 -face 34 -shell 1
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png

View File

@@ -1,12 +1,12 @@
puts "TODO OCC27414 ALL: Error: The command cannot be built"
puts "TODO OCC27414 ALL: gives an empty result"
puts "TODO OCC27414 ALL: TEST INCOMPLETE"
restore [locate_data_file bug26917_t116_c2.recipe.brep] s
OFFSETSHAPE 35 {} $calcul $type
offsetparameter 1.e-7 c i r
offsetload s 35
offsetperform result
checkprops result -v 8.96742e+008
checkprops result -s 6.85555e+006
checkprops result -s 6.85555e+006 -v 8.96742e+008
checknbshapes result -shell 1
unifysamedom result_unif result
checknbshapes result_unif -vertex 64 -edge 96 -wire 34 -face 34 -shell 1
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png

View File

@@ -1,12 +1,12 @@
puts "TODO OCC27414 ALL: Error: The command cannot be built"
puts "TODO OCC27414 ALL: gives an empty result"
puts "TODO OCC27414 ALL: TEST INCOMPLETE"
restore [locate_data_file bug26917_t130_c2.recipe.brep] s
OFFSETSHAPE 35 {} $calcul $type
offsetparameter 1.e-7 c i r
offsetload s 35
offsetperform result
checkprops result -v 6.89789e+008
checkprops result -s 5.45195e+006
checkprops result -s 5.45195e+006 -v 6.89789e+008
checknbshapes result -shell 1
unifysamedom result_unif result
checknbshapes result_unif -vertex 64 -edge 96 -wire 34 -face 34 -shell 1
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png

View File

@@ -1,12 +1,12 @@
puts "TODO OCC27414 ALL: Error: The command cannot be built"
puts "TODO OCC27414 ALL: gives an empty result"
puts "TODO OCC27414 ALL: TEST INCOMPLETE"
restore [locate_data_file bug26917_t137_c2.recipe.brep] s
OFFSETSHAPE 35 {} $calcul $type
offsetparameter 1.e-7 c i r
offsetload s 35
offsetperform result
checkprops result -v 8.96742e+008
checkprops result -s 6.85555e+006
checkprops result -s 6.85555e+006 -v 8.96742e+008
checknbshapes result -shell 1
unifysamedom result_unif result
checknbshapes result_unif -vertex 64 -edge 96 -wire 34 -face 34 -shell 1
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png

View File

@@ -1,12 +1,12 @@
puts "TODO OCC27414 ALL: Error: The command cannot be built"
puts "TODO OCC27414 ALL: gives an empty result"
puts "TODO OCC27414 ALL: TEST INCOMPLETE"
restore [locate_data_file bug26917_t114_c2.recipe_art1.brep] s
OFFSETSHAPE 2 {} $calcul $type
offsetparameter 1.e-7 c i r
offsetload s 2
offsetperform result
checkprops result -v 475
checkprops result -s 454.58
checkprops result -s 454.58 -v 475
checknbshapes result -shell 1
unifysamedom result_unif result
checknbshapes result_unif -vertex 14 -edge 21 -wire 9 -face 9 -shell 1
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png

View File

@@ -1,42 +0,0 @@
puts "========"
puts "OCC29093"
puts "========"
puts ""
#################################
# BOP PaveFiller hungs and constantly consumes memory
#################################
puts "TODO OCC28989 ALL : Error! Big tolerance value!"
puts "TODO OCC29145 ALL : Faulty shapes in variables faulty_1 to faulty_"
bclearobjects;
bcleartools;
restore [locate_data_file bug29093_hung.brep] a
explode a So
baddobjects a_1
baddtools a_2 a_3 a_4 a_5 a_6 a_7 a_8 a_9 a_10 a_11 a_12 a_13 a_14
dchrono cr restart
bfillds
bbuild result
dchrono cr stop counter bbuild
regexp {Tolerance +MAX=([-0-9.+eE]+)} [tolerance result] full MaxTol
# Maximal tolerance value must be updated after the fix.
# Current tolerance value is 803.89403359886296.
if {${MaxTol} > 1.0e-4} {
puts "Error! Big tolerance value!"
}
checkshape result
smallview
donly result
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@@ -1,32 +0,0 @@
puts "========"
puts "OCC29093"
puts "========"
puts ""
#################################
# BOP PaveFiller hungs and constantly consumes memory
#################################
puts "TODO OCC29145 ALL : Faulty shapes in variables faulty_1 to faulty_"
bclearobjects;
bcleartools;
restore [locate_data_file bug29093_hung2.brep] a
explode a So
baddobjects a_1
baddtools a_2 a_3 a_4 a_5 a_6 a_7 a_8 a_9 a_10 a_11 a_12 a_13 a_14
dchrono cr restart
bfillds
bbuild result
dchrono cr stop counter bbuild
checkshape result
smallview
donly result
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@@ -1,32 +0,0 @@
puts "========"
puts "OCC29093"
puts "========"
puts ""
#################################
# BOP PaveFiller hungs and constantly consumes memory
#################################
puts "TODO OCC29145 ALL : Faulty shapes in variables faulty_1 to faulty_"
bclearobjects;
bcleartools;
restore [locate_data_file bug29093_hung3.brep] a
explode a So
baddobjects a_1
baddtools a_2 a_3 a_4 a_5 a_6 a_7 a_8 a_9 a_10 a_11 a_12 a_13 a_14
dchrono cr restart
bfillds
bbuild result
dchrono cr stop counter bbuild
checkshape result
smallview
donly result
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@@ -1,4 +1,3 @@
puts "TODO ?OCC25918 Windows: Error : The area of result shape is"
puts "TODO OCC24156 MacOS: Tcl Exception:"
puts "TODO OCC24156 MacOS: TEST INCOMPLETE"
@@ -26,6 +25,6 @@ tcopy result_1 result
dchrono h2 stop counter blend
checkprops result -s 3.65777e+06
checkprops result -s 3.54895e+006
checkshape result
checkview -display result -2d -path ${imagedir}/${test_image}.png