mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-08 14:17:06 +03:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
52ff4caede | ||
|
aec5142ffb |
@@ -1935,38 +1935,26 @@ Offset direction, which used in class Adaptor2d_OffsetCurve for evaluating value
|
||||
|
||||
Adaptor2d_OffsetCurve aOC(BaseCurve, Offset) --> Adaptor2d_OffsetCurve aOC(BaseCurve, -Offset)
|
||||
|
||||
@subsection upgrade_750_ProgressIndicator Change of progress indication API
|
||||
subsection upgrade_750_ProgressIndicator Change of Message_ProgressIndicator
|
||||
|
||||
The progress indication mechanism has been revised to eliminate its weak points in
|
||||
previous design (leading to implementation mistakes).
|
||||
Redesign also allows using progress indicator in multi-threaded algorithms
|
||||
in more straight-forward way with minimal overhead.
|
||||
Note however, that multi-threaded algorithm should pre-allocate per-task
|
||||
progress ranges in advance to ensure thread-safety -
|
||||
see examples in documentation of class Message_ProgressScope for details.
|
||||
The progress indication mechanism has been revised to eliminate its weak points in previous design (leading to ambiguity and unprotected from an error-prone behavior).
|
||||
Redesign also allows using progress indicator in multi-threaded algorithms in more straight-forward way with minimal overhead.
|
||||
Note, however, that multi-threaded algorithm should pre-allocate per-thread progress scopes in advance to ensure thread-safety - check new classes API for details.
|
||||
|
||||
Classes Message_ProgressSentry and Message_ProgressScale have been removed.
|
||||
New classes Message_ProgressScope and Message_ProgressRange should be used as main
|
||||
API classes to organize progress indication in the algorithms.
|
||||
Instances of the class Message_ProgressRange are used to pass the progress capability to
|
||||
nested levels of the algorithm, and an instance of the class Message_ProgressScope is to
|
||||
be created (preferably as local variable) to manage progress at each level of the algorithm.
|
||||
New classes Message_ProgressScope and Messge_ProgressRange replace them and should be used as main API classes to organize progress indication in the algorithms.
|
||||
Instances of the class Message_ProgressRange are used to pass the progress capability to nested levels of the algorithm
|
||||
and an instance of the class Message_ProgressScope is to be created (preferably as local variable) to manage progress at each level of the algorithm.
|
||||
The instance of Message_ProgressIndicator is not passed anymore to sub-algorithms.
|
||||
See documentation of the class Message_ProgressScope for more details and examples.
|
||||
|
||||
Methods to deal with progress scopes and to advance progress are removed from class
|
||||
Message_ProgressIndicator; now it only provides interface to the application-level progress indicator.
|
||||
Virtual method Message_ProgressIndicator::Show() has changed its signature and should be
|
||||
updated accordingly in descendants of Message_ProgressIndicator.
|
||||
The scope passed as argument to this method can be used to obtain information on context
|
||||
of the current process (instead of calling method GetScope() in previous implementation).
|
||||
Methods Show(), UserBreak(), and Reset() are made protected in class Message_ProgressIndicator;
|
||||
methods More() or UserBreak() of classes Message_ProgressScope or Message_ProgressRange should
|
||||
be used to know if the cancel event has come.
|
||||
See documentation of the class Message_ProgressIndicator for more details and implementation
|
||||
of Draw_ProgressIndicator for an example.
|
||||
Methods to deal with progress scopes and to advance progress are removed from class Message_ProgressIndicator; now it only provides interface to the application-level progress indicator.
|
||||
Virtual method Message_ProgressIndicator::Show() has changed its signature and should be updated accordingly in descendants of Message_ProgressIndicator.
|
||||
The scope passed as argument to this method can be used to obtain information on context of the current process (instead of calling method GetScope() in previous implementation).
|
||||
Methods Show(), UserBreak(), and Reset() are made protected in class Message_ProgressIndicator; method More() of Message_ProgressScope should be used to know if the cancel event has come.
|
||||
See documentation of the class Message_ProgressIndicator for more details and implementation of Draw_ProgressIndicator for an example.
|
||||
|
||||
Let's take a look onto typical algorithm using an old API:
|
||||
Lets take a look onto typical algorithm using an old API:
|
||||
@code
|
||||
class MyAlgo
|
||||
{
|
||||
@@ -1979,10 +1967,7 @@ public:
|
||||
{
|
||||
Message_ProgressSentry aPSentry1 (theProgress, "Stage 1", 0, 153, 1);
|
||||
for (int anIter = 0; anIter < 153; ++anIter, aPSentry1.Next())
|
||||
{
|
||||
if (!aPSentry1.More()) { return false; }
|
||||
// do some job here...
|
||||
}
|
||||
{ if (!aPSentry1.More()) { return false; } }
|
||||
}
|
||||
aPSentry.Next();
|
||||
{
|
||||
@@ -1997,9 +1982,9 @@ private:
|
||||
//! Nested sub-algorithm taking Progress Indicator.
|
||||
bool perform2 (const Handle(Message_ProgressIndicator)& theProgress)
|
||||
{
|
||||
Message_ProgressSentry aPSentry2 (theProgress, "Stage 2", 0, 100, 1);
|
||||
for (int anIter = 0; anIter < 100 && aPSentry2.More(); ++anIter, aPSentry2.Next()) {}
|
||||
return !aPSentry2.UserBreak();
|
||||
Message_ProgressSentry aPSentry2 (theProgress, "Stage 2", 0, 561, 1);
|
||||
for (int anIter = 0; anIter < 561 && aPSentry2.More(); ++anIter, aPSentry2.Next()) {}
|
||||
return aPSentry2.More();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2010,25 +1995,19 @@ anAlgo.Perform ("FileName", aProgress);
|
||||
@endcode
|
||||
|
||||
The following guidance can be used to update such code:
|
||||
- Replace `const Handle(Message_ProgressIndicator)&` with `const Message_ProgressRange&`
|
||||
in arguments of the methods that support progress indication.
|
||||
- Replace `const Handle(Message_ProgressIndicator)&` with `const Message_ProgressRange&`.
|
||||
Message_ProgressIndicator object should be now created only at place where application starts algorithms.
|
||||
- Replace `Message_ProgressSentry` with `Message_ProgressScope`.
|
||||
Take note that Message_ProgressScope has less arguments (no "minimal value").
|
||||
In other aspects, Message_ProgressScope mimics an iterator-style interface
|
||||
(with methods More() and Next()) close to the old Message_ProgressSentry (pay attention
|
||||
to extra functionality of Message_ProgressScope::Next() method below).
|
||||
Note that method Message_ProgressScope::Close() is equivalent of the method
|
||||
Relieve() of Message_ProgressSentry in previous version.
|
||||
Class Message_ProgressSentry is still defined (marked as deprecated) providing
|
||||
API more close to old one, and can be still used to reduce porting efforts.
|
||||
- Each Message_ProgressScope should take the next Range object to work with.
|
||||
Within old API, Message_ProgressSentry received the root Progress Indicator
|
||||
object which mantained the sequence of ranges internally.
|
||||
Message_ProgressScope in new API takes Message_ProgressRange, which should be
|
||||
returned by Message_ProgressScope::Next() method of the parent scope.
|
||||
Do not use the same Range passed to the algorithm for all sub-Scopes like
|
||||
it was possible in old API; each range object may be used only once.
|
||||
Take note that Message_ProgressScope has smaller number of arguments (no "minimal value").
|
||||
In other aspects, Message_ProgressScope mimics an iterator-style interface (with methods More() and Next())
|
||||
close to the old Message_ProgressSentry (pay attention to extra functionality of Message_ProgressScope::Next() method below).
|
||||
- Each Message_ProgressScope should take the next Range to fill in.
|
||||
Within old API, Message_ProgressSentry received the root Progress Indicator object and implicitly split it into ranges using error-prone logic.
|
||||
Message_ProgressScope in new API takes Message_ProgressRange, which should be created from the Range of the parent Scope using value returned by Message_ProgressScope::Next() method.
|
||||
Don't use the same Range passed to the algorithm for all sub-Scopes like it was possible in old API.
|
||||
- Check user abortion state using Message_ProgressScope::UserBreak() method;
|
||||
Message_ProgressRange is a temporary object with the only purpose to create a new Message_ProgressScope,
|
||||
and Message_ProgressIndicator should be never passed directly to algorithms.
|
||||
|
||||
Take a look onto ported code and compare with code above to see differences:
|
||||
|
||||
@@ -2044,10 +2023,7 @@ public:
|
||||
{
|
||||
Message_ProgressScope aPSentry1 (aPSentry.Next(), "Stage 1", 153);
|
||||
for (int anIter = 0; anIter < 153; ++anIter, aPSentry1.Next())
|
||||
{
|
||||
if (!aPSentry1.More()) { return false; };
|
||||
// do some job here...
|
||||
}
|
||||
{ if (!aPSentry1.More()) { return false; }; }
|
||||
}
|
||||
{
|
||||
perform2 (aPSentry.Next());
|
||||
@@ -2059,9 +2035,9 @@ public:
|
||||
//! Nested sub-algorithm taking Progress sub-Range.
|
||||
bool perform2 (const Message_ProgressRange& theProgress)
|
||||
{
|
||||
Message_ProgressScope aPSentry2 (theProgress, "Stage 2", 100);
|
||||
for (int anIter = 0; anIter < 100 && aPSentry2.More(); ++anIter, aPSentry2.Next()) {}
|
||||
return !aPSentry2.UserBreak();
|
||||
Message_ProgressScope aPSentry2 (theProgress, "Stage 2", 561);
|
||||
for (int anIter = 0; anIter < 561 && aPSentry2.More(); ++anIter, aPSentry2.Next()) {}
|
||||
return aPSentry2.More();
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -53,6 +53,8 @@ unix {
|
||||
equals(MACOSX_USE_GLX, true): DEFINES += MACOSX_USE_GLX
|
||||
DEFINES += OCC_CONVERT_SIGNALS QT_NO_STL
|
||||
!macx | equals(MACOSX_USE_GLX, true): LIBS += -L$$QMAKE_LIBDIR_X11 $$QMAKE_LIBS_X11 -L$$QMAKE_LIBDIR_OPENGL $$QMAKE_LIBS_OPENGL $$QMAKE_LIBS_THREAD
|
||||
LIBS += -lfreeimageplus
|
||||
LIBS += -ltbb -ltbbmalloc
|
||||
QMAKE_CXXFLAGS += -std=gnu++11
|
||||
}
|
||||
|
||||
|
@@ -518,6 +518,8 @@ void AIS_ColoredShape::ComputeSelection (const Handle(SelectMgr_Selection)& theS
|
||||
const Handle(SelectMgr_EntityOwner)& anOwner = aSelEntIter.Value()->BaseSensitive()->OwnerId();
|
||||
anOwner->SetSelectable (aThis);
|
||||
}
|
||||
|
||||
StdSelect_BRepSelectionTool::PreBuildBVH (theSelection);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -94,6 +94,9 @@ DEFINE_STANDARD_HANDLE (AIS_Manipulator, AIS_InteractiveObject)
|
||||
//! @endcode
|
||||
//! The last method erases manipulator object.
|
||||
//! @warning
|
||||
//! On construction an instance of AIS_Manipulator object is bound to Graphic3d_ZLayerId_Topmost layer,
|
||||
//! so make sure to call for your AIS_InteractiveContext the method MainSelector()->SetPickClosest (Standard_False)
|
||||
//! otherwise you may notice issues with activation of modes.
|
||||
class AIS_Manipulator : public AIS_InteractiveObject
|
||||
{
|
||||
public:
|
||||
|
@@ -20,9 +20,9 @@
|
||||
|
||||
enum Approx_ParametrizationType
|
||||
{
|
||||
Approx_ChordLength, //!< parameters of points are proportionate to distances between them
|
||||
Approx_Centripetal, //!< parameters of points are proportionate to square roots of distances between them
|
||||
Approx_IsoParametric //!< parameters of points are distributed uniformly
|
||||
Approx_ChordLength,
|
||||
Approx_Centripetal,
|
||||
Approx_IsoParametric
|
||||
};
|
||||
|
||||
#endif // _Approx_ParametrizationType_HeaderFile
|
||||
|
@@ -17,7 +17,7 @@
|
||||
#ifndef _Approx_Status_HeaderFile
|
||||
#define _Approx_Status_HeaderFile
|
||||
|
||||
//! It is an auxiliary flag being used in inner computations
|
||||
|
||||
enum Approx_Status
|
||||
{
|
||||
Approx_PointsAdded,
|
||||
|
@@ -57,8 +57,7 @@ BOPAlgo_PaveFiller::BOPAlgo_PaveFiller
|
||||
BOPAlgo_Algo(theAllocator),
|
||||
myFPBDone(1, theAllocator),
|
||||
myIncreasedSS(1, theAllocator),
|
||||
myVertsToAvoidExtension(1, theAllocator),
|
||||
myDistances(1, theAllocator)
|
||||
myVertsToAvoidExtension(1, theAllocator)
|
||||
{
|
||||
myDS = NULL;
|
||||
myIterator = NULL;
|
||||
|
@@ -35,7 +35,6 @@
|
||||
#include <BOPDS_PDS.hxx>
|
||||
#include <BOPDS_PIterator.hxx>
|
||||
#include <BOPDS_VectorOfCurve.hxx>
|
||||
#include <BOPTools_BoxTree.hxx>
|
||||
#include <IntSurf_ListOfPntOn2S.hxx>
|
||||
#include <IntTools_ShrunkRange.hxx>
|
||||
#include <NCollection_BaseAllocator.hxx>
|
||||
@@ -320,9 +319,7 @@ protected:
|
||||
//! created the section curve.
|
||||
Standard_EXPORT Standard_Boolean IsExistingPaveBlock
|
||||
(const Handle(BOPDS_PaveBlock)& thePB, const BOPDS_Curve& theNC,
|
||||
const Standard_Real theTolR3D,
|
||||
const BOPDS_IndexedMapOfPaveBlock& theMPB,
|
||||
BOPTools_BoxTree& thePBTree,
|
||||
const Standard_Real theTolR3D, const BOPDS_IndexedMapOfPaveBlock& theMPB,
|
||||
const BOPDS_MapOfPaveBlock& theMPBCommon,
|
||||
Handle(BOPDS_PaveBlock)& thePBOut, Standard_Real& theTolNew);
|
||||
|
||||
@@ -415,21 +412,6 @@ protected:
|
||||
TColStd_DataMapOfIntegerListOfInteger& aDMVLV,
|
||||
const Standard_Integer aType = 0);
|
||||
|
||||
//! Adds the existing edges for intersection with section edges
|
||||
//! by checking the possible intersection with the faces comparing
|
||||
//! pre-saved E-F distances with new tolerances.
|
||||
Standard_EXPORT void ProcessExistingPaveBlocks (const Standard_Integer theInt,
|
||||
const Standard_Integer theCur,
|
||||
const Standard_Integer nF1,
|
||||
const Standard_Integer nF2,
|
||||
const TopoDS_Edge& theES,
|
||||
const BOPDS_IndexedMapOfPaveBlock& theMPBOnIn,
|
||||
BOPTools_BoxTree& thePBTree,
|
||||
BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB,
|
||||
TopTools_DataMapOfShapeInteger& theMVI,
|
||||
BOPDS_ListOfPaveBlock& theLPBC,
|
||||
BOPAlgo_DataMapOfPaveBlockListOfInteger& thePBFacesMap,
|
||||
BOPDS_MapOfPaveBlock& theMPB);
|
||||
|
||||
//! Adds the existing edges from the map <theMPBOnIn> which interfere
|
||||
//! with the vertices from <theMVB> map to the post treatment of section edges.
|
||||
@@ -437,12 +419,12 @@ protected:
|
||||
const Standard_Integer nF1,
|
||||
const Standard_Integer nF2,
|
||||
const BOPDS_IndexedMapOfPaveBlock& theMPBOnIn,
|
||||
BOPTools_BoxTree& thePBTree,
|
||||
const TColStd_DataMapOfIntegerListOfInteger& theDMBV,
|
||||
BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB,
|
||||
TopTools_DataMapOfShapeInteger& theMVI,
|
||||
BOPAlgo_DataMapOfPaveBlockListOfInteger& thePBFacesMap,
|
||||
BOPDS_MapOfPaveBlock& theMPB);
|
||||
|
||||
|
||||
//! Replaces existing pave block <thePB> with new pave blocks <theLPB>.
|
||||
//! The list <theLPB> contains images of <thePB> which were created in
|
||||
@@ -617,22 +599,6 @@ protected:
|
||||
//! Check all edges on the micro status and remove the positive ones
|
||||
Standard_EXPORT void RemoveMicroEdges();
|
||||
|
||||
//! Auxiliary structure to hold the edge distance to the face
|
||||
struct EdgeRangeDistance
|
||||
{
|
||||
Standard_Real First;
|
||||
Standard_Real Last;
|
||||
Standard_Real Distance;
|
||||
|
||||
EdgeRangeDistance (const Standard_Real theFirst = 0.0,
|
||||
const Standard_Real theLast = 0.0,
|
||||
const Standard_Real theDistance = RealLast())
|
||||
: First (theFirst), Last (theLast), Distance (theDistance)
|
||||
{}
|
||||
};
|
||||
|
||||
protected: //! Fields
|
||||
|
||||
TopTools_ListOfShape myArguments;
|
||||
BOPDS_PDS myDS;
|
||||
BOPDS_PIterator myIterator;
|
||||
@@ -649,11 +615,6 @@ protected: //! Fields
|
||||
//! which has already been extended to cover the real intersection
|
||||
//! points, and should not be extended any longer to be put
|
||||
//! on a section curve.
|
||||
|
||||
NCollection_DataMap <BOPDS_Pair,
|
||||
NCollection_List<EdgeRangeDistance>,
|
||||
BOPDS_PairMapHasher> myDistances; //!< Map to store minimal distances between shapes
|
||||
//! which have no real intersections
|
||||
|
||||
};
|
||||
|
||||
|
@@ -152,6 +152,8 @@ Standard_Integer BOPAlgo_PaveFiller::UpdateVertex
|
||||
//
|
||||
// add vertex to SD map
|
||||
myDS->AddShapeSD(nV, nVNew);
|
||||
//
|
||||
myDS->InitPaveBlocksForVertex(nV);
|
||||
|
||||
// Add new vertex to map of vertices to avoid further extension
|
||||
myVertsToAvoidExtension.Add(nVNew);
|
||||
|
@@ -300,6 +300,12 @@ void BOPAlgo_PaveFiller::PerformEF()
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const IntTools_SequenceOfCommonPrts& aCPrts=aEdgeFace.CommonParts();
|
||||
aNbCPrts = aCPrts.Length();
|
||||
if (!aNbCPrts) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
aEdgeFace.Indices(nE, nF);
|
||||
//
|
||||
const TopoDS_Edge& aE=aEdgeFace.Edge();
|
||||
@@ -307,23 +313,6 @@ void BOPAlgo_PaveFiller::PerformEF()
|
||||
//
|
||||
aTolE=BRep_Tool::Tolerance(aE);
|
||||
aTolF=BRep_Tool::Tolerance(aF);
|
||||
//
|
||||
const IntTools_SequenceOfCommonPrts& aCPrts=aEdgeFace.CommonParts();
|
||||
aNbCPrts = aCPrts.Length();
|
||||
if (!aNbCPrts) {
|
||||
if (aEdgeFace.MinimalDistance() < RealLast() &&
|
||||
aEdgeFace.MinimalDistance() > aTolE + aTolF)
|
||||
{
|
||||
const Handle(BOPDS_PaveBlock)& aPB=aEdgeFace.PaveBlock();
|
||||
aPB->Range(aT1, aT2);
|
||||
NCollection_List<EdgeRangeDistance>* pList = myDistances.ChangeSeek (BOPDS_Pair (nE, nF));
|
||||
if (!pList)
|
||||
pList = myDistances.Bound (BOPDS_Pair (nE, nF), NCollection_List<EdgeRangeDistance>());
|
||||
pList->Append (EdgeRangeDistance (aT1, aT2, aEdgeFace.MinimalDistance()));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const IntTools_Range& anewSR=aEdgeFace.NewSR();
|
||||
Handle(BOPDS_PaveBlock)& aPB=aEdgeFace.PaveBlock();
|
||||
//
|
||||
|
@@ -38,9 +38,7 @@
|
||||
#include <BOPDS_VectorOfPoint.hxx>
|
||||
#include <BOPTools_AlgoTools.hxx>
|
||||
#include <BOPTools_AlgoTools3D.hxx>
|
||||
#include <BOPTools_BoxSelector.hxx>
|
||||
#include <BOPTools_Parallel.hxx>
|
||||
#include <Bnd_Tools.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_TEdge.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
@@ -502,6 +500,7 @@ void BOPAlgo_PaveFiller::MakeBlocks()
|
||||
myDS->SubShapesOnIn(nF1, nF2, aMVOnIn, aMVCommon, aMPBOnIn, aMPBCommon);
|
||||
myDS->SharedEdges(nF1, nF2, aLSE, aAllocator);
|
||||
//
|
||||
Standard_Boolean bHasRealSectionEdge = Standard_False;
|
||||
// 1. Treat Points
|
||||
for (j=0; j<aNbP; ++j) {
|
||||
TopoDS_Vertex aV;
|
||||
@@ -574,27 +573,6 @@ void BOPAlgo_PaveFiller::MakeBlocks()
|
||||
BOPDS_Curve& aNC=aVC.ChangeValue(j);
|
||||
PutClosingPaveOnCurve (aNC);
|
||||
}
|
||||
//
|
||||
|
||||
BOPTools_BoxTree aPBTree;
|
||||
{
|
||||
// Fill the tree with boxes of pave blocks ON/IN
|
||||
// Tree will be build on first selection from the tree.
|
||||
const Standard_Integer aNbPB = aMPBOnIn.Extent();
|
||||
aPBTree.SetSize (aNbPB);
|
||||
for (Standard_Integer iPB = 1; iPB <= aNbPB; ++iPB)
|
||||
{
|
||||
const Handle(BOPDS_PaveBlock)& aPB = aMPBOnIn (iPB);
|
||||
if (!aPB->HasEdge())
|
||||
continue;
|
||||
|
||||
if (myDS->ShapeInfo (aPB->OriginalEdge()).HasFlag())
|
||||
continue;
|
||||
|
||||
aPBTree.Add (iPB, Bnd_Tools::Bnd2BVH (myDS->ShapeInfo (aPB->Edge()).Box()));
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// 3. Make section edges
|
||||
for (j=0; j<aNbC; ++j) {
|
||||
@@ -662,7 +640,7 @@ void BOPAlgo_PaveFiller::MakeBlocks()
|
||||
continue;
|
||||
}
|
||||
//
|
||||
bExist = IsExistingPaveBlock(aPB, aNC, aTolR3D, aMPBOnIn, aPBTree, aMPBCommon, aPBOut, aTolNew);
|
||||
bExist = IsExistingPaveBlock(aPB, aNC, aTolR3D, aMPBOnIn, aMPBCommon, aPBOut, aTolNew);
|
||||
if (bExist)
|
||||
{
|
||||
Standard_Boolean bInF1 = (aFI1.PaveBlocksOn().Contains(aPBOut) ||
|
||||
@@ -692,24 +670,23 @@ void BOPAlgo_PaveFiller::MakeBlocks()
|
||||
if (pFaces->IsEmpty() || !pFaces->Contains(nF))
|
||||
pFaces->Append(nF);
|
||||
|
||||
// Try fusing the vertices of the existing pave block
|
||||
// with the vertices put on the real section curve (except
|
||||
// for technological vertices, which will be removed)
|
||||
Standard_Integer nVOut1, nVOut2;
|
||||
aPBOut->Indices(nVOut1, nVOut2);
|
||||
if (nV1 != nVOut1 && nV1 != nVOut2 && !aMVBounds.Contains(nV1))
|
||||
{
|
||||
aVertsOnRejectedPB.Add(aV1);
|
||||
}
|
||||
if (nV2 != nVOut1 && nV2 != nVOut2 && !aMVBounds.Contains(nV2))
|
||||
{
|
||||
aVertsOnRejectedPB.Add(aV2);
|
||||
}
|
||||
|
||||
if (aMPBAdd.Add(aPBOut))
|
||||
{
|
||||
// Add edge for processing as the section edge
|
||||
PreparePostTreatFF(i, j, aPBOut, aMSCPB, aMVI, aLPBC);
|
||||
// Try fusing the vertices of the existing pave block
|
||||
// with the vertices put on the real section curve (except
|
||||
// for technological vertices, which will be removed)
|
||||
Standard_Integer nVOut1, nVOut2;
|
||||
aPBOut->Indices(nVOut1, nVOut2);
|
||||
if (nV1 != nVOut1 && nV1 != nVOut2 && !aMVBounds.Contains(nV1))
|
||||
{
|
||||
aVertsOnRejectedPB.Add(aV1);
|
||||
}
|
||||
if (nV2 != nVOut1 && nV2 != nVOut2 && !aMVBounds.Contains(nV2))
|
||||
{
|
||||
aVertsOnRejectedPB.Add(aV2);
|
||||
}
|
||||
}
|
||||
}
|
||||
continue;
|
||||
@@ -738,10 +715,8 @@ void BOPAlgo_PaveFiller::MakeBlocks()
|
||||
//
|
||||
aMVTol.UnBind(nV1);
|
||||
aMVTol.UnBind(nV2);
|
||||
|
||||
// Add existing pave blocks for post treatment
|
||||
ProcessExistingPaveBlocks (i, j, nF1, nF2, aES, aMPBOnIn, aPBTree,
|
||||
aMSCPB, aMVI, aLPBC, aPBFacesMap, aMPBAdd);
|
||||
//
|
||||
bHasRealSectionEdge = Standard_True;
|
||||
}
|
||||
//
|
||||
aLPBC.RemoveFirst();
|
||||
@@ -769,7 +744,29 @@ void BOPAlgo_PaveFiller::MakeBlocks()
|
||||
aDMVLV.UnBind(nV1);
|
||||
}
|
||||
//
|
||||
ProcessExistingPaveBlocks(i, nF1, nF2, aMPBOnIn, aPBTree, aDMBV, aMSCPB, aMVI, aPBFacesMap, aMPBAdd);
|
||||
ProcessExistingPaveBlocks(i, nF1, nF2, aMPBOnIn, aDMBV, aMSCPB, aMVI, aPBFacesMap, aMPBAdd);
|
||||
//
|
||||
// If the pair of faces has produced any real section edges
|
||||
// it is necessary to check if these edges do not intersect
|
||||
// any common IN edges of the faces. For that, all such edges
|
||||
// are added for Post Treatment along with sections edges.
|
||||
if (bHasRealSectionEdge) {
|
||||
const BOPDS_IndexedMapOfPaveBlock& aMPBIn1 = aFI1.PaveBlocksIn();
|
||||
const BOPDS_IndexedMapOfPaveBlock& aMPBIn2 = aFI2.PaveBlocksIn();
|
||||
//
|
||||
// For simplicity add all IN edges into the first set of section curves.
|
||||
// These existing edges will be removed from the set on the post treatment
|
||||
// stage in the UpdateFaceInfo function.
|
||||
BOPDS_ListOfPaveBlock& aLPBC = aVC.ChangeValue(0).ChangePaveBlocks();
|
||||
//
|
||||
Standard_Integer aNbIn1 = aMPBIn1.Extent();
|
||||
for (j = 1; j <= aNbIn1; ++j) {
|
||||
const Handle(BOPDS_PaveBlock)& aPB = aMPBIn1(j);
|
||||
if (aMPBIn2.Contains(aPB) && aMPBAdd.Add(aPB)) {
|
||||
PreparePostTreatFF(i, 0, aPB, aMSCPB, aMVI, aLPBC);
|
||||
}
|
||||
}
|
||||
}
|
||||
}//for (i=0; i<aNbFF; ++i) {
|
||||
|
||||
// Remove "micro" section edges
|
||||
@@ -931,17 +928,10 @@ void BOPAlgo_PaveFiller::PostTreatFF
|
||||
}
|
||||
//
|
||||
// 1 prepare arguments
|
||||
// Avoid intersection of existing edges among themselves
|
||||
TopoDS_Compound anExistingEdges;
|
||||
BRep_Builder().MakeCompound (anExistingEdges);
|
||||
TopTools_MapOfShape anAddedSD;
|
||||
for (k = aNbS; k > 0; --k) {
|
||||
const TopoDS_Shape& aS=theMSCPB.FindKey(k);
|
||||
const Handle(BOPDS_PaveBlock)& aPB = theMSCPB (k).PaveBlock1();
|
||||
if (!aPB.IsNull() && aPB->HasEdge())
|
||||
BRep_Builder().Add (anExistingEdges, aS);
|
||||
else
|
||||
aLS.Append(aS);
|
||||
aLS.Append(aS);
|
||||
// add vertices-candidates for SD from the map aDMNewSD,
|
||||
// so that they took part in fuse operation.
|
||||
TopoDS_Iterator itV(aS);
|
||||
@@ -958,8 +948,6 @@ void BOPAlgo_PaveFiller::PostTreatFF
|
||||
}
|
||||
}
|
||||
}
|
||||
if (anExistingEdges.NbChildren() > 0)
|
||||
aLS.Append (anExistingEdges);
|
||||
//
|
||||
// The section edges considered as a micro should be
|
||||
// specially treated - their vertices should be united and
|
||||
@@ -1041,12 +1029,6 @@ void BOPAlgo_PaveFiller::PostTreatFF
|
||||
aItLS.Initialize(aLS);
|
||||
for (; aItLS.More(); aItLS.Next()) {
|
||||
const TopoDS_Shape& aSx=aItLS.Value();
|
||||
if (aSx.ShapeType() == TopAbs_COMPOUND)
|
||||
{
|
||||
for (TopoDS_Iterator itC (aSx); itC.More(); itC.Next())
|
||||
aLS.Append (itC.Value());
|
||||
continue;
|
||||
}
|
||||
nSx=aPDS->Index(aSx);
|
||||
const BOPDS_ShapeInfo& aSIx=aPDS->ShapeInfo(nSx);
|
||||
//
|
||||
@@ -1614,124 +1596,108 @@ Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
|
||||
const BOPDS_Curve& theNC,
|
||||
const Standard_Real theTolR3D,
|
||||
const BOPDS_IndexedMapOfPaveBlock& theMPBOnIn,
|
||||
BOPTools_BoxTree& thePBTree,
|
||||
const BOPDS_MapOfPaveBlock& theMPBCommon,
|
||||
Handle(BOPDS_PaveBlock)& aPBOut,
|
||||
Standard_Real& theTolNew)
|
||||
{
|
||||
Standard_Boolean bRet;
|
||||
Standard_Real aT1, aT2, aTm, aTx, aTolCheck;
|
||||
Standard_Integer nSp, iFlag1, iFlag2, nV11, nV12, nV21, nV22, i, aNbPB;
|
||||
gp_Pnt aP1, aPm, aP2;
|
||||
Bnd_Box aBoxP1, aBoxPm, aBoxP2, aBoxTmp;
|
||||
//
|
||||
bRet=Standard_False;
|
||||
aTolCheck = theTolR3D + myFuzzyValue;
|
||||
const IntTools_Curve& aIC=theNC.Curve();
|
||||
|
||||
Standard_Real aT1, aT2;
|
||||
//
|
||||
thePB->Range(aT1, aT2);
|
||||
|
||||
Standard_Integer nV11, nV12;
|
||||
thePB->Indices (nV11, nV12);
|
||||
|
||||
//first point
|
||||
Bnd_Box aBoxP1;
|
||||
gp_Pnt aP1;
|
||||
aIC.D0 (aT1, aP1);
|
||||
aBoxP1.Add (aP1);
|
||||
const Standard_Real aTolV11 = BRep_Tool::Tolerance (TopoDS::Vertex (myDS->Shape (nV11)));
|
||||
aBoxP1.Enlarge (aTolV11);
|
||||
|
||||
// Find edges intersecting by AABB with the first point
|
||||
BOPTools_BoxTreeSelector aSelector;
|
||||
aSelector.SetBox (Bnd_Tools::Bnd2BVH (aBoxP1));
|
||||
aSelector.SetBVHSet (&thePBTree);
|
||||
if (!aSelector.Select())
|
||||
return Standard_False;
|
||||
|
||||
//intermediate point
|
||||
Bnd_Box aBoxPm;
|
||||
Standard_Real aTm = IntTools_Tools::IntermediatePoint (aT1, aT2);
|
||||
gp_Pnt aPm;
|
||||
aIC.D0(aTm, aPm);
|
||||
aBoxPm.Add (aPm);
|
||||
|
||||
// last point
|
||||
Bnd_Box aBoxP2;
|
||||
gp_Pnt aP2;
|
||||
aIC.D0 (aT2, aP2);
|
||||
aBoxP2.Add (aP2);
|
||||
const Standard_Real aTolV12 = BRep_Tool::Tolerance (TopoDS::Vertex (myDS->Shape (nV12)));
|
||||
aBoxP2.Enlarge (aTolV12);
|
||||
|
||||
thePB->Indices(nV11, nV12);
|
||||
const Standard_Real aTolV11 = BRep_Tool::Tolerance(TopoDS::Vertex(myDS->Shape(nV11)));
|
||||
const Standard_Real aTolV12 = BRep_Tool::Tolerance(TopoDS::Vertex(myDS->Shape(nV12)));
|
||||
const Standard_Real aTolV1 = Max(aTolV11, aTolV12) + myFuzzyValue;
|
||||
|
||||
Standard_Real aTolCheck = theTolR3D + myFuzzyValue;
|
||||
|
||||
//first point
|
||||
aIC.D0(aT1, aP1);
|
||||
aBoxP1.Add(aP1);
|
||||
aBoxP1.Enlarge(aTolV11);
|
||||
//intermediate point
|
||||
aTm=IntTools_Tools::IntermediatePoint (aT1, aT2);
|
||||
aIC.D0(aTm, aPm);
|
||||
aBoxPm.Add(aPm);
|
||||
//last point
|
||||
aIC.D0(aT2, aP2);
|
||||
aBoxP2.Add(aP2);
|
||||
aBoxP2.Enlarge(aTolV12);
|
||||
//
|
||||
// Look for the existing pave block closest to the section curve
|
||||
Standard_Boolean bFound = Standard_False;
|
||||
theTolNew = ::RealLast();
|
||||
|
||||
for (TColStd_ListOfInteger::Iterator it (aSelector.Indices()); it.More(); it.Next())
|
||||
{
|
||||
const Handle (BOPDS_PaveBlock)& aPB = theMPBOnIn (it.Value());
|
||||
|
||||
Standard_Integer nV21, nV22;
|
||||
aPB->Indices (nV21, nV22);
|
||||
|
||||
const Standard_Real aTolV21 = BRep_Tool::Tolerance (TopoDS::Vertex (myDS->Shape (nV21)));
|
||||
const Standard_Real aTolV22 = BRep_Tool::Tolerance (TopoDS::Vertex (myDS->Shape (nV22)));
|
||||
const Standard_Real aTolV2 = Max (aTolV21, aTolV22) + myFuzzyValue;
|
||||
|
||||
const BOPDS_ShapeInfo& aSISp = myDS->ChangeShapeInfo (aPB->Edge());
|
||||
const TopoDS_Edge& aSp = (*(TopoDS_Edge *)(&aSISp.Shape()));
|
||||
const Bnd_Box& aBoxSp = aSISp.Box();
|
||||
|
||||
Standard_Integer iFlag1 = (nV11 == nV21 || nV11 == nV22) ? 2 : 1;
|
||||
Standard_Integer iFlag2 = (nV12 == nV21 || nV12 == nV22) ? 2 : (!aBoxSp.IsOut (aBoxP2) ? 1 : 0);
|
||||
if (!iFlag2)
|
||||
aNbPB = theMPBOnIn.Extent();
|
||||
for (i = 1; i <= aNbPB; ++i) {
|
||||
const Handle(BOPDS_PaveBlock)& aPB = theMPBOnIn(i);
|
||||
aPB->Indices(nV21, nV22);
|
||||
const Standard_Real aTolV21 = BRep_Tool::Tolerance(TopoDS::Vertex(myDS->Shape(nV21)));
|
||||
const Standard_Real aTolV22 = BRep_Tool::Tolerance(TopoDS::Vertex(myDS->Shape(nV22)));
|
||||
const Standard_Real aTolV2 = Max(aTolV21, aTolV22) + myFuzzyValue;
|
||||
nSp=aPB->Edge();
|
||||
if (nSp < 0)
|
||||
continue;
|
||||
|
||||
Standard_Real aDist = 0.;
|
||||
|
||||
Standard_Real aRealTol = aTolCheck;
|
||||
if (myDS->IsCommonBlock(aPB))
|
||||
{
|
||||
aRealTol = Max(aRealTol, Max(aTolV1, aTolV2));
|
||||
if (theMPBCommon.Contains(aPB))
|
||||
// for an edge, which is a common block with a face,
|
||||
// increase the chance to coincide with section curve
|
||||
aRealTol *= 2.;
|
||||
}
|
||||
|
||||
Bnd_Box aBoxTmp = aBoxPm;
|
||||
aBoxTmp.Enlarge(aRealTol);
|
||||
|
||||
Standard_Real aDistToSp = 0.;
|
||||
Standard_Real aTx;
|
||||
if (aBoxSp.IsOut(aBoxTmp) || myContext->ComputePE(aPm,
|
||||
aRealTol,
|
||||
aSp,
|
||||
aTx, aDistToSp)) {
|
||||
continue;
|
||||
}
|
||||
const BOPDS_ShapeInfo& aSISp=myDS->ChangeShapeInfo(nSp);
|
||||
const TopoDS_Edge& aSp=(*(TopoDS_Edge *)(&aSISp.Shape()));
|
||||
const Bnd_Box& aBoxSp=aSISp.Box();
|
||||
//
|
||||
if (iFlag1 == 1) {
|
||||
iFlag1 = !myContext->ComputePE(aP1, aRealTol, aSp, aTx, aDist);
|
||||
if (iFlag1 && aDistToSp < aDist)
|
||||
aDistToSp = aDist;
|
||||
}
|
||||
//
|
||||
if (iFlag2 == 1) {
|
||||
iFlag2 = !myContext->ComputePE(aP2, aRealTol, aSp, aTx, aDist);
|
||||
if (iFlag2 && aDistToSp < aDist)
|
||||
aDistToSp = aDist;
|
||||
}
|
||||
//
|
||||
if (iFlag1 && iFlag2)
|
||||
{
|
||||
if (aDistToSp < theTolNew)
|
||||
iFlag1 = (nV11 == nV21 || nV11 == nV22) ? 2 :
|
||||
(!aBoxSp.IsOut(aBoxP1) ? 1 : 0);
|
||||
iFlag2 = (nV12 == nV21 || nV12 == nV22) ? 2 :
|
||||
(!aBoxSp.IsOut(aBoxP2) ? 1 : 0);
|
||||
if (iFlag1 && iFlag2) {
|
||||
Standard_Real aDist = 0.;
|
||||
|
||||
Standard_Real aRealTol = aTolCheck;
|
||||
if (myDS->IsCommonBlock(aPB))
|
||||
{
|
||||
aPBOut = aPB;
|
||||
theTolNew = aDistToSp;
|
||||
bFound = Standard_True;
|
||||
aRealTol = Max(aRealTol, Max(aTolV1, aTolV2));
|
||||
if (theMPBCommon.Contains(aPB))
|
||||
// for an edge, which is a common block with a face,
|
||||
// increase the chance to coincide with section curve
|
||||
aRealTol *= 2.;
|
||||
}
|
||||
|
||||
aBoxTmp = aBoxPm;
|
||||
aBoxTmp.Enlarge(aRealTol);
|
||||
|
||||
Standard_Real aDistToSp = 0.;
|
||||
if (aBoxSp.IsOut(aBoxTmp) || myContext->ComputePE(aPm,
|
||||
aRealTol,
|
||||
aSp,
|
||||
aTx, aDistToSp)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
if (iFlag1 == 1) {
|
||||
iFlag1 = !myContext->ComputePE(aP1, aRealTol, aSp, aTx, aDist);
|
||||
if (iFlag1 && aDistToSp < aDist)
|
||||
aDistToSp = aDist;
|
||||
}
|
||||
//
|
||||
if (iFlag2 == 1) {
|
||||
iFlag2 = !myContext->ComputePE(aP2, aRealTol, aSp, aTx, aDist);
|
||||
if (iFlag2 && aDistToSp < aDist)
|
||||
aDistToSp = aDist;
|
||||
}
|
||||
//
|
||||
if (iFlag1 && iFlag2)
|
||||
{
|
||||
if (aDistToSp < theTolNew)
|
||||
{
|
||||
aPBOut = aPB;
|
||||
theTolNew = aDistToSp;
|
||||
bRet = Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return bFound;
|
||||
return bRet;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -2510,96 +2476,6 @@ void BOPAlgo_PaveFiller::PutPaveOnCurve
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ProcessExistingPaveBlocks
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::ProcessExistingPaveBlocks (const Standard_Integer theInt,
|
||||
const Standard_Integer theCur,
|
||||
const Standard_Integer nF1,
|
||||
const Standard_Integer nF2,
|
||||
const TopoDS_Edge& theES,
|
||||
const BOPDS_IndexedMapOfPaveBlock& theMPBOnIn,
|
||||
BOPTools_BoxTree& thePBTree,
|
||||
BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB,
|
||||
TopTools_DataMapOfShapeInteger& theMVI,
|
||||
BOPDS_ListOfPaveBlock& theLPBC,
|
||||
BOPAlgo_DataMapOfPaveBlockListOfInteger& thePBFacesMap,
|
||||
BOPDS_MapOfPaveBlock& theMPB)
|
||||
{
|
||||
Bnd_Box aBoxES;
|
||||
BRepBndLib::Add (theES, aBoxES, false);
|
||||
|
||||
BOPTools_BoxTreeSelector aSelector;
|
||||
aSelector.SetBox (Bnd_Tools::Bnd2BVH (aBoxES));
|
||||
aSelector.SetBVHSet (&thePBTree);
|
||||
if (!aSelector.Select())
|
||||
return;
|
||||
|
||||
const Standard_Real aTolES = BRep_Tool::Tolerance (theES);
|
||||
|
||||
const BOPDS_FaceInfo& aFI1 = myDS->FaceInfo (nF1);
|
||||
const BOPDS_FaceInfo& aFI2 = myDS->FaceInfo (nF2);
|
||||
|
||||
for (TColStd_ListOfInteger::Iterator itPB (aSelector.Indices()); itPB.More(); itPB.Next())
|
||||
{
|
||||
const Handle(BOPDS_PaveBlock)& aPBF = theMPBOnIn (itPB.Value());
|
||||
if (theMPB.Contains (aPBF))
|
||||
continue;
|
||||
|
||||
Standard_Boolean bInF1 = (aFI1.PaveBlocksOn().Contains(aPBF) ||
|
||||
aFI1.PaveBlocksIn().Contains(aPBF));
|
||||
Standard_Boolean bInF2 = (aFI2.PaveBlocksOn().Contains(aPBF) ||
|
||||
aFI2.PaveBlocksIn().Contains(aPBF));
|
||||
if (bInF1 && bInF2)
|
||||
{
|
||||
// Add all common edges for post treatment
|
||||
theMPB.Add (aPBF);
|
||||
PreparePostTreatFF (theInt, theCur, aPBF, theMSCPB, theMVI, theLPBC);
|
||||
continue;
|
||||
}
|
||||
|
||||
const Standard_Integer nF = bInF1 ? nF2 : nF1;
|
||||
const NCollection_List<EdgeRangeDistance>* pList = myDistances.Seek (BOPDS_Pair (aPBF->OriginalEdge(), nF));
|
||||
if (!pList)
|
||||
continue;
|
||||
|
||||
Standard_Real aT1, aT2;
|
||||
aPBF->Range (aT1, aT2);
|
||||
|
||||
Standard_Real aDist = RealLast();
|
||||
for (NCollection_List<EdgeRangeDistance>::Iterator itR (*pList); itR.More(); itR.Next())
|
||||
{
|
||||
const EdgeRangeDistance& aRangeDist = itR.Value();
|
||||
if ((aT1 <= aRangeDist.First && aRangeDist.First <= aT2) ||
|
||||
(aT1 <= aRangeDist.Last && aRangeDist.Last <= aT2) ||
|
||||
(aRangeDist.First <= aT1 && aT1 <= aRangeDist.Last) ||
|
||||
(aRangeDist.First <= aT2 && aT2 <= aRangeDist.Last))
|
||||
{
|
||||
aDist = aRangeDist.Distance;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (aDist < RealLast())
|
||||
{
|
||||
const TopoDS_Edge& aEF = TopoDS::Edge (myDS->Shape (aPBF->Edge()));
|
||||
const Standard_Real aTolSum = aTolES + BRep_Tool::Tolerance (aEF);
|
||||
|
||||
if (aDist <= aTolSum)
|
||||
{
|
||||
theMPB.Add (aPBF);
|
||||
PreparePostTreatFF (theInt, theCur, aPBF, theMSCPB, theMVI, theLPBC);
|
||||
|
||||
TColStd_ListOfInteger* pFaces = thePBFacesMap.ChangeSeek(aPBF);
|
||||
if (!pFaces)
|
||||
pFaces = thePBFacesMap.Bound (aPBF, TColStd_ListOfInteger());
|
||||
if (pFaces->IsEmpty() || !pFaces->Contains (nF))
|
||||
pFaces->Append (nF);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ProcessExistingPaveBlocks
|
||||
//purpose :
|
||||
@@ -2609,7 +2485,6 @@ void BOPAlgo_PaveFiller::ProcessExistingPaveBlocks
|
||||
const Standard_Integer nF1,
|
||||
const Standard_Integer nF2,
|
||||
const BOPDS_IndexedMapOfPaveBlock& aMPBOnIn,
|
||||
BOPTools_BoxTree& thePBTree,
|
||||
const TColStd_DataMapOfIntegerListOfInteger& aDMBV,
|
||||
BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& aMSCPB,
|
||||
TopTools_DataMapOfShapeInteger& aMVI,
|
||||
@@ -2621,7 +2496,7 @@ void BOPAlgo_PaveFiller::ProcessExistingPaveBlocks
|
||||
}
|
||||
//
|
||||
Standard_Real aT, dummy;
|
||||
Standard_Integer nV, nE, iC, iFlag;
|
||||
Standard_Integer i, nV, nE, iC, aNbPB, iFlag;
|
||||
TColStd_ListIteratorOfListOfInteger aItLI;
|
||||
TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger aItBV;
|
||||
//
|
||||
@@ -2632,6 +2507,8 @@ void BOPAlgo_PaveFiller::ProcessExistingPaveBlocks
|
||||
const BOPDS_FaceInfo& aFI1 = myDS->FaceInfo(nF1);
|
||||
const BOPDS_FaceInfo& aFI2 = myDS->FaceInfo(nF2);
|
||||
//
|
||||
aNbPB = aMPBOnIn.Extent();
|
||||
//
|
||||
aItBV.Initialize(aDMBV);
|
||||
for (; aItBV.More(); aItBV.Next()) {
|
||||
iC = aItBV.Key();
|
||||
@@ -2650,15 +2527,8 @@ void BOPAlgo_PaveFiller::ProcessExistingPaveBlocks
|
||||
continue;
|
||||
}
|
||||
//
|
||||
BOPTools_BoxTreeSelector aSelector;
|
||||
aSelector.SetBox (Bnd_Tools::Bnd2BVH (aBoxV));
|
||||
aSelector.SetBVHSet (&thePBTree);
|
||||
if (!aSelector.Select())
|
||||
continue;
|
||||
|
||||
for (TColStd_ListOfInteger::Iterator it (aSelector.Indices()); it.More(); it.Next())
|
||||
{
|
||||
const Handle(BOPDS_PaveBlock)& aPB = aMPBOnIn (it.Value());
|
||||
for (i = 1; i <= aNbPB; ++i) {
|
||||
const Handle(BOPDS_PaveBlock)& aPB = aMPBOnIn(i);
|
||||
if (aPB->Pave1().Index() == nV || aPB->Pave2().Index() == nV) {
|
||||
continue;
|
||||
}
|
||||
@@ -2666,8 +2536,18 @@ void BOPAlgo_PaveFiller::ProcessExistingPaveBlocks
|
||||
if (aMPB.Contains(aPB)) {
|
||||
continue;
|
||||
}
|
||||
if (myDS->ShapeInfo(aPB->OriginalEdge()).HasFlag()) { // skip degenerated edges
|
||||
continue;
|
||||
}
|
||||
//
|
||||
nE = aPB->Edge();
|
||||
const BOPDS_ShapeInfo& aSIE = myDS->ShapeInfo(nE);
|
||||
const Bnd_Box& aBoxE = aSIE.Box();
|
||||
//
|
||||
if (aBoxV.IsOut(aBoxE)) {
|
||||
continue;
|
||||
}
|
||||
//
|
||||
const TopoDS_Edge& aE = *(TopoDS_Edge*)&aSIE.Shape();
|
||||
//
|
||||
iFlag = myContext->ComputeVE(aV, aE, aT, dummy, myFuzzyValue);
|
||||
@@ -3370,7 +3250,6 @@ void BOPAlgo_PaveFiller::UpdateBlocksWithSharedVertices()
|
||||
aTolV=BRep_Tool::Tolerance(aV);
|
||||
//
|
||||
UpdateVertex(nV, aTolV);
|
||||
myDS->InitPaveBlocksForVertex (nV);
|
||||
}
|
||||
}//for (j=0; j<aNbC; ++j) {
|
||||
}//for (i=0; i<aNbFF; ++i) {
|
||||
|
@@ -786,7 +786,7 @@ Standard_Integer NbWaysOut(const BOPAlgo_ListOfEdgeInfo& aLEInfo)
|
||||
//for case chl/927/r9
|
||||
aTX=0.05*(aLast - aFirst);//aTX=0.25*(aLast - aFirst);
|
||||
if (aTX < 5.e-5) {
|
||||
aTX = Min (5.e-5, (aLast - aFirst) / 2.);
|
||||
aTX = 5.e-5;
|
||||
}
|
||||
if(dt > aTX) {
|
||||
// to save direction of the curve as much as it possible
|
||||
|
@@ -825,8 +825,7 @@ Standard_Boolean BOPTools_AlgoTools::IsInternalFace
|
||||
const TopoDS_Face& aF2=(*(TopoDS_Face*)(&aLF.Last()));
|
||||
iRet=BOPTools_AlgoTools::IsInternalFace(theFace, aE, aF1, aF2,
|
||||
theContext);
|
||||
if (iRet != 2)
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}//for(; aExp.More(); aExp.Next()) {
|
||||
//
|
||||
@@ -902,6 +901,8 @@ Standard_Integer BOPTools_AlgoTools::IsInternalFace
|
||||
const TopoDS_Face& theFace2,
|
||||
const Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
Standard_Boolean bRet;
|
||||
Standard_Integer iRet;
|
||||
TopoDS_Edge aE1, aE2;
|
||||
TopoDS_Face aFOff;
|
||||
BOPTools_ListOfCoupleOfShape theLCSOff;
|
||||
@@ -930,15 +931,17 @@ Standard_Integer BOPTools_AlgoTools::IsInternalFace
|
||||
aCS2.SetShape2(theFace2);
|
||||
theLCSOff.Append(aCS2);
|
||||
//
|
||||
Standard_Integer iRet = 0; // theFace is not internal
|
||||
Standard_Boolean isDone = GetFaceOff (aE1, theFace1, theLCSOff, aFOff, theContext);
|
||||
if (!isDone)
|
||||
// error, unable to classify face by this edge
|
||||
iRet = 2;
|
||||
else if (theFace.IsEqual (aFOff))
|
||||
bRet=GetFaceOff(aE1, theFace1, theLCSOff, aFOff, theContext);
|
||||
//
|
||||
iRet=0; // theFace is not internal
|
||||
if (theFace.IsEqual(aFOff)) {
|
||||
// theFace is internal
|
||||
iRet = 1;
|
||||
|
||||
iRet=1;
|
||||
if (!bRet) {
|
||||
// theFace seems to be internal
|
||||
iRet=2;
|
||||
}
|
||||
}
|
||||
return iRet;
|
||||
}
|
||||
//=======================================================================
|
||||
@@ -954,7 +957,7 @@ Standard_Boolean BOPTools_AlgoTools::GetFaceOff
|
||||
{
|
||||
Standard_Boolean bRet, bIsComputed;
|
||||
Standard_Real aT, aT1, aT2, aAngle, aTwoPI, aAngleMin, aDt3D;
|
||||
Standard_Real aUmin, aUsup, aVmin, aVsup;
|
||||
Standard_Real aUmin, aUsup, aVmin, aVsup, aPA;
|
||||
gp_Pnt aPn1, aPn2, aPx;
|
||||
gp_Dir aDN1, aDN2, aDBF, aDBF2, aDTF;
|
||||
gp_Vec aVTgt;
|
||||
@@ -964,6 +967,7 @@ Standard_Boolean BOPTools_AlgoTools::GetFaceOff
|
||||
BOPTools_ListIteratorOfListOfCoupleOfShape aIt;
|
||||
GeomAPI_ProjectPointOnSurf aProjPL;
|
||||
//
|
||||
aPA=Precision::Angular();
|
||||
aAngleMin=100.;
|
||||
aTwoPI=M_PI+M_PI;
|
||||
aC3D =BRep_Tool::Curve(theE1, aT1, aT2);
|
||||
@@ -990,10 +994,6 @@ Standard_Boolean BOPTools_AlgoTools::GetFaceOff
|
||||
//
|
||||
aDTF=aDN1^aDBF;
|
||||
//
|
||||
// The difference between faces should be obvious enough
|
||||
// to guarantee the correctness of the classification
|
||||
Standard_Real anAngleCriteria = Precision::Confusion();
|
||||
|
||||
bRet=Standard_True;
|
||||
aIt.Initialize(theLCSOff);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
@@ -1012,7 +1012,11 @@ Standard_Boolean BOPTools_AlgoTools::GetFaceOff
|
||||
//Angle
|
||||
aAngle=AngleWithRef(aDBF, aDBF2, aDTF);
|
||||
//
|
||||
if (Abs(aAngle) < Precision::Angular()) {
|
||||
if(aAngle<0.) {
|
||||
aAngle=aTwoPI+aAngle;
|
||||
}
|
||||
//
|
||||
if (aAngle<aPA) {
|
||||
if (aF2==theF1) {
|
||||
aAngle=M_PI;
|
||||
}
|
||||
@@ -1021,21 +1025,19 @@ Standard_Boolean BOPTools_AlgoTools::GetFaceOff
|
||||
}
|
||||
}
|
||||
//
|
||||
if (Abs(aAngle) < anAngleCriteria ||
|
||||
Abs (aAngle-aAngleMin) < anAngleCriteria) {
|
||||
if (fabs(aAngle-aAngleMin)<aPA) {
|
||||
// the minimal angle can not be found
|
||||
bRet=Standard_False;
|
||||
}
|
||||
//
|
||||
if (aAngle < 0.)
|
||||
{
|
||||
aAngle = aTwoPI + aAngle;
|
||||
}
|
||||
//
|
||||
if (aAngle<aAngleMin){
|
||||
aAngleMin=aAngle;
|
||||
theFOff=aF2;
|
||||
}
|
||||
else if (aAngle==aAngleMin) {
|
||||
// the minimal angle can not be found
|
||||
bRet=Standard_False;
|
||||
}
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
|
@@ -154,7 +154,7 @@ void BRepExtrema_DistShapeShape::DistanceMapMap (const TopTools_IndexedMapOfShap
|
||||
const TopoDS_Shape& aShape1 = theMap1 (aPair.Index1);
|
||||
const TopoDS_Shape& aShape2 = theMap2 (aPair.Index2);
|
||||
|
||||
BRepExtrema_DistanceSS aDistTool (aShape1, aShape2, aBox1, aBox2, myDistRef, myEps);
|
||||
BRepExtrema_DistanceSS aDistTool (aShape1, aShape2, aBox1, aBox2, myDistRef, myEps, myFlag);
|
||||
if (aDistTool.IsDone())
|
||||
{
|
||||
if (aDistTool.DistValue() < myDistRef - myEps)
|
||||
@@ -199,8 +199,7 @@ BRepExtrema_DistShapeShape::BRepExtrema_DistShapeShape()
|
||||
myEps (Precision::Confusion()),
|
||||
myIsInitS1 (Standard_False),
|
||||
myIsInitS2 (Standard_False),
|
||||
myFlag (Extrema_ExtFlag_MINMAX),
|
||||
myAlgo (Extrema_ExtAlgo_Grad)
|
||||
myFlag (Extrema_ExtFlag_MINMAX)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -211,16 +210,14 @@ BRepExtrema_DistShapeShape::BRepExtrema_DistShapeShape()
|
||||
//=======================================================================
|
||||
BRepExtrema_DistShapeShape::BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,
|
||||
const TopoDS_Shape& Shape2,
|
||||
const Extrema_ExtFlag F,
|
||||
const Extrema_ExtAlgo A)
|
||||
const Extrema_ExtFlag F)
|
||||
: myDistRef (0.0),
|
||||
myIsDone (Standard_False),
|
||||
myInnerSol (Standard_False),
|
||||
myEps (Precision::Confusion()),
|
||||
myIsInitS1 (Standard_False),
|
||||
myIsInitS2 (Standard_False),
|
||||
myFlag (F),
|
||||
myAlgo (A)
|
||||
myFlag (F)
|
||||
{
|
||||
LoadS1(Shape1);
|
||||
LoadS2(Shape2);
|
||||
@@ -235,16 +232,14 @@ BRepExtrema_DistShapeShape::BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape
|
||||
BRepExtrema_DistShapeShape::BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,
|
||||
const TopoDS_Shape& Shape2,
|
||||
const Standard_Real theDeflection,
|
||||
const Extrema_ExtFlag F,
|
||||
const Extrema_ExtAlgo A)
|
||||
const Extrema_ExtFlag F)
|
||||
: myDistRef (0.0),
|
||||
myIsDone (Standard_False),
|
||||
myInnerSol (Standard_False),
|
||||
myEps (theDeflection),
|
||||
myIsInitS1 (Standard_False),
|
||||
myIsInitS2 (Standard_False),
|
||||
myFlag (F),
|
||||
myAlgo (A)
|
||||
myFlag (F)
|
||||
{
|
||||
LoadS1(Shape1);
|
||||
LoadS2(Shape2);
|
||||
|
@@ -18,7 +18,6 @@
|
||||
#include <BRepExtrema_SeqOfSolution.hxx>
|
||||
#include <BRepExtrema_SolutionElem.hxx>
|
||||
#include <BRepExtrema_SupportType.hxx>
|
||||
#include <Extrema_ExtAlgo.hxx>
|
||||
#include <Extrema_ExtFlag.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
@@ -39,9 +38,9 @@ class BRepExtrema_DistShapeShape
|
||||
Standard_EXPORT BRepExtrema_DistShapeShape();
|
||||
//! computation of the minimum distance (value and pair of points) using default deflection <br>
|
||||
//! Default value is Precision::Confusion(). <br>
|
||||
Standard_EXPORT BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,const TopoDS_Shape& Shape2,const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX,const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad);
|
||||
Standard_EXPORT BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,const TopoDS_Shape& Shape2,const Extrema_ExtFlag F = Extrema_ExtFlag_MIN);
|
||||
//! create tool and load both shapes into it <br>
|
||||
Standard_EXPORT BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,const TopoDS_Shape& Shape2,const Standard_Real theDeflection,const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX,const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad);
|
||||
Standard_EXPORT BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,const TopoDS_Shape& Shape2,const Standard_Real theDeflection,const Extrema_ExtFlag F = Extrema_ExtFlag_MIN);
|
||||
|
||||
void SetDeflection(const Standard_Real theDeflection)
|
||||
{
|
||||
@@ -129,11 +128,6 @@ class BRepExtrema_DistShapeShape
|
||||
myFlag = F;
|
||||
}
|
||||
|
||||
void SetAlgo(const Extrema_ExtAlgo A)
|
||||
{
|
||||
myAlgo = A;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
//! computes the minimum distance between two maps of shapes (Face,Edge,Vertex) <br>
|
||||
@@ -156,7 +150,6 @@ private:
|
||||
Standard_Boolean myIsInitS1;
|
||||
Standard_Boolean myIsInitS2;
|
||||
Extrema_ExtFlag myFlag;
|
||||
Extrema_ExtAlgo myAlgo;
|
||||
Bnd_SeqOfBox myBV1;
|
||||
Bnd_SeqOfBox myBV2;
|
||||
Bnd_SeqOfBox myBE1;
|
||||
|
@@ -772,7 +772,7 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Vertex& S1, const TopoDS_Face&
|
||||
const Standard_Real Dst=B1.Distance(B2);
|
||||
if ((Dst < myDstRef - myEps) || (fabs(Dst-myDstRef) < myEps))
|
||||
{
|
||||
BRepExtrema_ExtPF Ext(S1,S2,myFlag,myAlgo);
|
||||
BRepExtrema_ExtPF Ext(S1,S2,myFlag);
|
||||
const Standard_Integer NbExtrema = Ext.IsDone()? Ext.NbExt() : 0;
|
||||
if ( NbExtrema > 0 )
|
||||
{
|
||||
@@ -828,7 +828,7 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Face& S1, const TopoDS_Vertex&
|
||||
const Standard_Real Dst=B1.Distance(B2);
|
||||
if ((Dst < myDstRef - myEps) || (fabs(Dst-myDstRef) < myEps))
|
||||
{
|
||||
BRepExtrema_ExtPF Ext(S2,S1,myFlag,myAlgo);
|
||||
BRepExtrema_ExtPF Ext(S2,S1,myFlag);
|
||||
const Standard_Integer NbExtrema = Ext.IsDone()? Ext.NbExt() : 0;
|
||||
if ( NbExtrema > 0 )
|
||||
{
|
||||
|
@@ -16,7 +16,6 @@
|
||||
|
||||
#include <BRepExtrema_SeqOfSolution.hxx>
|
||||
#include <Extrema_ExtFlag.hxx>
|
||||
#include <Extrema_ExtAlgo.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
|
||||
@@ -39,9 +38,8 @@ class BRepExtrema_DistanceSS
|
||||
BRepExtrema_DistanceSS(const TopoDS_Shape& S1, const TopoDS_Shape& S2,
|
||||
const Bnd_Box& B1, const Bnd_Box& B2,
|
||||
const Standard_Real DstRef,
|
||||
const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX,
|
||||
const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad)
|
||||
: myDstRef(DstRef), myModif(Standard_False), myEps(Precision::Confusion()), myFlag(F), myAlgo(A)
|
||||
const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX)
|
||||
: myDstRef(DstRef), myModif(Standard_False), myEps(Precision::Confusion()), myFlag(F)
|
||||
{
|
||||
Perform(S1, S2, B1, B2);
|
||||
}
|
||||
@@ -52,9 +50,8 @@ class BRepExtrema_DistanceSS
|
||||
BRepExtrema_DistanceSS(const TopoDS_Shape& S1, const TopoDS_Shape& S2,
|
||||
const Bnd_Box& B1, const Bnd_Box& B2,
|
||||
const Standard_Real DstRef, const Standard_Real aDeflection,
|
||||
const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX,
|
||||
const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad)
|
||||
: myDstRef(DstRef), myModif(Standard_False), myEps(aDeflection), myFlag(F), myAlgo(A)
|
||||
const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX)
|
||||
: myDstRef(DstRef), myModif(Standard_False), myEps(aDeflection), myFlag(F)
|
||||
{
|
||||
Perform(S1, S2, B1, B2);
|
||||
}
|
||||
@@ -83,11 +80,6 @@ class BRepExtrema_DistanceSS
|
||||
{
|
||||
myFlag = F;
|
||||
}
|
||||
//! sets the flag controlling ...
|
||||
void SetAlgo(const Extrema_ExtAlgo A)
|
||||
{
|
||||
myAlgo = A;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -130,7 +122,6 @@ class BRepExtrema_DistanceSS
|
||||
Standard_Boolean myModif;
|
||||
Standard_Real myEps;
|
||||
Extrema_ExtFlag myFlag;
|
||||
Extrema_ExtAlgo myAlgo;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -32,9 +32,9 @@
|
||||
//=======================================================================
|
||||
|
||||
BRepExtrema_ExtPF::BRepExtrema_ExtPF(const TopoDS_Vertex& TheVertex, const TopoDS_Face& TheFace,
|
||||
const Extrema_ExtFlag TheFlag, const Extrema_ExtAlgo TheAlgo)
|
||||
const Extrema_ExtFlag TheFlag)
|
||||
{
|
||||
Initialize(TheFace,TheFlag,TheAlgo);
|
||||
Initialize(TheFace,TheFlag);
|
||||
Perform(TheVertex,TheFace);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ BRepExtrema_ExtPF::BRepExtrema_ExtPF(const TopoDS_Vertex& TheVertex, const TopoD
|
||||
//=======================================================================
|
||||
|
||||
void BRepExtrema_ExtPF::Initialize(const TopoDS_Face& TheFace,
|
||||
const Extrema_ExtFlag TheFlag, const Extrema_ExtAlgo TheAlgo)
|
||||
const Extrema_ExtFlag TheFlag)
|
||||
{
|
||||
// cette surface doit etre en champ. Extrema ne fait
|
||||
// pas de copie et prend seulement un pointeur dessus.
|
||||
@@ -60,7 +60,6 @@ void BRepExtrema_ExtPF::Initialize(const TopoDS_Face& TheFace,
|
||||
Standard_Real U1, U2, V1, V2;
|
||||
BRepTools::UVBounds(TheFace, U1, U2, V1, V2);
|
||||
myExtPS.SetFlag(TheFlag);
|
||||
myExtPS.SetAlgo(TheAlgo);
|
||||
myExtPS.Initialize(mySurf, U1, U2, V1, V2, aTolU, aTolV);
|
||||
}
|
||||
|
||||
|
@@ -21,7 +21,6 @@
|
||||
#include <Extrema_SequenceOfPOnSurf.hxx>
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
#include <Extrema_ExtFlag.hxx>
|
||||
#include <Extrema_ExtAlgo.hxx>
|
||||
|
||||
class TopoDS_Vertex;
|
||||
class TopoDS_Face;
|
||||
@@ -38,12 +37,10 @@ class BRepExtrema_ExtPF
|
||||
{}
|
||||
//! It calculates all the distances. <br>
|
||||
Standard_EXPORT BRepExtrema_ExtPF(const TopoDS_Vertex& TheVertex,const TopoDS_Face& TheFace,
|
||||
const Extrema_ExtFlag TheFlag = Extrema_ExtFlag_MINMAX,
|
||||
const Extrema_ExtAlgo TheAlgo = Extrema_ExtAlgo_Grad);
|
||||
const Extrema_ExtFlag TheFlag = Extrema_ExtFlag_MINMAX);
|
||||
|
||||
Standard_EXPORT void Initialize(const TopoDS_Face& TheFace,
|
||||
const Extrema_ExtFlag TheFlag = Extrema_ExtFlag_MINMAX,
|
||||
const Extrema_ExtAlgo TheAlgo = Extrema_ExtAlgo_Grad);
|
||||
const Extrema_ExtFlag TheFlag = Extrema_ExtFlag_MINMAX);
|
||||
|
||||
//! An exception is raised if the fields have not been initialized. <br>
|
||||
//! Be careful: this method uses the Face only for classify not for the fields. <br>
|
||||
@@ -79,11 +76,6 @@ class BRepExtrema_ExtPF
|
||||
myExtPS.SetFlag(F);
|
||||
}
|
||||
|
||||
void SetAlgo(const Extrema_ExtAlgo A)
|
||||
{
|
||||
myExtPS.SetAlgo(A);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Extrema_ExtPS myExtPS;
|
||||
|
@@ -23,6 +23,7 @@
|
||||
#include <BRepLib_MakeFace.hxx>
|
||||
#include <BRepTools_WireExplorer.hxx>
|
||||
#include <BRepTopAdaptor_FClass2d.hxx>
|
||||
#include <GCPnts.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
#include <Geom_BezierCurve.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
@@ -181,39 +182,6 @@ BRepLib_FindSurface::BRepLib_FindSurface(const TopoDS_Shape& S,
|
||||
|
||||
namespace
|
||||
{
|
||||
static void fillParams (const TColStd_Array1OfReal& theKnots,
|
||||
Standard_Integer theDegree,
|
||||
Standard_Real theParMin,
|
||||
Standard_Real theParMax,
|
||||
NCollection_Vector<Standard_Real>& theParams)
|
||||
{
|
||||
Standard_Real aPrevPar = theParMin;
|
||||
theParams.Append (aPrevPar);
|
||||
|
||||
Standard_Integer aNbP = Max (theDegree, 1);
|
||||
|
||||
for (Standard_Integer i = 1;
|
||||
(i < theKnots.Length()) && (theKnots (i) < (theParMax - Precision::PConfusion())); ++i)
|
||||
{
|
||||
if (theKnots (i + 1) < theParMin + Precision::PConfusion())
|
||||
continue;
|
||||
|
||||
Standard_Real aStep = (theKnots (i + 1) - theKnots (i)) / aNbP;
|
||||
for (Standard_Integer k = 1; k <= aNbP ; ++k)
|
||||
{
|
||||
Standard_Real aPar = theKnots (i) + k * aStep;
|
||||
if (aPar > theParMax - Precision::PConfusion())
|
||||
break;
|
||||
|
||||
if (aPar > aPrevPar + Precision::PConfusion())
|
||||
{
|
||||
theParams.Append (aPar);
|
||||
aPrevPar = aPar;
|
||||
}
|
||||
}
|
||||
}
|
||||
theParams.Append (theParMax);
|
||||
}
|
||||
|
||||
static void fillPoints (const BRepAdaptor_Curve& theCurve,
|
||||
const NCollection_Vector<Standard_Real> theParams,
|
||||
@@ -361,13 +329,13 @@ void BRepLib_FindSurface::Init(const TopoDS_Shape& S,
|
||||
aKnots.SetValue (1, GC->FirstParameter());
|
||||
aKnots.SetValue (2, GC->LastParameter());
|
||||
|
||||
fillParams (aKnots, GC->Degree(), dfUf, dfUl, aParams);
|
||||
GCPnts::FillParams (aKnots, GC->Degree(), dfUf, dfUl, aParams);
|
||||
break;
|
||||
}
|
||||
case GeomAbs_BSplineCurve:
|
||||
{
|
||||
Handle(Geom_BSplineCurve) GC = c.BSpline();
|
||||
fillParams (GC->Knots(), GC->Degree(), dfUf, dfUl, aParams);
|
||||
GCPnts::FillParams (GC->Knots(), GC->Degree(), dfUf, dfUl, aParams);
|
||||
break;
|
||||
}
|
||||
case GeomAbs_Line:
|
||||
@@ -394,7 +362,7 @@ void BRepLib_FindSurface::Init(const TopoDS_Shape& S,
|
||||
aBounds.SetValue (1, dfUf);
|
||||
aBounds.SetValue (2, dfUl);
|
||||
|
||||
fillParams (aBounds, iNbPoints - 1, dfUf, dfUl, aParams);
|
||||
GCPnts::FillParams (aBounds, iNbPoints - 1, dfUf, dfUl, aParams);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -46,8 +46,7 @@ BRepMesh_BaseMeshAlgo::~BRepMesh_BaseMeshAlgo()
|
||||
//=======================================================================
|
||||
void BRepMesh_BaseMeshAlgo::Perform(
|
||||
const IMeshData::IFaceHandle& theDFace,
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Message_ProgressRange& theRange)
|
||||
const IMeshTools_Parameters& theParameters)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -62,11 +61,7 @@ void BRepMesh_BaseMeshAlgo::Perform(
|
||||
|
||||
if (initDataStructure())
|
||||
{
|
||||
if (!theRange.More())
|
||||
{
|
||||
return;
|
||||
}
|
||||
generateMesh(theRange);
|
||||
generateMesh();
|
||||
commitSurfaceTriangulation();
|
||||
}
|
||||
}
|
||||
|
@@ -42,8 +42,7 @@ public:
|
||||
//! Performs processing of the given face.
|
||||
Standard_EXPORT virtual void Perform(
|
||||
const IMeshData::IFaceHandle& theDFace,
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
|
||||
const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_BaseMeshAlgo, IMeshTools_MeshAlgo)
|
||||
|
||||
@@ -104,7 +103,7 @@ protected:
|
||||
Standard_EXPORT virtual Standard_Boolean initDataStructure();
|
||||
|
||||
//! Generates mesh for the contour stored in data structure.
|
||||
Standard_EXPORT virtual void generateMesh(const Message_ProgressRange& theRange) = 0;
|
||||
Standard_EXPORT virtual void generateMesh() = 0;
|
||||
|
||||
private:
|
||||
|
||||
|
@@ -52,8 +52,7 @@ protected:
|
||||
//! Perfroms processing of generated mesh.
|
||||
//! By default does nothing.
|
||||
//! Expected to be called from method generateMesh() in successor classes.
|
||||
virtual void postProcessMesh (BRepMesh_Delaun& /*theMesher*/,
|
||||
const Message_ProgressRange& /*theRange*/)
|
||||
virtual void postProcessMesh (BRepMesh_Delaun& /*theMesher*/)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
@@ -370,7 +370,7 @@ void BRepMesh_Delaun::compute(IMeshData::VectorOfInteger& theVertexIndexes)
|
||||
createTriangles( theVertexIndexes( anVertexIdx ), aLoopEdges );
|
||||
|
||||
// Add other nodes to the mesh
|
||||
createTrianglesOnNewVertices (theVertexIndexes, Message_ProgressRange());
|
||||
createTrianglesOnNewVertices( theVertexIndexes );
|
||||
}
|
||||
|
||||
// Destruction of triangles containing a top of the super triangle
|
||||
@@ -523,8 +523,7 @@ void BRepMesh_Delaun::createTriangles(const Standard_Integer theVertexI
|
||||
//purpose : Creation of triangles from the new nodes
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::createTrianglesOnNewVertices(
|
||||
IMeshData::VectorOfInteger& theVertexIndexes,
|
||||
const Message_ProgressRange& theRange)
|
||||
IMeshData::VectorOfInteger& theVertexIndexes)
|
||||
{
|
||||
Handle(NCollection_IncAllocator) aAllocator =
|
||||
new NCollection_IncAllocator(IMeshData::MEMORY_BLOCK_SIZE_HUGE);
|
||||
@@ -538,13 +537,8 @@ void BRepMesh_Delaun::createTrianglesOnNewVertices(
|
||||
|
||||
Standard_Integer anIndex = theVertexIndexes.Lower();
|
||||
Standard_Integer anUpper = theVertexIndexes.Upper();
|
||||
Message_ProgressScope aPS(theRange, "Create triangles on new vertices", anUpper);
|
||||
for (; anIndex <= anUpper; ++anIndex, aPS.Next())
|
||||
for( ; anIndex <= anUpper; ++anIndex )
|
||||
{
|
||||
if (!aPS.More())
|
||||
{
|
||||
return;
|
||||
}
|
||||
aAllocator->Reset(Standard_False);
|
||||
IMeshData::MapOfIntegerInteger aLoopEdges(10, aAllocator);
|
||||
|
||||
@@ -2213,14 +2207,13 @@ void BRepMesh_Delaun::RemoveVertex( const BRepMesh_Vertex& theVertex )
|
||||
//function : AddVertices
|
||||
//purpose : Adds some vertices in the triangulation.
|
||||
//=======================================================================
|
||||
void BRepMesh_Delaun::AddVertices(IMeshData::VectorOfInteger& theVertices,
|
||||
const Message_ProgressRange& theRange)
|
||||
void BRepMesh_Delaun::AddVertices(IMeshData::VectorOfInteger& theVertices)
|
||||
{
|
||||
ComparatorOfIndexedVertexOfDelaun aCmp(myMeshData);
|
||||
std::make_heap(theVertices.begin(), theVertices.end(), aCmp);
|
||||
std::sort_heap(theVertices.begin(), theVertices.end(), aCmp);
|
||||
|
||||
createTrianglesOnNewVertices(theVertices, theRange);
|
||||
createTrianglesOnNewVertices(theVertices);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -29,7 +29,6 @@
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TColStd_SequenceOfInteger.hxx>
|
||||
#include <TColStd_MapOfInteger.hxx>
|
||||
#include <Message_ProgressRange.hxx>
|
||||
|
||||
class Bnd_B2d;
|
||||
class Bnd_Box2d;
|
||||
@@ -76,8 +75,7 @@ public:
|
||||
Standard_EXPORT void RemoveVertex (const BRepMesh_Vertex& theVertex);
|
||||
|
||||
//! Adds some vertices into the triangulation.
|
||||
Standard_EXPORT void AddVertices (IMeshData::VectorOfInteger& theVerticesIndices,
|
||||
const Message_ProgressRange& theRange = Message_ProgressRange());
|
||||
Standard_EXPORT void AddVertices (IMeshData::VectorOfInteger& theVerticesIndices);
|
||||
|
||||
//! Modify mesh to use the edge.
|
||||
//! @return True if done
|
||||
@@ -286,8 +284,7 @@ private:
|
||||
IMeshData::SequenceOfBndB2d& thePolyBoxes);
|
||||
|
||||
//! Creates the triangles on new nodes.
|
||||
void createTrianglesOnNewVertices (IMeshData::VectorOfInteger& theVertexIndices,
|
||||
const Message_ProgressRange& theRange);
|
||||
void createTrianglesOnNewVertices (IMeshData::VectorOfInteger& theVertexIndices);
|
||||
|
||||
//! Cleanup mesh from the free triangles.
|
||||
void cleanupMesh();
|
||||
|
@@ -37,7 +37,7 @@ BRepMesh_DelaunayBaseMeshAlgo::~BRepMesh_DelaunayBaseMeshAlgo()
|
||||
//function : generateMesh
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_DelaunayBaseMeshAlgo::generateMesh(const Message_ProgressRange& theRange)
|
||||
void BRepMesh_DelaunayBaseMeshAlgo::generateMesh()
|
||||
{
|
||||
const Handle(BRepMesh_DataStructureOfDelaun)& aStructure = getStructure();
|
||||
const Handle(VectorOfPnt)& aNodesMap = getNodesMap();
|
||||
@@ -53,9 +53,5 @@ void BRepMesh_DelaunayBaseMeshAlgo::generateMesh(const Message_ProgressRange& th
|
||||
BRepMesh_MeshTool aCleaner(aStructure);
|
||||
aCleaner.EraseFreeLinks();
|
||||
|
||||
if (!theRange.More())
|
||||
{
|
||||
return;
|
||||
}
|
||||
postProcessMesh(aMesher, theRange);
|
||||
postProcessMesh(aMesher);
|
||||
}
|
||||
|
@@ -40,7 +40,7 @@ public:
|
||||
protected:
|
||||
|
||||
//! Generates mesh for the contour stored in data structure.
|
||||
Standard_EXPORT virtual void generateMesh (const Message_ProgressRange& theRange) Standard_OVERRIDE;
|
||||
Standard_EXPORT virtual void generateMesh() Standard_OVERRIDE;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -47,32 +47,21 @@ public:
|
||||
protected:
|
||||
|
||||
//! Perfroms processing of generated mesh. Generates surface nodes and inserts them into structure.
|
||||
virtual void postProcessMesh (BRepMesh_Delaun& theMesher,
|
||||
const Message_ProgressRange& theRange) Standard_OVERRIDE
|
||||
virtual void postProcessMesh(BRepMesh_Delaun& theMesher) Standard_OVERRIDE
|
||||
{
|
||||
Message_ProgressScope aPS(theRange, "Post process mesh", 2);
|
||||
// Insert surface nodes.
|
||||
DelaunayInsertionBaseClass::postProcessMesh (theMesher, aPS.Next());
|
||||
if (!aPS.More())
|
||||
{
|
||||
return;
|
||||
}
|
||||
DelaunayInsertionBaseClass::postProcessMesh(theMesher);
|
||||
|
||||
if (this->getParameters().ControlSurfaceDeflection &&
|
||||
this->getStructure()->ElementsOfDomain().Extent() > 0)
|
||||
{
|
||||
optimizeMesh(theMesher, aPS.Next());
|
||||
}
|
||||
else
|
||||
{
|
||||
aPS.Next();
|
||||
optimizeMesh(theMesher);
|
||||
}
|
||||
}
|
||||
|
||||
//! Checks deviation of a mesh from geometrical surface.
|
||||
//! Inserts additional nodes in case of huge deviation.
|
||||
virtual void optimizeMesh (BRepMesh_Delaun& theMesher,
|
||||
const Message_ProgressRange& theRange)
|
||||
virtual void optimizeMesh(BRepMesh_Delaun& theMesher)
|
||||
{
|
||||
Handle(NCollection_IncAllocator) aTmpAlloc =
|
||||
new NCollection_IncAllocator(IMeshData::MEMORY_BLOCK_SIZE_HUGE);
|
||||
@@ -83,13 +72,8 @@ protected:
|
||||
|
||||
const Standard_Integer aIterationsNb = 11;
|
||||
Standard_Boolean isInserted = Standard_True;
|
||||
Message_ProgressScope aPS(theRange, "Iteration", aIterationsNb);
|
||||
for (Standard_Integer aPass = 1; aPass <= aIterationsNb && isInserted && !myIsAllDegenerated; ++aPass)
|
||||
{
|
||||
if (!aPS.More())
|
||||
{
|
||||
return;
|
||||
}
|
||||
// Reset stop condition
|
||||
myMaxSqDeflection = -1.;
|
||||
myIsAllDegenerated = Standard_True;
|
||||
@@ -99,6 +83,7 @@ protected:
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// Iterate on current triangles
|
||||
IMeshData::IteratorOfMapOfInteger aTriangleIt(this->getStructure()->ElementsOfDomain());
|
||||
for (; aTriangleIt.More(); aTriangleIt.Next())
|
||||
@@ -107,7 +92,7 @@ protected:
|
||||
splitTriangleGeometry(aTriangle);
|
||||
}
|
||||
|
||||
isInserted = this->insertNodes(myControlNodes, theMesher, aPS.Next());
|
||||
isInserted = this->insertNodes(myControlNodes, theMesher);
|
||||
}
|
||||
|
||||
myCouplesMap.Nullify();
|
||||
|
@@ -85,29 +85,23 @@ protected:
|
||||
}
|
||||
|
||||
//! Perfroms processing of generated mesh. Generates surface nodes and inserts them into structure.
|
||||
virtual void postProcessMesh (BRepMesh_Delaun& theMesher,
|
||||
const Message_ProgressRange& theRange) Standard_OVERRIDE
|
||||
virtual void postProcessMesh(BRepMesh_Delaun& theMesher) Standard_OVERRIDE
|
||||
{
|
||||
if (!theRange.More())
|
||||
{
|
||||
return;
|
||||
}
|
||||
InsertionBaseClass::postProcessMesh (theMesher, Message_ProgressRange()); // shouldn't be range passed here?
|
||||
InsertionBaseClass::postProcessMesh(theMesher);
|
||||
|
||||
if (!myIsPreProcessSurfaceNodes)
|
||||
{
|
||||
const Handle(IMeshData::ListOfPnt2d) aSurfaceNodes =
|
||||
this->getRangeSplitter().GenerateSurfaceNodes(this->getParameters());
|
||||
|
||||
insertNodes(aSurfaceNodes, theMesher, theRange);
|
||||
insertNodes(aSurfaceNodes, theMesher);
|
||||
}
|
||||
}
|
||||
|
||||
//! Inserts nodes into mesh.
|
||||
Standard_Boolean insertNodes(
|
||||
const Handle(IMeshData::ListOfPnt2d)& theNodes,
|
||||
BRepMesh_Delaun& theMesher,
|
||||
const Message_ProgressRange& theRange)
|
||||
BRepMesh_Delaun& theMesher)
|
||||
{
|
||||
if (theNodes.IsNull() || theNodes->IsEmpty())
|
||||
{
|
||||
@@ -126,11 +120,7 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
theMesher.AddVertices (aVertexIndexes, theRange);
|
||||
if (!theRange.More())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
theMesher.AddVertices(aVertexIndexes);
|
||||
return !aVertexIndexes.IsEmpty();
|
||||
}
|
||||
|
||||
|
@@ -18,7 +18,6 @@
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Message_ProgressRange.hxx>
|
||||
|
||||
//! This is a common interface for meshing algorithms
|
||||
//! instantiated by Mesh Factory and implemented by plugins.
|
||||
@@ -47,7 +46,7 @@ public:
|
||||
}
|
||||
|
||||
//! Compute triangulation for set shape.
|
||||
virtual void Perform(const Message_ProgressRange& theRange = Message_ProgressRange()) = 0;
|
||||
virtual void Perform() = 0;
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(BRepMesh_DiscretRoot,Standard_Transient)
|
||||
|
@@ -85,10 +85,8 @@ Handle(IMeshTools_CurveTessellator) BRepMesh_EdgeDiscret::CreateEdgeTessellation
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepMesh_EdgeDiscret::performInternal (
|
||||
const Handle (IMeshData_Model)& theModel,
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Message_ProgressRange& theRange)
|
||||
const IMeshTools_Parameters& theParameters)
|
||||
{
|
||||
(void )theRange;
|
||||
myModel = theModel;
|
||||
myParameters = theParameters;
|
||||
|
||||
|
@@ -75,8 +75,7 @@ protected:
|
||||
//! Performs processing of edges of the given model.
|
||||
Standard_EXPORT virtual Standard_Boolean performInternal (
|
||||
const Handle (IMeshData_Model)& theModel,
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Message_ProgressRange& theRange) Standard_OVERRIDE;
|
||||
const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
|
@@ -39,46 +39,13 @@ BRepMesh_FaceDiscret::~BRepMesh_FaceDiscret()
|
||||
{
|
||||
}
|
||||
|
||||
//! Auxiliary functor for parallel processing of Faces.
|
||||
class BRepMesh_FaceDiscret::FaceListFunctor
|
||||
{
|
||||
public:
|
||||
FaceListFunctor (BRepMesh_FaceDiscret* theAlgo,
|
||||
const Message_ProgressRange& theRange)
|
||||
: myAlgo (theAlgo),
|
||||
myScope (theRange, "Face Discret", theAlgo->myModel->FacesNb())
|
||||
{
|
||||
myRanges.reserve (theAlgo->myModel->FacesNb());
|
||||
for (Standard_Integer aFaceIter = 0; aFaceIter < theAlgo->myModel->FacesNb(); ++aFaceIter)
|
||||
{
|
||||
myRanges.push_back (myScope.Next());
|
||||
}
|
||||
}
|
||||
|
||||
void operator() (const Standard_Integer theFaceIndex) const
|
||||
{
|
||||
if (!myScope.More())
|
||||
{
|
||||
return;
|
||||
}
|
||||
Message_ProgressScope aFaceScope(myRanges[theFaceIndex], NULL, 1);
|
||||
myAlgo->process(theFaceIndex, aFaceScope.Next());
|
||||
}
|
||||
|
||||
private:
|
||||
mutable BRepMesh_FaceDiscret* myAlgo;
|
||||
Message_ProgressScope myScope;
|
||||
std::vector<Message_ProgressRange> myRanges;
|
||||
};
|
||||
|
||||
//=======================================================================
|
||||
// Function: Perform
|
||||
// Purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepMesh_FaceDiscret::performInternal(
|
||||
const Handle(IMeshData_Model)& theModel,
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Message_ProgressRange& theRange)
|
||||
const IMeshTools_Parameters& theParameters)
|
||||
{
|
||||
myModel = theModel;
|
||||
myParameters = theParameters;
|
||||
@@ -87,12 +54,7 @@ Standard_Boolean BRepMesh_FaceDiscret::performInternal(
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
FaceListFunctor aFunctor(this, theRange);
|
||||
OSD_Parallel::For(0, myModel->FacesNb(), aFunctor, !(myParameters.InParallel && myModel->FacesNb() > 1));
|
||||
if (!theRange.More())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
OSD_Parallel::For(0, myModel->FacesNb(), *this, !(myParameters.InParallel && myModel->FacesNb() > 1));
|
||||
|
||||
myModel.Nullify(); // Do not hold link to model.
|
||||
return Standard_True;
|
||||
@@ -102,8 +64,7 @@ Standard_Boolean BRepMesh_FaceDiscret::performInternal(
|
||||
// Function: process
|
||||
// Purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_FaceDiscret::process(const Standard_Integer theFaceIndex,
|
||||
const Message_ProgressRange& theRange) const
|
||||
void BRepMesh_FaceDiscret::process(const Standard_Integer theFaceIndex) const
|
||||
{
|
||||
const IMeshData::IFaceHandle& aDFace = myModel->GetFace(theFaceIndex);
|
||||
if (aDFace->IsSet(IMeshData_Failure) ||
|
||||
@@ -125,12 +86,7 @@ void BRepMesh_FaceDiscret::process(const Standard_Integer theFaceIndex,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!theRange.More())
|
||||
{
|
||||
aDFace->SetStatus (IMeshData_UserBreak);
|
||||
return;
|
||||
}
|
||||
aMeshingAlgo->Perform(aDFace, myParameters, theRange);
|
||||
aMeshingAlgo->Perform(aDFace, myParameters);
|
||||
}
|
||||
catch (Standard_Failure const&)
|
||||
{
|
||||
|
@@ -20,7 +20,6 @@
|
||||
#include <IMeshTools_Parameters.hxx>
|
||||
#include <IMeshData_Types.hxx>
|
||||
#include <IMeshTools_MeshAlgoFactory.hxx>
|
||||
#include <NCollection_Array1.hxx>
|
||||
|
||||
//! Class implements functionality starting triangulation of model's faces.
|
||||
//! Each face is processed separately and can be executed in parallel mode.
|
||||
@@ -37,6 +36,11 @@ public:
|
||||
//! Destructor.
|
||||
Standard_EXPORT virtual ~BRepMesh_FaceDiscret();
|
||||
|
||||
//! Functor API to discretize the given edge.
|
||||
inline void operator() (const Standard_Integer theFaceIndex) const {
|
||||
process(theFaceIndex);
|
||||
}
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_FaceDiscret, IMeshTools_ModelAlgo)
|
||||
|
||||
protected:
|
||||
@@ -44,17 +48,12 @@ protected:
|
||||
//! Performs processing of faces of the given model.
|
||||
Standard_EXPORT virtual Standard_Boolean performInternal (
|
||||
const Handle(IMeshData_Model)& theModel,
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Message_ProgressRange& theRange) Standard_OVERRIDE;
|
||||
const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
//! Checks existing discretization of the face and updates data model.
|
||||
void process (const Standard_Integer theFaceIndex,
|
||||
const Message_ProgressRange& theRange) const;
|
||||
|
||||
private:
|
||||
class FaceListFunctor;
|
||||
void process(const Standard_Integer theFaceIndex) const;
|
||||
|
||||
private:
|
||||
|
||||
|
@@ -66,12 +66,11 @@ BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh( const TopoDS_Shape& theSh
|
||||
//=======================================================================
|
||||
BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh(
|
||||
const TopoDS_Shape& theShape,
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Message_ProgressRange& theRange)
|
||||
const IMeshTools_Parameters& theParameters)
|
||||
: myParameters(theParameters)
|
||||
{
|
||||
myShape = theShape;
|
||||
Perform(theRange);
|
||||
Perform();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -86,17 +85,17 @@ BRepMesh_IncrementalMesh::~BRepMesh_IncrementalMesh()
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_IncrementalMesh::Perform(const Message_ProgressRange& theRange)
|
||||
void BRepMesh_IncrementalMesh::Perform()
|
||||
{
|
||||
Handle(BRepMesh_Context) aContext = new BRepMesh_Context;
|
||||
Perform (aContext, theRange);
|
||||
Perform (aContext);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BRepMesh_IncrementalMesh::Perform(const Handle(IMeshTools_Context)& theContext, const Message_ProgressRange& theRange)
|
||||
void BRepMesh_IncrementalMesh::Perform(const Handle(IMeshTools_Context)& theContext)
|
||||
{
|
||||
initParameters();
|
||||
|
||||
@@ -104,14 +103,9 @@ void BRepMesh_IncrementalMesh::Perform(const Handle(IMeshTools_Context)& theCont
|
||||
theContext->ChangeParameters() = myParameters;
|
||||
theContext->ChangeParameters().CleanModel = Standard_False;
|
||||
|
||||
Message_ProgressScope aPS(theRange, "Perform incmesh", 10);
|
||||
IMeshTools_MeshBuilder aIncMesh(theContext);
|
||||
aIncMesh.Perform(aPS.Next(9));
|
||||
if (!aPS.More())
|
||||
{
|
||||
myStatus = IMeshData_UserBreak;
|
||||
return;
|
||||
}
|
||||
aIncMesh.Perform();
|
||||
|
||||
myStatus = IMeshData_NoError;
|
||||
const Handle(IMeshData_Model)& aModel = theContext->GetModel();
|
||||
if (!aModel.IsNull())
|
||||
@@ -128,7 +122,7 @@ void BRepMesh_IncrementalMesh::Perform(const Handle(IMeshTools_Context)& theCont
|
||||
}
|
||||
}
|
||||
}
|
||||
aPS.Next(1);
|
||||
|
||||
setDone();
|
||||
}
|
||||
|
||||
|
@@ -50,15 +50,13 @@ public: //! @name mesher API
|
||||
//! @param theShape shape to be meshed.
|
||||
//! @param theParameters - parameters of meshing
|
||||
Standard_EXPORT BRepMesh_IncrementalMesh(const TopoDS_Shape& theShape,
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Message_ProgressRange& theRange = Message_ProgressRange());
|
||||
const IMeshTools_Parameters& theParameters);
|
||||
|
||||
//! Performs meshing ot the shape.
|
||||
Standard_EXPORT virtual void Perform(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
|
||||
Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
|
||||
|
||||
//! Performs meshing using custom context;
|
||||
Standard_EXPORT void Perform(const Handle(IMeshTools_Context)& theContext,
|
||||
const Message_ProgressRange& theRange = Message_ProgressRange());
|
||||
Standard_EXPORT void Perform(const Handle(IMeshTools_Context)& theContext);
|
||||
|
||||
public: //! @name accessing to parameters.
|
||||
|
||||
|
@@ -117,10 +117,8 @@ BRepMesh_ModelHealer::~BRepMesh_ModelHealer()
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepMesh_ModelHealer::performInternal(
|
||||
const Handle(IMeshData_Model)& theModel,
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Message_ProgressRange& theRange)
|
||||
const IMeshTools_Parameters& theParameters)
|
||||
{
|
||||
(void )theRange;
|
||||
myModel = theModel;
|
||||
myParameters = theParameters;
|
||||
if (myModel.IsNull())
|
||||
|
@@ -61,8 +61,7 @@ protected:
|
||||
//! Performs processing of edges of the given model.
|
||||
Standard_EXPORT virtual Standard_Boolean performInternal (
|
||||
const Handle(IMeshData_Model)& theModel,
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Message_ProgressRange& theRange) Standard_OVERRIDE;
|
||||
const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
|
@@ -179,10 +179,8 @@ BRepMesh_ModelPostProcessor::~BRepMesh_ModelPostProcessor()
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepMesh_ModelPostProcessor::performInternal(
|
||||
const Handle(IMeshData_Model)& theModel,
|
||||
const IMeshTools_Parameters& /*theParameters*/,
|
||||
const Message_ProgressRange& theRange)
|
||||
const IMeshTools_Parameters& /*theParameters*/)
|
||||
{
|
||||
(void )theRange;
|
||||
if (theModel.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
|
@@ -39,8 +39,7 @@ protected:
|
||||
//! Performs processing of edges of the given model.
|
||||
Standard_EXPORT virtual Standard_Boolean performInternal (
|
||||
const Handle(IMeshData_Model)& theModel,
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Message_ProgressRange& theRange) Standard_OVERRIDE;
|
||||
const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -250,10 +250,8 @@ BRepMesh_ModelPreProcessor::~BRepMesh_ModelPreProcessor()
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepMesh_ModelPreProcessor::performInternal(
|
||||
const Handle(IMeshData_Model)& theModel,
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Message_ProgressRange& theRange)
|
||||
const IMeshTools_Parameters& theParameters)
|
||||
{
|
||||
(void )theRange;
|
||||
if (theModel.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
|
@@ -40,8 +40,7 @@ protected:
|
||||
//! Performs processing of edges of the given model.
|
||||
Standard_EXPORT virtual Standard_Boolean performInternal (
|
||||
const Handle(IMeshData_Model)& theModel,
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Message_ProgressRange& theRange) Standard_OVERRIDE;
|
||||
const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -47,16 +47,11 @@ public:
|
||||
//! Performs processing of the given face.
|
||||
virtual void Perform(
|
||||
const IMeshData::IFaceHandle& theDFace,
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Message_ProgressRange& theRange) Standard_OVERRIDE
|
||||
const IMeshTools_Parameters& theParameters) Standard_OVERRIDE
|
||||
{
|
||||
myRangeSplitter.Reset(theDFace, theParameters);
|
||||
myClassifier = new BRepMesh_Classifier;
|
||||
if (!theRange.More())
|
||||
{
|
||||
return;
|
||||
}
|
||||
BaseAlgo::Perform(theDFace, theParameters, theRange);
|
||||
BaseAlgo::Perform(theDFace, theParameters);
|
||||
myClassifier.Nullify();
|
||||
}
|
||||
|
||||
|
@@ -73,7 +73,7 @@ static Standard_Integer distmini(Draw_Interpretor& di, Standard_Integer n, const
|
||||
if (n == 5)
|
||||
aDeflection = Draw::Atof(a[4]);
|
||||
|
||||
BRepExtrema_DistShapeShape dst(S1 ,S2, aDeflection);
|
||||
BRepExtrema_DistShapeShape dst(S1 ,S2, aDeflection, Extrema_ExtFlag_MIN);
|
||||
|
||||
if (dst.IsDone())
|
||||
{
|
||||
|
@@ -619,9 +619,9 @@ static Standard_Integer getedgeregul
|
||||
//=======================================================================
|
||||
static Standard_Integer projponf(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n < 3 || n > 5) {
|
||||
if (n < 3 || n > 4) {
|
||||
di << "Project point on the face.\n";
|
||||
di << "Usage: projponf face pnt [extrema flag: -min/-max/-minmax] [extrema algo: -g(grad)/-t(tree)]\n";
|
||||
di << "Usage: projponf face pnt [extrema flag: -min/-max/-minmax]\n";
|
||||
return 1;
|
||||
}
|
||||
// get face
|
||||
@@ -644,7 +644,6 @@ static Standard_Integer projponf(Draw_Interpretor& di, Standard_Integer n, const
|
||||
//
|
||||
// get projection options
|
||||
// default values;
|
||||
Extrema_ExtAlgo anExtAlgo = Extrema_ExtAlgo_Grad;
|
||||
Extrema_ExtFlag anExtFlag = Extrema_ExtFlag_MINMAX;
|
||||
//
|
||||
for (Standard_Integer i = 3; i < n; ++i) {
|
||||
@@ -657,12 +656,6 @@ static Standard_Integer projponf(Draw_Interpretor& di, Standard_Integer n, const
|
||||
else if (!strcasecmp(a[i], "-minmax")) {
|
||||
anExtFlag = Extrema_ExtFlag_MINMAX;
|
||||
}
|
||||
else if (!strcasecmp(a[i], "-t")) {
|
||||
anExtAlgo = Extrema_ExtAlgo_Tree;
|
||||
}
|
||||
else if (!strcasecmp(a[i], "-g")) {
|
||||
anExtAlgo = Extrema_ExtAlgo_Grad;
|
||||
}
|
||||
}
|
||||
//
|
||||
// get surface
|
||||
@@ -679,7 +672,6 @@ static Standard_Integer projponf(Draw_Interpretor& di, Standard_Integer n, const
|
||||
GeomAPI_ProjectPointOnSurf aProjPS;
|
||||
aProjPS.Init(aSurf, aUMin, aUMax, aVMin, aVMax);
|
||||
// set the options
|
||||
aProjPS.SetExtremaAlgo(anExtAlgo);
|
||||
aProjPS.SetExtremaFlag(anExtFlag);
|
||||
// perform projection
|
||||
aProjPS.Perform(aP);
|
||||
@@ -768,7 +760,7 @@ void BRepTest::SurfaceCommands(Draw_Interpretor& theCommands)
|
||||
theCommands.Add ("getedgeregularity", "getedgeregularity edge face1 [face2]", __FILE__,getedgeregul,g);
|
||||
|
||||
theCommands.Add ("projponf",
|
||||
"projponf face pnt [extrema flag: -min/-max/-minmax] [extrema algo: -g(grad)/-t(tree)]\n"
|
||||
"projponf face pnt [extrema flag: -min/-max/-minmax]\n"
|
||||
"\t\tProject point on the face.",
|
||||
__FILE__, projponf, g);
|
||||
}
|
||||
|
@@ -66,6 +66,18 @@ public: //! @name Adding elements in BVH
|
||||
BVH_Object<NumType, Dimension>::myIsDirty = Standard_True;
|
||||
}
|
||||
|
||||
//! Allows to update the box of the element while the tree is not yet built
|
||||
virtual void UpdateBox (const Standard_Integer theId, const BVH_Box<NumType, Dimension>& theNewBox)
|
||||
{
|
||||
if (BVH_Object<NumType, Dimension>::myIsDirty)
|
||||
{
|
||||
if (theId >= 0 && theId < Size())
|
||||
{
|
||||
myBoxes[theId] = theNewBox;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public: //! @name BVH construction
|
||||
|
||||
//! BVH construction
|
||||
|
@@ -84,7 +84,7 @@ public: //! @name Necessary overrides for BVH construction
|
||||
//! Returns the bounding box with the given index.
|
||||
virtual BVH_Box <NumType, Dimension> Box (const Standard_Integer theIndex) const Standard_OVERRIDE
|
||||
{
|
||||
return myBoxes[myIndices[theIndex]];
|
||||
return this->myBoxes[myIndices[theIndex]];
|
||||
}
|
||||
|
||||
//! Swaps indices of two specified boxes.
|
||||
@@ -95,9 +95,9 @@ public: //! @name Necessary overrides for BVH construction
|
||||
}
|
||||
|
||||
//! Returns the Element with the index theIndex.
|
||||
virtual DataType Element (const Standard_Integer theIndex) const
|
||||
virtual DataType Element (const Standard_Integer theIndex) const Standard_OVERRIDE
|
||||
{
|
||||
return myElements[myIndices[theIndex]];
|
||||
return this->myElements[myIndices[theIndex]];
|
||||
}
|
||||
|
||||
protected: //! @name Fields
|
||||
|
@@ -88,6 +88,24 @@ public: //! @name Point-Box Square distance
|
||||
return aDist;
|
||||
}
|
||||
|
||||
//! Computes Max square distance between point and bounding box
|
||||
static T PointBoxMaxSquareDistance (const BVH_VecNt& thePoint,
|
||||
const BVH_VecNt& theCMin,
|
||||
const BVH_VecNt& theCMax)
|
||||
{
|
||||
T aDist = 0;
|
||||
for (int i = 0; i < N; ++i)
|
||||
{
|
||||
T dmin = 0, dmax = 0;
|
||||
if (thePoint[i] > theCMin[i]) { dmin = thePoint[i] - theCMin[i]; }
|
||||
if (thePoint[i] < theCMax[i]) { dmax = theCMax[i] - thePoint[i]; }
|
||||
T d = dmin > dmax ? dmin : dmax;
|
||||
d *= d;
|
||||
aDist += d;
|
||||
}
|
||||
return aDist;
|
||||
}
|
||||
|
||||
public: //! @name Point-Box projection
|
||||
|
||||
//! Computes projection of point on bounding box
|
||||
@@ -110,7 +128,6 @@ public: //! @name Point-Box projection
|
||||
{
|
||||
return thePoint.cwiseMax (theCMin).cwiseMin (theCMax);
|
||||
}
|
||||
|
||||
public: //! @name Point-Triangle Square distance
|
||||
|
||||
//! Computes square distance between point and triangle
|
||||
|
@@ -18,6 +18,10 @@
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
#include <Standard_Failure.hxx>
|
||||
|
||||
#include <Bnd_OBB.hxx>
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <Draw_Box.hxx>
|
||||
|
||||
// This file defines global functions not declared in any public header,
|
||||
// intended for use from debugger prompt (Command Window in Visual Studio)
|
||||
|
||||
@@ -40,3 +44,47 @@ Standard_EXPORT const char* Draw_Eval (const char *theCommandStr)
|
||||
return anException.GetMessageString();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DBRep_SetOBB
|
||||
//purpose : Draw OBB
|
||||
//=======================================================================
|
||||
Standard_EXPORT const char* Draw_SetOBB(const char* theNameStr, void* theBox)
|
||||
{
|
||||
if (theNameStr == 0 || theBox == 0)
|
||||
{
|
||||
return "Error: name or box is null";
|
||||
}
|
||||
try {
|
||||
Bnd_OBB B = *(Bnd_OBB*)theBox;
|
||||
Handle(Draw_Box) DB = new Draw_Box (B, Draw_orange);
|
||||
Draw::Set (theNameStr, DB);
|
||||
return theNameStr;
|
||||
}
|
||||
catch (Standard_Failure const& anException)
|
||||
{
|
||||
return anException.GetMessageString();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DBRep_SetBox
|
||||
//purpose : Draw Box
|
||||
//=======================================================================
|
||||
Standard_EXPORT const char* Draw_SetBox(const char* theNameStr, void* theBox)
|
||||
{
|
||||
if (theNameStr == 0 || theBox == 0)
|
||||
{
|
||||
return "Error: name or box is null";
|
||||
}
|
||||
try {
|
||||
Bnd_Box B = *(Bnd_Box*)theBox;
|
||||
Handle(Draw_Box) DB = new Draw_Box (B, Draw_orange);
|
||||
Draw::Set (theNameStr, DB);
|
||||
return theNameStr;
|
||||
}
|
||||
catch (Standard_Failure const& anException)
|
||||
{
|
||||
return anException.GetMessageString();
|
||||
}
|
||||
}
|
||||
|
@@ -202,7 +202,7 @@ Standard_Boolean Draw_ProgressIndicator::UserBreak()
|
||||
{
|
||||
OSD::ControlBreak();
|
||||
}
|
||||
catch (const OSD_Exception_CTRL_BREAK&)
|
||||
catch (OSD_Exception_CTRL_BREAK)
|
||||
{
|
||||
myBreak = Standard_True;
|
||||
}
|
||||
|
@@ -23,7 +23,6 @@
|
||||
#include <Draw_Drawable3D.hxx>
|
||||
#include <Draw_Grid.hxx>
|
||||
#include <Draw_Number.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <Draw_ProgressIndicator.hxx>
|
||||
#include <Draw_SequenceOfDrawable3D.hxx>
|
||||
#include <Message.hxx>
|
||||
|
@@ -1,27 +0,0 @@
|
||||
// Created on: 1991-02-26
|
||||
// Created by: Isabelle GRIGNON
|
||||
// Copyright (c) 1991-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 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 _Extrema_ExtAlgo_HeaderFile
|
||||
#define _Extrema_ExtAlgo_HeaderFile
|
||||
|
||||
|
||||
enum Extrema_ExtAlgo
|
||||
{
|
||||
Extrema_ExtAlgo_Grad,
|
||||
Extrema_ExtAlgo_Tree
|
||||
};
|
||||
|
||||
#endif // _Extrema_ExtAlgo_HeaderFile
|
@@ -17,12 +17,16 @@
|
||||
#ifndef _Extrema_ExtFlag_HeaderFile
|
||||
#define _Extrema_ExtFlag_HeaderFile
|
||||
|
||||
|
||||
//! Enumeration describes the objective for extrema algorithms.
|
||||
//! Generally:
|
||||
//! - *Extrema_ExtFlag_MIN* - means that only minimal solutions are required
|
||||
//! - *Extrema_ExtFlag_MAX* - means that only maximal solutions are required
|
||||
//! - *Extrema_ExtFlag_MINMAX* - means that all solutions are required
|
||||
enum Extrema_ExtFlag
|
||||
{
|
||||
Extrema_ExtFlag_MIN,
|
||||
Extrema_ExtFlag_MAX,
|
||||
Extrema_ExtFlag_MINMAX
|
||||
Extrema_ExtFlag_MIN,
|
||||
Extrema_ExtFlag_MAX,
|
||||
Extrema_ExtFlag_MINMAX
|
||||
};
|
||||
|
||||
#endif // _Extrema_ExtFlag_HeaderFile
|
||||
|
@@ -144,7 +144,7 @@ void Extrema_ExtPExtS::MakePreciser (Standard_Real& U,
|
||||
}
|
||||
//=============================================================================
|
||||
|
||||
Extrema_ExtPExtS::Extrema_ExtPExtS()
|
||||
Extrema_ExtPExtS::Extrema_ExtPExtS (const Handle (Extrema_GenExtPS)& theExtPS)
|
||||
: myuinf(0.0),
|
||||
myusup(0.0),
|
||||
mytolu(0.0),
|
||||
@@ -153,7 +153,8 @@ Extrema_ExtPExtS::Extrema_ExtPExtS()
|
||||
mytolv(0.0),
|
||||
myIsAnalyticallyComputable(Standard_False),
|
||||
myDone(Standard_False),
|
||||
myNbExt(0)
|
||||
myNbExt(0),
|
||||
myExtPS (theExtPS)
|
||||
{
|
||||
for (size_t anIdx = 0; anIdx < sizeof (mySqDist) / sizeof (mySqDist[0]); anIdx++)
|
||||
{
|
||||
@@ -170,7 +171,8 @@ Extrema_ExtPExtS::Extrema_ExtPExtS (const gp_Pnt&
|
||||
const Standard_Real theVmin,
|
||||
const Standard_Real theVsup,
|
||||
const Standard_Real theTolU,
|
||||
const Standard_Real theTolV)
|
||||
const Standard_Real theTolV,
|
||||
const Handle(Extrema_GenExtPS)& theExtPS)
|
||||
: myuinf(theUmin),
|
||||
myusup(theUsup),
|
||||
mytolu(theTolU),
|
||||
@@ -180,7 +182,8 @@ Extrema_ExtPExtS::Extrema_ExtPExtS (const gp_Pnt&
|
||||
myS (theS),
|
||||
myIsAnalyticallyComputable(Standard_False),
|
||||
myDone(Standard_False),
|
||||
myNbExt(0)
|
||||
myNbExt(0),
|
||||
myExtPS (theExtPS)
|
||||
{
|
||||
for (size_t anIdx = 0; anIdx < sizeof (mySqDist) / sizeof (mySqDist[0]); anIdx++)
|
||||
{
|
||||
@@ -201,7 +204,8 @@ Extrema_ExtPExtS::Extrema_ExtPExtS (const gp_Pnt&
|
||||
Extrema_ExtPExtS::Extrema_ExtPExtS (const gp_Pnt& theP,
|
||||
const Handle(GeomAdaptor_HSurfaceOfLinearExtrusion)& theS,
|
||||
const Standard_Real theTolU,
|
||||
const Standard_Real theTolV)
|
||||
const Standard_Real theTolV,
|
||||
const Handle(Extrema_GenExtPS)& theExtPS)
|
||||
: myuinf(theS->FirstUParameter()),
|
||||
myusup(theS->LastUParameter()),
|
||||
mytolu(theTolU),
|
||||
@@ -211,7 +215,8 @@ Extrema_ExtPExtS::Extrema_ExtPExtS (const gp_Pnt&
|
||||
myS (theS),
|
||||
myIsAnalyticallyComputable(Standard_False),
|
||||
myDone(Standard_False),
|
||||
myNbExt(0)
|
||||
myNbExt(0),
|
||||
myExtPS (theExtPS)
|
||||
{
|
||||
for (size_t anIdx = 0; anIdx < sizeof (mySqDist) / sizeof (mySqDist[0]); anIdx++)
|
||||
{
|
||||
@@ -265,15 +270,18 @@ void Extrema_ExtPExtS::Initialize (const Handle(GeomAdaptor_HSurfaceOfLinearExtr
|
||||
|
||||
if (!myIsAnalyticallyComputable)
|
||||
{
|
||||
myExtPS.Initialize (theS->ChangeSurface(),
|
||||
32,
|
||||
32,
|
||||
theUinf,
|
||||
theUsup,
|
||||
theVinf,
|
||||
theVsup,
|
||||
theTolU,
|
||||
theTolV);
|
||||
if (myExtPS.IsNull())
|
||||
myExtPS = new Extrema_GenExtPS();
|
||||
|
||||
myExtPS->Initialize (theS->ChangeSurface(),
|
||||
32,
|
||||
32,
|
||||
theUinf,
|
||||
theUsup,
|
||||
theVinf,
|
||||
theVsup,
|
||||
theTolU,
|
||||
theTolV);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,11 +300,9 @@ void Extrema_ExtPExtS::Perform (const gp_Pnt& P)
|
||||
myNbExt = 0;
|
||||
|
||||
if (!myIsAnalyticallyComputable) {
|
||||
myExtPS.Perform(P);
|
||||
myDone = myExtPS.IsDone();
|
||||
// modified by NIZHNY-EAP Wed Nov 17 12:59:08 1999 ___BEGIN___
|
||||
myNbExt = myExtPS.NbExt();
|
||||
// modified by NIZHNY-EAP Wed Nov 17 12:59:09 1999 ___END___
|
||||
myExtPS->Perform(P);
|
||||
myDone = myExtPS->IsDone();
|
||||
myNbExt = myExtPS->NbExt();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -455,10 +461,8 @@ Standard_Boolean Extrema_ExtPExtS::IsDone () const { return myDone; }
|
||||
Standard_Integer Extrema_ExtPExtS::NbExt () const
|
||||
{
|
||||
if (!IsDone()) { throw StdFail_NotDone(); }
|
||||
if (myIsAnalyticallyComputable)
|
||||
return myNbExt;
|
||||
else
|
||||
return myExtPS.NbExt();
|
||||
|
||||
return myNbExt;
|
||||
}
|
||||
//=============================================================================
|
||||
|
||||
@@ -474,7 +478,7 @@ Standard_Real Extrema_ExtPExtS::SquareDistance (const Standard_Integer N) const
|
||||
return mySqDist[N-1];
|
||||
// modified by NIZHNY-MKK Thu Sep 18 14:48:42 2003.END
|
||||
else
|
||||
return myExtPS.SquareDistance(N);
|
||||
return myExtPS->SquareDistance(N);
|
||||
}
|
||||
//=============================================================================
|
||||
|
||||
@@ -491,7 +495,7 @@ const Extrema_POnSurf& Extrema_ExtPExtS::Point (const Standard_Integer N) const
|
||||
}
|
||||
// modified by NIZHNY-MKK Thu Sep 18 14:47:43 2003.END
|
||||
else
|
||||
return myExtPS.Point(N);
|
||||
return myExtPS->Point(N);
|
||||
}
|
||||
//=============================================================================
|
||||
|
||||
|
@@ -50,15 +50,21 @@ class Extrema_ExtPExtS : public Standard_Transient
|
||||
public:
|
||||
|
||||
|
||||
Standard_EXPORT Extrema_ExtPExtS();
|
||||
//! theExtPS is used to compute the solutions in case
|
||||
//! it cannot be found analytically.
|
||||
Standard_EXPORT Extrema_ExtPExtS(const Handle(Extrema_GenExtPS)& theExtPS);
|
||||
|
||||
//! It calculates all the distances between a point
|
||||
//! from gp and a Surface.
|
||||
Standard_EXPORT Extrema_ExtPExtS(const gp_Pnt& P, const Handle(GeomAdaptor_HSurfaceOfLinearExtrusion)& S, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV);
|
||||
//! theExtPS is used to compute the solutions in case
|
||||
//! it cannot be found analytically.
|
||||
Standard_EXPORT Extrema_ExtPExtS(const gp_Pnt& P, const Handle(GeomAdaptor_HSurfaceOfLinearExtrusion)& S, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV, const Handle(Extrema_GenExtPS)& theExtPS = NULL);
|
||||
|
||||
//! It calculates all the distances between a point
|
||||
//! from gp and a Surface.
|
||||
Standard_EXPORT Extrema_ExtPExtS(const gp_Pnt& P, const Handle(GeomAdaptor_HSurfaceOfLinearExtrusion)& S, const Standard_Real TolU, const Standard_Real TolV);
|
||||
//! theExtPS is used to compute the solutions in case
|
||||
//! it cannot be found analytically.
|
||||
Standard_EXPORT Extrema_ExtPExtS(const gp_Pnt& P, const Handle(GeomAdaptor_HSurfaceOfLinearExtrusion)& S, const Standard_Real TolU, const Standard_Real TolV, const Handle(Extrema_GenExtPS)& theExtPS = NULL);
|
||||
|
||||
//! Initializes the fields of the algorithm.
|
||||
Standard_EXPORT void Initialize (const Handle(GeomAdaptor_HSurfaceOfLinearExtrusion)& S, const Standard_Real Uinf, const Standard_Real Usup, const Standard_Real Vinf, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV);
|
||||
@@ -103,13 +109,12 @@ private:
|
||||
Handle(GeomAdaptor_HSurfaceOfLinearExtrusion) myS;
|
||||
gp_Vec myDirection;
|
||||
gp_Ax2 myPosition;
|
||||
Extrema_GenExtPS myExtPS;
|
||||
Standard_Boolean myIsAnalyticallyComputable;
|
||||
Standard_Boolean myDone;
|
||||
Standard_Integer myNbExt;
|
||||
Standard_Real mySqDist[4];
|
||||
Extrema_POnSurf myPoint[4];
|
||||
|
||||
Handle(Extrema_GenExtPS) myExtPS;
|
||||
|
||||
};
|
||||
|
||||
|
@@ -208,7 +208,9 @@ static Standard_Boolean IsExtremum (const Standard_Real U, const Standard_Real V
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Extrema_ExtPRevS::Extrema_ExtPRevS()
|
||||
Extrema_ExtPRevS::Extrema_ExtPRevS(const Handle(Extrema_GenExtPS)& theExtPS)
|
||||
:
|
||||
myExtPS (theExtPS)
|
||||
{
|
||||
myvinf = myvsup = 0.0;
|
||||
mytolv = Precision::Confusion();
|
||||
@@ -233,7 +235,10 @@ Extrema_ExtPRevS::Extrema_ExtPRevS (const gp_Pnt&
|
||||
const Standard_Real theVmin,
|
||||
const Standard_Real theVsup,
|
||||
const Standard_Real theTolU,
|
||||
const Standard_Real theTolV)
|
||||
const Standard_Real theTolV,
|
||||
const Handle(Extrema_GenExtPS)& theExtPS)
|
||||
:
|
||||
myExtPS (theExtPS)
|
||||
{
|
||||
Initialize (theS,
|
||||
theUmin,
|
||||
@@ -253,7 +258,10 @@ Extrema_ExtPRevS::Extrema_ExtPRevS (const gp_Pnt&
|
||||
Extrema_ExtPRevS::Extrema_ExtPRevS (const gp_Pnt& theP,
|
||||
const Handle(GeomAdaptor_HSurfaceOfRevolution)& theS,
|
||||
const Standard_Real theTolU,
|
||||
const Standard_Real theTolV)
|
||||
const Standard_Real theTolV,
|
||||
const Handle(Extrema_GenExtPS)& theExtPS)
|
||||
:
|
||||
myExtPS (theExtPS)
|
||||
{
|
||||
Initialize (theS,
|
||||
theS->FirstUParameter(),
|
||||
@@ -305,15 +313,18 @@ void Extrema_ExtPRevS::Initialize (const Handle(GeomAdaptor_HSurfaceOfRevolution
|
||||
aNbv = 100;
|
||||
}
|
||||
|
||||
myExtPS.Initialize (theS->ChangeSurface(),
|
||||
aNbu,
|
||||
aNbv,
|
||||
theUmin,
|
||||
theUsup,
|
||||
theVmin,
|
||||
theVsup,
|
||||
theTolU,
|
||||
theTolV);
|
||||
if (myExtPS.IsNull())
|
||||
myExtPS = new Extrema_GenExtPS();
|
||||
|
||||
myExtPS->Initialize (theS->ChangeSurface(),
|
||||
aNbu,
|
||||
aNbv,
|
||||
theUmin,
|
||||
theUsup,
|
||||
theVmin,
|
||||
theVsup,
|
||||
theTolU,
|
||||
theTolV);
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
@@ -326,11 +337,11 @@ void Extrema_ExtPRevS::Perform(const gp_Pnt& P)
|
||||
myDone = Standard_False;
|
||||
myNbExt = 0;
|
||||
|
||||
if (!myIsAnalyticallyComputable) {
|
||||
|
||||
myExtPS.Perform(P);
|
||||
myDone = myExtPS.IsDone();
|
||||
myNbExt = myExtPS.NbExt();
|
||||
if (!myIsAnalyticallyComputable)
|
||||
{
|
||||
myExtPS->Perform(P);
|
||||
myDone = myExtPS->IsDone();
|
||||
myNbExt = myExtPS->NbExt();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -555,7 +566,7 @@ Standard_Real Extrema_ExtPRevS::SquareDistance(const Standard_Integer N) const
|
||||
if (myIsAnalyticallyComputable)
|
||||
return mySqDist[N-1];
|
||||
else
|
||||
return myExtPS.SquareDistance(N);
|
||||
return myExtPS->SquareDistance(N);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Point
|
||||
@@ -571,7 +582,7 @@ const Extrema_POnSurf& Extrema_ExtPRevS::Point(const Standard_Integer N) const
|
||||
if (myIsAnalyticallyComputable)
|
||||
return myPoint[N-1];
|
||||
else
|
||||
return myExtPS.Point(N);
|
||||
return myExtPS->Point(N);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -45,16 +45,21 @@ class Extrema_ExtPRevS : public Standard_Transient
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Standard_EXPORT Extrema_ExtPRevS();
|
||||
//! theExtPS is used to compute the solutions in case
|
||||
//! it cannot be found analytically.
|
||||
Standard_EXPORT Extrema_ExtPRevS(const Handle(Extrema_GenExtPS)& theExtPS = NULL);
|
||||
|
||||
//! It calculates all the distances between a point
|
||||
//! from gp and a SurfacePtr from Adaptor3d.
|
||||
Standard_EXPORT Extrema_ExtPRevS(const gp_Pnt& P, const Handle(GeomAdaptor_HSurfaceOfRevolution)& S, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV);
|
||||
//! theExtPS is used to compute the solutions in case
|
||||
//! it cannot be found analytically.
|
||||
Standard_EXPORT Extrema_ExtPRevS(const gp_Pnt& P, const Handle(GeomAdaptor_HSurfaceOfRevolution)& S, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV, const Handle(Extrema_GenExtPS)& theExtPS = NULL);
|
||||
|
||||
//! It calculates all the distances between a point
|
||||
//! from gp and a SurfacePtr from Adaptor3d.
|
||||
Standard_EXPORT Extrema_ExtPRevS(const gp_Pnt& P, const Handle(GeomAdaptor_HSurfaceOfRevolution)& S, const Standard_Real TolU, const Standard_Real TolV);
|
||||
//! theExtPS is used to compute the solutions in case
|
||||
//! it cannot be found analytically.
|
||||
Standard_EXPORT Extrema_ExtPRevS(const gp_Pnt& P, const Handle(GeomAdaptor_HSurfaceOfRevolution)& S, const Standard_Real TolU, const Standard_Real TolV, const Handle(Extrema_GenExtPS)& theExtPS = NULL);
|
||||
|
||||
Standard_EXPORT void Initialize (const Handle(GeomAdaptor_HSurfaceOfRevolution)& S, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV);
|
||||
|
||||
@@ -90,13 +95,12 @@ private:
|
||||
Standard_Real myvsup;
|
||||
Standard_Real mytolv;
|
||||
gp_Ax2 myPosition;
|
||||
Extrema_GenExtPS myExtPS;
|
||||
Standard_Boolean myIsAnalyticallyComputable;
|
||||
Standard_Boolean myDone;
|
||||
Standard_Integer myNbExt;
|
||||
Standard_Real mySqDist[8];
|
||||
Extrema_POnSurf myPoint[8];
|
||||
|
||||
Handle(Extrema_GenExtPS) myExtPS;
|
||||
|
||||
};
|
||||
|
||||
|
@@ -112,25 +112,25 @@ void Extrema_ExtPS::TreatSolution (const Extrema_POnSurf& PS,
|
||||
Standard_Real U, V;
|
||||
PS.Parameter(U, V);
|
||||
if (myS->IsUPeriodic()) {
|
||||
U = ElCLib::InPeriod(U, myuinf, myuinf + myS->UPeriod());
|
||||
U = ElCLib::InPeriod(U, myLocUMin, myLocUMin + myS->UPeriod());
|
||||
|
||||
// Handle trimmed surfaces.
|
||||
if (U > myusup + mytolu)
|
||||
if (U > myLocUMax + mytolu)
|
||||
U -= myS->UPeriod();
|
||||
if (U < myuinf - mytolu)
|
||||
if (U < myLocUMin - mytolu)
|
||||
U += myS->UPeriod();
|
||||
}
|
||||
if (myS->IsVPeriodic()) {
|
||||
V = ElCLib::InPeriod(V, myvinf, myvinf + myS->VPeriod());
|
||||
V = ElCLib::InPeriod(V, myLocVMin, myLocVMin + myS->VPeriod());
|
||||
|
||||
// Handle trimmed surfaces.
|
||||
if (V > myvsup + mytolv)
|
||||
if (V > myLocVMax + mytolv)
|
||||
V -= myS->VPeriod();
|
||||
if (V < myvinf - mytolv)
|
||||
if (V < myLocVMin - mytolv)
|
||||
V += myS->VPeriod();
|
||||
}
|
||||
if ((myuinf-U) <= mytolu && (U-myusup) <= mytolu &&
|
||||
(myvinf-V) <= mytolv && (V-myvsup) <= mytolv) {
|
||||
if ((myLocUMin-U) <= mytolu && (U-myLocUMax) <= mytolu &&
|
||||
(myLocVMin-V) <= mytolv && (V-myLocVMax) <= mytolv) {
|
||||
myPoints.Append(Extrema_POnSurf (U, V, PS.Value()));
|
||||
mySqDist.Append(Val);
|
||||
}
|
||||
@@ -169,12 +169,8 @@ Extrema_ExtPS::Extrema_ExtPS (const gp_Pnt& theP,
|
||||
const Adaptor3d_Surface& theS,
|
||||
const Standard_Real theTolU,
|
||||
const Standard_Real theTolV,
|
||||
const Extrema_ExtFlag theF,
|
||||
const Extrema_ExtAlgo theA)
|
||||
const Extrema_ExtFlag theTarget)
|
||||
{
|
||||
myExtPS.SetFlag (theF);
|
||||
myExtPS.SetAlgo (theA);
|
||||
|
||||
Initialize (theS,
|
||||
theS.FirstUParameter(),
|
||||
theS.LastUParameter(),
|
||||
@@ -183,6 +179,8 @@ Extrema_ExtPS::Extrema_ExtPS (const gp_Pnt& theP,
|
||||
theTolU,
|
||||
theTolV);
|
||||
|
||||
myExtPS->SetTarget (theTarget);
|
||||
|
||||
Perform (theP);
|
||||
}
|
||||
|
||||
@@ -199,12 +197,8 @@ Extrema_ExtPS::Extrema_ExtPS (const gp_Pnt& theP,
|
||||
const Standard_Real theVsup,
|
||||
const Standard_Real theTolU,
|
||||
const Standard_Real theTolV,
|
||||
const Extrema_ExtFlag theF,
|
||||
const Extrema_ExtAlgo theA)
|
||||
const Extrema_ExtFlag theTarget)
|
||||
{
|
||||
myExtPS.SetFlag (theF);
|
||||
myExtPS.SetAlgo (theA);
|
||||
|
||||
Initialize (theS,
|
||||
theUinf,
|
||||
theUsup,
|
||||
@@ -213,6 +207,8 @@ Extrema_ExtPS::Extrema_ExtPS (const gp_Pnt& theP,
|
||||
theTolU,
|
||||
theTolV);
|
||||
|
||||
myExtPS->SetTarget (theTarget);
|
||||
|
||||
Perform (theP);
|
||||
}
|
||||
|
||||
@@ -241,6 +237,11 @@ void Extrema_ExtPS::Initialize (const Adaptor3d_Surface& theS,
|
||||
if (Precision::IsNegativeInfinite(myvinf)) myvinf = -1e10;
|
||||
if (Precision::IsPositiveInfinite(myvsup)) myvsup = 1e10;
|
||||
|
||||
myLocUMin = myuinf;
|
||||
myLocUMax = myusup;
|
||||
myLocVMin = myvinf;
|
||||
myLocVMax = myvsup;
|
||||
|
||||
mytolu = theTolU;
|
||||
mytolv = theTolV;
|
||||
mytype = myS->GetType();
|
||||
@@ -263,7 +264,10 @@ void Extrema_ExtPS::Initialize (const Adaptor3d_Surface& theS,
|
||||
if(bUIsoIsDeg) nbU = 300;
|
||||
if(bVIsoIsDeg) nbV = 300;
|
||||
|
||||
myExtPS.Initialize(*myS, nbU, nbV, myuinf, myusup, myvinf, myvsup, mytolu, mytolv);
|
||||
if (myExtPS.IsNull())
|
||||
myExtPS = new Extrema_GenExtPS();
|
||||
|
||||
myExtPS->Initialize(*myS, nbU, nbV, myuinf, myusup, myvinf, myvsup, mytolu, mytolv);
|
||||
|
||||
myExtPExtS.Nullify();
|
||||
myExtPRevS.Nullify();
|
||||
@@ -273,12 +277,29 @@ void Extrema_ExtPS::Initialize (const Adaptor3d_Surface& theS,
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Extrema_ExtPS::Perform (const gp_Pnt& thePoint)
|
||||
{
|
||||
Perform (thePoint, myuinf, myusup, myvinf, myvsup);
|
||||
}
|
||||
|
||||
void Extrema_ExtPS::Perform(const gp_Pnt& thePoint)
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Extrema_ExtPS::Perform (const gp_Pnt& thePoint,
|
||||
const Standard_Real theLocUMin,
|
||||
const Standard_Real theLocUMax,
|
||||
const Standard_Real theLocVMin,
|
||||
const Standard_Real theLocVMax)
|
||||
{
|
||||
myPoints.Clear();
|
||||
mySqDist.Clear();
|
||||
|
||||
myLocUMin = Max (theLocUMin, myuinf);
|
||||
myLocUMax = Min (theLocUMax, myusup);
|
||||
myLocVMin = Max (theLocVMin, myvinf);
|
||||
myLocVMax = Min (theLocVMax, myvsup);
|
||||
|
||||
switch (mytype)
|
||||
{
|
||||
case GeomAbs_Cylinder:
|
||||
@@ -304,7 +325,7 @@ void Extrema_ExtPS::Perform(const gp_Pnt& thePoint)
|
||||
Handle(GeomAdaptor_HSurfaceOfLinearExtrusion) aS (new GeomAdaptor_HSurfaceOfLinearExtrusion (
|
||||
GeomAdaptor_SurfaceOfLinearExtrusion (myS->BasisCurve(), myS->Direction())));
|
||||
|
||||
myExtPExtS = new Extrema_ExtPExtS (thePoint, aS, myuinf, myusup, myvinf, myvsup, mytolu, mytolv);
|
||||
myExtPExtS = new Extrema_ExtPExtS (thePoint, aS, myuinf, myusup, myvinf, myvsup, mytolu, mytolv, myExtPS);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -330,7 +351,7 @@ void Extrema_ExtPS::Perform(const gp_Pnt& thePoint)
|
||||
Handle(GeomAdaptor_HSurfaceOfRevolution) aS (new GeomAdaptor_HSurfaceOfRevolution (
|
||||
GeomAdaptor_SurfaceOfRevolution (myS->BasisCurve(), myS->AxeOfRevolution())));
|
||||
|
||||
myExtPRevS = new Extrema_ExtPRevS (thePoint, aS, myuinf, myusup, myvinf, myvsup, mytolu, mytolv);
|
||||
myExtPRevS = new Extrema_ExtPRevS (thePoint, aS, myuinf, myusup, myvinf, myvsup, mytolu, mytolv, myExtPS);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -351,13 +372,13 @@ void Extrema_ExtPS::Perform(const gp_Pnt& thePoint)
|
||||
|
||||
default:
|
||||
{
|
||||
myExtPS.Perform (thePoint);
|
||||
myDone = myExtPS.IsDone();
|
||||
myExtPS->Perform (thePoint, myLocUMin, myLocUMax, myLocVMin, myLocVMax);
|
||||
myDone = myExtPS->IsDone();
|
||||
if (myDone)
|
||||
{
|
||||
for (Standard_Integer anIdx = 1; anIdx <= myExtPS.NbExt(); ++anIdx)
|
||||
for (Standard_Integer anIdx = 1; anIdx <= myExtPS->NbExt(); ++anIdx)
|
||||
{
|
||||
TreatSolution (myExtPS.Point (anIdx), myExtPS.SquareDistance (anIdx));
|
||||
TreatSolution (myExtPS->Point (anIdx), myExtPS->SquareDistance (anIdx));
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -423,10 +444,8 @@ void Extrema_ExtPS::TrimmedSquareDistances(Standard_Real& dUfVf,
|
||||
|
||||
void Extrema_ExtPS::SetFlag(const Extrema_ExtFlag F)
|
||||
{
|
||||
myExtPS.SetFlag(F);
|
||||
}
|
||||
if (myExtPS.IsNull())
|
||||
myExtPS = new Extrema_GenExtPS();
|
||||
|
||||
void Extrema_ExtPS::SetAlgo(const Extrema_ExtAlgo A)
|
||||
{
|
||||
myExtPS.SetAlgo(A);
|
||||
myExtPS->SetTarget(F);
|
||||
}
|
||||
|
@@ -31,7 +31,6 @@
|
||||
#include <TColStd_SequenceOfReal.hxx>
|
||||
#include <GeomAbs_SurfaceType.hxx>
|
||||
#include <Extrema_ExtFlag.hxx>
|
||||
#include <Extrema_ExtAlgo.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
class Extrema_ExtPExtS;
|
||||
class Extrema_ExtPRevS;
|
||||
@@ -63,7 +62,11 @@ public:
|
||||
//! TolU et TolV are used to determine the conditions
|
||||
//! to stop the iterations; at the iteration number n:
|
||||
//! (Un - Un-1) < TolU and (Vn - Vn-1) < TolV .
|
||||
Standard_EXPORT Extrema_ExtPS(const gp_Pnt& P, const Adaptor3d_Surface& S, const Standard_Real TolU, const Standard_Real TolV, const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX, const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad);
|
||||
Standard_EXPORT Extrema_ExtPS(const gp_Pnt& P,
|
||||
const Adaptor3d_Surface& S,
|
||||
const Standard_Real TolU,
|
||||
const Standard_Real TolV,
|
||||
const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX);
|
||||
|
||||
//! It calculates all the distances.
|
||||
//! NbU and NbV are used to locate the close points
|
||||
@@ -73,16 +76,39 @@ public:
|
||||
//! TolU et TolV are used to determine the conditions
|
||||
//! to stop the iterations; at the iteration number n:
|
||||
//! (Un - Un-1) < TolU and (Vn - Vn-1) < TolV .
|
||||
Standard_EXPORT Extrema_ExtPS(const gp_Pnt& P, const Adaptor3d_Surface& S, const Standard_Real Uinf, const Standard_Real Usup, const Standard_Real Vinf, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV, const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX, const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad);
|
||||
Standard_EXPORT Extrema_ExtPS(const gp_Pnt& P,
|
||||
const Adaptor3d_Surface& S,
|
||||
const Standard_Real Uinf,
|
||||
const Standard_Real Usup,
|
||||
const Standard_Real Vinf,
|
||||
const Standard_Real Vsup,
|
||||
const Standard_Real TolU,
|
||||
const Standard_Real TolV,
|
||||
const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX);
|
||||
|
||||
//! Initializes the fields of the algorithm.
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Surface& S, const Standard_Real Uinf, const Standard_Real Usup, const Standard_Real Vinf, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV);
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Surface& S,
|
||||
const Standard_Real Uinf,
|
||||
const Standard_Real Usup,
|
||||
const Standard_Real Vinf,
|
||||
const Standard_Real Vsup,
|
||||
const Standard_Real TolU,
|
||||
const Standard_Real TolV);
|
||||
|
||||
//! Computes the distances.
|
||||
//! An exception is raised if the fieds have not been
|
||||
//! initialized.
|
||||
Standard_EXPORT void Perform (const gp_Pnt& P);
|
||||
|
||||
//! Performs localized extrema search.
|
||||
//! The solution to be found in the given parametric space, which
|
||||
//! is required to be inside the initialized parametric space.
|
||||
Standard_EXPORT void Perform (const gp_Pnt& P,
|
||||
const Standard_Real theLocUMin,
|
||||
const Standard_Real theLocUMax,
|
||||
const Standard_Real theLocVMin,
|
||||
const Standard_Real theLocVMax);
|
||||
|
||||
//! Returns True if the distances are found.
|
||||
Standard_EXPORT Standard_Boolean IsDone() const;
|
||||
|
||||
@@ -107,9 +133,6 @@ public:
|
||||
Standard_EXPORT void TrimmedSquareDistances (Standard_Real& dUfVf, Standard_Real& dUfVl, Standard_Real& dUlVf, Standard_Real& dUlVl, gp_Pnt& PUfVf, gp_Pnt& PUfVl, gp_Pnt& PUlVf, gp_Pnt& PUlVl) const;
|
||||
|
||||
Standard_EXPORT void SetFlag (const Extrema_ExtFlag F);
|
||||
|
||||
Standard_EXPORT void SetAlgo (const Extrema_ExtAlgo A);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -130,7 +153,7 @@ private:
|
||||
Adaptor3d_SurfacePtr myS;
|
||||
Standard_Boolean myDone;
|
||||
Extrema_ExtPElS myExtPElS;
|
||||
Extrema_GenExtPS myExtPS;
|
||||
Handle(Extrema_GenExtPS) myExtPS;
|
||||
Extrema_SequenceOfPOnSurf myPoints;
|
||||
Standard_Real myuinf;
|
||||
Standard_Real myusup;
|
||||
@@ -138,6 +161,10 @@ private:
|
||||
Standard_Real myvsup;
|
||||
Standard_Real mytolu;
|
||||
Standard_Real mytolv;
|
||||
Standard_Real myLocUMin; //!< Localized parametric space boundary (required to be inside the main parametric space)
|
||||
Standard_Real myLocUMax; //!< Localized parametric space boundary (required to be inside the main parametric space)
|
||||
Standard_Real myLocVMin; //!< Localized parametric space boundary (required to be inside the main parametric space)
|
||||
Standard_Real myLocVMax; //!< Localized parametric space boundary (required to be inside the main parametric space)
|
||||
Standard_Real d11;
|
||||
Standard_Real d12;
|
||||
Standard_Real d21;
|
||||
|
@@ -25,25 +25,31 @@
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_TypeMismatch.hxx>
|
||||
|
||||
Extrema_FuncPSNorm::Extrema_FuncPSNorm ()
|
||||
: myS(NULL),
|
||||
Extrema_FuncPSNorm::Extrema_FuncPSNorm()
|
||||
:
|
||||
myS(NULL),
|
||||
myU(0.0),
|
||||
myV(0.0)
|
||||
myV(0.0),
|
||||
myPinit (Standard_False),
|
||||
mySinit (Standard_False),
|
||||
myTarget (Extrema_ExtFlag_MINMAX),
|
||||
myBestSqDistance (-1)
|
||||
{
|
||||
myPinit = Standard_False;
|
||||
mySinit = Standard_False;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
Extrema_FuncPSNorm::Extrema_FuncPSNorm (const gp_Pnt& P,
|
||||
const Adaptor3d_Surface& S)
|
||||
: myU(0.0),
|
||||
myV(0.0)
|
||||
const Adaptor3d_Surface& S)
|
||||
:
|
||||
myP (P),
|
||||
myS ((Adaptor3d_SurfacePtr)&S),
|
||||
myU(0.0),
|
||||
myV(0.0),
|
||||
myPinit (Standard_True),
|
||||
mySinit (Standard_True),
|
||||
myTarget (Extrema_ExtFlag_MINMAX),
|
||||
myBestSqDistance (-1)
|
||||
{
|
||||
myP = P;
|
||||
myS = (Adaptor3d_SurfacePtr)&S;
|
||||
myPinit = Standard_True;
|
||||
mySinit = Standard_True;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@@ -51,18 +57,23 @@ void Extrema_FuncPSNorm::Initialize(const Adaptor3d_Surface& S)
|
||||
{
|
||||
myS = (Adaptor3d_SurfacePtr)&S;
|
||||
mySinit = Standard_True;
|
||||
myPoint.Clear();
|
||||
mySqDist.Clear();
|
||||
myPoints.clear();
|
||||
mySqDistances.clear();
|
||||
myTarget = Extrema_ExtFlag_MINMAX;
|
||||
myBestSqDistance = -1;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void Extrema_FuncPSNorm::SetPoint(const gp_Pnt& P)
|
||||
void Extrema_FuncPSNorm::SetPoint (const gp_Pnt& P,
|
||||
const Extrema_ExtFlag theTarget)
|
||||
{
|
||||
myP = P;
|
||||
myPinit = Standard_True;
|
||||
myPoint.Clear();
|
||||
mySqDist.Clear();
|
||||
myTarget = theTarget;
|
||||
myBestSqDistance = (myTarget == Extrema_ExtFlag_MIN ? RealLast() : RealFirst());
|
||||
myPoints.clear();
|
||||
mySqDistances.clear();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@@ -124,45 +135,66 @@ Standard_Boolean Extrema_FuncPSNorm::Values (const math_Vector& UV,
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
//=============================================================================
|
||||
|
||||
Standard_Integer Extrema_FuncPSNorm::GetStateNumber ()
|
||||
//=============================================================================
|
||||
Standard_Integer Extrema_FuncPSNorm::GetStateNumber()
|
||||
{
|
||||
if (!myPinit || !mySinit) throw Standard_TypeMismatch();
|
||||
//comparison of solution with previous solutions
|
||||
Standard_Integer i = 1, nbSol = mySqDist.Length();
|
||||
Standard_Real tol2d = Precision::PConfusion() * Precision::PConfusion();
|
||||
|
||||
for( ; i <= nbSol; i++)
|
||||
|
||||
Standard_Real aNewSqDist = myPs.SquareDistance (myP);
|
||||
if ((myTarget == Extrema_ExtFlag_MIN && aNewSqDist > myBestSqDistance) ||
|
||||
(myTarget == Extrema_ExtFlag_MAX && aNewSqDist < myBestSqDistance))
|
||||
return 0;
|
||||
myBestSqDistance = aNewSqDist;
|
||||
|
||||
// Comparison of solution with previous solutions
|
||||
Standard_Real tol2d = Precision::SquarePConfusion();
|
||||
std::size_t i = 0, nbSol = mySqDistances.size();
|
||||
for (; i < nbSol; i++)
|
||||
{
|
||||
Standard_Real aU, aV;
|
||||
myPoint(i).Parameter(aU, aV);
|
||||
if( ((myU - aU ) * (myU - aU ) + (myV - aV ) * (myV - aV )) <= tol2d )
|
||||
Extrema_POnSurf& aPOnSurf = myPoints[i];
|
||||
aPOnSurf.Parameter (aU, aV);
|
||||
if (((myU - aU) * (myU - aU) + (myV - aV) * (myV - aV)) <= tol2d)
|
||||
{
|
||||
// The points are almost the same in the parametric space.
|
||||
if (myTarget != Extrema_ExtFlag_MINMAX)
|
||||
{
|
||||
// Check if new solution gives better distance than the existing solution.
|
||||
Standard_Real& anOldSqDist = mySqDistances[i];
|
||||
if ((myTarget == Extrema_ExtFlag_MIN && aNewSqDist < anOldSqDist) ||
|
||||
(myTarget == Extrema_ExtFlag_MAX && aNewSqDist > anOldSqDist))
|
||||
{
|
||||
aPOnSurf.SetParameters (myU, myV, myPs);
|
||||
anOldSqDist = aNewSqDist;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( i <= nbSol)
|
||||
return 0;
|
||||
mySqDist.Append(myPs.SquareDistance(myP));
|
||||
myPoint.Append(Extrema_POnSurf(myU,myV,myPs));
|
||||
if (i < nbSol)
|
||||
return 0;
|
||||
mySqDistances.push_back (aNewSqDist);
|
||||
myPoints.push_back (Extrema_POnSurf (myU, myV, myPs));
|
||||
return 0;
|
||||
}
|
||||
//=============================================================================
|
||||
|
||||
Standard_Integer Extrema_FuncPSNorm::NbExt () const
|
||||
{
|
||||
return mySqDist.Length();
|
||||
return static_cast<Standard_Integer>(mySqDistances.size());
|
||||
}
|
||||
//=============================================================================
|
||||
|
||||
Standard_Real Extrema_FuncPSNorm::SquareDistance (const Standard_Integer N) const
|
||||
{
|
||||
if (!myPinit || !mySinit) throw Standard_TypeMismatch();
|
||||
return mySqDist.Value(N);
|
||||
return mySqDistances [N - 1];
|
||||
}
|
||||
//=============================================================================
|
||||
|
||||
const Extrema_POnSurf& Extrema_FuncPSNorm::Point (const Standard_Integer N) const
|
||||
{
|
||||
if (!myPinit || !mySinit) throw Standard_TypeMismatch();
|
||||
return myPoint.Value(N);
|
||||
return myPoints [N - 1];
|
||||
}
|
||||
|
@@ -23,12 +23,12 @@
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Adaptor3d_SurfacePtr.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <TColStd_SequenceOfReal.hxx>
|
||||
#include <Extrema_SequenceOfPOnSurf.hxx>
|
||||
#include <Extrema_ExtFlag.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <math_FunctionSetWithDerivatives.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
#include <vector>
|
||||
class Standard_OutOfRange;
|
||||
class gp_Pnt;
|
||||
class Adaptor3d_Surface;
|
||||
@@ -71,8 +71,10 @@ public:
|
||||
//! sets the field mysurf of the function.
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Surface& S);
|
||||
|
||||
//! sets the field mysurf of the function.
|
||||
Standard_EXPORT void SetPoint (const gp_Pnt& P);
|
||||
//! Initializes the function with the point and
|
||||
//! target (MIN, MAX or MINMAX). MINMAX is used as default target.
|
||||
Standard_EXPORT void SetPoint (const gp_Pnt& P,
|
||||
const Extrema_ExtFlag theTarget = Extrema_ExtFlag_MINMAX);
|
||||
|
||||
Standard_EXPORT Standard_Integer NbVariables() const Standard_OVERRIDE;
|
||||
|
||||
@@ -99,6 +101,19 @@ public:
|
||||
//! Returns the Nth extremum.
|
||||
Standard_EXPORT const Extrema_POnSurf& Point (const Standard_Integer N) const;
|
||||
|
||||
//! Returns the target (MIN, MAX or MINMAX).
|
||||
Extrema_ExtFlag Target() const
|
||||
{
|
||||
return myTarget;
|
||||
}
|
||||
|
||||
//! Returns the best (min or max, depending on the mode) found
|
||||
//! square distance. Does not make sense for MINMAX mode.
|
||||
Standard_Real BestSquareDistance() const
|
||||
{
|
||||
return myBestSqDistance;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
gp_Pnt myP;
|
||||
@@ -106,9 +121,11 @@ private:
|
||||
Standard_Real myU;
|
||||
Standard_Real myV;
|
||||
gp_Pnt myPs;
|
||||
TColStd_SequenceOfReal mySqDist;
|
||||
Extrema_SequenceOfPOnSurf myPoint;
|
||||
std::vector<Standard_Real> mySqDistances;
|
||||
std::vector<Extrema_POnSurf> myPoints;
|
||||
Standard_Boolean myPinit;
|
||||
Standard_Boolean mySinit;
|
||||
Extrema_ExtFlag myTarget;
|
||||
Standard_Real myBestSqDistance;
|
||||
};
|
||||
#endif // _Extrema_FunctPSNorm_HeaderFile
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -21,18 +21,20 @@
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Adaptor3d_SurfacePtr.hxx>
|
||||
#include <BVH_BoxSet.hxx>
|
||||
#include <BVH_IndexedBoxSet.hxx>
|
||||
#include <BVH_Traverse.hxx>
|
||||
#include <Extrema_HArray2OfPOnSurf.hxx>
|
||||
#include <Extrema_HArray2OfPOnSurfParams.hxx>
|
||||
#include <Extrema_FuncPSNorm.hxx>
|
||||
#include <Extrema_POnSurfParams.hxx>
|
||||
#include <Extrema_ExtFlag.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Extrema_HArray2OfPOnSurfParams.hxx>
|
||||
#include <Extrema_HUBTreeOfSphere.hxx>
|
||||
#include <Bnd_HArray1OfSphere.hxx>
|
||||
#include <Extrema_FuncPSNorm.hxx>
|
||||
#include <Adaptor3d_SurfacePtr.hxx>
|
||||
#include <Extrema_ExtFlag.hxx>
|
||||
#include <Extrema_ExtAlgo.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <Extrema_POnSurfParams.hxx>
|
||||
class StdFail_NotDone;
|
||||
class Standard_OutOfRange;
|
||||
class Standard_TypeMismatch;
|
||||
@@ -42,130 +44,376 @@ class Extrema_POnSurf;
|
||||
class Extrema_POnSurfParams;
|
||||
|
||||
|
||||
//! It calculates all the extremum distances
|
||||
//! between a point and a surface.
|
||||
//! Grid cell defined by (U, V) indices of the minimal
|
||||
//! corner of the cell
|
||||
struct Extrema_GenExtPS_GridCell
|
||||
{
|
||||
Standard_Integer UIndex; //!< U index of the minimal corner
|
||||
Standard_Integer VIndex; //!< V index of the minimal corner
|
||||
|
||||
Extrema_GenExtPS_GridCell (Standard_Integer theUInd = -1, Standard_Integer theVInd = -1)
|
||||
: UIndex (theUInd), VIndex (theVInd)
|
||||
{}
|
||||
};
|
||||
|
||||
//! typedef to BVH tree of the grid cells
|
||||
typedef BVH_BoxSet <Standard_Real, 3, Extrema_GenExtPS_GridCell> Extrema_GenExtPS_GridCellBoxSet;
|
||||
|
||||
|
||||
//! It calculates the extreme distances between a point and a surface.
|
||||
//! These distances can be minimum or maximum.
|
||||
class Extrema_GenExtPS
|
||||
//!
|
||||
//! The function F(u,v) = distance (P, S(u,v)) has an extrema when
|
||||
//! gradient(F) = 0. The algorithm searches all the zeros inside
|
||||
//! the definition ranges of the surface.
|
||||
//!
|
||||
//! When defining the surface, the number of samples in U and V direction
|
||||
//! should be specified. These numbers should be great enough such
|
||||
//! that if there exist N extreme distances between the point and the surface,
|
||||
//! so there also exist N extrema between the point and the grid.
|
||||
//!
|
||||
//! It is possible to look for extrema distances in the whole parametric
|
||||
//! space of the surface or limit it with the specified range which can be
|
||||
//! useful when it is needed to look for local extrema distances.
|
||||
//!
|
||||
//! Parametric tolerances are used to determine the conditions to stop the
|
||||
//! iterations - at the iteration number n:
|
||||
//! (Un - Un-1) < TolU and (Vn - Vn-1) < TolV
|
||||
//!
|
||||
//! It is possible to look for only Minimal or Maximal distances,
|
||||
//! as well as for all solutions.
|
||||
//!
|
||||
//! The class is BVH enhanced - the grid cells are stored into BVH-organized
|
||||
//! structure. Depending on the Extrema target the traverse of the BVH tree
|
||||
//! is different.
|
||||
class Extrema_GenExtPS:
|
||||
protected BVH_Traverse <Standard_Real, 3, Extrema_GenExtPS_GridCellBoxSet>,
|
||||
public Standard_Transient
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
DEFINE_STANDARD_RTTIEXT (Extrema_GenExtPS, Standard_Transient)
|
||||
|
||||
public: //! @name Constructors computing the distances
|
||||
|
||||
//! Constructor for computation of the distances between specified point and surface.
|
||||
//! The whole parametric space of the surfaces is taken into account.
|
||||
//!
|
||||
//! Constructor is mostly used for one time projection of the point on the surface,
|
||||
//! but still the instances of extrema can be used for projecting other points on the surface
|
||||
//! with *Perform()* method.
|
||||
//!
|
||||
//! @param theP point
|
||||
//! @param theS Surface
|
||||
//! @param theNbU Number of samples in U direction
|
||||
//! @param theNbV Number of samples in V direction
|
||||
//! @param theTolU U Parametric tolerance
|
||||
//! @param theTolV V Parametric tolerance
|
||||
//! @param theTarget defines what solutions are required
|
||||
Standard_EXPORT Extrema_GenExtPS (const gp_Pnt& theP,
|
||||
const Adaptor3d_Surface& theS,
|
||||
const Standard_Integer theNbU,
|
||||
const Standard_Integer theNbV,
|
||||
const Standard_Real theTolU,
|
||||
const Standard_Real theTolV,
|
||||
const Extrema_ExtFlag theTarget = Extrema_ExtFlag_MINMAX);
|
||||
|
||||
//! Constructor for computation of the distances between specified point and surface.
|
||||
//! Only the specified parametric range of the surface is taken into account.
|
||||
//!
|
||||
//! Constructor is mostly used for one time projection of the point on the surface,
|
||||
//! but still the instances of extrema can be used for projecting other points on the surface
|
||||
//! with *Perform()* method.
|
||||
//!
|
||||
//! @param theP point
|
||||
//! @param theS Surface
|
||||
//! @param theNbU Number of samples in U direction
|
||||
//! @param theNbV Number of samples in V direction
|
||||
//! @param theUMin Lower U bound
|
||||
//! @param theUMax Upper U bound
|
||||
//! @param theVMin Lower V bound
|
||||
//! @param theVMax Upper V bound
|
||||
//! @param theTolU U Parametric tolerance
|
||||
//! @param theTolV V Parametric tolerance
|
||||
//! @param theTarget defines what solutions are required
|
||||
Standard_EXPORT Extrema_GenExtPS (const gp_Pnt& theP,
|
||||
const Adaptor3d_Surface& theS,
|
||||
const Standard_Integer theNbU,
|
||||
const Standard_Integer theNbV,
|
||||
const Standard_Real theUMin,
|
||||
const Standard_Real theUMax,
|
||||
const Standard_Real theVMin,
|
||||
const Standard_Real theVMax,
|
||||
const Standard_Real theTolU,
|
||||
const Standard_Real theTolV,
|
||||
const Extrema_ExtFlag theTarget = Extrema_ExtFlag_MINMAX);
|
||||
|
||||
public: //! @name Empty constructor + Initialization step
|
||||
|
||||
//! Empty constructor
|
||||
Standard_EXPORT Extrema_GenExtPS();
|
||||
|
||||
//! Initializes Extrema algorithm with the surfaces.
|
||||
//! Search is performed in whole parametric range of the surface.
|
||||
//! @param theS Surface
|
||||
//! @param theNbU Number of samples in U direction
|
||||
//! @param theNbV Number of samples in V direction
|
||||
//! @param theTolU U Parametric tolerance
|
||||
//! @param theTolV V Parametric tolerance
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Surface& theS,
|
||||
const Standard_Integer theNbU,
|
||||
const Standard_Integer theNbV,
|
||||
const Standard_Real theTolU,
|
||||
const Standard_Real theTolV);
|
||||
|
||||
//! Initializes Extrema algorithm with the surfaces.
|
||||
//! Search is performed in the given parametric range.
|
||||
//! @param S Surface
|
||||
//! @param theNbU Number of samples in U direction
|
||||
//! @param theNbV Number of samples in V direction
|
||||
//! @param theUMin Lower U bound
|
||||
//! @param theUMax Upper U bound
|
||||
//! @param theVMin Lower V bound
|
||||
//! @param theVMax Upper V bound
|
||||
//! @param theTolU U Parametric tolerance
|
||||
//! @param theTolV V Parametric tolerance
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Surface& theS,
|
||||
const Standard_Integer theNbU,
|
||||
const Standard_Integer theNbV,
|
||||
const Standard_Real theUMin,
|
||||
const Standard_Real theUMax,
|
||||
const Standard_Real theVMin,
|
||||
const Standard_Real theVMax,
|
||||
const Standard_Real theTolU,
|
||||
const Standard_Real theTolV);
|
||||
|
||||
public: //! @name Specifying the search options
|
||||
|
||||
//! Specifies what solutions are necessary:
|
||||
//! - *Extrema_ExtFlag_MIN* - only minimal solutions
|
||||
//! - *Extrema_ExtFlag_MAX* - only maximal solutions
|
||||
//! - *Extrema_ExtFlag_MINMAX - all solutions (default value).
|
||||
void SetTarget (const Extrema_ExtFlag theTarget)
|
||||
{
|
||||
myTarget = theTarget;
|
||||
}
|
||||
|
||||
//! Returns the Extrema target type
|
||||
Extrema_ExtFlag Target() const { return myTarget; }
|
||||
|
||||
//! Sets the tolerance for the search.
|
||||
//! These tolerances are used for projection of the point,
|
||||
//! and not used for surface initialization, so can be changed
|
||||
//! from point to point.
|
||||
void SetTolerance (const Standard_Real theTolU,
|
||||
const Standard_Real theTolV)
|
||||
{
|
||||
myTolU = theTolU;
|
||||
myTolV = theTolV;
|
||||
}
|
||||
|
||||
|
||||
public: //! @name Performing projection
|
||||
|
||||
//! Performs projection of the point on the surface.
|
||||
//! Extrema must already be initialized with the surface.
|
||||
//! Allows multiple points be projected on the same surface.
|
||||
Standard_EXPORT void Perform (const gp_Pnt& theP);
|
||||
|
||||
//! Performs localized extrema search.
|
||||
//! The localized boundaries are required to be inside the
|
||||
//! main (initialized) surface parametric space.
|
||||
Standard_EXPORT void Perform (const gp_Pnt& theP,
|
||||
const Standard_Real theUMin,
|
||||
const Standard_Real theUMax,
|
||||
const Standard_Real theVMin,
|
||||
const Standard_Real theVMax);
|
||||
|
||||
//! It calculates all the distances.
|
||||
//! The function F(u,v)=distance(P,S(u,v)) has an
|
||||
//! extremum when gradient(F)=0. The algorithm searchs
|
||||
//! all the zeros inside the definition ranges of the
|
||||
//! surface.
|
||||
//! NbU and NbV are used to locate the close points
|
||||
//! to find the zeros. They must be great enough
|
||||
//! such that if there is N extrema, there will
|
||||
//! be N extrema between P and the grid.
|
||||
//! TolU et TolV are used to determine the conditions
|
||||
//! to stop the iterations; at the iteration number n:
|
||||
//! (Un - Un-1) < TolU and (Vn - Vn-1) < TolV .
|
||||
Standard_EXPORT Extrema_GenExtPS(const gp_Pnt& P, const Adaptor3d_Surface& S, const Standard_Integer NbU, const Standard_Integer NbV, const Standard_Real TolU, const Standard_Real TolV, const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX, const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad);
|
||||
|
||||
//! It calculates all the distances.
|
||||
//! The function F(u,v)=distance(P,S(u,v)) has an
|
||||
//! extremum when gradient(F)=0. The algorithm searchs
|
||||
//! all the zeros inside the definition ranges of the
|
||||
//! surface.
|
||||
//! NbU and NbV are used to locate the close points
|
||||
//! to find the zeros. They must be great enough
|
||||
//! such that if there is N extrema, there will
|
||||
//! be N extrema between P and the grid.
|
||||
//! TolU et TolV are used to determine the conditions
|
||||
//! to stop the iterations; at the iteration number n:
|
||||
//! (Un - Un-1) < TolU and (Vn - Vn-1) < TolV .
|
||||
Standard_EXPORT Extrema_GenExtPS(const gp_Pnt& P, const Adaptor3d_Surface& S, const Standard_Integer NbU, const Standard_Integer NbV, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV, const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX, const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad);
|
||||
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Surface& S, const Standard_Integer NbU, const Standard_Integer NbV, const Standard_Real TolU, const Standard_Real TolV);
|
||||
|
||||
Standard_EXPORT void Initialize (const Adaptor3d_Surface& S, const Standard_Integer NbU, const Standard_Integer NbV, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV);
|
||||
|
||||
//! the algorithm is done with the point P.
|
||||
//! An exception is raised if the fields have not
|
||||
//! been initialized.
|
||||
Standard_EXPORT void Perform (const gp_Pnt& P);
|
||||
|
||||
Standard_EXPORT void SetFlag (const Extrema_ExtFlag F);
|
||||
|
||||
Standard_EXPORT void SetAlgo (const Extrema_ExtAlgo A);
|
||||
|
||||
public: //! @name Getting the results
|
||||
|
||||
//! Returns True if the distances are found.
|
||||
Standard_EXPORT Standard_Boolean IsDone() const;
|
||||
|
||||
//! Returns the number of extremum distances.
|
||||
Standard_Boolean IsDone() const { return myIsDone; }
|
||||
|
||||
//! Returns the number of extrema distances found.
|
||||
//! @throws StdFail_NotDone if extrema search has failed.
|
||||
Standard_EXPORT Standard_Integer NbExt() const;
|
||||
|
||||
|
||||
//! Returns the value of the Nth resulting square distance.
|
||||
Standard_EXPORT Standard_Real SquareDistance (const Standard_Integer N) const;
|
||||
|
||||
//! @throws StdFail_NotDone if extrema search has failed.
|
||||
//! @throws Standard_OutOfRange if given index is out of range of found
|
||||
//! solutions ((N < 1) || (N > NbExt()).
|
||||
Standard_EXPORT Standard_Real SquareDistance (const Standard_Integer theN) const;
|
||||
|
||||
//! Returns the point of the Nth resulting distance.
|
||||
Standard_EXPORT const Extrema_POnSurf& Point (const Standard_Integer N) const;
|
||||
//! @throws StdFail_NotDone if extrema search has failed.
|
||||
//! @throws Standard_OutOfRange if given index is out of range of found
|
||||
//! solutions ((N < 1) || (N > NbExt()).
|
||||
Standard_EXPORT const Extrema_POnSurf& Point (const Standard_Integer theN) const;
|
||||
|
||||
|
||||
protected: //! @name Protected methods performing the job
|
||||
|
||||
//! Creation of grid of parametric points (sampling of the surface)
|
||||
Standard_EXPORT void BuildGrid();
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Standard_EXPORT Adaptor3d_SurfacePtr Bidon() const;
|
||||
|
||||
Standard_EXPORT void BuildTree();
|
||||
|
||||
Standard_EXPORT void FindSolution (const gp_Pnt& P, const Extrema_POnSurfParams& theParams);
|
||||
|
||||
//! Selection of points to build grid, depending on the type of surface
|
||||
Standard_EXPORT void GetGridPoints (const Adaptor3d_Surface& theSurf);
|
||||
|
||||
//! Creation of grid of parametric points
|
||||
Standard_EXPORT void BuildGrid (const gp_Pnt& thePoint);
|
||||
|
||||
|
||||
//! Builds the BVH tree with bounding boxes of the cells of the grid
|
||||
Standard_EXPORT void BuildTree();
|
||||
|
||||
//! Looks for the solution starting at given point
|
||||
Standard_EXPORT Standard_Boolean FindSolution (const Extrema_POnSurfParams& theParams);
|
||||
|
||||
//! Compute new edge parameters.
|
||||
Standard_EXPORT const Extrema_POnSurfParams& ComputeEdgeParameters (const Standard_Boolean IsUEdge, const Extrema_POnSurfParams& theParam0, const Extrema_POnSurfParams& theParam1, const gp_Pnt& thePoints, const Standard_Real theDiffTol);
|
||||
Standard_EXPORT const Extrema_POnSurfParams&
|
||||
ComputeFaceParameters (const Standard_Integer theU,
|
||||
const Standard_Integer theV);
|
||||
|
||||
//! Compute new edge parameters.
|
||||
Standard_EXPORT const Extrema_POnSurfParams&
|
||||
ComputeEdgeParameters (const Standard_Boolean IsUEdge,
|
||||
const Extrema_POnSurfParams& theParam0,
|
||||
const Extrema_POnSurfParams& theParam1,
|
||||
const Standard_Real theDiffTol);
|
||||
|
||||
//! Looks for the Min or Max Solution (depending on the given target).
|
||||
Standard_EXPORT Standard_Boolean FindSolution (const Standard_Integer theUIndex,
|
||||
const Standard_Integer theVIndex,
|
||||
const Extrema_ExtFlag theTarget);
|
||||
|
||||
|
||||
Standard_Boolean myDone;
|
||||
Standard_Boolean myInit;
|
||||
Standard_Real myumin;
|
||||
Standard_Real myusup;
|
||||
Standard_Real myvmin;
|
||||
Standard_Real myvsup;
|
||||
Standard_Integer myusample;
|
||||
Standard_Integer myvsample;
|
||||
Standard_Real mytolu;
|
||||
Standard_Real mytolv;
|
||||
Handle(Extrema_HArray2OfPOnSurfParams) myPoints;
|
||||
Extrema_HUBTreeOfSphere mySphereUBTree;
|
||||
Handle(Bnd_HArray1OfSphere) mySphereArray;
|
||||
Extrema_FuncPSNorm myF;
|
||||
Adaptor3d_SurfacePtr myS;
|
||||
Extrema_ExtFlag myFlag;
|
||||
Extrema_ExtAlgo myAlgo;
|
||||
Handle(TColStd_HArray1OfReal) myUParams;
|
||||
Handle(TColStd_HArray1OfReal) myVParams;
|
||||
protected: //! @name Rules for BVH traverse
|
||||
|
||||
//! Rejection of the node by bounding box.
|
||||
//! Metric is computed to choose the best branch.
|
||||
//! Returns true if the node should be rejected, false otherwise.
|
||||
Standard_EXPORT virtual Standard_Boolean
|
||||
RejectNode (const BVH_Vec3d& theCornerMin,
|
||||
const BVH_Vec3d& theCornerMax,
|
||||
Standard_Real& theMetric) const Standard_OVERRIDE;
|
||||
|
||||
//! Rejects the node by the metric
|
||||
Standard_EXPORT virtual Standard_Boolean
|
||||
RejectMetric (const Standard_Real& theMetric) const Standard_OVERRIDE;
|
||||
|
||||
//! Compares the two metrics and chooses the best one.
|
||||
//! Returns true if the first metric is better than the second,
|
||||
//! false otherwise.
|
||||
Standard_EXPORT virtual Standard_Boolean
|
||||
IsMetricBetter (const Standard_Real& theLeft,
|
||||
const Standard_Real& theRight) const Standard_OVERRIDE;
|
||||
|
||||
//! Leaf element acceptance.
|
||||
//! Metric of the parent leaf-node is passed to avoid the check on the
|
||||
//! element and accept it unconditionally.
|
||||
//! Returns true if the element has been accepted, false otherwise.
|
||||
Standard_EXPORT virtual Standard_Boolean
|
||||
Accept (const Standard_Integer theIndex,
|
||||
const Standard_Real& theMetric) Standard_OVERRIDE;
|
||||
|
||||
protected: //! @name Auxiliary types
|
||||
|
||||
//! Structure to keep and sort the results
|
||||
struct Extrema_GenExtPS_ExtPSResult
|
||||
{
|
||||
Extrema_POnSurf UV; //! UV coordinates of extrema solution
|
||||
Standard_Real SqDistance; //! Square distance to target point
|
||||
|
||||
Extrema_GenExtPS_ExtPSResult()
|
||||
: SqDistance (-1)
|
||||
{}
|
||||
|
||||
Extrema_GenExtPS_ExtPSResult (const Extrema_POnSurf& theUV,
|
||||
const Standard_Real theSqDist)
|
||||
: UV (theUV),
|
||||
SqDistance (theSqDist)
|
||||
{}
|
||||
|
||||
//! IsLess operator
|
||||
Standard_Boolean operator< (const Extrema_GenExtPS_ExtPSResult& Other) const
|
||||
{
|
||||
if (SqDistance != Other.SqDistance)
|
||||
return SqDistance < Other.SqDistance;
|
||||
|
||||
Standard_Real U1, U2, V1, V2;
|
||||
UV.Parameter (U1, V1);
|
||||
Other.UV.Parameter (U2, V2);
|
||||
return (U1 < U2 || (U1 == U2 && V1 < V2));
|
||||
}
|
||||
};
|
||||
|
||||
//! Localized parametric space of surface on which the single
|
||||
//! BVH tree is built
|
||||
struct Extrema_GenExtPS_LocalizedGrid
|
||||
{
|
||||
Standard_Integer IdUMin;
|
||||
Standard_Integer IdUMax;
|
||||
Standard_Integer IdVMin;
|
||||
Standard_Integer IdVMax;
|
||||
Handle(Extrema_GenExtPS_GridCellBoxSet) CellBoxSet;
|
||||
|
||||
Extrema_GenExtPS_LocalizedGrid ()
|
||||
: IdUMin (0), IdUMax (0), IdVMin (0), IdVMax (0), CellBoxSet (NULL)
|
||||
{}
|
||||
|
||||
Extrema_GenExtPS_LocalizedGrid (const Standard_Integer theUMin,
|
||||
const Standard_Integer theUMax,
|
||||
const Standard_Integer theVMin,
|
||||
const Standard_Integer theVMax,
|
||||
const Handle(Extrema_GenExtPS_GridCellBoxSet)& theCellBoxSet)
|
||||
: IdUMin (theUMin), IdUMax (theUMax),
|
||||
IdVMin (theVMin), IdVMax (theVMax),
|
||||
CellBoxSet (theCellBoxSet)
|
||||
{}
|
||||
};
|
||||
|
||||
protected: //! @name Fields
|
||||
|
||||
// Inputs
|
||||
gp_Pnt myPoint; //!< Point
|
||||
Adaptor3d_SurfacePtr myS; //!< Surface
|
||||
Extrema_FuncPSNorm myF; //!< Function
|
||||
|
||||
Standard_Real myUMin; //!< Surface parametric range: UMin
|
||||
Standard_Real myUMax; //!< Surface parametric range: UMax
|
||||
Standard_Real myVMin; //!< Surface parametric range: VMin
|
||||
Standard_Real myVMax; //!< Surface parametric range: VMax
|
||||
|
||||
Standard_Integer myNbUSamples; //!< Number of samples in U parametric direction
|
||||
Standard_Integer myNbVSamples; //!< Number of samples in V parametric direction
|
||||
|
||||
Standard_Real myTolU; //!< U parametric tolerance
|
||||
Standard_Real myTolV; //!< V parametric tolerance
|
||||
|
||||
Standard_Real myLocUMin; //!< Localized surface parametric range: UMin
|
||||
Standard_Real myLocUMax; //!< Localized surface parametric range: UMax
|
||||
Standard_Real myLocVMin; //!< Localized surface parametric range: VMin
|
||||
Standard_Real myLocVMax; //!< Localized surface parametric range: VMax
|
||||
|
||||
Extrema_ExtFlag myTarget; //!< Extrema objective
|
||||
|
||||
// Intermediate data
|
||||
|
||||
Handle(Extrema_HArray2OfPOnSurfParams) myPoints; //!< Grid points
|
||||
Handle(Extrema_HArray2OfPOnSurf) myMidPoints; //!< Points in the middle of the cell
|
||||
Handle(TColStd_HArray1OfReal) myUParams; //!< Grid parameters in U parametric direction
|
||||
Handle(TColStd_HArray1OfReal) myVParams; //!< Grid parameters in V parametric direction
|
||||
|
||||
Handle(Extrema_HArray2OfPOnSurfParams) myFacePntParams;
|
||||
Handle(Extrema_HArray2OfPOnSurfParams) myUEdgePntParams;
|
||||
Handle(Extrema_HArray2OfPOnSurfParams) myVEdgePntParams;
|
||||
Extrema_POnSurfParams myGridParam;
|
||||
|
||||
Standard_Real mySqDistance; //!< Min/Max found square distance used in BVH tree traverse
|
||||
opencascade::handle
|
||||
<BVH_IndexedBoxSet<Standard_Real, 3, Extrema_GenExtPS_LocalizedGrid> > myBVHBoxSet; //!< High-level BVH of BVH organized grid cells
|
||||
|
||||
// Results
|
||||
std::vector <Extrema_GenExtPS_ExtPSResult> mySolutions; //!< Found solutions (sorted first by distance to target point,
|
||||
//! second by the ascending U,V coordinates)
|
||||
Standard_Boolean myIsDone; //!< Done/Not done flag
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_HANDLE (Extrema_GenExtPS, Standard_Transient)
|
||||
|
||||
#endif // _Extrema_GenExtPS_HeaderFile
|
||||
|
@@ -12,7 +12,7 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
inline Extrema_POnSurfParams::Extrema_POnSurfParams()
|
||||
: mySqrDistance (0.),
|
||||
: mySqrDistance (-1),
|
||||
myElementType (Extrema_Node),
|
||||
myIndexU (0),
|
||||
myIndexV (0)
|
||||
@@ -22,7 +22,7 @@ inline Extrema_POnSurfParams::Extrema_POnSurfParams()
|
||||
inline Extrema_POnSurfParams::Extrema_POnSurfParams
|
||||
(const Standard_Real theU, const Standard_Real theV, const gp_Pnt &thePnt)
|
||||
: Extrema_POnSurf (theU, theV, thePnt),
|
||||
mySqrDistance (0.),
|
||||
mySqrDistance (-1),
|
||||
myElementType (Extrema_Node),
|
||||
myIndexU (0),
|
||||
myIndexV (0)
|
||||
|
@@ -33,7 +33,6 @@ Extrema_EPCOfExtPC.hxx
|
||||
Extrema_EPCOfExtPC2d.hxx
|
||||
Extrema_EPCOfExtPC2d_0.cxx
|
||||
Extrema_EPCOfExtPC_0.cxx
|
||||
Extrema_ExtAlgo.hxx
|
||||
Extrema_ExtCC.cxx
|
||||
Extrema_ExtCC.hxx
|
||||
Extrema_ExtCC2d.cxx
|
||||
|
@@ -17,23 +17,6 @@
|
||||
#include <Message.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
|
||||
//! Buffer with decoded data.
|
||||
class FSD_Base64DecoderBuffer : public NCollection_Buffer
|
||||
{
|
||||
public:
|
||||
//! Empty constructor.
|
||||
FSD_Base64DecoderBuffer() : NCollection_Buffer (NCollection_BaseAllocator::CommonBaseAllocator()) {}
|
||||
|
||||
//! Shrink data size.
|
||||
void ShrinkSize (Standard_Size theSize)
|
||||
{
|
||||
if (theSize < mySize)
|
||||
{
|
||||
mySize = theSize;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// =======================================================================
|
||||
// function : Decode
|
||||
// purpose :
|
||||
@@ -54,7 +37,7 @@ Handle(NCollection_Buffer) FSD_Base64Decoder::Decode (const Standard_Byte* theSt
|
||||
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 255, 255, 255, 255, 255
|
||||
};
|
||||
|
||||
Handle(FSD_Base64DecoderBuffer) aData = new FSD_Base64DecoderBuffer();
|
||||
Handle(NCollection_Buffer) aData = new NCollection_Buffer (NCollection_BaseAllocator::CommonBaseAllocator());
|
||||
if (!aData->Allocate (3 * theLen / 4))
|
||||
{
|
||||
Message::SendFail ("Fail to allocate memory.");
|
||||
@@ -99,8 +82,6 @@ Handle(NCollection_Buffer) FSD_Base64Decoder::Decode (const Standard_Byte* theSt
|
||||
++aDataPtr;
|
||||
}
|
||||
}
|
||||
// shrink buffer size to actual length
|
||||
const Standard_Size aFinalLen = aDataPtr - aData->ChangeData();
|
||||
aData->ShrinkSize (aFinalLen);
|
||||
|
||||
return aData;
|
||||
}
|
||||
|
@@ -1,3 +1,5 @@
|
||||
GCPnts.cxx
|
||||
GCPnts.hxx
|
||||
GCPnts_AbscissaPoint.cxx
|
||||
GCPnts_AbscissaPoint.pxx
|
||||
GCPnts_AbscissaPoint.hxx
|
||||
|
54
src/GCPnts/GCPnts.cxx
Normal file
54
src/GCPnts/GCPnts.cxx
Normal file
@@ -0,0 +1,54 @@
|
||||
// Created on: 2020-05-18
|
||||
// Copyright (c) 1999-2020 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 <GCPnts.hxx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
//=======================================================================
|
||||
//function : FillParams
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GCPnts::FillParams (const TColStd_Array1OfReal& theKnots,
|
||||
const Standard_Integer theDegree,
|
||||
const Standard_Real theParMin,
|
||||
const Standard_Real theParMax,
|
||||
NCollection_Vector<Standard_Real>& theParams)
|
||||
{
|
||||
Standard_Real aPrevPar = theParMin;
|
||||
theParams.Append (aPrevPar);
|
||||
|
||||
Standard_Integer aNbP = Max (theDegree, 1);
|
||||
|
||||
for (Standard_Integer i = 1;
|
||||
(i < theKnots.Length()) && (theKnots (i) < (theParMax - Precision::PConfusion())); ++i)
|
||||
{
|
||||
if (theKnots (i + 1) < theParMin + Precision::PConfusion())
|
||||
continue;
|
||||
|
||||
Standard_Real aStep = (theKnots (i + 1) - theKnots (i)) / aNbP;
|
||||
for (Standard_Integer k = 1; k <= aNbP ; ++k)
|
||||
{
|
||||
Standard_Real aPar = theKnots (i) + k * aStep;
|
||||
if (aPar > theParMax - Precision::PConfusion())
|
||||
break;
|
||||
|
||||
if (aPar > aPrevPar + Precision::PConfusion())
|
||||
{
|
||||
theParams.Append (aPar);
|
||||
aPrevPar = aPar;
|
||||
}
|
||||
}
|
||||
}
|
||||
theParams.Append (theParMax);
|
||||
}
|
35
src/GCPnts/GCPnts.hxx
Normal file
35
src/GCPnts/GCPnts.hxx
Normal file
@@ -0,0 +1,35 @@
|
||||
// Created on: 2020-05-18
|
||||
// Copyright (c) 1999-2020 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 _GCPnts_HeaderFile
|
||||
#define _GCPnts_HeaderFile
|
||||
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <NCollection_Vector.hxx>
|
||||
|
||||
//! The GCPnts package provides general utilities for
|
||||
//! Curves analysis.
|
||||
class GCPnts
|
||||
{
|
||||
public:
|
||||
|
||||
//! Fills <theParams> vector with sampling parameters on the curve
|
||||
Standard_EXPORT static void FillParams (const TColStd_Array1OfReal& theKnots,
|
||||
const Standard_Integer theDegree,
|
||||
const Standard_Real theParMin,
|
||||
const Standard_Real theParMax,
|
||||
NCollection_Vector<Standard_Real>& theParams);
|
||||
};
|
||||
|
||||
#endif
|
@@ -40,10 +40,9 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf()
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf (const gp_Pnt& P,
|
||||
const Handle(Geom_Surface)& Surface,
|
||||
const Extrema_ExtAlgo theProjAlgo)
|
||||
const Handle(Geom_Surface)& Surface)
|
||||
{
|
||||
Init (P, Surface, theProjAlgo);
|
||||
Init (P, Surface);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : GeomAPI_ProjectPointOnSurf
|
||||
@@ -51,10 +50,9 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf()
|
||||
//=======================================================================
|
||||
GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf (const gp_Pnt& P,
|
||||
const Handle(Geom_Surface)& Surface,
|
||||
const Standard_Real Tolerance,
|
||||
const Extrema_ExtAlgo theProjAlgo)
|
||||
const Standard_Real Tolerance)
|
||||
{
|
||||
Init (P, Surface, Tolerance, theProjAlgo);
|
||||
Init (P, Surface, Tolerance);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : GeomAPI_ProjectPointOnSurf
|
||||
@@ -65,11 +63,10 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf()
|
||||
const Standard_Real Umin,
|
||||
const Standard_Real Usup,
|
||||
const Standard_Real Vmin,
|
||||
const Standard_Real Vsup,
|
||||
const Extrema_ExtAlgo theProjAlgo)
|
||||
const Standard_Real Vsup)
|
||||
|
||||
{
|
||||
Init (P, Surface, Umin, Usup, Vmin, Vsup, theProjAlgo);
|
||||
Init (P, Surface, Umin, Usup, Vmin, Vsup);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : GeomAPI_ProjectPointOnSurf
|
||||
@@ -81,11 +78,10 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf()
|
||||
const Standard_Real Usup,
|
||||
const Standard_Real Vmin,
|
||||
const Standard_Real Vsup,
|
||||
const Standard_Real Tolerance,
|
||||
const Extrema_ExtAlgo theProjAlgo)
|
||||
const Standard_Real Tolerance)
|
||||
|
||||
{
|
||||
Init (P, Surface, Umin, Usup, Vmin, Vsup, Tolerance, theProjAlgo);
|
||||
Init (P, Surface, Umin, Usup, Vmin, Vsup, Tolerance);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
@@ -114,11 +110,10 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf()
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GeomAPI_ProjectPointOnSurf::Init (const gp_Pnt& P,
|
||||
const Handle(Geom_Surface)& Surface,
|
||||
const Extrema_ExtAlgo theProjAlgo)
|
||||
const Handle(Geom_Surface)& Surface)
|
||||
|
||||
{
|
||||
Init (P, Surface, Precision::Confusion(), theProjAlgo);
|
||||
Init (P, Surface, Precision::Confusion());
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
@@ -126,27 +121,15 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf()
|
||||
//=======================================================================
|
||||
void GeomAPI_ProjectPointOnSurf::Init(const gp_Pnt& P,
|
||||
const Handle(Geom_Surface)& Surface,
|
||||
const Standard_Real Tolerance,
|
||||
const Extrema_ExtAlgo theProjAlgo)
|
||||
const Standard_Real Tolerance)
|
||||
|
||||
{
|
||||
//modified by NIZNHY-PKV Thu Apr 4 10:37:55 2002 f
|
||||
//GeomAdaptor_Surface TheSurface (Surface);
|
||||
//myExtPS = Extrema_ExtPS (P, TheSurface, Tolerance, Tolerance);
|
||||
|
||||
//modified by NIZNHY-PKV Mon Apr 8 11:13:37 2002 f XXX
|
||||
Standard_Real Umin, Usup, Vmin, Vsup;
|
||||
Surface->Bounds(Umin, Usup, Vmin, Vsup);
|
||||
myGeomAdaptor.Load(Surface, Umin, Usup, Vmin, Vsup);
|
||||
//
|
||||
//myExtPS = Extrema_ExtPS();
|
||||
myExtPS.SetAlgo(theProjAlgo);
|
||||
myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance);
|
||||
myExtPS.Perform(P);
|
||||
//XXXmyExtPS = Extrema_ExtPS (P, myGeomAdaptor, Tolerance, Tolerance);
|
||||
//modified by NIZNHY-PKV Mon Apr 8 11:13:44 2002 t XXX
|
||||
|
||||
//modified by NIZNHY-PKV Thu Apr 4 10:37:58 2002 t
|
||||
Init ();
|
||||
}
|
||||
|
||||
@@ -160,20 +143,12 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf()
|
||||
const Standard_Real Umin,
|
||||
const Standard_Real Usup,
|
||||
const Standard_Real Vmin,
|
||||
const Standard_Real Vsup,
|
||||
const Extrema_ExtAlgo theProjAlgo)
|
||||
const Standard_Real Vsup)
|
||||
{
|
||||
Standard_Real Tolerance = Precision::PConfusion();
|
||||
//modified by NIZNHY-PKV Thu Apr 4 10:38:23 2002 f
|
||||
//GeomAdaptor_Surface TheSurface (Surface,Umin,Usup,Vmin,Vsup);
|
||||
//myExtPS = Extrema_ExtPS (P, TheSurface, Tol, Tol);
|
||||
myGeomAdaptor.Load(Surface, Umin,Usup,Vmin,Vsup);
|
||||
//myExtPS = Extrema_ExtPS();
|
||||
myExtPS.SetAlgo(theProjAlgo);
|
||||
myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance);
|
||||
myExtPS.Perform(P);
|
||||
//XXX myExtPS = Extrema_ExtPS (P, myGeomAdaptor, Tol, Tol);
|
||||
//modified by NIZNHY-PKV Thu Apr 4 10:38:30 2002 t
|
||||
Init ();
|
||||
}
|
||||
|
||||
@@ -187,19 +162,11 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf()
|
||||
const Standard_Real Usup,
|
||||
const Standard_Real Vmin,
|
||||
const Standard_Real Vsup,
|
||||
const Standard_Real Tolerance,
|
||||
const Extrema_ExtAlgo theProjAlgo)
|
||||
const Standard_Real Tolerance)
|
||||
{
|
||||
//modified by NIZNHY-PKV Thu Apr 4 10:39:10 2002 f
|
||||
//GeomAdaptor_Surface TheSurface (Surface,Umin,Usup,Vmin,Vsup);
|
||||
//myExtPS = Extrema_ExtPS (P, TheSurface, Tolerance, Tolerance);
|
||||
myGeomAdaptor.Load(Surface, Umin,Usup,Vmin,Vsup);
|
||||
//myExtPS = Extrema_ExtPS();
|
||||
myExtPS.SetAlgo(theProjAlgo);
|
||||
myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance);
|
||||
myExtPS.Perform(P);
|
||||
//XXX myExtPS = Extrema_ExtPS (P, myGeomAdaptor, Tolerance, Tolerance);
|
||||
//modified by NIZNHY-PKV Thu Apr 4 10:39:14 2002 t
|
||||
Init ();
|
||||
}
|
||||
//=======================================================================
|
||||
@@ -210,20 +177,11 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf()
|
||||
const Standard_Real Umin,
|
||||
const Standard_Real Usup,
|
||||
const Standard_Real Vmin,
|
||||
const Standard_Real Vsup,
|
||||
const Extrema_ExtAlgo theProjAlgo)
|
||||
const Standard_Real Vsup)
|
||||
{
|
||||
Standard_Real Tolerance = Precision::PConfusion();
|
||||
//modified by NIZNHY-PKV Thu Apr 4 10:41:50 2002 f
|
||||
//GeomAdaptor_Surface TheSurface (Surface,Umin,Usup,Vmin,Vsup);
|
||||
myGeomAdaptor.Load(Surface, Umin,Usup,Vmin,Vsup);
|
||||
//modified by NIZNHY-PKV Thu Apr 4 10:42:29 2002 t
|
||||
//myExtPS = Extrema_ExtPS();
|
||||
//modified by NIZNHY-PKV Thu Apr 4 10:42:32 2002 f
|
||||
//myExtPS.Initialize(TheSurface, Umin, Usup, Vmin, Vsup, Tol, Tol);
|
||||
myExtPS.SetAlgo(theProjAlgo);
|
||||
myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance);
|
||||
//modified by NIZNHY-PKV Thu Apr 4 10:42:39 2002 t
|
||||
myIsDone = Standard_False;
|
||||
}
|
||||
//=======================================================================
|
||||
@@ -235,19 +193,10 @@ GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf()
|
||||
const Standard_Real Usup,
|
||||
const Standard_Real Vmin,
|
||||
const Standard_Real Vsup,
|
||||
const Standard_Real Tolerance,
|
||||
const Extrema_ExtAlgo theProjAlgo)
|
||||
const Standard_Real Tolerance)
|
||||
{
|
||||
//modified by NIZNHY-PKV Thu Apr 4 10:43:00 2002 f
|
||||
//GeomAdaptor_Surface TheSurface (Surface,Umin,Usup,Vmin,Vsup);
|
||||
myGeomAdaptor.Load(Surface, Umin,Usup,Vmin,Vsup);
|
||||
//modified by NIZNHY-PKV Thu Apr 4 10:43:16 2002 t
|
||||
//myExtPS = Extrema_ExtPS();
|
||||
//modified by NIZNHY-PKV Thu Apr 4 10:43:18 2002 f
|
||||
//myExtPS.Initialize(TheSurface, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance);
|
||||
myExtPS.SetAlgo(theProjAlgo);
|
||||
myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance);
|
||||
//modified by NIZNHY-PKV Thu Apr 4 10:43:26 2002 t
|
||||
myIsDone = Standard_False;
|
||||
}
|
||||
//=======================================================================
|
||||
|
@@ -25,7 +25,6 @@
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Extrema_ExtPS.hxx>
|
||||
#include <GeomAdaptor_Surface.hxx>
|
||||
#include <Extrema_ExtAlgo.hxx>
|
||||
#include <Extrema_ExtFlag.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
class Standard_OutOfRange;
|
||||
@@ -51,45 +50,38 @@ public:
|
||||
|
||||
//! Create the projection of a point <P> on a surface
|
||||
//! <Surface>
|
||||
Standard_EXPORT GeomAPI_ProjectPointOnSurf(const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Extrema_ExtAlgo Algo = Extrema_ExtAlgo_Grad);
|
||||
Standard_EXPORT GeomAPI_ProjectPointOnSurf(const gp_Pnt& P, const Handle(Geom_Surface)& Surface);
|
||||
|
||||
//! Create the projection of a point <P> on a surface
|
||||
//! <Surface>
|
||||
//! Create the projection of a point <P> on a surface
|
||||
//! <Surface>. The solution are computed in the domain
|
||||
//! [Umin,Usup] [Vmin,Vsup] of the surface.
|
||||
Standard_EXPORT GeomAPI_ProjectPointOnSurf(const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Standard_Real Tolerance, const Extrema_ExtAlgo Algo = Extrema_ExtAlgo_Grad);
|
||||
Standard_EXPORT GeomAPI_ProjectPointOnSurf(const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Standard_Real Tolerance);
|
||||
|
||||
Standard_EXPORT GeomAPI_ProjectPointOnSurf(const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real Tolerance, const Extrema_ExtAlgo Algo = Extrema_ExtAlgo_Grad);
|
||||
Standard_EXPORT GeomAPI_ProjectPointOnSurf(const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real Tolerance);
|
||||
|
||||
//! Init the projection of a point <P> on a surface
|
||||
//! <Surface>
|
||||
Standard_EXPORT GeomAPI_ProjectPointOnSurf(const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Extrema_ExtAlgo Algo = Extrema_ExtAlgo_Grad);
|
||||
Standard_EXPORT GeomAPI_ProjectPointOnSurf(const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup);
|
||||
|
||||
Standard_EXPORT void Init (const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Standard_Real Tolerance, const Extrema_ExtAlgo Algo = Extrema_ExtAlgo_Grad);
|
||||
Standard_EXPORT void Init (const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Standard_Real Tolerance);
|
||||
|
||||
//! Init the projection of a point <P> on a surface
|
||||
//! <Surface>. The solution are computed in the domain
|
||||
//! [Umin,Usup] [Vmin,Vsup] of the surface.
|
||||
Standard_EXPORT void Init (const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Extrema_ExtAlgo Algo = Extrema_ExtAlgo_Grad);
|
||||
Standard_EXPORT void Init (const gp_Pnt& P, const Handle(Geom_Surface)& Surface);
|
||||
|
||||
Standard_EXPORT void Init (const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real Tolerance, const Extrema_ExtAlgo Algo = Extrema_ExtAlgo_Grad);
|
||||
Standard_EXPORT void Init (const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real Tolerance);
|
||||
|
||||
//! Init the projection for many points on a surface
|
||||
//! <Surface>. The solutions will be computed in the domain
|
||||
//! [Umin,Usup] [Vmin,Vsup] of the surface.
|
||||
Standard_EXPORT void Init (const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Extrema_ExtAlgo Algo = Extrema_ExtAlgo_Grad);
|
||||
Standard_EXPORT void Init (const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup);
|
||||
|
||||
Standard_EXPORT void Init (const Handle(Geom_Surface)& Surface, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real Tolerance, const Extrema_ExtAlgo Algo = Extrema_ExtAlgo_Grad);
|
||||
Standard_EXPORT void Init (const Handle(Geom_Surface)& Surface, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real Tolerance);
|
||||
|
||||
Standard_EXPORT void Init (const Handle(Geom_Surface)& Surface, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Extrema_ExtAlgo Algo = Extrema_ExtAlgo_Grad);
|
||||
|
||||
//! Sets the Extrema search algorithm - Grad or Tree. <br>
|
||||
//! By default the Extrema is initialized with Grad algorithm.
|
||||
void SetExtremaAlgo(const Extrema_ExtAlgo theAlgo)
|
||||
{
|
||||
myExtPS.SetAlgo(theAlgo);
|
||||
}
|
||||
Standard_EXPORT void Init (const Handle(Geom_Surface)& Surface, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup);
|
||||
|
||||
//! Sets the Extrema search flag - MIN or MAX or MINMAX.<br>
|
||||
//! By default the Extrema is set to search the MinMax solutions.
|
||||
|
@@ -219,12 +219,6 @@ GeomFill_Sweep::GeomFill_Sweep(const Handle(GeomFill_LocationLaw)& Location,
|
||||
|
||||
// Traitement des KPart
|
||||
if (myKPart) isKPart = BuildKPart();
|
||||
|
||||
if (!isKPart)
|
||||
{
|
||||
myExchUV = Standard_False;
|
||||
isUReversed = isVReversed = Standard_False;
|
||||
}
|
||||
|
||||
// Traitement des produits Formelles
|
||||
if ((!isKPart) && (Methode == GeomFill_Location)) {
|
||||
@@ -882,7 +876,6 @@ static Standard_Boolean IsSweepParallelSpine (const Handle(GeomFill_LocationLaw)
|
||||
// l == f - "degenerated" surface
|
||||
// UlastOnSec - UfirstOnSec > M_PI_2 - "twisted" surface,
|
||||
// it is impossible to represent with help of trimmed sphere
|
||||
isUReversed = Standard_False;
|
||||
return Ok;
|
||||
}
|
||||
|
||||
|
@@ -1112,9 +1112,8 @@ void GeomInt_IntSS::BuildPCurves (Standard_Real f,
|
||||
const gp_Pnt aP3d1 = C->Value(f);
|
||||
const gp_Pnt aP3d2 = C->Value(l);
|
||||
|
||||
anExtr.SetAlgo(Extrema_ExtAlgo_Grad);
|
||||
anExtr.Initialize(anAS, umin, umax, vmin, vmax,
|
||||
Precision::Confusion(), Precision::Confusion());
|
||||
Precision::Confusion(), Precision::Confusion());
|
||||
anExtr.Perform(aP3d1);
|
||||
|
||||
if(ParametersOfNearestPointOnSurface(anExtr, aU, aV))
|
||||
|
@@ -89,9 +89,9 @@ static void showProjSolution(Draw_Interpretor& di,
|
||||
|
||||
static Standard_Integer proj (Draw_Interpretor& di, Standard_Integer n, const char** a)
|
||||
{
|
||||
if ( n < 5)
|
||||
if ( n != 5 && n != 7)
|
||||
{
|
||||
Message::SendFail() << " Use proj curve/surf x y z [{extrema algo: g(grad)/t(tree)}|{u v}]";
|
||||
Message::SendFail() << " Use proj curve/surf x y z [{u v}]";
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -99,10 +99,6 @@ static Standard_Integer proj (Draw_Interpretor& di, Standard_Integer n, const ch
|
||||
|
||||
Handle(Geom_Curve) GC = DrawTrSurf::GetCurve(a[1]);
|
||||
Handle(Geom_Surface) GS;
|
||||
Extrema_ExtAlgo aProjAlgo = Extrema_ExtAlgo_Grad;
|
||||
|
||||
if (n == 6 && a[5][0] == 't')
|
||||
aProjAlgo = Extrema_ExtAlgo_Tree;
|
||||
|
||||
if (GC.IsNull())
|
||||
{
|
||||
@@ -111,12 +107,12 @@ static Standard_Integer proj (Draw_Interpretor& di, Standard_Integer n, const ch
|
||||
if (GS.IsNull())
|
||||
return 1;
|
||||
|
||||
if (n <= 6)
|
||||
if (n == 5)
|
||||
{
|
||||
Standard_Real U1, U2, V1, V2;
|
||||
GS->Bounds(U1,U2,V1,V2);
|
||||
|
||||
GeomAPI_ProjectPointOnSurf proj(P,GS,U1,U2,V1,V2,aProjAlgo);
|
||||
GeomAPI_ProjectPointOnSurf proj(P,GS,U1,U2,V1,V2);
|
||||
if (!proj.IsDone())
|
||||
{
|
||||
di << "projection failed.";
|
||||
@@ -753,7 +749,7 @@ void GeometryTest::APICommands(Draw_Interpretor& theCommands)
|
||||
|
||||
done = Standard_True;
|
||||
|
||||
theCommands.Add("proj", "proj curve/surf x y z [{extrema algo: g(grad)/t(tree)}|{u v}]\n"
|
||||
theCommands.Add("proj", "proj curve/surf x y z [{u v}]\n"
|
||||
"\t\tOptional parameters are relevant to surf only.\n"
|
||||
"\t\tIf initial {u v} are given then local extrema is called",__FILE__, proj);
|
||||
|
||||
|
@@ -218,7 +218,7 @@ Standard_Boolean IGESData_UndefinedEntity::ReadDir
|
||||
iapb = Standard_False;
|
||||
if (v[3] < -max) iapb = Standard_True;
|
||||
else if (v[3] < 0) {
|
||||
anent = GetCasted(IGESData_IGESEntity,IR->BoundEntity((1-v[3])/2));
|
||||
anent = GetCasted(IGESData_IGESEntity,IR->BoundEntity((-1-v[3])/2));
|
||||
if (!anent->IsKind(STANDARD_TYPE(IGESData_LineFontEntity))) iapb = Standard_True;
|
||||
}
|
||||
// Sending of message : Line Font Pattern field is incorrect.
|
||||
@@ -232,7 +232,7 @@ Standard_Boolean IGESData_UndefinedEntity::ReadDir
|
||||
iapb = Standard_False;
|
||||
if (v[4] < -max) iapb = Standard_True;
|
||||
else if (v[4] < 0) {
|
||||
anent = GetCasted(IGESData_IGESEntity,IR->BoundEntity((1-v[4])/2));
|
||||
anent = GetCasted(IGESData_IGESEntity,IR->BoundEntity((-1-v[4])/2));
|
||||
if (!anent->IsKind(STANDARD_TYPE(IGESData_LevelListEntity))) iapb = Standard_True;
|
||||
}
|
||||
|
||||
@@ -276,7 +276,7 @@ Standard_Boolean IGESData_UndefinedEntity::ReadDir
|
||||
|
||||
iapb = Standard_False;
|
||||
if (v[7] < 0 || v[7] > max) iapb = Standard_True;
|
||||
else if (v[7] > 0) {
|
||||
else if (v[7] < 0) {
|
||||
anent = GetCasted(IGESData_IGESEntity,IR->BoundEntity((1+v[7])/2));
|
||||
if (!anent->IsKind(STANDARD_TYPE(IGESData_LabelDisplayEntity))) iapb = Standard_True;
|
||||
}
|
||||
@@ -290,9 +290,9 @@ Standard_Boolean IGESData_UndefinedEntity::ReadDir
|
||||
}
|
||||
|
||||
iapb = Standard_False;
|
||||
if (v[14] < -max || v[14] > max) iapb = Standard_True;
|
||||
if (v[14] < 0 || v[14] > max) iapb = Standard_True;
|
||||
else if (v[14] < 0) {
|
||||
anent = GetCasted(IGESData_IGESEntity,IR->BoundEntity((1-v[14])/2));
|
||||
anent = GetCasted(IGESData_IGESEntity,IR->BoundEntity((1+v[14])/2));
|
||||
if (!anent->IsKind(STANDARD_TYPE(IGESData_ColorEntity)))
|
||||
{ thedstat += 512; v[14] = 0; }
|
||||
}
|
||||
|
@@ -19,16 +19,15 @@
|
||||
//! Enumerates statuses used to notify state of discrete model.
|
||||
enum IMeshData_Status
|
||||
{
|
||||
IMeshData_NoError = 0x0, //!< Mesh generation is successful.
|
||||
IMeshData_OpenWire = 0x1, //!< Notifies open wire problem, which can potentially lead to incorrect results.
|
||||
IMeshData_SelfIntersectingWire = 0x2, //!< Notifies self-intersections on discretized wire, which can potentially lead to incorrect results.
|
||||
IMeshData_Failure = 0x4, //!< Failed to generate mesh for some faces.
|
||||
IMeshData_ReMesh = 0x8, //!< Deflection of some edges has been decreased due to interference of discrete model.
|
||||
IMeshData_UnorientedWire = 0x10, //!< Notifies bad orientation of a wire, which can potentially lead to incorrect results.
|
||||
IMeshData_TooFewPoints = 0x20, //!< Discrete model contains too few boundary points to generate mesh.
|
||||
IMeshData_Outdated = 0x40, //!< Existing triangulation of some faces corresponds to greater deflection than specified by parameter.
|
||||
IMeshData_Reused = 0x80, //!< Existing triangulation of some faces is reused as far as it fits specified deflection.
|
||||
IMeshData_UserBreak = 0x160 //!< User break
|
||||
IMeshData_NoError = 0x0, //!< Mesh generation is successful.
|
||||
IMeshData_OpenWire = 0x1, //!< Notifies open wire problem, which can potentially lead to incorrect results.
|
||||
IMeshData_SelfIntersectingWire = 0x2, //!< Notifies self-intersections on discretized wire, which can potentially lead to incorrect results.
|
||||
IMeshData_Failure = 0x4, //!< Failed to generate mesh for some faces.
|
||||
IMeshData_ReMesh = 0x8, //!< Deflection of some edges has been decreased due to interference of discrete model.
|
||||
IMeshData_UnorientedWire = 0x10, //!< Notifies bad orientation of a wire, which can potentially lead to incorrect results.
|
||||
IMeshData_TooFewPoints = 0x20, //!< Discrete model contains too few boundary points to generate mesh.
|
||||
IMeshData_Outdated = 0x40, //!< Existing triangulation of some faces corresponds to greater deflection than specified by parameter.
|
||||
IMeshData_Reused = 0x80 //!< Existing triangulation of some faces is reused as far as it fits specified deflection.
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -22,7 +22,6 @@
|
||||
#include <IMeshData_Model.hxx>
|
||||
#include <IMeshTools_Parameters.hxx>
|
||||
#include <IMeshTools_ModelAlgo.hxx>
|
||||
#include <Message_ProgressRange.hxx>
|
||||
|
||||
//! Interface class representing context of BRepMesh algorithm.
|
||||
//! Intended to cache discrete model and instances of tools for
|
||||
@@ -65,7 +64,7 @@ public:
|
||||
}
|
||||
|
||||
// Discretize edges of a model.
|
||||
return myEdgeDiscret->Perform(myModel, myParameters, Message_ProgressRange());
|
||||
return myEdgeDiscret->Perform(myModel, myParameters);
|
||||
}
|
||||
|
||||
//! Performs healing of discrete model built by DiscretizeEdges() method
|
||||
@@ -80,7 +79,7 @@ public:
|
||||
|
||||
return myModelHealer.IsNull() ?
|
||||
Standard_True :
|
||||
myModelHealer->Perform (myModel, myParameters, Message_ProgressRange());
|
||||
myModelHealer->Perform(myModel, myParameters);
|
||||
}
|
||||
|
||||
//! Performs pre-processing of discrete model using assigned algorithm.
|
||||
@@ -95,12 +94,12 @@ public:
|
||||
|
||||
return myPreProcessor.IsNull() ?
|
||||
Standard_True :
|
||||
myPreProcessor->Perform (myModel, myParameters, Message_ProgressRange());
|
||||
myPreProcessor->Perform(myModel, myParameters);
|
||||
}
|
||||
|
||||
//! Performs meshing of faces of discrete model using assigned meshing algorithm.
|
||||
//! @return True on success, False elsewhere.
|
||||
virtual Standard_Boolean DiscretizeFaces (const Message_ProgressRange& theRange)
|
||||
Standard_EXPORT virtual Standard_Boolean DiscretizeFaces()
|
||||
{
|
||||
if (myModel.IsNull() || myFaceDiscret.IsNull())
|
||||
{
|
||||
@@ -108,7 +107,7 @@ public:
|
||||
}
|
||||
|
||||
// Discretize faces of a model.
|
||||
return myFaceDiscret->Perform (myModel, myParameters, theRange);
|
||||
return myFaceDiscret->Perform(myModel, myParameters);
|
||||
}
|
||||
|
||||
//! Performs post-processing of discrete model using assigned algorithm.
|
||||
@@ -122,7 +121,7 @@ public:
|
||||
|
||||
return myPostProcessor.IsNull() ?
|
||||
Standard_True :
|
||||
myPostProcessor->Perform(myModel, myParameters, Message_ProgressRange());
|
||||
myPostProcessor->Perform(myModel, myParameters);
|
||||
}
|
||||
|
||||
//! Cleans temporary context data.
|
||||
|
@@ -19,7 +19,6 @@
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <IMeshData_Types.hxx>
|
||||
#include <Message_ProgressRange.hxx>
|
||||
|
||||
struct IMeshTools_Parameters;
|
||||
|
||||
@@ -36,8 +35,7 @@ public:
|
||||
//! Performs processing of the given face.
|
||||
Standard_EXPORT virtual void Perform(
|
||||
const IMeshData::IFaceHandle& theDFace,
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Message_ProgressRange& theRange) = 0;
|
||||
const IMeshTools_Parameters& theParameters) = 0;
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(IMeshTools_MeshAlgo, Standard_Transient)
|
||||
|
||||
|
@@ -47,7 +47,7 @@ IMeshTools_MeshBuilder::~IMeshTools_MeshBuilder ()
|
||||
// Function: Perform
|
||||
// Purpose :
|
||||
//=======================================================================
|
||||
void IMeshTools_MeshBuilder::Perform (const Message_ProgressRange& theRange)
|
||||
void IMeshTools_MeshBuilder::Perform ()
|
||||
{
|
||||
ClearStatus ();
|
||||
|
||||
@@ -58,8 +58,6 @@ void IMeshTools_MeshBuilder::Perform (const Message_ProgressRange& theRange)
|
||||
return;
|
||||
}
|
||||
|
||||
Message_ProgressScope aPS(theRange, "Mesh Perform", 10);
|
||||
|
||||
if (aContext->BuildModel ())
|
||||
{
|
||||
if (aContext->DiscretizeEdges ())
|
||||
@@ -68,7 +66,7 @@ void IMeshTools_MeshBuilder::Perform (const Message_ProgressRange& theRange)
|
||||
{
|
||||
if (aContext->PreProcessModel())
|
||||
{
|
||||
if (aContext->DiscretizeFaces(aPS.Next(9)))
|
||||
if (aContext->DiscretizeFaces())
|
||||
{
|
||||
if (aContext->PostProcessModel())
|
||||
{
|
||||
@@ -81,12 +79,6 @@ void IMeshTools_MeshBuilder::Perform (const Message_ProgressRange& theRange)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!aPS.More())
|
||||
{
|
||||
SetStatus(Message_Fail8);
|
||||
aContext->Clean();
|
||||
return;
|
||||
}
|
||||
SetStatus(Message_Fail6);
|
||||
}
|
||||
}
|
||||
@@ -121,6 +113,6 @@ void IMeshTools_MeshBuilder::Perform (const Message_ProgressRange& theRange)
|
||||
Message_Warn1 : Message_Fail2);
|
||||
}
|
||||
}
|
||||
aPS.Next(1);
|
||||
|
||||
aContext->Clean ();
|
||||
}
|
||||
|
@@ -19,7 +19,6 @@
|
||||
#include <Message_Algorithm.hxx>
|
||||
#include <IMeshTools_Context.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Message_ProgressRange.hxx>
|
||||
|
||||
//! Builds mesh for each face of shape without triangulation.
|
||||
//! In case if some faces of shape have already been triangulated
|
||||
@@ -63,7 +62,7 @@ public:
|
||||
}
|
||||
|
||||
//! Performs meshing ot the shape using current context.
|
||||
Standard_EXPORT virtual void Perform (const Message_ProgressRange& theRange);
|
||||
Standard_EXPORT virtual void Perform ();
|
||||
|
||||
DEFINE_STANDARD_RTTI_INLINE(IMeshTools_MeshBuilder, Message_Algorithm)
|
||||
|
||||
|
@@ -20,7 +20,6 @@
|
||||
#include <Standard_Failure.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Message_ProgressRange.hxx>
|
||||
|
||||
class IMeshData_Model;
|
||||
struct IMeshTools_Parameters;
|
||||
@@ -38,14 +37,13 @@ public:
|
||||
//! Exceptions protected processing of the given model.
|
||||
Standard_Boolean Perform (
|
||||
const Handle (IMeshData_Model)& theModel,
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Message_ProgressRange& theRange)
|
||||
const IMeshTools_Parameters& theParameters)
|
||||
{
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
|
||||
return performInternal (theModel, theParameters, theRange);
|
||||
return performInternal (theModel, theParameters);
|
||||
}
|
||||
catch (Standard_Failure const&)
|
||||
{
|
||||
@@ -65,8 +63,7 @@ protected:
|
||||
//! Performs processing of the given model.
|
||||
Standard_EXPORT virtual Standard_Boolean performInternal (
|
||||
const Handle (IMeshData_Model)& theModel,
|
||||
const IMeshTools_Parameters& theParameters,
|
||||
const Message_ProgressRange& theRange) = 0;
|
||||
const IMeshTools_Parameters& theParameters) = 0;
|
||||
};
|
||||
|
||||
#endif
|
@@ -2164,6 +2164,10 @@ static void SeekAdditionalPoints( const IntSurf_Quadric& theQuad1,
|
||||
return;
|
||||
|
||||
Standard_Integer aNbPoints = theEndPointOnLine - theStartPointOnLine + 1;
|
||||
if(aNbPoints >= theMinNbPoints)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Standard_Real aMinDeltaParam = theTol2D;
|
||||
|
||||
@@ -2188,7 +2192,7 @@ static void SeekAdditionalPoints( const IntSurf_Quadric& theQuad1,
|
||||
Standard_Real U1prec = 0.0, V1prec = 0.0, U2prec = 0.0, V2prec = 0.0;
|
||||
|
||||
Standard_Integer aNbPointsPrev = 0;
|
||||
do
|
||||
while(aNbPoints < theMinNbPoints && (aNbPoints != aNbPointsPrev))
|
||||
{
|
||||
aNbPointsPrev = aNbPoints;
|
||||
for(Standard_Integer fp = theStartPointOnLine, lp = 0; fp < aLastPointIndex; fp = lp + 1)
|
||||
@@ -2265,7 +2269,7 @@ static void SeekAdditionalPoints( const IntSurf_Quadric& theQuad1,
|
||||
{
|
||||
return;
|
||||
}
|
||||
} while(aNbPoints < theMinNbPoints && (aNbPoints != aNbPointsPrev));
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -3560,7 +3564,7 @@ static IntPatch_ImpImpIntersection::IntStatus
|
||||
}
|
||||
|
||||
#ifdef INTPATCH_IMPIMPINTERSECTION_DEBUG
|
||||
aWLine[i]->Dump(0);
|
||||
//aWLine[i]->Dump();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@@ -125,8 +125,7 @@ myVMinParameter(0.),
|
||||
myVMaxParameter(0.),
|
||||
myBeanTolerance(0.),
|
||||
myFaceTolerance(0.),
|
||||
myIsDone(Standard_False),
|
||||
myMinSqDistance(RealLast())
|
||||
myIsDone(Standard_False)
|
||||
{
|
||||
myCriteria = Precision::Confusion();
|
||||
myCurveResolution = Precision::PConfusion();
|
||||
@@ -147,8 +146,7 @@ IntTools_BeanFaceIntersector::IntTools_BeanFaceIntersector(const TopoDS_Edge& th
|
||||
myVMaxParameter(0.),
|
||||
myBeanTolerance(0.),
|
||||
myFaceTolerance(0.),
|
||||
myIsDone(Standard_False),
|
||||
myMinSqDistance(RealLast())
|
||||
myIsDone(Standard_False)
|
||||
{
|
||||
Init(theEdge, theFace);
|
||||
}
|
||||
@@ -167,8 +165,7 @@ IntTools_BeanFaceIntersector::IntTools_BeanFaceIntersector(const BRepAdaptor_Cur
|
||||
myUMaxParameter(0.),
|
||||
myVMinParameter(0.),
|
||||
myVMaxParameter(0.),
|
||||
myIsDone(Standard_False),
|
||||
myMinSqDistance(RealLast())
|
||||
myIsDone(Standard_False)
|
||||
{
|
||||
Init(theCurve, theSurface, theBeanTolerance, theFaceTolerance);
|
||||
}
|
||||
@@ -195,8 +192,7 @@ IntTools_BeanFaceIntersector::IntTools_BeanFaceIntersector(const BRepAdaptor_Cur
|
||||
myVMaxParameter(theVMaxParameter),
|
||||
myBeanTolerance(theBeanTolerance),
|
||||
myFaceTolerance(theFaceTolerance),
|
||||
myIsDone(Standard_False),
|
||||
myMinSqDistance(RealLast())
|
||||
myIsDone(Standard_False)
|
||||
{
|
||||
myCurve = theCurve;
|
||||
|
||||
@@ -655,14 +651,9 @@ void IntTools_BeanFaceIntersector::ComputeAroundExactIntersection()
|
||||
ComputeRangeFromStartPoint(Standard_False, aPoint.W(), U, V);
|
||||
ComputeRangeFromStartPoint(Standard_True, aPoint.W(), U, V);
|
||||
|
||||
if(aNbRanges == myRangeManager.Length())
|
||||
{
|
||||
if(aNbRanges == myRangeManager.Length()) {
|
||||
SetEmptyResultRange(aPoint.W(), myRangeManager);
|
||||
}
|
||||
else
|
||||
{
|
||||
myMinSqDistance = 0.0;
|
||||
}
|
||||
} // end if(aNbRanges == myRangeManager.Length())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -678,7 +669,6 @@ void IntTools_BeanFaceIntersector::ComputeAroundExactIntersection()
|
||||
|
||||
ComputeRangeFromStartPoint(Standard_False, aPoint1.W(), aPoint1.U(), aPoint1.V());
|
||||
ComputeRangeFromStartPoint(Standard_True, aPoint2.W(), aPoint2.U(), aPoint2.V());
|
||||
myMinSqDistance = 0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -950,9 +940,6 @@ void IntTools_BeanFaceIntersector::ComputeUsingExtremum()
|
||||
|
||||
if (myExtrema.IsParallel()) {
|
||||
|
||||
if (myMinSqDistance > myExtrema.SquareDistance (1))
|
||||
myMinSqDistance = myExtrema.SquareDistance (1);
|
||||
|
||||
if(myExtrema.SquareDistance(1) < myCriteria * myCriteria) {
|
||||
Standard_Real U1, V1, U2, V2;
|
||||
Standard_Real adistance1 = Distance(anarg1, U1, V1);
|
||||
@@ -1035,9 +1022,6 @@ void IntTools_BeanFaceIntersector::ComputeUsingExtremum()
|
||||
SetEmptyResultRange(p1.Parameter(), myRangeManager);
|
||||
}
|
||||
}
|
||||
|
||||
if (myMinSqDistance > myExtrema.SquareDistance (j))
|
||||
myMinSqDistance = myExtrema.SquareDistance (j);
|
||||
} //end for
|
||||
|
||||
if(!solutionfound) {
|
||||
|
@@ -130,14 +130,17 @@ public:
|
||||
|
||||
Standard_EXPORT void Result (IntTools_SequenceOfRanges& theResults) const;
|
||||
|
||||
//! Returns the minimal distance found between edge and face
|
||||
Standard_Real MinimalSquareDistance() const
|
||||
{
|
||||
return myMinSqDistance;
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Standard_EXPORT void ComputeAroundExactIntersection();
|
||||
|
||||
@@ -188,7 +191,6 @@ private:
|
||||
Handle(IntTools_Context) myContext;
|
||||
IntTools_SequenceOfRanges myResults;
|
||||
Standard_Boolean myIsDone;
|
||||
Standard_Real myMinSqDistance;
|
||||
|
||||
};
|
||||
|
||||
|
@@ -71,7 +71,6 @@ static
|
||||
myIsDone=Standard_False;
|
||||
myErrorStatus=1;
|
||||
myQuickCoincidenceCheck=Standard_False;
|
||||
myMinDistance = RealLast();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsCoincident
|
||||
@@ -536,10 +535,7 @@ void IntTools_EdgeFace::Perform()
|
||||
anIntersector.SetContext(myContext);
|
||||
//
|
||||
anIntersector.Perform();
|
||||
|
||||
if (anIntersector.MinimalSquareDistance() < RealLast())
|
||||
myMinDistance = Sqrt (anIntersector.MinimalSquareDistance());
|
||||
|
||||
|
||||
if(!anIntersector.IsDone()) {
|
||||
return;
|
||||
}
|
||||
|
@@ -177,11 +177,6 @@ public: //! @name Obtaining results
|
||||
return mySeqOfCommonPrts;
|
||||
}
|
||||
|
||||
//! Returns the minimal distance found between edge and face
|
||||
Standard_Real MinimalDistance() const
|
||||
{
|
||||
return myMinDistance;
|
||||
}
|
||||
|
||||
protected: //! @name Protected methods performing the intersection
|
||||
|
||||
@@ -215,7 +210,6 @@ protected:
|
||||
IntTools_SequenceOfCommonPrts mySeqOfCommonPrts;
|
||||
IntTools_Range myRange;
|
||||
Standard_Boolean myQuickCoincidenceCheck;
|
||||
Standard_Real myMinDistance; //!< Minimal distance found
|
||||
};
|
||||
|
||||
#endif // _IntTools_EdgeFace_HeaderFile
|
||||
|
@@ -32,13 +32,11 @@
|
||||
#include <CSLib.hxx>
|
||||
#include <DBRep.hxx>
|
||||
#include <Draw_Appli.hxx>
|
||||
#include <Draw_ProgressIndicator.hxx>
|
||||
#include <Draw_Segment2D.hxx>
|
||||
#include <DrawTrSurf.hxx>
|
||||
#include <GeometryTest.hxx>
|
||||
#include <IMeshData_Status.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <Message_ProgressRange.hxx>
|
||||
#include <Poly_Connect.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopTools_MapIteratorOfMapOfShape.hxx>
|
||||
@@ -159,8 +157,7 @@ options:\n\
|
||||
di << "Incremental Mesh, multi-threading "
|
||||
<< (aMeshParams.InParallel ? "ON" : "OFF") << "\n";
|
||||
|
||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
|
||||
BRepMesh_IncrementalMesh aMesher (aShape, aMeshParams, aProgress->Start());
|
||||
BRepMesh_IncrementalMesh aMesher (aShape, aMeshParams);
|
||||
|
||||
di << "Meshing statuses: ";
|
||||
const Standard_Integer aStatus = aMesher.GetStatusFlags();
|
||||
@@ -171,7 +168,7 @@ options:\n\
|
||||
else
|
||||
{
|
||||
Standard_Integer i;
|
||||
for (i = 0; i < 9; i++)
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
Standard_Integer aFlag = aStatus & (1 << i);
|
||||
if (aFlag)
|
||||
@@ -202,9 +199,6 @@ options:\n\
|
||||
case IMeshData_Reused:
|
||||
di << "Reused ";
|
||||
break;
|
||||
case IMeshData_UserBreak:
|
||||
di << "User break";
|
||||
break;
|
||||
case IMeshData_NoError:
|
||||
default:
|
||||
break;
|
||||
|
@@ -42,8 +42,6 @@ public:
|
||||
|
||||
Standard_EXPORT virtual void BVH() Standard_OVERRIDE;
|
||||
|
||||
virtual Standard_Boolean ToBuildBVH() const Standard_OVERRIDE { return Standard_False; }
|
||||
|
||||
Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual Standard_Boolean HasInitLocation() const Standard_OVERRIDE;
|
||||
|
@@ -652,6 +652,8 @@ void MeshVS_Mesh::ComputeSelection (const Handle(SelectMgr_Selection)& theSelect
|
||||
}
|
||||
}
|
||||
|
||||
StdSelect_BRepSelectionTool::PreBuildBVH (theSelection);
|
||||
|
||||
if (toShowComputeSelectionTime)
|
||||
{
|
||||
Standard_Real sec, cpu;
|
||||
|
@@ -99,12 +99,12 @@ protected:
|
||||
//! Show() should return as soon as possible to reduce thread contention
|
||||
//! in multithreaded algorithms.
|
||||
//!
|
||||
//! It is recommended to update (redraw, output etc.) only if progress is
|
||||
//! advanced by at least 1% from previous update.
|
||||
//! It is recommended to update (redraw, output etc.) only if progress advanced
|
||||
//! by at least 1% from previous update.
|
||||
//!
|
||||
//! Flag isForce is intended for forcing update in case if it is required
|
||||
//! at particular step of the algorithm; all calls to it from inside the core
|
||||
//! mechanism (Message_Progress... classes) are done with this flag equal to False.
|
||||
//! Flag isForce is intended for forcing update in case if it is
|
||||
//! optimized; all calls to it from inside the core mechanism are
|
||||
//! done with this flag equal to False.
|
||||
//!
|
||||
//! The parameter theScope is the current scope being advanced;
|
||||
//! it can be used to show the names and ranges of the on-going scope and
|
||||
@@ -120,7 +120,7 @@ public:
|
||||
//!@name Auxiliary methods
|
||||
|
||||
//! Returns total progress position ranged from 0 to 1.
|
||||
//! Should not be called concurrently while the progress is advancing,
|
||||
//! Should not be called concurrently while the progress is advancing
|
||||
//! except from implementation of method Show().
|
||||
Standard_Real GetPosition() const
|
||||
{
|
||||
|
@@ -32,22 +32,21 @@ class Message_ProgressScope;
|
||||
//! A range object can be copied, the responsibility for progress advancement is
|
||||
//! then taken by the copy.
|
||||
//! The same range object may be used (either copied or used to create scope) only once.
|
||||
//! Any consequent attempts to use range will give no result on the progress;
|
||||
//! Any consequenct attempts to use range will give no result on the progress;
|
||||
//! in debug mode, an assert message will be generated.
|
||||
//!
|
||||
//! @sa Message_ProgressScope for more details
|
||||
class Message_ProgressRange
|
||||
{
|
||||
public:
|
||||
//! Constructor of the empty range
|
||||
//! Constructor of the range
|
||||
Message_ProgressRange()
|
||||
: myParentScope (0), myStart(0.), myDelta (0.), myWasUsed (false)
|
||||
: myParentScope (0), myDelta (0), myWasUsed (false)
|
||||
{}
|
||||
|
||||
//! Copy constructor disarms the source
|
||||
//! Copy constructor disarms the source.
|
||||
Message_ProgressRange (const Message_ProgressRange& theOther)
|
||||
: myParentScope (theOther.myParentScope),
|
||||
myStart (theOther.myStart),
|
||||
myDelta (theOther.myDelta),
|
||||
myWasUsed (theOther.myWasUsed)
|
||||
{
|
||||
@@ -55,11 +54,10 @@ public:
|
||||
theOther.myWasUsed = true;
|
||||
}
|
||||
|
||||
//! Copy assignment disarms the source
|
||||
//! Copy assignment disarms the source.
|
||||
Message_ProgressRange& operator=(const Message_ProgressRange& theOther)
|
||||
{
|
||||
myParentScope = theOther.myParentScope;
|
||||
myStart = theOther.myStart;
|
||||
myDelta = theOther.myDelta;
|
||||
myWasUsed = theOther.myWasUsed;
|
||||
theOther.myWasUsed = true;
|
||||
@@ -89,19 +87,15 @@ public:
|
||||
|
||||
private:
|
||||
//! Constructor is private
|
||||
Message_ProgressRange (const Message_ProgressScope& theParent,
|
||||
Standard_Real theStart, Standard_Real theDelta)
|
||||
Message_ProgressRange (const Message_ProgressScope& theParent, Standard_Real theDelta)
|
||||
: myParentScope (&theParent),
|
||||
myStart (theStart),
|
||||
myDelta (theDelta),
|
||||
myWasUsed (false)
|
||||
{}
|
||||
|
||||
private:
|
||||
const Message_ProgressScope* myParentScope; //!< Pointer to parent scope
|
||||
Standard_Real myStart; //!< Start point on the global scale
|
||||
Standard_Real myDelta; //!< Step of incrementation on the global scale
|
||||
|
||||
Standard_Real myDelta; //!< Step of incrementation
|
||||
mutable Standard_Boolean myWasUsed; //!< Flag indicating that this range
|
||||
//! was used to create a new scope
|
||||
|
||||
|
@@ -34,48 +34,29 @@ class Message_ProgressIndicator;
|
||||
//! On every level (sub-operation) in hierarchy of operations
|
||||
//! the local instance of the Message_ProgressScope class is created.
|
||||
//! It takes a part of the upper-level scope (via Message_ProgressRange) and provides
|
||||
//! a way to consider this part as independent scale with locally defined range.
|
||||
//! a way to consider this part as independent scale with locally defined range.
|
||||
//!
|
||||
//! The position on the local scale may be advanced using the method Next(),
|
||||
//! which allows iteration-like advancement. This method can take argument to
|
||||
//! advance by the specified value (with default step equal to 1).
|
||||
//! This method returns Message_ProgressRange object that takes responsibility
|
||||
//! of making the specified step, either directly at its destruction or by
|
||||
//! delegating this task to another sub-scope created from that range object.
|
||||
//! advance on the needed value. And, this method returns ProgressRange object
|
||||
//! that takes responsibility of making the specified step at its destruction.
|
||||
//! The ProgressRange can be used to create a new progress sub-scope.
|
||||
//!
|
||||
//! It is important that sub-scope must have life time less than
|
||||
//! the life time of its parent scope that provided the range.
|
||||
//! The usage pattern is to create scope objects as local variables in the
|
||||
//! functions that do the job, and pass range objects returned by Next() to
|
||||
//! the functions of the lower level, to allow them creating their own scopes.
|
||||
//!
|
||||
//! The scope has a name that can be used in visualization of the progress.
|
||||
//! It can be null. Note that when C string literal is used as a name, then its
|
||||
//! value is not copied, just pointer is stored. In other variants (char pointer
|
||||
//! or a string class) the string is copied, which is additional overhead.
|
||||
//! It can be null. Note that the string is not copied, just pointer is stored.
|
||||
//! So, the pointer must point to the string with life time
|
||||
//! greater than that of the scope object.
|
||||
//!
|
||||
//! The same instance of the progress scope! must not be used concurrently from different threads.
|
||||
//! For the algorithm running its tasks in parallel threads, a common scope is
|
||||
//! created before the parallel execution, and the range objects produced by method
|
||||
//! Next() are used to initialise the data pertinent to each task.
|
||||
//! Then the progress is advanced within each task using its own range object.
|
||||
//! See example below.
|
||||
//!
|
||||
//! Note that while a range of the scope is specified using Standard_Real
|
||||
//! (double) parameter, it is expected to be a positive integer value.
|
||||
//! If the range is not an integer, method Next() shall be called with
|
||||
//! explicit step argument, and the rounded value returned by method Value()
|
||||
//! may be not coherent with the step and range.
|
||||
//!
|
||||
//! A scope can be created with option "infinite". This is useful when
|
||||
//! the number of steps is not known by the time of the scope creation.
|
||||
//! In this case the progress will be advanced logarithmically, approaching
|
||||
//! the end of the scope at infinite number of steps. The parameter Max
|
||||
//! for infinite scope indicates number of steps corresponding to mid-range.
|
||||
//! In multithreaded programs, for each task running concurrently it is recommended
|
||||
//! to create a separate progress scope. The same instance of the progress scope
|
||||
//! must not be used concurrently from different threads.
|
||||
//!
|
||||
//! A progress scope created with empty constructor is not connected to any
|
||||
//! progress indicator, and passing the range created on it to any algorithm
|
||||
//! allows it executing safely without actual progress indication.
|
||||
//! allows it executing safely without progress indication.
|
||||
//!
|
||||
//! Example of preparation of progress indicator:
|
||||
//!
|
||||
@@ -151,11 +132,12 @@ class Message_ProgressIndicator;
|
||||
//! {
|
||||
//! void operator() (Task& theTask) const
|
||||
//! {
|
||||
//! // Note: it is essential that this method is executed only once for the same Task object
|
||||
//! Message_ProgressScope aPS (theTask.Range, NULL, theTask.Data.NbItems);
|
||||
//! for (Standard_Integer i = 0; i < theTask.Data.NbSteps && aPS.More(); i++)
|
||||
//! // Note: it is essential that this method is executed only once
|
||||
//! // for the same Task object
|
||||
//! Message_ProgressScope aPS (theTask.Range, "Processing task", 1);
|
||||
//! if (aPS.More())
|
||||
//! {
|
||||
//! do_job (theTask.Data.Item[i], aPS.Next());
|
||||
//! // ... process data
|
||||
//! }
|
||||
//! }
|
||||
//! };
|
||||
@@ -171,24 +153,6 @@ class Message_ProgressIndicator;
|
||||
//! OSD_Parallel::ForEach (aTasks.begin(), aTasks.end(), Functor());
|
||||
//! }
|
||||
//! @endcode
|
||||
//!
|
||||
//! For lightweight algorithms that do not need advancing the progress
|
||||
//! within individual tasks the code can be simplified to avoid inner scopes:
|
||||
//!
|
||||
//! @code
|
||||
//! struct Functor
|
||||
//! {
|
||||
//! void operator() (Task& theTask) const
|
||||
//! {
|
||||
//! if (theTask.Range.More())
|
||||
//! {
|
||||
//! do_job (theTask.Data);
|
||||
//! // advance the progress
|
||||
//! theTask.Range.Close();
|
||||
//! }
|
||||
//! }
|
||||
//! };
|
||||
//! @endcode
|
||||
class Message_ProgressScope
|
||||
{
|
||||
public:
|
||||
@@ -201,10 +165,7 @@ public: //! @name Preparation methods
|
||||
: myProgress (0),
|
||||
myParent (0),
|
||||
myName (0),
|
||||
myStart (0.),
|
||||
myPortion (1.),
|
||||
myMax (1.),
|
||||
myValue (0.),
|
||||
myPortion (1.), myMax (1.), myValue (0.),
|
||||
myIsActive (false),
|
||||
myIsOwnName (false),
|
||||
myIsInfinite (false)
|
||||
@@ -341,16 +302,12 @@ public: //! @name Auxiliary methods to use in ProgressIndicator
|
||||
}
|
||||
|
||||
//! Returns the current value of progress in this scope.
|
||||
//!
|
||||
//! The value is computed by mapping current global progress into
|
||||
//! this scope range; the result is rounded up to integer.
|
||||
//! Note that if MaxValue() is not an integer, Value() can be
|
||||
//! greater than MaxValue() due to that rounding.
|
||||
//!
|
||||
//! This method should not be called concurrently while the progress
|
||||
//! is advancing, except from implementation of method Show() in
|
||||
//! descendant of Message_ProgressIndicator.
|
||||
Standard_Real Value() const;
|
||||
//! If this scope is being advanced by sub-scoping, that value is
|
||||
//! computed by mapping current global progress into this scope range.
|
||||
Standard_Real Value() const
|
||||
{
|
||||
return myIsActive ? myValue : myMax;
|
||||
}
|
||||
|
||||
//! Returns the infinite flag
|
||||
Standard_Boolean IsInfinite() const
|
||||
@@ -369,7 +326,7 @@ public: //! @name Destruction, allocation
|
||||
//! Destructor - closes the scope and adds its scale to the total progress
|
||||
~Message_ProgressScope()
|
||||
{
|
||||
Close();
|
||||
Relieve();
|
||||
if (myIsOwnName)
|
||||
{
|
||||
Standard::Free (myName);
|
||||
@@ -378,9 +335,9 @@ public: //! @name Destruction, allocation
|
||||
}
|
||||
}
|
||||
|
||||
//! Closes the scope and advances the progress to its end.
|
||||
//! Closed scope should not be used.
|
||||
void Close();
|
||||
//! Closes the scope and adds its scale to the total progress.
|
||||
//! Relieved scope should not be used.
|
||||
void Relieve();
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
@@ -390,10 +347,12 @@ private: //! @name Internal methods
|
||||
//! Called only by Message_ProgressIndicator constructor.
|
||||
Message_ProgressScope (Message_ProgressIndicator* theProgress);
|
||||
|
||||
//! Convert value from this scope to global scale, but disregarding
|
||||
//! start position of the scope, in the range [0, myPortion]
|
||||
//! Convert value from this scale to global one
|
||||
Standard_Real localToGlobal(const Standard_Real theVal) const;
|
||||
|
||||
//! Convert value from global scale to this one
|
||||
Standard_Real globalToLocal(const Standard_Real theVal) const;
|
||||
|
||||
private:
|
||||
//! Copy constructor is prohibited
|
||||
Message_ProgressScope (const Message_ProgressScope& theOther);
|
||||
@@ -407,9 +366,7 @@ private:
|
||||
const Message_ProgressScope* myParent; //!< Pointer to parent scope
|
||||
Standard_CString myName; //!< Name of the operation being done in this scope, or null
|
||||
|
||||
Standard_Real myStart; //!< Start position on the global scale [0, 1]
|
||||
Standard_Real myPortion; //!< The portion of the global scale covered by this scope [0, 1]
|
||||
|
||||
Standard_Real myPortion; //!< The portion of the global scale covered by this scope (from 0 to 1)
|
||||
Standard_Real myMax; //!< Maximal value of progress in this scope
|
||||
Standard_Real myValue; //!< Current position advanced within this scope [0, Max]
|
||||
|
||||
@@ -432,7 +389,6 @@ inline Message_ProgressScope::Message_ProgressScope (Message_ProgressIndicator*
|
||||
: myProgress(theProgress),
|
||||
myParent(0),
|
||||
myName(0),
|
||||
myStart(0.),
|
||||
myPortion(1.),
|
||||
myMax(1.),
|
||||
myValue(0.),
|
||||
@@ -453,7 +409,6 @@ inline Message_ProgressScope::Message_ProgressScope (const Message_ProgressRange
|
||||
: myProgress (theRange.myParentScope != NULL ? theRange.myParentScope->myProgress : NULL),
|
||||
myParent (theRange.myParentScope),
|
||||
myName (NULL),
|
||||
myStart (theRange.myStart),
|
||||
myPortion (theRange.myDelta),
|
||||
myMax (Max (1.e-6, theMax)), // protection against zero range
|
||||
myValue (0.),
|
||||
@@ -478,7 +433,6 @@ Message_ProgressScope::Message_ProgressScope (const Message_ProgressRange& theRa
|
||||
: myProgress (theRange.myParentScope != NULL ? theRange.myParentScope->myProgress : NULL),
|
||||
myParent (theRange.myParentScope),
|
||||
myName (theName),
|
||||
myStart (theRange.myStart),
|
||||
myPortion (theRange.myDelta),
|
||||
myMax (Max (1.e-6, theMax)), // protection against zero range
|
||||
myValue (0.),
|
||||
@@ -501,7 +455,6 @@ inline Message_ProgressScope::Message_ProgressScope (const Message_ProgressRange
|
||||
: myProgress (theRange.myParentScope != NULL ? theRange.myParentScope->myProgress : NULL),
|
||||
myParent (theRange.myParentScope),
|
||||
myName (NULL),
|
||||
myStart (theRange.myStart),
|
||||
myPortion (theRange.myDelta),
|
||||
myMax (Max (1.e-6, theMax)), // protection against zero range
|
||||
myValue (0.),
|
||||
@@ -514,10 +467,10 @@ inline Message_ProgressScope::Message_ProgressScope (const Message_ProgressRange
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Close
|
||||
//function : Relieve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline void Message_ProgressScope::Close()
|
||||
inline void Message_ProgressScope::Relieve()
|
||||
{
|
||||
if (!myIsActive)
|
||||
{
|
||||
@@ -553,14 +506,17 @@ inline Standard_Boolean Message_ProgressScope::UserBreak() const
|
||||
//=======================================================================
|
||||
inline Message_ProgressRange Message_ProgressScope::Next (Standard_Real theStep)
|
||||
{
|
||||
if (myIsActive && theStep > 0.)
|
||||
if (myIsActive)
|
||||
{
|
||||
Standard_Real aCurr = localToGlobal(myValue);
|
||||
Standard_Real aNext = localToGlobal(myValue += theStep);
|
||||
Standard_Real aDelta = aNext - aCurr;
|
||||
if (aDelta > 0.)
|
||||
if (theStep > 0.)
|
||||
{
|
||||
return Message_ProgressRange(*this, myStart + aCurr, aDelta);
|
||||
Standard_Real aCurr = localToGlobal (myValue);
|
||||
Standard_Real aNext = localToGlobal (myValue += theStep);
|
||||
Standard_Real aDelta = aNext - aCurr;
|
||||
if (aDelta > 0.)
|
||||
{
|
||||
return Message_ProgressRange (*this, aDelta);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Message_ProgressRange();
|
||||
@@ -601,34 +557,23 @@ inline Standard_Real Message_ProgressScope::localToGlobal (const Standard_Real t
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//function : globalToLocal
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Real Message_ProgressScope::Value () const
|
||||
inline Standard_Real Message_ProgressScope::globalToLocal (const Standard_Real theVal) const
|
||||
{
|
||||
if (!myIsActive)
|
||||
{
|
||||
return myIsInfinite ? Precision::Infinite() : myMax;
|
||||
}
|
||||
|
||||
// get current progress on the global scale counted
|
||||
// from the start of this scope
|
||||
Standard_Real aVal = myProgress->GetPosition() - myStart;
|
||||
|
||||
// if progress has not reached yet the start of this scope, return 0
|
||||
if (aVal <= 0.)
|
||||
return 0.;
|
||||
|
||||
// if at end of the scope (or behind), report the maximum
|
||||
Standard_Real aDist = myPortion - aVal;
|
||||
Standard_Real aDist = myPortion - theVal;
|
||||
if (aDist <= Precision::Confusion())
|
||||
return myIsInfinite ? Precision::Infinite() : myMax;
|
||||
|
||||
// map the value to the range of this scope [0, Max],
|
||||
// rounding up to integer, with small correction applied
|
||||
// to avoid rounding errors
|
||||
return std::ceil (myMax * aVal / (myIsInfinite ? aDist : myPortion) - Precision::Confusion());
|
||||
if (!myIsInfinite)
|
||||
return myMax * theVal / myPortion;
|
||||
|
||||
// Standard_Real x = log (theVal / aDist); // exponent
|
||||
Standard_Real x = theVal / aDist; // hyperbola
|
||||
return x * myMax;
|
||||
}
|
||||
|
||||
#endif // _Message_ProgressScope_HeaderFile
|
||||
|
@@ -38,9 +38,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
//! Method Relieve() was replaced by Close() in Message_ProgressScope
|
||||
void Relieve () { Close(); }
|
||||
|
||||
private:
|
||||
//! Message_ProgressRange should be passed to constructor instead of Message_ProgressIndicator.
|
||||
Message_ProgressSentry (const Handle(Message_ProgressIndicator)& theProgress,
|
||||
|
@@ -189,7 +189,7 @@ void Message_Report::Dump (Standard_OStream& theOS, Message_Gravity theGravity)
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SendMessages
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
@@ -202,7 +202,7 @@ void Message_Report::SendMessages (const Handle(Message_Messenger)& theMessenger
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SendMessages
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
|
@@ -82,14 +82,11 @@ public:
|
||||
//! Dumps collected alerts with specified gravity to stream
|
||||
Standard_EXPORT void Dump (Standard_OStream& theOS, Message_Gravity theGravity);
|
||||
|
||||
//! Sends all collected alerts to messenger.
|
||||
Standard_EXPORT virtual void SendMessages (const Handle(Message_Messenger)& theMessenger);
|
||||
//! Sends all collected alerts to messenger
|
||||
Standard_EXPORT void SendMessages (const Handle(Message_Messenger)& theMessenger);
|
||||
|
||||
//! Dumps collected alerts with specified gravity to messenger.
|
||||
//! Default implementation creates Message_Msg object with a message
|
||||
//! key returned by alert, and sends it in the messenger.
|
||||
Standard_EXPORT virtual void SendMessages (const Handle(Message_Messenger)& theMessenger,
|
||||
Message_Gravity theGravity);
|
||||
//! Dumps collected alerts with specified gravity to messenger
|
||||
Standard_EXPORT void SendMessages (const Handle(Message_Messenger)& theMessenger, Message_Gravity theGravity);
|
||||
|
||||
//! Merges data from theOther report into this
|
||||
Standard_EXPORT void Merge (const Handle(Message_Report)& theOther);
|
||||
|
@@ -55,34 +55,48 @@ Standard_Boolean OSD::CStringToReal(const Standard_CString aString,
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
//=======================================================================
|
||||
//function : OSDSecSleep
|
||||
//purpose : Cause the process to sleep during a amount of seconds
|
||||
//=======================================================================
|
||||
void OSD::SecSleep (const Standard_Integer theSeconds)
|
||||
{
|
||||
|
||||
#ifdef _WIN32
|
||||
Sleep (theSeconds * 1000);
|
||||
# include <windows.h>
|
||||
# define SLEEP(NSEC) Sleep(1000*(NSEC))
|
||||
#else
|
||||
usleep (theSeconds * 1000 * 1000);
|
||||
#include <unistd.h>
|
||||
# define SLEEP(NSEC) sleep(NSEC)
|
||||
#endif
|
||||
|
||||
void OSD::SecSleep(const Standard_Integer aDelay)
|
||||
{
|
||||
SLEEP(aDelay);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MilliSecSleep
|
||||
//purpose : Cause the process to sleep during a amount of milliseconds
|
||||
//=======================================================================
|
||||
void OSD::MilliSecSleep (const Standard_Integer theMilliseconds)
|
||||
{
|
||||
|
||||
#ifdef _WIN32
|
||||
Sleep (theMilliseconds);
|
||||
#else
|
||||
usleep (theMilliseconds * 1000);
|
||||
#endif
|
||||
|
||||
void OSD::MilliSecSleep(const Standard_Integer aDelay)
|
||||
{
|
||||
Sleep(aDelay) ;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
void OSD::MilliSecSleep(const Standard_Integer aDelay)
|
||||
{
|
||||
struct timeval timeout ;
|
||||
|
||||
timeout.tv_sec = aDelay / 1000 ;
|
||||
timeout.tv_usec = (aDelay % 1000) * 1000 ;
|
||||
|
||||
select(0,NULL,NULL,NULL,&timeout) ;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -113,11 +113,11 @@ public:
|
||||
Standard_EXPORT static Standard_Boolean ToCatchFloatingSignals();
|
||||
|
||||
//! Commands the process to sleep for a number of seconds.
|
||||
Standard_EXPORT static void SecSleep (const Standard_Integer theSeconds);
|
||||
|
||||
Standard_EXPORT static void SecSleep (const Standard_Integer aDelay);
|
||||
|
||||
//! Commands the process to sleep for a number of milliseconds
|
||||
Standard_EXPORT static void MilliSecSleep (const Standard_Integer theMilliseconds);
|
||||
|
||||
Standard_EXPORT static void MilliSecSleep (const Standard_Integer aDelay);
|
||||
|
||||
//! Converts aReal into aCstring in exponential format with a period as
|
||||
//! decimal point, no thousand separator and no grouping of digits.
|
||||
//! The conversion is independant from the current locale
|
||||
|
@@ -95,6 +95,7 @@ struct aFuncStruct
|
||||
Handle(Adaptor3d_HSurface) mySurf; // Surface where to project.
|
||||
Handle(Adaptor3d_HCurve) myCurve; // Curve to project.
|
||||
Handle(Adaptor2d_HCurve2d) myInitCurve2d; // Initial 2dcurve projection.
|
||||
mutable Extrema_ExtPS myGlobExtPS; // Extrema initialized on whole parameter space of the surface
|
||||
Standard_Real mySqProjOrtTol; // Used to filter non-orthogonal projected point.
|
||||
Standard_Real myTolU;
|
||||
Standard_Real myTolV;
|
||||
@@ -190,6 +191,73 @@ static Standard_Real anOrthogSqValue(const gp_Pnt& aBasePnt,
|
||||
return (aFirstPart * aFirstPart + aSecondPart * aSecondPart);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : checkSolution
|
||||
//purpose : checks if the current solution is better than initial point
|
||||
//=======================================================================
|
||||
static Standard_Boolean checkSolution (const Extrema_POnSurf& theSol,
|
||||
const Standard_Real theProjSqDist,
|
||||
const Handle(Adaptor3d_HSurface)& theSurf,
|
||||
const Standard_Real theUPeriod,
|
||||
const Standard_Real theVPeriod,
|
||||
const Standard_Integer theNbU,
|
||||
const Standard_Integer theNbV,
|
||||
const gp_Pnt& thePoint,
|
||||
const Standard_Real theProjTol,
|
||||
const Standard_Real theDist,
|
||||
gp_Pnt2d& thePOnSurf)
|
||||
{
|
||||
Standard_Real U, V;
|
||||
theSol.Parameter (U, V);
|
||||
Standard_Real Dist2Min = anOrthogSqValue (thePoint, theSurf, U, V);
|
||||
if (Dist2Min < theProjTol && // Point is projection.
|
||||
theProjSqDist < theDist + Precision::SquareConfusion()) // Point better than initial.
|
||||
{
|
||||
thePOnSurf.SetXY (gp_XY (U - theNbU * theUPeriod, V - theNbV * theVPeriod));
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : checkSolution
|
||||
//purpose : checks solutions found by extrema
|
||||
//=======================================================================
|
||||
static Standard_Boolean checkSolution (const Extrema_ExtPS& theExtrema,
|
||||
const Handle(Adaptor3d_HSurface)& theSurf,
|
||||
const Standard_Real theUPeriod,
|
||||
const Standard_Real theVPeriod,
|
||||
const Standard_Integer theNbU,
|
||||
const Standard_Integer theNbV,
|
||||
const gp_Pnt& thePoint,
|
||||
const Standard_Real theProjTol,
|
||||
const Standard_Real theDist,
|
||||
gp_Pnt2d& theSolution)
|
||||
{
|
||||
if (!theExtrema.IsDone() || !theExtrema.NbExt())
|
||||
return Standard_False;
|
||||
|
||||
Standard_Real aDist2Min = RealLast();
|
||||
Standard_Integer iGoodValue = -1;
|
||||
|
||||
for (Standard_Integer i = 1; i <= theExtrema.NbExt(); i++)
|
||||
{
|
||||
if (aDist2Min > theExtrema.SquareDistance(i))
|
||||
{
|
||||
aDist2Min = theExtrema.SquareDistance(i);
|
||||
iGoodValue = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (iGoodValue < 1)
|
||||
return Standard_False;
|
||||
|
||||
return checkSolution (theExtrema.Point (iGoodValue), theExtrema.SquareDistance (iGoodValue),
|
||||
theSurf, theUPeriod, theVPeriod, theNbU, theNbV,
|
||||
thePoint, theProjTol, theDist, theSolution);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose : (OCC217 - apo)- Compute Point2d that project on polar surface(<Surf>) 3D<Curve>
|
||||
@@ -298,10 +366,8 @@ static gp_Pnt2d Function_Value(const Standard_Real theU,
|
||||
}
|
||||
|
||||
// Non-analytical case.
|
||||
Standard_Real Dist2Min = RealLast();
|
||||
Standard_Real uperiod = theData.myPeriod[0],
|
||||
vperiod = theData.myPeriod[1],
|
||||
u, v;
|
||||
vperiod = theData.myPeriod[1];
|
||||
|
||||
// U0 and V0 are the points within the initialized period.
|
||||
if(U0 < Uinf)
|
||||
@@ -379,36 +445,31 @@ static gp_Pnt2d Function_Value(const Standard_Real theU,
|
||||
locext.Perform(p, U0, V0);
|
||||
if (locext.IsDone())
|
||||
{
|
||||
locext.Point().Parameter(u, v);
|
||||
Dist2Min = anOrthogSqValue(p, theData.mySurf, u, v);
|
||||
if (Dist2Min < theData.mySqProjOrtTol && // Point is projection.
|
||||
locext.SquareDistance() < aSurfPntDist + Precision::SquareConfusion()) // Point better than initial.
|
||||
gp_Pnt2d pnt;
|
||||
if (checkSolution (locext.Point(), locext.SquareDistance(),
|
||||
theData.mySurf, uperiod, vperiod, decalU, decalV,
|
||||
p, theData.mySqProjOrtTol, aSurfPntDist, pnt))
|
||||
{
|
||||
gp_Pnt2d pnt(u - decalU*uperiod,v - decalV*vperiod);
|
||||
return pnt;
|
||||
}
|
||||
}
|
||||
|
||||
// Perform whole param space search.
|
||||
Extrema_ExtPS ext(p, SurfLittle, theData.myTolU, theData.myTolV);
|
||||
gp_Pnt2d pnt;
|
||||
// Perform search on the whole parametric space using preinitialized extrema.
|
||||
theData.myGlobExtPS.Perform (p, uInfLi, uSupLi, vInfLi, vSupLi);
|
||||
if (checkSolution (theData.myGlobExtPS, theData.mySurf, uperiod, vperiod, decalU, decalV,
|
||||
p, theData.mySqProjOrtTol, aSurfPntDist, pnt))
|
||||
{
|
||||
return pnt;
|
||||
}
|
||||
|
||||
// Perform search on the decreased parametric space.
|
||||
Extrema_ExtPS ext(p, SurfLittle, theData.myTolU, theData.myTolV, Extrema_ExtFlag_MIN);
|
||||
if (ext.IsDone() && ext.NbExt() >= 1)
|
||||
{
|
||||
Dist2Min = ext.SquareDistance(1);
|
||||
Standard_Integer GoodValue = 1;
|
||||
for (Standard_Integer i = 2 ; i <= ext.NbExt() ; i++ )
|
||||
if (checkSolution (ext, theData.mySurf, uperiod, vperiod, decalU, decalV,
|
||||
p, theData.mySqProjOrtTol, aSurfPntDist, pnt))
|
||||
{
|
||||
if( Dist2Min > ext.SquareDistance(i))
|
||||
{
|
||||
Dist2Min = ext.SquareDistance(i);
|
||||
GoodValue = i;
|
||||
}
|
||||
}
|
||||
ext.Point(GoodValue).Parameter(u, v);
|
||||
Dist2Min = anOrthogSqValue(p, theData.mySurf, u, v);
|
||||
if (Dist2Min < theData.mySqProjOrtTol && // Point is projection.
|
||||
ext.SquareDistance(GoodValue) < aSurfPntDist + Precision::SquareConfusion()) // Point better than initial.
|
||||
{
|
||||
gp_Pnt2d pnt(u - decalU*uperiod,v - decalV*vperiod);
|
||||
return pnt;
|
||||
}
|
||||
}
|
||||
@@ -445,6 +506,14 @@ class ProjLib_PolarFunction : public AppCont_Function
|
||||
myStruct.mySqProjOrtTol = 10000.0 * Tol3d * Tol3d;
|
||||
myStruct.myTolU = Surf->UResolution(Tol3d);
|
||||
myStruct.myTolV = Surf->VResolution(Tol3d);
|
||||
|
||||
Standard_Real Uinf, Usup, Vinf, Vsup;
|
||||
Uinf = Surf->Surface().FirstUParameter();
|
||||
Usup = Surf->Surface().LastUParameter();
|
||||
Vinf = Surf->Surface().FirstVParameter();
|
||||
Vsup = Surf->Surface().LastVParameter();
|
||||
myStruct.myGlobExtPS.Initialize (Surf->Surface(), Uinf, Usup, Vinf, Vsup, myStruct.myTolU, myStruct.myTolV);
|
||||
myStruct.myGlobExtPS.SetFlag (Extrema_ExtFlag_MIN);
|
||||
}
|
||||
|
||||
~ProjLib_PolarFunction() {}
|
||||
|
@@ -4843,12 +4843,12 @@ namespace
|
||||
{
|
||||
void operator()(Task& theTask) const
|
||||
{
|
||||
if (theTask.Range.More())
|
||||
Message_ProgressScope aPS(theTask.Range, NULL, 1);
|
||||
if (aPS.More())
|
||||
{
|
||||
if (theTask.Mat1.RowNumber() > 1)
|
||||
theTask.Mat3 = theTask.Mat1 * theTask.Mat2;
|
||||
}
|
||||
theTask.Range.Close();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@@ -149,7 +149,7 @@ Standard_Boolean RWStl_Reader::Read (const char* theFile,
|
||||
// (80 bytes header + 4 bytes facet count + 50 bytes for one facet);
|
||||
// thus assume files shorter than 134 as Ascii without probing
|
||||
// (probing may bring stream to fail state if EOF is reached)
|
||||
bool isAscii = ((size_t)theEnd < THE_STL_MIN_FILE_SIZE || IsAscii (aStream, true));
|
||||
bool isAscii = ((size_t)theEnd < THE_STL_MIN_FILE_SIZE || IsAscii (aStream));
|
||||
|
||||
Standard_ReadLineBuffer aBuffer (THE_BUFFER_SIZE);
|
||||
|
||||
@@ -185,8 +185,7 @@ Standard_Boolean RWStl_Reader::Read (const char* theFile,
|
||||
//purpose :
|
||||
//==============================================================================
|
||||
|
||||
Standard_Boolean RWStl_Reader::IsAscii (Standard_IStream& theStream,
|
||||
const bool isSeekgAvailable)
|
||||
Standard_Boolean RWStl_Reader::IsAscii (Standard_IStream& theStream)
|
||||
{
|
||||
// read first 134 bytes to detect file format
|
||||
char aBuffer[THE_STL_MIN_FILE_SIZE];
|
||||
@@ -197,18 +196,10 @@ Standard_Boolean RWStl_Reader::IsAscii (Standard_IStream& theStream,
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isSeekgAvailable)
|
||||
// put back the read symbols
|
||||
for (std::streamsize aByteIter = aNbRead; aByteIter > 0; --aByteIter)
|
||||
{
|
||||
// get back to the beginning
|
||||
theStream.seekg(0, theStream.beg);
|
||||
}
|
||||
else
|
||||
{
|
||||
// put back the read symbols
|
||||
for (std::streamsize aByteIter = aNbRead; aByteIter > 0; --aByteIter)
|
||||
{
|
||||
theStream.unget();
|
||||
}
|
||||
theStream.unget();
|
||||
}
|
||||
|
||||
// if file is shorter than size of binary file with 1 facet, it must be ascii
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user