Coverity issues: fix Mesh, Points and Inspection module
This commit is contained in:
parent
e4f0ddad84
commit
9b013f7254
|
@ -751,8 +751,11 @@ App::DocumentObjectExecReturn* Feature::execute(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fRMS = fRMS / countRMS;
|
if (countRMS > 0) {
|
||||||
fRMS = sqrt(fRMS);
|
fRMS = fRMS / countRMS;
|
||||||
|
fRMS = sqrt(fRMS);
|
||||||
|
}
|
||||||
|
|
||||||
Base::Console().Message("RMS value for '%s' with search radius=%.4f is: %.4f\n",
|
Base::Console().Message("RMS value for '%s' with search radius=%.4f is: %.4f\n",
|
||||||
this->Label.getValue(), this->SearchRadius.getValue(), fRMS);
|
this->Label.getValue(), this->SearchRadius.getValue(), fRMS);
|
||||||
|
|
||||||
|
|
|
@ -183,7 +183,7 @@ void ViewProviderInspection::updateData(const App::Property* prop)
|
||||||
{
|
{
|
||||||
// set to the expected size
|
// set to the expected size
|
||||||
if (prop->getTypeId() == App::PropertyLink::getClassTypeId()) {
|
if (prop->getTypeId() == App::PropertyLink::getClassTypeId()) {
|
||||||
App::GeoFeature* object = static_cast<const App::PropertyLink*>(prop)->getValue<App::GeoFeature*>();
|
App::GeoFeature* object = dynamic_cast<const App::PropertyLink*>(prop)->getValue<App::GeoFeature*>();
|
||||||
if (object) {
|
if (object) {
|
||||||
float accuracy=0;
|
float accuracy=0;
|
||||||
Base::Type meshId = Base::Type::fromName("Mesh::Feature");
|
Base::Type meshId = Base::Type::fromName("Mesh::Feature");
|
||||||
|
@ -260,9 +260,10 @@ void ViewProviderInspection::updateData(const App::Property* prop)
|
||||||
// force an update of the Inventor data nodes
|
// force an update of the Inventor data nodes
|
||||||
if (this->pcObject) {
|
if (this->pcObject) {
|
||||||
App::Property* link = this->pcObject->getPropertyByName("Actual");
|
App::Property* link = this->pcObject->getPropertyByName("Actual");
|
||||||
if (link) updateData(link);
|
if (link)
|
||||||
|
updateData(link);
|
||||||
|
setDistances();
|
||||||
}
|
}
|
||||||
setDistances();
|
|
||||||
}
|
}
|
||||||
else if (prop->getTypeId() == App::PropertyFloat::getClassTypeId()) {
|
else if (prop->getTypeId() == App::PropertyFloat::getClassTypeId()) {
|
||||||
if (strcmp(prop->getName(), "SearchRadius") == 0) {
|
if (strcmp(prop->getName(), "SearchRadius") == 0) {
|
||||||
|
@ -281,6 +282,9 @@ SoSeparator* ViewProviderInspection::getFrontRoot(void) const
|
||||||
|
|
||||||
void ViewProviderInspection::setDistances()
|
void ViewProviderInspection::setDistances()
|
||||||
{
|
{
|
||||||
|
if (!pcObject)
|
||||||
|
return;
|
||||||
|
|
||||||
App::Property* pDistances = pcObject->getPropertyByName("Distances");
|
App::Property* pDistances = pcObject->getPropertyByName("Distances");
|
||||||
if (!pDistances) {
|
if (!pDistances) {
|
||||||
SoDebugError::post("ViewProviderInspection::setDistances", "Unknown property 'Distances'");
|
SoDebugError::post("ViewProviderInspection::setDistances", "Unknown property 'Distances'");
|
||||||
|
|
|
@ -1570,34 +1570,34 @@ bool MeshAlgorithm::ConnectPolygons(std::list<std::vector<Base::Vector3f> > &clP
|
||||||
std::list<std::pair<Base::Vector3f, Base::Vector3f> > &rclLines) const
|
std::list<std::pair<Base::Vector3f, Base::Vector3f> > &rclLines) const
|
||||||
{
|
{
|
||||||
|
|
||||||
for(std::list< std::vector<Base::Vector3f> >::iterator OutIter = clPolyList.begin(); OutIter != clPolyList.end(); ++OutIter)
|
for (std::list< std::vector<Base::Vector3f> >::iterator OutIter = clPolyList.begin(); OutIter != clPolyList.end(); ++OutIter) {
|
||||||
{
|
if (OutIter->empty())
|
||||||
std::pair<Base::Vector3f,Base::Vector3f> currentSort;
|
continue;
|
||||||
float fDist = Base::Distance(OutIter->front(),OutIter->back());
|
std::pair<Base::Vector3f,Base::Vector3f> currentSort;
|
||||||
currentSort.first = OutIter->front();
|
float fDist = Base::Distance(OutIter->front(),OutIter->back());
|
||||||
currentSort.second = OutIter->back();
|
currentSort.first = OutIter->front();
|
||||||
|
currentSort.second = OutIter->back();
|
||||||
|
|
||||||
for(std::list< std::vector<Base::Vector3f> >::iterator InnerIter = clPolyList.begin(); InnerIter != clPolyList.end(); ++InnerIter)
|
for (std::list< std::vector<Base::Vector3f> >::iterator InnerIter = clPolyList.begin(); InnerIter != clPolyList.end(); ++InnerIter) {
|
||||||
{
|
if (OutIter == InnerIter)
|
||||||
if(OutIter == InnerIter) continue;
|
continue;
|
||||||
|
|
||||||
|
if (Base::Distance(OutIter->front(), InnerIter->front()) < fDist) {
|
||||||
|
currentSort.second = InnerIter->front();
|
||||||
|
fDist = Base::Distance(OutIter->front(),InnerIter->front());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Base::Distance(OutIter->front(), InnerIter->back()) < fDist) {
|
||||||
|
currentSort.second = InnerIter->back();
|
||||||
|
fDist = Base::Distance(OutIter->front(),InnerIter->back());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rclLines.push_front(currentSort);
|
||||||
|
|
||||||
if(Base::Distance(OutIter->front(),InnerIter->front()) < fDist)
|
|
||||||
{
|
|
||||||
currentSort.second = InnerIter->front();
|
|
||||||
fDist = Base::Distance(OutIter->front(),InnerIter->front());
|
|
||||||
}
|
|
||||||
if(Base::Distance(OutIter->front(),InnerIter->back()) < fDist)
|
|
||||||
{
|
|
||||||
currentSort.second = InnerIter->back();
|
|
||||||
fDist = Base::Distance(OutIter->front(),InnerIter->back());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rclLines.push_front(currentSort);
|
return true;
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeshAlgorithm::GetFacetsFromPlane (const MeshFacetGrid &rclGrid, const Base::Vector3f& clNormal, float d, const Base::Vector3f &rclLeft,
|
void MeshAlgorithm::GetFacetsFromPlane (const MeshFacetGrid &rclGrid, const Base::Vector3f& clNormal, float d, const Base::Vector3f &rclLeft,
|
||||||
|
|
|
@ -107,9 +107,11 @@ void Approximation::AddPoints(const std::list<Base::Vector3f> &rsPointList)
|
||||||
Base::Vector3f Approximation::GetGravity() const
|
Base::Vector3f Approximation::GetGravity() const
|
||||||
{
|
{
|
||||||
Base::Vector3f clGravity;
|
Base::Vector3f clGravity;
|
||||||
for (std::list<Base::Vector3f>::const_iterator it = _vPoints.begin(); it!=_vPoints.end(); ++it)
|
if (!_vPoints.empty()) {
|
||||||
clGravity += *it;
|
for (std::list<Base::Vector3f>::const_iterator it = _vPoints.begin(); it!=_vPoints.end(); ++it)
|
||||||
clGravity *= 1.0f / float(_vPoints.size());
|
clGravity += *it;
|
||||||
|
clGravity *= 1.0f / float(_vPoints.size());
|
||||||
|
}
|
||||||
return clGravity;
|
return clGravity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,10 +175,10 @@ float PlaneFit::Fit()
|
||||||
szz = szz - mz*mz/((double)nSize);
|
szz = szz - mz*mz/((double)nSize);
|
||||||
|
|
||||||
#if defined(FC_USE_EIGEN)
|
#if defined(FC_USE_EIGEN)
|
||||||
Eigen::Matrix3d covMat = Eigen::Matrix3d::Zero();
|
Eigen::Matrix3d covMat = Eigen::Matrix3d::Zero();
|
||||||
covMat(0,0) = sxx;
|
covMat(0,0) = sxx;
|
||||||
covMat(1,1) = syy;
|
covMat(1,1) = syy;
|
||||||
covMat(2,2) = szz;
|
covMat(2,2) = szz;
|
||||||
covMat(0,1) = sxy; covMat(1,0) = sxy;
|
covMat(0,1) = sxy; covMat(1,0) = sxy;
|
||||||
covMat(0,2) = sxz; covMat(2,0) = sxz;
|
covMat(0,2) = sxz; covMat(2,0) = sxz;
|
||||||
covMat(1,2) = syz; covMat(2,1) = syz;
|
covMat(1,2) = syz; covMat(2,1) = syz;
|
||||||
|
@ -451,7 +453,7 @@ const double& QuadraticFit::GetCoeffArray() const
|
||||||
|
|
||||||
double QuadraticFit::GetCoeff(unsigned long ulIndex) const
|
double QuadraticFit::GetCoeff(unsigned long ulIndex) const
|
||||||
{
|
{
|
||||||
assert( ulIndex >= 0 && ulIndex < 10 );
|
assert(ulIndex < 10);
|
||||||
|
|
||||||
if( _bIsFitted )
|
if( _bIsFitted )
|
||||||
return _fCoeff[ ulIndex ];
|
return _fCoeff[ ulIndex ];
|
||||||
|
@ -636,9 +638,9 @@ double SurfaceFit::PolynomFit()
|
||||||
// <=> sum[(P*Vi)*Vi] = sum[Vi*zi]
|
// <=> sum[(P*Vi)*Vi] = sum[Vi*zi]
|
||||||
// <=> sum[(Vi*Vi^t)*P] = sum[Vi*zi] where (Vi*Vi^t) is a symmetric matrix
|
// <=> sum[(Vi*Vi^t)*P] = sum[Vi*zi] where (Vi*Vi^t) is a symmetric matrix
|
||||||
// <=> sum[(Vi*Vi^t)]*P = sum[Vi*zi]
|
// <=> sum[(Vi*Vi^t)]*P = sum[Vi*zi]
|
||||||
Eigen::Matrix<double,6,6> A = Eigen::Matrix<double,6,6>::Zero();
|
Eigen::Matrix<double,6,6> A = Eigen::Matrix<double,6,6>::Zero();
|
||||||
Eigen::Matrix<double,6,1> b = Eigen::Matrix<double,6,1>::Zero();
|
Eigen::Matrix<double,6,1> b = Eigen::Matrix<double,6,1>::Zero();
|
||||||
Eigen::Matrix<double,6,1> x = Eigen::Matrix<double,6,1>::Zero();
|
Eigen::Matrix<double,6,1> x = Eigen::Matrix<double,6,1>::Zero();
|
||||||
|
|
||||||
std::vector<Base::Vector3d> transform;
|
std::vector<Base::Vector3d> transform;
|
||||||
transform.reserve(_vPoints.size());
|
transform.reserve(_vPoints.size());
|
||||||
|
@ -765,7 +767,8 @@ double SurfaceFit::PolynomFit()
|
||||||
// that 'sigma' becomes negative.
|
// that 'sigma' becomes negative.
|
||||||
if (sigma < 0)
|
if (sigma < 0)
|
||||||
sigma = 0;
|
sigma = 0;
|
||||||
sigma = sqrt(sigma/_vPoints.size());
|
if (!_vPoints.empty())
|
||||||
|
sigma = sqrt(sigma/_vPoints.size());
|
||||||
|
|
||||||
_fLastResult = static_cast<float>(sigma);
|
_fLastResult = static_cast<float>(sigma);
|
||||||
return _fLastResult;
|
return _fLastResult;
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
using namespace MeshCore;
|
using namespace MeshCore;
|
||||||
|
|
||||||
|
|
||||||
MeshBuilder::MeshBuilder (MeshKernel& kernel) : _meshKernel(kernel), _seq(0)
|
MeshBuilder::MeshBuilder (MeshKernel& kernel) : _meshKernel(kernel), _seq(0), _ptIdx(0)
|
||||||
{
|
{
|
||||||
_fSaveTolerance = MeshDefinitions::_fMinPointDistanceD1;
|
_fSaveTolerance = MeshDefinitions::_fMinPointDistanceD1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,7 @@ private:
|
||||||
// keep an array of iterators pointing to the vertex inside the set to save memory
|
// keep an array of iterators pointing to the vertex inside the set to save memory
|
||||||
typedef std::pair<std::set<MeshPoint>::iterator, bool> MeshPointIterator;
|
typedef std::pair<std::set<MeshPoint>::iterator, bool> MeshPointIterator;
|
||||||
std::vector<MeshPointIterator> _pointsIterator;
|
std::vector<MeshPointIterator> _pointsIterator;
|
||||||
unsigned long _ptIdx;
|
unsigned long _ptIdx;
|
||||||
|
|
||||||
void SetNeighbourhood ();
|
void SetNeighbourhood ();
|
||||||
// As it's forbidden to insert a degenerated facet but insert its vertices anyway we must remove them
|
// As it's forbidden to insert a degenerated facet but insert its vertices anyway we must remove them
|
||||||
|
|
|
@ -508,7 +508,7 @@ void MeshEvalPointManifolds::GetFacetIndices (std::vector<unsigned long> &facets
|
||||||
bool MeshEvalSingleFacet::Evaluate ()
|
bool MeshEvalSingleFacet::Evaluate ()
|
||||||
{
|
{
|
||||||
// get all non-manifolds
|
// get all non-manifolds
|
||||||
MeshEvalTopology::Evaluate();
|
(void)MeshEvalTopology::Evaluate();
|
||||||
/*
|
/*
|
||||||
// for each (multiple) single linked facet there should
|
// for each (multiple) single linked facet there should
|
||||||
// exist two valid facets sharing the same edge
|
// exist two valid facets sharing the same edge
|
||||||
|
|
|
@ -1793,7 +1793,8 @@ bool MeshOutput::SaveBinarySTL (std::ostream &rstrOut) const
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Base::SequencerLauncher seq("saving...", _rclMesh.CountFacets() + 1);
|
Base::SequencerLauncher seq("saving...", _rclMesh.CountFacets() + 1);
|
||||||
|
|
||||||
|
// stl_header has a length of 80
|
||||||
strcpy(szInfo, stl_header.c_str());
|
strcpy(szInfo, stl_header.c_str());
|
||||||
rstrOut.write(szInfo, std::strlen(szInfo));
|
rstrOut.write(szInfo, std::strlen(szInfo));
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,6 @@ protected:
|
||||||
MeshKernel &_resultMesh; /** Result mesh */
|
MeshKernel &_resultMesh; /** Result mesh */
|
||||||
OperationType _operationType; /** Set Operation Type */
|
OperationType _operationType; /** Set Operation Type */
|
||||||
float _minDistanceToPoint; /** Minimal distance to facet corner points */
|
float _minDistanceToPoint; /** Minimal distance to facet corner points */
|
||||||
float _saveMinMeshDistance;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Helper class cutting edge to his two attached facets
|
// Helper class cutting edge to his two attached facets
|
||||||
|
|
|
@ -36,7 +36,11 @@
|
||||||
using namespace MeshCore;
|
using namespace MeshCore;
|
||||||
|
|
||||||
|
|
||||||
AbstractSmoothing::AbstractSmoothing(MeshKernel& m) : kernel(m)
|
AbstractSmoothing::AbstractSmoothing(MeshKernel& m)
|
||||||
|
: kernel(m)
|
||||||
|
, tolerance(0)
|
||||||
|
, component(Normal)
|
||||||
|
, continuity(C0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,11 +34,13 @@
|
||||||
using namespace MeshCore;
|
using namespace MeshCore;
|
||||||
|
|
||||||
MeshSearchNeighbours::MeshSearchNeighbours (const MeshKernel &rclM, float fSampleDistance)
|
MeshSearchNeighbours::MeshSearchNeighbours (const MeshKernel &rclM, float fSampleDistance)
|
||||||
: _rclMesh(rclM),
|
: _rclMesh(rclM)
|
||||||
_rclFAry(rclM.GetFacets()),
|
, _rclFAry(rclM.GetFacets())
|
||||||
_rclPAry(rclM.GetPoints()),
|
, _rclPAry(rclM.GetPoints())
|
||||||
_clPt2Fa(rclM),
|
, _clPt2Fa(rclM)
|
||||||
_fSampleDistance(fSampleDistance)
|
, _fMaxDistanceP2(0)
|
||||||
|
, _fSampleDistance(fSampleDistance)
|
||||||
|
, _bTooFewPoints(false)
|
||||||
{
|
{
|
||||||
MeshAlgorithm(_rclMesh).ResetFacetFlag(MeshFacet::MARKED);
|
MeshAlgorithm(_rclMesh).ResetFacetFlag(MeshFacet::MARKED);
|
||||||
MeshAlgorithm(_rclMesh).ResetPointFlag(MeshPoint::MARKED);
|
MeshAlgorithm(_rclMesh).ResetPointFlag(MeshPoint::MARKED);
|
||||||
|
|
|
@ -409,7 +409,12 @@ namespace MeshGui {
|
||||||
/* TRANSLATOR MeshGui::MeshFillHole */
|
/* TRANSLATOR MeshGui::MeshFillHole */
|
||||||
|
|
||||||
MeshFillHole::MeshFillHole(MeshHoleFiller& hf, Gui::View3DInventor* parent)
|
MeshFillHole::MeshFillHole(MeshHoleFiller& hf, Gui::View3DInventor* parent)
|
||||||
: QObject(parent), myMesh(0), myNumPoints(0), myHoleFiller(hf)
|
: QObject(parent)
|
||||||
|
, myMesh(0)
|
||||||
|
, myNumPoints(0)
|
||||||
|
, myVertex1(0)
|
||||||
|
, myVertex2(0)
|
||||||
|
, myHoleFiller(hf)
|
||||||
{
|
{
|
||||||
myBoundariesRoot = new SoSeparator;
|
myBoundariesRoot = new SoSeparator;
|
||||||
myBoundariesRoot->ref();
|
myBoundariesRoot->ref();
|
||||||
|
|
|
@ -78,6 +78,9 @@ unsigned char MeshSelection::cross_mask_bitmap[] = {
|
||||||
MeshSelection::MeshSelection()
|
MeshSelection::MeshSelection()
|
||||||
: onlyPointToUserTriangles(false)
|
: onlyPointToUserTriangles(false)
|
||||||
, onlyVisibleTriangles(false)
|
, onlyVisibleTriangles(false)
|
||||||
|
, addToSelection(false)
|
||||||
|
, addComponent(false)
|
||||||
|
, removeComponent(false)
|
||||||
, activeCB(0)
|
, activeCB(0)
|
||||||
, selectionCB(0)
|
, selectionCB(0)
|
||||||
, ivViewer(0)
|
, ivViewer(0)
|
||||||
|
|
|
@ -588,7 +588,10 @@ void SoFCMeshObjectShape::initClass()
|
||||||
SO_NODE_INIT_CLASS(SoFCMeshObjectShape, SoShape, "Shape");
|
SO_NODE_INIT_CLASS(SoFCMeshObjectShape, SoShape, "Shape");
|
||||||
}
|
}
|
||||||
|
|
||||||
SoFCMeshObjectShape::SoFCMeshObjectShape() : renderTriangleLimit(100000), meshChanged(true)
|
SoFCMeshObjectShape::SoFCMeshObjectShape()
|
||||||
|
: renderTriangleLimit(100000)
|
||||||
|
, meshChanged(true)
|
||||||
|
, selectBuf(0)
|
||||||
{
|
{
|
||||||
SO_NODE_CONSTRUCTOR(SoFCMeshObjectShape);
|
SO_NODE_CONSTRUCTOR(SoFCMeshObjectShape);
|
||||||
setName(SoFCMeshObjectShape::getClassTypeId().getName());
|
setName(SoFCMeshObjectShape::getClassTypeId().getName());
|
||||||
|
|
|
@ -1028,7 +1028,7 @@ void ViewProviderMesh::getFacetsFromPolygon(const std::vector<SbVec2f>& picked,
|
||||||
std::vector<unsigned long>& indices) const
|
std::vector<unsigned long>& indices) const
|
||||||
{
|
{
|
||||||
#if 1
|
#if 1
|
||||||
bool ok = true;
|
const bool ok = true;
|
||||||
Base::Polygon2D polygon;
|
Base::Polygon2D polygon;
|
||||||
for (std::vector<SbVec2f>::const_iterator it = picked.begin(); it != picked.end(); ++it)
|
for (std::vector<SbVec2f>::const_iterator it = picked.begin(); it != picked.end(); ++it)
|
||||||
polygon.Add(Base::Vector2D((*it)[0],(*it)[1]));
|
polygon.Add(Base::Vector2D((*it)[0],(*it)[1]));
|
||||||
|
@ -1890,6 +1890,8 @@ PROPERTY_SOURCE(MeshGui::ViewProviderIndexedFaceSet, MeshGui::ViewProviderMesh)
|
||||||
|
|
||||||
ViewProviderIndexedFaceSet::ViewProviderIndexedFaceSet()
|
ViewProviderIndexedFaceSet::ViewProviderIndexedFaceSet()
|
||||||
{
|
{
|
||||||
|
pcMeshCoord = 0;
|
||||||
|
pcMeshFaces = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewProviderIndexedFaceSet::~ViewProviderIndexedFaceSet()
|
ViewProviderIndexedFaceSet::~ViewProviderIndexedFaceSet()
|
||||||
|
@ -1979,6 +1981,8 @@ PROPERTY_SOURCE(MeshGui::ViewProviderMeshObject, MeshGui::ViewProviderMesh)
|
||||||
|
|
||||||
ViewProviderMeshObject::ViewProviderMeshObject()
|
ViewProviderMeshObject::ViewProviderMeshObject()
|
||||||
{
|
{
|
||||||
|
pcMeshNode = 0;
|
||||||
|
pcMeshShape = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewProviderMeshObject::~ViewProviderMeshObject()
|
ViewProviderMeshObject::~ViewProviderMeshObject()
|
||||||
|
|
|
@ -145,7 +145,7 @@ void ViewProviderMeshOrientation::attach(App::DocumentObject* pcFeat)
|
||||||
|
|
||||||
void ViewProviderMeshOrientation::showDefects(const std::vector<unsigned long>& inds)
|
void ViewProviderMeshOrientation::showDefects(const std::vector<unsigned long>& inds)
|
||||||
{
|
{
|
||||||
Mesh::Feature* f = dynamic_cast<Mesh::Feature*>(pcObject);
|
Mesh::Feature* f = static_cast<Mesh::Feature*>(pcObject);
|
||||||
const MeshCore::MeshKernel & rMesh = f->Mesh.getValue().getKernel();
|
const MeshCore::MeshKernel & rMesh = f->Mesh.getValue().getKernel();
|
||||||
|
|
||||||
pcCoords->point.deleteValues(0);
|
pcCoords->point.deleteValues(0);
|
||||||
|
@ -212,7 +212,7 @@ void ViewProviderMeshNonManifolds::showDefects(const std::vector<unsigned long>&
|
||||||
{
|
{
|
||||||
if ((inds.size() % 2) != 0)
|
if ((inds.size() % 2) != 0)
|
||||||
return;
|
return;
|
||||||
Mesh::Feature* f = dynamic_cast<Mesh::Feature*>(pcObject);
|
Mesh::Feature* f = static_cast<Mesh::Feature*>(pcObject);
|
||||||
const MeshCore::MeshKernel & rMesh = f->Mesh.getValue().getKernel();
|
const MeshCore::MeshKernel & rMesh = f->Mesh.getValue().getKernel();
|
||||||
|
|
||||||
pcCoords->point.deleteValues(0);
|
pcCoords->point.deleteValues(0);
|
||||||
|
@ -275,7 +275,7 @@ void ViewProviderMeshNonManifoldPoints::attach(App::DocumentObject* pcFeat)
|
||||||
|
|
||||||
void ViewProviderMeshNonManifoldPoints::showDefects(const std::vector<unsigned long>& inds)
|
void ViewProviderMeshNonManifoldPoints::showDefects(const std::vector<unsigned long>& inds)
|
||||||
{
|
{
|
||||||
Mesh::Feature* f = dynamic_cast<Mesh::Feature*>(pcObject);
|
Mesh::Feature* f = static_cast<Mesh::Feature*>(pcObject);
|
||||||
const MeshCore::MeshKernel & rMesh = f->Mesh.getValue().getKernel();
|
const MeshCore::MeshKernel & rMesh = f->Mesh.getValue().getKernel();
|
||||||
pcCoords->point.deleteValues(0);
|
pcCoords->point.deleteValues(0);
|
||||||
pcCoords->point.setNum(inds.size());
|
pcCoords->point.setNum(inds.size());
|
||||||
|
@ -339,7 +339,7 @@ void ViewProviderMeshDuplicatedFaces::attach(App::DocumentObject* pcFeat)
|
||||||
|
|
||||||
void ViewProviderMeshDuplicatedFaces::showDefects(const std::vector<unsigned long>& inds)
|
void ViewProviderMeshDuplicatedFaces::showDefects(const std::vector<unsigned long>& inds)
|
||||||
{
|
{
|
||||||
Mesh::Feature* f = dynamic_cast<Mesh::Feature*>(pcObject);
|
Mesh::Feature* f = static_cast<Mesh::Feature*>(pcObject);
|
||||||
const MeshCore::MeshKernel & rMesh = f->Mesh.getValue().getKernel();
|
const MeshCore::MeshKernel & rMesh = f->Mesh.getValue().getKernel();
|
||||||
|
|
||||||
pcCoords->point.deleteValues(0);
|
pcCoords->point.deleteValues(0);
|
||||||
|
@ -404,7 +404,7 @@ void ViewProviderMeshDuplicatedPoints::attach(App::DocumentObject* pcFeat)
|
||||||
|
|
||||||
void ViewProviderMeshDuplicatedPoints::showDefects(const std::vector<unsigned long>& inds)
|
void ViewProviderMeshDuplicatedPoints::showDefects(const std::vector<unsigned long>& inds)
|
||||||
{
|
{
|
||||||
Mesh::Feature* f = dynamic_cast<Mesh::Feature*>(pcObject);
|
Mesh::Feature* f = static_cast<Mesh::Feature*>(pcObject);
|
||||||
const MeshCore::MeshKernel & rMesh = f->Mesh.getValue().getKernel();
|
const MeshCore::MeshKernel & rMesh = f->Mesh.getValue().getKernel();
|
||||||
pcCoords->point.deleteValues(0);
|
pcCoords->point.deleteValues(0);
|
||||||
pcCoords->point.setNum(inds.size());
|
pcCoords->point.setNum(inds.size());
|
||||||
|
@ -461,7 +461,7 @@ void ViewProviderMeshDegenerations::attach(App::DocumentObject* pcFeat)
|
||||||
|
|
||||||
void ViewProviderMeshDegenerations::showDefects(const std::vector<unsigned long>& inds)
|
void ViewProviderMeshDegenerations::showDefects(const std::vector<unsigned long>& inds)
|
||||||
{
|
{
|
||||||
Mesh::Feature* f = dynamic_cast<Mesh::Feature*>(pcObject);
|
Mesh::Feature* f = static_cast<Mesh::Feature*>(pcObject);
|
||||||
const MeshCore::MeshKernel & rMesh = f->Mesh.getValue().getKernel();
|
const MeshCore::MeshKernel & rMesh = f->Mesh.getValue().getKernel();
|
||||||
|
|
||||||
pcCoords->point.deleteValues(0);
|
pcCoords->point.deleteValues(0);
|
||||||
|
@ -567,7 +567,7 @@ void ViewProviderMeshIndices::attach(App::DocumentObject* pcFeat)
|
||||||
|
|
||||||
void ViewProviderMeshIndices::showDefects(const std::vector<unsigned long>& inds)
|
void ViewProviderMeshIndices::showDefects(const std::vector<unsigned long>& inds)
|
||||||
{
|
{
|
||||||
Mesh::Feature* f = dynamic_cast<Mesh::Feature*>(pcObject);
|
Mesh::Feature* f = static_cast<Mesh::Feature*>(pcObject);
|
||||||
const MeshCore::MeshKernel & rMesh = f->Mesh.getValue().getKernel();
|
const MeshCore::MeshKernel & rMesh = f->Mesh.getValue().getKernel();
|
||||||
|
|
||||||
if (!inds.empty()) {
|
if (!inds.empty()) {
|
||||||
|
@ -636,7 +636,7 @@ void ViewProviderMeshSelfIntersections::showDefects(const std::vector<unsigned l
|
||||||
{
|
{
|
||||||
if (indices.size() % 2 != 0)
|
if (indices.size() % 2 != 0)
|
||||||
return;
|
return;
|
||||||
Mesh::Feature* f = dynamic_cast<Mesh::Feature*>(pcObject);
|
Mesh::Feature* f = static_cast<Mesh::Feature*>(pcObject);
|
||||||
const MeshCore::MeshKernel & rMesh = f->Mesh.getValue().getKernel();
|
const MeshCore::MeshKernel & rMesh = f->Mesh.getValue().getKernel();
|
||||||
MeshCore::MeshEvalSelfIntersection eval(rMesh);
|
MeshCore::MeshEvalSelfIntersection eval(rMesh);
|
||||||
|
|
||||||
|
@ -645,7 +645,7 @@ void ViewProviderMeshSelfIntersections::showDefects(const std::vector<unsigned l
|
||||||
for (it = indices.begin(); it != indices.end(); ) {
|
for (it = indices.begin(); it != indices.end(); ) {
|
||||||
unsigned long id1 = *it; ++it;
|
unsigned long id1 = *it; ++it;
|
||||||
unsigned long id2 = *it; ++it;
|
unsigned long id2 = *it; ++it;
|
||||||
intersection.push_back(std::make_pair(id1,id2));
|
intersection.push_back(std::make_pair(id1,id2));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::pair<Base::Vector3f, Base::Vector3f> > lines;
|
std::vector<std::pair<Base::Vector3f, Base::Vector3f> > lines;
|
||||||
|
@ -714,7 +714,7 @@ void ViewProviderMeshFolds::attach(App::DocumentObject* pcFeat)
|
||||||
|
|
||||||
void ViewProviderMeshFolds::showDefects(const std::vector<unsigned long>& inds)
|
void ViewProviderMeshFolds::showDefects(const std::vector<unsigned long>& inds)
|
||||||
{
|
{
|
||||||
Mesh::Feature* f = dynamic_cast<Mesh::Feature*>(pcObject);
|
Mesh::Feature* f = static_cast<Mesh::Feature*>(pcObject);
|
||||||
const MeshCore::MeshKernel & rMesh = f->Mesh.getValue().getKernel();
|
const MeshCore::MeshKernel & rMesh = f->Mesh.getValue().getKernel();
|
||||||
|
|
||||||
pcCoords->point.deleteValues(0);
|
pcCoords->point.deleteValues(0);
|
||||||
|
|
|
@ -65,6 +65,8 @@ ViewProviderMeshTransformDemolding::ViewProviderMeshTransformDemolding()
|
||||||
{
|
{
|
||||||
pcTrackballDragger = new SoTrackballDragger;
|
pcTrackballDragger = new SoTrackballDragger;
|
||||||
pcTrackballDragger->ref();
|
pcTrackballDragger->ref();
|
||||||
|
pcTransformDrag = 0;
|
||||||
|
pcColorMat = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewProviderMeshTransformDemolding::~ViewProviderMeshTransformDemolding()
|
ViewProviderMeshTransformDemolding::~ViewProviderMeshTransformDemolding()
|
||||||
|
@ -122,7 +124,7 @@ void ViewProviderMeshTransformDemolding::attach(App::DocumentObject *pcFeat)
|
||||||
calcNormalVector();
|
calcNormalVector();
|
||||||
calcMaterialIndex(SbRotation());
|
calcMaterialIndex(SbRotation());
|
||||||
// geting center point
|
// geting center point
|
||||||
center = dynamic_cast<Feature*>(pcObject)->Mesh.getValue().getKernel().GetBoundBox().GetCenter();
|
center = static_cast<Feature*>(pcObject)->Mesh.getValue().getKernel().GetBoundBox().GetCenter();
|
||||||
|
|
||||||
//SoGetBoundingBoxAction boxAction;
|
//SoGetBoundingBoxAction boxAction;
|
||||||
//pcHighlight->getBoundingBox(&boxAction);
|
//pcHighlight->getBoundingBox(&boxAction);
|
||||||
|
@ -131,7 +133,7 @@ void ViewProviderMeshTransformDemolding::attach(App::DocumentObject *pcFeat)
|
||||||
|
|
||||||
void ViewProviderMeshTransformDemolding::calcNormalVector(void)
|
void ViewProviderMeshTransformDemolding::calcNormalVector(void)
|
||||||
{
|
{
|
||||||
const MeshKernel& cMesh = dynamic_cast<Feature*>(pcObject)->Mesh.getValue().getKernel();
|
const MeshKernel& cMesh = static_cast<Feature*>(pcObject)->Mesh.getValue().getKernel();
|
||||||
|
|
||||||
MeshFacetIterator cFIt(cMesh);
|
MeshFacetIterator cFIt(cMesh);
|
||||||
for( cFIt.Init(); cFIt.More(); cFIt.Next())
|
for( cFIt.Init(); cFIt.More(); cFIt.Next())
|
||||||
|
|
|
@ -282,25 +282,33 @@ void PointsGrid::Position (const Base::Vector3d &rclPoint, unsigned long &rulX,
|
||||||
|
|
||||||
void PointsGrid::CalculateGridLength (unsigned long ulCtGrid, unsigned long ulMaxGrids)
|
void PointsGrid::CalculateGridLength (unsigned long ulCtGrid, unsigned long ulMaxGrids)
|
||||||
{
|
{
|
||||||
// Grid Laengen bzw. Anzahl der Grids pro Dimension berechnen
|
// Grid Laengen bzw. Anzahl der Grids pro Dimension berechnen
|
||||||
// pro Grid sollen ca. 10 (?!?!) Facets liegen
|
// pro Grid sollen ca. 10 (?!?!) Facets liegen
|
||||||
// bzw. max Grids sollten 10000 nicht ueberschreiten
|
// bzw. max Grids sollten 10000 nicht ueberschreiten
|
||||||
Base::BoundBox3d clBBPtsEnlarged;// = _pclPoints->GetBoundBox();
|
Base::BoundBox3d clBBPtsEnlarged;// = _pclPoints->GetBoundBox();
|
||||||
for (PointKernel::const_iterator it = _pclPoints->begin(); it != _pclPoints->end(); ++it )
|
for (PointKernel::const_iterator it = _pclPoints->begin(); it != _pclPoints->end(); ++it )
|
||||||
clBBPtsEnlarged.Add(*it);
|
clBBPtsEnlarged.Add(*it);
|
||||||
double fVolElem;
|
double fVolElem;
|
||||||
|
|
||||||
if (_ulCtElements > (ulMaxGrids * ulCtGrid))
|
if (_ulCtElements > (ulMaxGrids * ulCtGrid))
|
||||||
fVolElem = (clBBPtsEnlarged.LengthX() * clBBPtsEnlarged.LengthY() * clBBPtsEnlarged.LengthZ()) / float(ulMaxGrids * ulCtGrid);
|
fVolElem = (clBBPtsEnlarged.LengthX() * clBBPtsEnlarged.LengthY() * clBBPtsEnlarged.LengthZ()) / float(ulMaxGrids * ulCtGrid);
|
||||||
else
|
else
|
||||||
fVolElem = (clBBPtsEnlarged.LengthX() * clBBPtsEnlarged.LengthY() * clBBPtsEnlarged.LengthZ()) / float(_ulCtElements);
|
fVolElem = (clBBPtsEnlarged.LengthX() * clBBPtsEnlarged.LengthY() * clBBPtsEnlarged.LengthZ()) / float(_ulCtElements);
|
||||||
|
|
||||||
double fVol = fVolElem * float(ulCtGrid);
|
double fVol = fVolElem * float(ulCtGrid);
|
||||||
double fGridLen = float(pow((float)fVol,(float) 1.0f / 3.0f));
|
double fGridLen = float(pow((float)fVol,(float) 1.0f / 3.0f));
|
||||||
|
|
||||||
_ulCtGridsX = std::max<unsigned long>((unsigned long)(clBBPtsEnlarged.LengthX() / fGridLen), 1);
|
if (fGridLen > 0) {
|
||||||
_ulCtGridsY = std::max<unsigned long>((unsigned long)(clBBPtsEnlarged.LengthY() / fGridLen), 1);
|
_ulCtGridsX = std::max<unsigned long>((unsigned long)(clBBPtsEnlarged.LengthX() / fGridLen), 1);
|
||||||
_ulCtGridsZ = std::max<unsigned long>((unsigned long)(clBBPtsEnlarged.LengthZ() / fGridLen), 1);
|
_ulCtGridsY = std::max<unsigned long>((unsigned long)(clBBPtsEnlarged.LengthY() / fGridLen), 1);
|
||||||
|
_ulCtGridsZ = std::max<unsigned long>((unsigned long)(clBBPtsEnlarged.LengthZ() / fGridLen), 1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Degenerated grid
|
||||||
|
_ulCtGridsX = 1;
|
||||||
|
_ulCtGridsY = 1;
|
||||||
|
_ulCtGridsZ = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PointsGrid::CalculateGridLength (int iCtGridPerAxis)
|
void PointsGrid::CalculateGridLength (int iCtGridPerAxis)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user