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;
|
||||
fRMS = sqrt(fRMS);
|
||||
if (countRMS > 0) {
|
||||
fRMS = fRMS / countRMS;
|
||||
fRMS = sqrt(fRMS);
|
||||
}
|
||||
|
||||
Base::Console().Message("RMS value for '%s' with search radius=%.4f is: %.4f\n",
|
||||
this->Label.getValue(), this->SearchRadius.getValue(), fRMS);
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ void ViewProviderInspection::updateData(const App::Property* prop)
|
|||
{
|
||||
// set to the expected size
|
||||
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) {
|
||||
float accuracy=0;
|
||||
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
|
||||
if (this->pcObject) {
|
||||
App::Property* link = this->pcObject->getPropertyByName("Actual");
|
||||
if (link) updateData(link);
|
||||
if (link)
|
||||
updateData(link);
|
||||
setDistances();
|
||||
}
|
||||
setDistances();
|
||||
}
|
||||
else if (prop->getTypeId() == App::PropertyFloat::getClassTypeId()) {
|
||||
if (strcmp(prop->getName(), "SearchRadius") == 0) {
|
||||
|
@ -281,6 +282,9 @@ SoSeparator* ViewProviderInspection::getFrontRoot(void) const
|
|||
|
||||
void ViewProviderInspection::setDistances()
|
||||
{
|
||||
if (!pcObject)
|
||||
return;
|
||||
|
||||
App::Property* pDistances = pcObject->getPropertyByName("Distances");
|
||||
if (!pDistances) {
|
||||
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
|
||||
{
|
||||
|
||||
for(std::list< std::vector<Base::Vector3f> >::iterator OutIter = clPolyList.begin(); OutIter != clPolyList.end(); ++OutIter)
|
||||
{
|
||||
std::pair<Base::Vector3f,Base::Vector3f> currentSort;
|
||||
float fDist = Base::Distance(OutIter->front(),OutIter->back());
|
||||
currentSort.first = OutIter->front();
|
||||
currentSort.second = OutIter->back();
|
||||
for (std::list< std::vector<Base::Vector3f> >::iterator OutIter = clPolyList.begin(); OutIter != clPolyList.end(); ++OutIter) {
|
||||
if (OutIter->empty())
|
||||
continue;
|
||||
std::pair<Base::Vector3f,Base::Vector3f> currentSort;
|
||||
float fDist = Base::Distance(OutIter->front(),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)
|
||||
{
|
||||
if(OutIter == InnerIter) continue;
|
||||
for (std::list< std::vector<Base::Vector3f> >::iterator InnerIter = clPolyList.begin(); InnerIter != clPolyList.end(); ++InnerIter) {
|
||||
if (OutIter == InnerIter)
|
||||
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,
|
||||
|
|
|
@ -107,9 +107,11 @@ void Approximation::AddPoints(const std::list<Base::Vector3f> &rsPointList)
|
|||
Base::Vector3f Approximation::GetGravity() const
|
||||
{
|
||||
Base::Vector3f clGravity;
|
||||
for (std::list<Base::Vector3f>::const_iterator it = _vPoints.begin(); it!=_vPoints.end(); ++it)
|
||||
clGravity += *it;
|
||||
clGravity *= 1.0f / float(_vPoints.size());
|
||||
if (!_vPoints.empty()) {
|
||||
for (std::list<Base::Vector3f>::const_iterator it = _vPoints.begin(); it!=_vPoints.end(); ++it)
|
||||
clGravity += *it;
|
||||
clGravity *= 1.0f / float(_vPoints.size());
|
||||
}
|
||||
return clGravity;
|
||||
}
|
||||
|
||||
|
@ -173,10 +175,10 @@ float PlaneFit::Fit()
|
|||
szz = szz - mz*mz/((double)nSize);
|
||||
|
||||
#if defined(FC_USE_EIGEN)
|
||||
Eigen::Matrix3d covMat = Eigen::Matrix3d::Zero();
|
||||
covMat(0,0) = sxx;
|
||||
covMat(1,1) = syy;
|
||||
covMat(2,2) = szz;
|
||||
Eigen::Matrix3d covMat = Eigen::Matrix3d::Zero();
|
||||
covMat(0,0) = sxx;
|
||||
covMat(1,1) = syy;
|
||||
covMat(2,2) = szz;
|
||||
covMat(0,1) = sxy; covMat(1,0) = sxy;
|
||||
covMat(0,2) = sxz; covMat(2,0) = sxz;
|
||||
covMat(1,2) = syz; covMat(2,1) = syz;
|
||||
|
@ -451,7 +453,7 @@ const double& QuadraticFit::GetCoeffArray() const
|
|||
|
||||
double QuadraticFit::GetCoeff(unsigned long ulIndex) const
|
||||
{
|
||||
assert( ulIndex >= 0 && ulIndex < 10 );
|
||||
assert(ulIndex < 10);
|
||||
|
||||
if( _bIsFitted )
|
||||
return _fCoeff[ ulIndex ];
|
||||
|
@ -636,9 +638,9 @@ double SurfaceFit::PolynomFit()
|
|||
// <=> 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]
|
||||
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> x = Eigen::Matrix<double,6,1>::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> x = Eigen::Matrix<double,6,1>::Zero();
|
||||
|
||||
std::vector<Base::Vector3d> transform;
|
||||
transform.reserve(_vPoints.size());
|
||||
|
@ -765,7 +767,8 @@ double SurfaceFit::PolynomFit()
|
|||
// that 'sigma' becomes negative.
|
||||
if (sigma < 0)
|
||||
sigma = 0;
|
||||
sigma = sqrt(sigma/_vPoints.size());
|
||||
if (!_vPoints.empty())
|
||||
sigma = sqrt(sigma/_vPoints.size());
|
||||
|
||||
_fLastResult = static_cast<float>(sigma);
|
||||
return _fLastResult;
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
using namespace MeshCore;
|
||||
|
||||
|
||||
MeshBuilder::MeshBuilder (MeshKernel& kernel) : _meshKernel(kernel), _seq(0)
|
||||
MeshBuilder::MeshBuilder (MeshKernel& kernel) : _meshKernel(kernel), _seq(0), _ptIdx(0)
|
||||
{
|
||||
_fSaveTolerance = MeshDefinitions::_fMinPointDistanceD1;
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ private:
|
|||
// keep an array of iterators pointing to the vertex inside the set to save memory
|
||||
typedef std::pair<std::set<MeshPoint>::iterator, bool> MeshPointIterator;
|
||||
std::vector<MeshPointIterator> _pointsIterator;
|
||||
unsigned long _ptIdx;
|
||||
unsigned long _ptIdx;
|
||||
|
||||
void SetNeighbourhood ();
|
||||
// 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 ()
|
||||
{
|
||||
// get all non-manifolds
|
||||
MeshEvalTopology::Evaluate();
|
||||
(void)MeshEvalTopology::Evaluate();
|
||||
/*
|
||||
// for each (multiple) single linked facet there should
|
||||
// exist two valid facets sharing the same edge
|
||||
|
|
|
@ -1793,7 +1793,8 @@ bool MeshOutput::SaveBinarySTL (std::ostream &rstrOut) const
|
|||
return false;
|
||||
|
||||
Base::SequencerLauncher seq("saving...", _rclMesh.CountFacets() + 1);
|
||||
|
||||
|
||||
// stl_header has a length of 80
|
||||
strcpy(szInfo, stl_header.c_str());
|
||||
rstrOut.write(szInfo, std::strlen(szInfo));
|
||||
|
||||
|
|
|
@ -74,7 +74,6 @@ protected:
|
|||
MeshKernel &_resultMesh; /** Result mesh */
|
||||
OperationType _operationType; /** Set Operation Type */
|
||||
float _minDistanceToPoint; /** Minimal distance to facet corner points */
|
||||
float _saveMinMeshDistance;
|
||||
|
||||
private:
|
||||
// Helper class cutting edge to his two attached facets
|
||||
|
|
|
@ -36,7 +36,11 @@
|
|||
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;
|
||||
|
||||
MeshSearchNeighbours::MeshSearchNeighbours (const MeshKernel &rclM, float fSampleDistance)
|
||||
: _rclMesh(rclM),
|
||||
_rclFAry(rclM.GetFacets()),
|
||||
_rclPAry(rclM.GetPoints()),
|
||||
_clPt2Fa(rclM),
|
||||
_fSampleDistance(fSampleDistance)
|
||||
: _rclMesh(rclM)
|
||||
, _rclFAry(rclM.GetFacets())
|
||||
, _rclPAry(rclM.GetPoints())
|
||||
, _clPt2Fa(rclM)
|
||||
, _fMaxDistanceP2(0)
|
||||
, _fSampleDistance(fSampleDistance)
|
||||
, _bTooFewPoints(false)
|
||||
{
|
||||
MeshAlgorithm(_rclMesh).ResetFacetFlag(MeshFacet::MARKED);
|
||||
MeshAlgorithm(_rclMesh).ResetPointFlag(MeshPoint::MARKED);
|
||||
|
|
|
@ -409,7 +409,12 @@ namespace MeshGui {
|
|||
/* TRANSLATOR MeshGui::MeshFillHole */
|
||||
|
||||
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->ref();
|
||||
|
|
|
@ -78,6 +78,9 @@ unsigned char MeshSelection::cross_mask_bitmap[] = {
|
|||
MeshSelection::MeshSelection()
|
||||
: onlyPointToUserTriangles(false)
|
||||
, onlyVisibleTriangles(false)
|
||||
, addToSelection(false)
|
||||
, addComponent(false)
|
||||
, removeComponent(false)
|
||||
, activeCB(0)
|
||||
, selectionCB(0)
|
||||
, ivViewer(0)
|
||||
|
|
|
@ -588,7 +588,10 @@ void SoFCMeshObjectShape::initClass()
|
|||
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);
|
||||
setName(SoFCMeshObjectShape::getClassTypeId().getName());
|
||||
|
|
|
@ -1028,7 +1028,7 @@ void ViewProviderMesh::getFacetsFromPolygon(const std::vector<SbVec2f>& picked,
|
|||
std::vector<unsigned long>& indices) const
|
||||
{
|
||||
#if 1
|
||||
bool ok = true;
|
||||
const bool ok = true;
|
||||
Base::Polygon2D polygon;
|
||||
for (std::vector<SbVec2f>::const_iterator it = picked.begin(); it != picked.end(); ++it)
|
||||
polygon.Add(Base::Vector2D((*it)[0],(*it)[1]));
|
||||
|
@ -1890,6 +1890,8 @@ PROPERTY_SOURCE(MeshGui::ViewProviderIndexedFaceSet, MeshGui::ViewProviderMesh)
|
|||
|
||||
ViewProviderIndexedFaceSet::ViewProviderIndexedFaceSet()
|
||||
{
|
||||
pcMeshCoord = 0;
|
||||
pcMeshFaces = 0;
|
||||
}
|
||||
|
||||
ViewProviderIndexedFaceSet::~ViewProviderIndexedFaceSet()
|
||||
|
@ -1979,6 +1981,8 @@ PROPERTY_SOURCE(MeshGui::ViewProviderMeshObject, MeshGui::ViewProviderMesh)
|
|||
|
||||
ViewProviderMeshObject::ViewProviderMeshObject()
|
||||
{
|
||||
pcMeshNode = 0;
|
||||
pcMeshShape = 0;
|
||||
}
|
||||
|
||||
ViewProviderMeshObject::~ViewProviderMeshObject()
|
||||
|
|
|
@ -145,7 +145,7 @@ void ViewProviderMeshOrientation::attach(App::DocumentObject* pcFeat)
|
|||
|
||||
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();
|
||||
|
||||
pcCoords->point.deleteValues(0);
|
||||
|
@ -212,7 +212,7 @@ void ViewProviderMeshNonManifolds::showDefects(const std::vector<unsigned long>&
|
|||
{
|
||||
if ((inds.size() % 2) != 0)
|
||||
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();
|
||||
|
||||
pcCoords->point.deleteValues(0);
|
||||
|
@ -275,7 +275,7 @@ void ViewProviderMeshNonManifoldPoints::attach(App::DocumentObject* pcFeat)
|
|||
|
||||
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();
|
||||
pcCoords->point.deleteValues(0);
|
||||
pcCoords->point.setNum(inds.size());
|
||||
|
@ -339,7 +339,7 @@ void ViewProviderMeshDuplicatedFaces::attach(App::DocumentObject* pcFeat)
|
|||
|
||||
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();
|
||||
|
||||
pcCoords->point.deleteValues(0);
|
||||
|
@ -404,7 +404,7 @@ void ViewProviderMeshDuplicatedPoints::attach(App::DocumentObject* pcFeat)
|
|||
|
||||
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();
|
||||
pcCoords->point.deleteValues(0);
|
||||
pcCoords->point.setNum(inds.size());
|
||||
|
@ -461,7 +461,7 @@ void ViewProviderMeshDegenerations::attach(App::DocumentObject* pcFeat)
|
|||
|
||||
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();
|
||||
|
||||
pcCoords->point.deleteValues(0);
|
||||
|
@ -567,7 +567,7 @@ void ViewProviderMeshIndices::attach(App::DocumentObject* pcFeat)
|
|||
|
||||
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();
|
||||
|
||||
if (!inds.empty()) {
|
||||
|
@ -636,7 +636,7 @@ void ViewProviderMeshSelfIntersections::showDefects(const std::vector<unsigned l
|
|||
{
|
||||
if (indices.size() % 2 != 0)
|
||||
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();
|
||||
MeshCore::MeshEvalSelfIntersection eval(rMesh);
|
||||
|
||||
|
@ -645,7 +645,7 @@ void ViewProviderMeshSelfIntersections::showDefects(const std::vector<unsigned l
|
|||
for (it = indices.begin(); it != indices.end(); ) {
|
||||
unsigned long id1 = *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;
|
||||
|
@ -714,7 +714,7 @@ void ViewProviderMeshFolds::attach(App::DocumentObject* pcFeat)
|
|||
|
||||
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();
|
||||
|
||||
pcCoords->point.deleteValues(0);
|
||||
|
|
|
@ -65,6 +65,8 @@ ViewProviderMeshTransformDemolding::ViewProviderMeshTransformDemolding()
|
|||
{
|
||||
pcTrackballDragger = new SoTrackballDragger;
|
||||
pcTrackballDragger->ref();
|
||||
pcTransformDrag = 0;
|
||||
pcColorMat = 0;
|
||||
}
|
||||
|
||||
ViewProviderMeshTransformDemolding::~ViewProviderMeshTransformDemolding()
|
||||
|
@ -122,7 +124,7 @@ void ViewProviderMeshTransformDemolding::attach(App::DocumentObject *pcFeat)
|
|||
calcNormalVector();
|
||||
calcMaterialIndex(SbRotation());
|
||||
// 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;
|
||||
//pcHighlight->getBoundingBox(&boxAction);
|
||||
|
@ -131,7 +133,7 @@ void ViewProviderMeshTransformDemolding::attach(App::DocumentObject *pcFeat)
|
|||
|
||||
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);
|
||||
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)
|
||||
{
|
||||
// Grid Laengen bzw. Anzahl der Grids pro Dimension berechnen
|
||||
// pro Grid sollen ca. 10 (?!?!) Facets liegen
|
||||
// bzw. max Grids sollten 10000 nicht ueberschreiten
|
||||
Base::BoundBox3d clBBPtsEnlarged;// = _pclPoints->GetBoundBox();
|
||||
for (PointKernel::const_iterator it = _pclPoints->begin(); it != _pclPoints->end(); ++it )
|
||||
clBBPtsEnlarged.Add(*it);
|
||||
double fVolElem;
|
||||
// Grid Laengen bzw. Anzahl der Grids pro Dimension berechnen
|
||||
// pro Grid sollen ca. 10 (?!?!) Facets liegen
|
||||
// bzw. max Grids sollten 10000 nicht ueberschreiten
|
||||
Base::BoundBox3d clBBPtsEnlarged;// = _pclPoints->GetBoundBox();
|
||||
for (PointKernel::const_iterator it = _pclPoints->begin(); it != _pclPoints->end(); ++it )
|
||||
clBBPtsEnlarged.Add(*it);
|
||||
double fVolElem;
|
||||
|
||||
if (_ulCtElements > (ulMaxGrids * ulCtGrid))
|
||||
fVolElem = (clBBPtsEnlarged.LengthX() * clBBPtsEnlarged.LengthY() * clBBPtsEnlarged.LengthZ()) / float(ulMaxGrids * ulCtGrid);
|
||||
else
|
||||
fVolElem = (clBBPtsEnlarged.LengthX() * clBBPtsEnlarged.LengthY() * clBBPtsEnlarged.LengthZ()) / float(_ulCtElements);
|
||||
if (_ulCtElements > (ulMaxGrids * ulCtGrid))
|
||||
fVolElem = (clBBPtsEnlarged.LengthX() * clBBPtsEnlarged.LengthY() * clBBPtsEnlarged.LengthZ()) / float(ulMaxGrids * ulCtGrid);
|
||||
else
|
||||
fVolElem = (clBBPtsEnlarged.LengthX() * clBBPtsEnlarged.LengthY() * clBBPtsEnlarged.LengthZ()) / float(_ulCtElements);
|
||||
|
||||
double fVol = fVolElem * float(ulCtGrid);
|
||||
double fGridLen = float(pow((float)fVol,(float) 1.0f / 3.0f));
|
||||
double fVol = fVolElem * float(ulCtGrid);
|
||||
double fGridLen = float(pow((float)fVol,(float) 1.0f / 3.0f));
|
||||
|
||||
_ulCtGridsX = std::max<unsigned long>((unsigned long)(clBBPtsEnlarged.LengthX() / fGridLen), 1);
|
||||
_ulCtGridsY = std::max<unsigned long>((unsigned long)(clBBPtsEnlarged.LengthY() / fGridLen), 1);
|
||||
_ulCtGridsZ = std::max<unsigned long>((unsigned long)(clBBPtsEnlarged.LengthZ() / fGridLen), 1);
|
||||
if (fGridLen > 0) {
|
||||
_ulCtGridsX = std::max<unsigned long>((unsigned long)(clBBPtsEnlarged.LengthX() / 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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user