Skip to content

Commit

Permalink
Slightly refactor used data types.
Browse files Browse the repository at this point in the history
  • Loading branch information
sslyadnev committed Jun 11, 2020
1 parent 054a0d2 commit 5579ec4
Show file tree
Hide file tree
Showing 40 changed files with 841 additions and 317 deletions.
6 changes: 6 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions src/asiAlgo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,10 @@ set (features_H_FILES
features/asiAlgo_FeatureAttrAdjacency.h
features/asiAlgo_FeatureAttrAngle.h
features/asiAlgo_FeatureAttrFace.h
features/asiAlgo_FeatureFormulation.h
features/asiAlgo_FeatureType.h
features/asiAlgo_FeatureFaces.h
features/asiAlgo_FeatureType.h
features/asiAlgo_Isomorphism.h
features/asiAlgo_RecognizeIsolated.h
features/asiAlgo_Recognizer.h
features/asiAlgo_ShapePartnerHasher.h
features/asiAlgo_TopoAttr.h
Expand All @@ -243,6 +244,7 @@ set (features_CPP_FILES
features/asiAlgo_ExtractFeatures.cpp
features/asiAlgo_ExtractFeaturesResult.cpp
features/asiAlgo_Isomorphism.cpp
features/asiAlgo_RecognizeIsolated.cpp
features/asiAlgo_Recognizer.cpp
features/asiAlgo_TopoGraph.cpp
)
Expand Down
2 changes: 1 addition & 1 deletion src/asiAlgo/auxiliary/asiAlgo_CompleteEdgeLoop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ asiAlgo_CompleteEdgeLoop::asiAlgo_CompleteEdgeLoop(const Handle(asiAlgo_AAG)& aa
bool asiAlgo_CompleteEdgeLoop::operator()(const int seedEdgeIndex,
TColStd_PackedMapOfInteger& loopIndices)
{
const TopoDS_Shape& model = m_aag->GetMasterCAD();
const TopoDS_Shape& model = m_aag->GetMasterShape();

// Build auxiliary maps.
if ( m_vertexEdgeMap.IsEmpty() )
Expand Down
8 changes: 4 additions & 4 deletions src/asiAlgo/auxiliary/asiAlgo_FindVisibleFaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ bool asiAlgo_FindVisibleFaces::Perform()

//-----------------------------------------------------------------------------

const NCollection_DataMap<int, asiAlgo_FindVisibleFaces::t_score>&
const NCollection_DataMap<t_topoId , asiAlgo_FindVisibleFaces::t_score>&
asiAlgo_FindVisibleFaces::GetResultScores() const
{
return m_scores;
Expand Down Expand Up @@ -214,7 +214,7 @@ bool asiAlgo_FindVisibleFaces::isVisible(const t_rayBundle& rb) const
bool asiAlgo_FindVisibleFaces::testLeaf(const gp_Lin& ray,
const double length,
const BVH_Vec4i& leaf,
const int face2Skip,
const t_topoId face2Skip,
int& resultFacet,
double& resultRayParamNormalized,
gp_XYZ& hitPoint) const
Expand All @@ -229,7 +229,7 @@ bool asiAlgo_FindVisibleFaces::testLeaf(const gp_Lin& ray,
resultFacet = -1;
resultRayParamNormalized = RealLast();

// Loop over the tentative facets
// Loop over the tentative facets.
for ( int fidx = leaf.y(); fidx <= leaf.z(); ++fidx )
{
// Get facet to test.
Expand Down Expand Up @@ -388,7 +388,7 @@ bool asiAlgo_FindVisibleFaces::isIntersected(const gp_XYZ& rayStart,
double& hitParamNormalized,
gp_XYZ& hitPoint) const
{
// Moller–Trumbore intersection algorithm
// Moller?Trumbore intersection algorithm
// (T. Moller et al, Fast Minimum Storage Ray / Triangle Intersection)
gp_Vec e1(pntTri1, pntTri2),
e2(pntTri1, pntTri3);
Expand Down
21 changes: 12 additions & 9 deletions src/asiAlgo/auxiliary/asiAlgo_FindVisibleFaces.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

// asiAlgo includes
#include <asiAlgo_BVHFacets.h>
#include <asiAlgo_FeatureFaces.h>

// Active Data includes
#include <ActAPI_IAlgorithm.h>
Expand All @@ -57,15 +58,15 @@ class asiAlgo_FindVisibleFaces : public ActAPI_IAlgorithm
struct t_rayBundle
{
std::vector<gp_Lin> Rays; //!< Ray bundle.
int FaceIndex; //!< Reference to the corresponding CAD face.
t_topoId FaceIndex; //!< Reference to the corresponding CAD face.

//! Default ctor leaving the face ID uninitialized.
t_rayBundle() : FaceIndex(0) {}

//! Ctor with initialization.
//! \param[in] _ray single ray to pass.
//! \param[in] _faceId reference to the CAD face.
t_rayBundle(const gp_Lin& _ray, const int _faceId)
t_rayBundle(const gp_Lin& _ray, const t_topoId _faceId)
{
Rays.push_back(_ray);
FaceIndex = _faceId;
Expand Down Expand Up @@ -111,8 +112,10 @@ class asiAlgo_FindVisibleFaces : public ActAPI_IAlgorithm
asiAlgo_EXPORT bool
Perform();

public:

//! \return the accumulated collection of visible faces.
asiAlgo_EXPORT const NCollection_DataMap<int, t_score>&
asiAlgo_EXPORT const NCollection_DataMap<t_topoId, t_score>&
GetResultScores() const;

//! Gathers all visible faces. The second argument is used to
Expand All @@ -122,8 +125,8 @@ class asiAlgo_FindVisibleFaces : public ActAPI_IAlgorithm
//! \param[out] faces the collected visible faces.
//! \param[in] maxHits the max allowed number of hits.
asiAlgo_EXPORT void
GetResultFaces(TColStd_PackedMapOfInteger& faces,
const int maxHits = 0) const;
GetResultFaces(asiAlgo_Feature& faces,
const int maxHits = 0) const;

protected:

Expand All @@ -142,7 +145,7 @@ class asiAlgo_FindVisibleFaces : public ActAPI_IAlgorithm
testLeaf(const gp_Lin& ray,
const double length,
const BVH_Vec4i& leaf,
const int face2Skip,
const t_topoId face2Skip,
int& resultFacet,
double& resultRayParamNormalized,
gp_XYZ& hitPoint) const;
Expand Down Expand Up @@ -170,9 +173,9 @@ class asiAlgo_FindVisibleFaces : public ActAPI_IAlgorithm

protected:

Handle(asiAlgo_BVHFacets) m_bvh; //!< BVH for facets.
std::vector<t_rayBundle> m_rayBundles; //!< Rays to test.
NCollection_DataMap<int, t_score> m_scores; //!< Intersection "score" for each face.
Handle(asiAlgo_BVHFacets) m_bvh; //!< BVH for facets.
std::vector<t_rayBundle> m_rayBundles; //!< Rays to test.
NCollection_DataMap<t_topoId , t_score> m_scores; //!< Intersection "score" for each face.

};

Expand Down
2 changes: 1 addition & 1 deletion src/asiAlgo/blends/asiAlgo_FindCrossEdges.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ asiAlgo_FindCrossEdges::asiAlgo_FindCrossEdges(const Handle(asiAlgo_AAG)& aag,
ActAPI_ProgressEntry progress,
ActAPI_PlotterEntry plotter)
: ActAPI_IAlgorithm ( progress, plotter ),
m_master ( aag->GetMasterCAD() ),
m_master ( aag->GetMasterShape() ),
m_aag ( aag )
{}

Expand Down
2 changes: 1 addition & 1 deletion src/asiAlgo/blends/asiAlgo_FindSmoothEdges.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ asiAlgo_FindSmoothEdges::asiAlgo_FindSmoothEdges(const Handle(asiAlgo_AAG)& aag,
ActAPI_PlotterEntry plotter)
//
: ActAPI_IAlgorithm ( progress, plotter ),
m_master ( aag->GetMasterCAD() ),
m_master ( aag->GetMasterShape() ),
m_aag ( aag )
{}

Expand Down
2 changes: 1 addition & 1 deletion src/asiAlgo/blends/asiAlgo_FindSpringEdges.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ asiAlgo_FindSpringEdges::asiAlgo_FindSpringEdges(const Handle(asiAlgo_AAG)& aag,
ActAPI_PlotterEntry plotter)
//
: ActAPI_IAlgorithm ( progress, plotter ),
m_master ( aag->GetMasterCAD() ),
m_master ( aag->GetMasterShape() ),
m_aag ( aag )
{}

Expand Down
2 changes: 1 addition & 1 deletion src/asiAlgo/blends/asiAlgo_FindTermEdges.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ asiAlgo_FindTermEdges::asiAlgo_FindTermEdges(const Handle(asiAlgo_AAG)& aag,
ActAPI_ProgressEntry progress,
ActAPI_PlotterEntry plotter)
: ActAPI_IAlgorithm ( progress, plotter ),
m_master ( aag->GetMasterCAD() ),
m_master ( aag->GetMasterShape() ),
m_aag ( aag )
{}

Expand Down
2 changes: 1 addition & 1 deletion src/asiAlgo/blends/asiAlgo_RecognizeBlends.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ asiAlgo_RecognizeBlends::asiAlgo_RecognizeBlends(const Handle(asiAlgo_AAG)& aag,
ActAPI_ProgressEntry progress,
ActAPI_PlotterEntry plotter)
//
: asiAlgo_Recognizer(aag->GetMasterCAD(), aag, progress, plotter)
: asiAlgo_Recognizer(aag->GetMasterShape(), aag, progress, plotter)
{}

//-----------------------------------------------------------------------------
Expand Down
17 changes: 0 additions & 17 deletions src/asiAlgo/blends/asiAlgo_RecognizeBlends.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,23 +89,6 @@ class asiAlgo_RecognizeBlends : public asiAlgo_Recognizer
Perform(const int faceId,
const double radius = 1e100);

private:

//! Reaction to formulation changing.
//! \param[in] formulation activated formulation.
virtual void onFormulation(const asiAlgo_FeatureFormulation formulation)
{
switch ( formulation )
{
case FeatureFormulation_Full:
case FeatureFormulation_SupportFace:
Standard_ProgramError::Raise("Unsupported formulation");
//
case FeatureFormulation_GuessFace:
default: break;
}
}

};

#endif
4 changes: 2 additions & 2 deletions src/asiAlgo/blends/asiAlgo_SuppressBlendChain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ bool asiAlgo_SuppressBlendChain::Perform(const int faceId)
m_iSuppressedChains = 1;

// Set history.
m_history->AddModified(m_aag->GetMasterCAD(), m_result);
m_history->AddModified(m_aag->GetMasterShape(), m_result);

return true;
}
Expand Down Expand Up @@ -469,7 +469,7 @@ bool
asiAlgo_SuppressBlendChain::performTopoOperations(TopoDS_Shape& resultShape)
{
// Input shape.
resultShape = m_aag->GetMasterCAD();
resultShape = m_aag->GetMasterShape();

// Process the initialized topological conditions.
for ( asiAlgo_HBlendTopoConditionMap::Iterator cit(*m_workflow.topoCondition);
Expand Down
2 changes: 1 addition & 1 deletion src/asiAlgo/blends/asiAlgo_SuppressBlendsInc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ bool asiAlgo_SuppressBlendsInc::Perform(const Handle(asiAlgo_AAG)& aag,
history = new asiAlgo_History(/*m_progress, m_plotter*/);

// Initialize outputs.
result = aag->GetMasterCAD();
result = aag->GetMasterShape();
numSuppressedChains = 0;

TColStd_PackedMapOfInteger fids;
Expand Down
2 changes: 1 addition & 1 deletion src/asiAlgo/editing/asiAlgo_InvertFaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ asiAlgo_InvertFaces::asiAlgo_InvertFaces(const Handle(asiAlgo_AAG)& aag,

bool asiAlgo_InvertFaces::Perform(const TColStd_PackedMapOfInteger& faceIds)
{
const TopoDS_Shape& master = m_aag->GetMasterCAD();
const TopoDS_Shape& master = m_aag->GetMasterShape();

if ( master.ShapeType() == TopAbs_FACE )
{
Expand Down
Loading

0 comments on commit 5579ec4

Please sign in to comment.