|
|
|
|
@@ -25,6 +25,7 @@
|
|
|
|
|
#ifndef _PreComp_
|
|
|
|
|
#include <boost/core/ignore_unused.hpp>
|
|
|
|
|
#include <numeric>
|
|
|
|
|
#include <limits>
|
|
|
|
|
|
|
|
|
|
#include <BRepBuilderAPI_MakeVertex.hxx>
|
|
|
|
|
#include <BRepClass3d_SolidClassifier.hxx>
|
|
|
|
|
@@ -316,7 +317,7 @@ InspectNominalMesh::~InspectNominalMesh()
|
|
|
|
|
float InspectNominalMesh::getDistance(const Base::Vector3f& point) const
|
|
|
|
|
{
|
|
|
|
|
if (!_box.IsInBox(point)) {
|
|
|
|
|
return FLT_MAX; // must be inside bbox
|
|
|
|
|
return std::numeric_limits<float>::max(); // must be inside bbox
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::vector<unsigned long> indices;
|
|
|
|
|
@@ -327,7 +328,7 @@ float InspectNominalMesh::getDistance(const Base::Vector3f& point) const
|
|
|
|
|
indices.insert(indices.begin(), inds.begin(), inds.end());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float fMinDist = FLT_MAX;
|
|
|
|
|
float fMinDist = std::numeric_limits<float>::max();
|
|
|
|
|
bool positive = true;
|
|
|
|
|
for (unsigned long it : indices) {
|
|
|
|
|
MeshCore::MeshGeomFacet geomFace = _mesh.GetFacet(it);
|
|
|
|
|
@@ -393,7 +394,7 @@ InspectNominalFastMesh::~InspectNominalFastMesh()
|
|
|
|
|
float InspectNominalFastMesh::getDistance(const Base::Vector3f& point) const
|
|
|
|
|
{
|
|
|
|
|
if (!_box.IsInBox(point)) {
|
|
|
|
|
return FLT_MAX; // must be inside bbox
|
|
|
|
|
return std::numeric_limits<float>::max(); // must be inside bbox
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::set<unsigned long> indices;
|
|
|
|
|
@@ -413,7 +414,7 @@ float InspectNominalFastMesh::getDistance(const Base::Vector3f& point) const
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
float fMinDist = FLT_MAX;
|
|
|
|
|
float fMinDist = std::numeric_limits<float>::max();
|
|
|
|
|
bool positive = true;
|
|
|
|
|
for (unsigned long it : indices) {
|
|
|
|
|
MeshCore::MeshGeomFacet geomFace = _mesh.GetFacet(it);
|
|
|
|
|
@@ -457,7 +458,7 @@ float InspectNominalPoints::getDistance(const Base::Vector3f& point) const
|
|
|
|
|
_pGrid->Position(pointd, x, y, z);
|
|
|
|
|
_pGrid->GetElements(x, y, z, indices);
|
|
|
|
|
|
|
|
|
|
double fMinDist = DBL_MAX;
|
|
|
|
|
double fMinDist = std::numeric_limits<double>::max();
|
|
|
|
|
for (unsigned long it : indices) {
|
|
|
|
|
Base::Vector3d pt = _rKernel.getPoint(it);
|
|
|
|
|
double fDist = Base::Distance(pointd, pt);
|
|
|
|
|
@@ -501,7 +502,7 @@ float InspectNominalShape::getDistance(const Base::Vector3f& point) const
|
|
|
|
|
BRepBuilderAPI_MakeVertex mkVert(pnt3d);
|
|
|
|
|
distss->LoadS2(mkVert.Vertex());
|
|
|
|
|
|
|
|
|
|
float fMinDist = FLT_MAX;
|
|
|
|
|
float fMinDist = std::numeric_limits<float>::max();
|
|
|
|
|
if (distss->Perform() && distss->NbSolution() > 0) {
|
|
|
|
|
fMinDist = (float)distss->Value();
|
|
|
|
|
// the shape is a solid, check if the vertex is inside
|
|
|
|
|
@@ -713,7 +714,7 @@ struct DistanceInspection
|
|
|
|
|
{
|
|
|
|
|
Base::Vector3f pnt = actual->getPoint(index);
|
|
|
|
|
|
|
|
|
|
float fMinDist = FLT_MAX;
|
|
|
|
|
float fMinDist = std::numeric_limits<float>::max();
|
|
|
|
|
for (auto it : nominal) {
|
|
|
|
|
float fDist = it->getDistance(pnt);
|
|
|
|
|
if (fabs(fDist) < fabs(fMinDist)) {
|
|
|
|
|
@@ -722,10 +723,10 @@ struct DistanceInspection
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fMinDist > this->radius) {
|
|
|
|
|
fMinDist = FLT_MAX;
|
|
|
|
|
fMinDist = std::numeric_limits<float>::max();
|
|
|
|
|
}
|
|
|
|
|
else if (-fMinDist > this->radius) {
|
|
|
|
|
fMinDist = -FLT_MAX;
|
|
|
|
|
fMinDist = -std::numeric_limits<float>::max();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return fMinDist;
|
|
|
|
|
@@ -884,7 +885,7 @@ App::DocumentObjectExecReturn* Feature::execute()
|
|
|
|
|
float fRMS = 0;
|
|
|
|
|
int countRMS = 0;
|
|
|
|
|
for (std::vector<float>::iterator it = vals.begin(); it != vals.end(); ++it) {
|
|
|
|
|
if (fabs(*it) < FLT_MAX) {
|
|
|
|
|
if (fabs(*it) < std::numeric_limits<float>::max()) {
|
|
|
|
|
fRMS += (*it) * (*it);
|
|
|
|
|
countRMS++;
|
|
|
|
|
}
|
|
|
|
|
@@ -904,7 +905,7 @@ App::DocumentObjectExecReturn* Feature::execute()
|
|
|
|
|
DistanceInspectionRMS res;
|
|
|
|
|
Base::Vector3f pnt = actual->getPoint(index);
|
|
|
|
|
|
|
|
|
|
float fMinDist = FLT_MAX;
|
|
|
|
|
float fMinDist = std::numeric_limits<float>::max();
|
|
|
|
|
for (auto it : inspectNominal) {
|
|
|
|
|
float fDist = it->getDistance(pnt);
|
|
|
|
|
if (fabs(fDist) < fabs(fMinDist)) {
|
|
|
|
|
@@ -913,10 +914,10 @@ App::DocumentObjectExecReturn* Feature::execute()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fMinDist > this->SearchRadius.getValue()) {
|
|
|
|
|
fMinDist = FLT_MAX;
|
|
|
|
|
fMinDist = std::numeric_limits<float>::max();
|
|
|
|
|
}
|
|
|
|
|
else if (-fMinDist > this->SearchRadius.getValue()) {
|
|
|
|
|
fMinDist = -FLT_MAX;
|
|
|
|
|
fMinDist = -std::numeric_limits<float>::max();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
res.m_sumsq += fMinDist * fMinDist;
|
|
|
|
|
|