Updates will be applied April 15th at 12pm EDT (UTC-0400). GitLab could be a little slow between 12 - 12:45pm EDT.

Commit 29c16232 authored by Max Zeyen's avatar Max Zeyen

Fixing Bugs Causing Errors Wrong Results in vtkCellValidator

Fixing errors within vtkCellValidator that caused a wrong state mask
evaluation, returning wrong error messages in case of errors.
Changing the IsConvex method of vtkPolyhedron to use local instead
of global face ids to access points. Global face ids resulted in accessing
the wrong points causing erroneous face centroids and normals.
parent 88d4dc38
......@@ -803,7 +803,7 @@ bool vtkPolyhedron::IsConvex()
{
double x[2][3], n[3], c[3], c0[3], c1[3], c0p[3], c1p[3], n0[3], n1[3];
double n0p[3], n1p[3], np[3], tmp0, tmp1;
vtkIdType i, w[2], p0, p1, edgeId, edgeFaces[2], loc, v, *face, r = 0;
vtkIdType i, w[2], edgeId, edgeFaces[2], loc, v, *face, r = 0;
const double eps = FLT_EPSILON;
std::vector<double> p(this->PointIds->GetNumberOfIds());
......@@ -819,20 +819,16 @@ bool vtkPolyhedron::IsConvex()
this->EdgeTable->InitTraversal();
while ((edgeId = this->EdgeTable->GetNextEdge(w[0], w[1])) >= 0)
{
// get the global point ids
p0 = this->PointIds->GetId(w[0]);
p1 = this->PointIds->GetId(w[1]);
// get the edge points
this->Points->GetPoint(p0, x[0]);
this->Points->GetPoint(p1, x[1]);
this->Points->GetPoint(w[0], x[0]);
this->Points->GetPoint(w[1], x[1]);
// get the local face ids
this->EdgeFaces->GetTypedTuple(edgeId, edgeFaces);
// get the face vertex ids for the first face
loc = this->FaceLocations->GetValue(edgeFaces[0]);
face = this->GlobalFaces->GetPointer(loc);
face = this->Faces->GetPointer(loc);
// compute the centroid and normal for the first face
vtkPolygon::ComputeCentroid(this->Points, face[0], face + 1, c0);
......@@ -840,7 +836,7 @@ bool vtkPolyhedron::IsConvex()
// get the face vertex ids for the second face
loc = this->FaceLocations->GetValue(edgeFaces[1]);
face = this->GlobalFaces->GetPointer(loc);
face = this->Faces->GetPointer(loc);
// compute the centroid and normal for the second face
vtkPolygon::ComputeCentroid(this->Points, face[0], face + 1, c1);
......
......@@ -1708,16 +1708,17 @@ void vtkCellValidator::PrintState(vtkCellValidator::State state, ostream& os,
{
os << indent << " - Intersecting edges\n";
}
if ((state & vtkCellValidator::State::NoncontiguousEdges) !=
if ((state & vtkCellValidator::State::NoncontiguousEdges) ==
vtkCellValidator::State::NoncontiguousEdges)
{
os << indent << " - Noncontiguous edges\n";
}
if ((state & vtkCellValidator::State::Nonconvex) != vtkCellValidator::State::Nonconvex)
if ((state & vtkCellValidator::State::Nonconvex) ==
vtkCellValidator::State::Nonconvex)
{
os << indent << " - Nonconvex\n";
}
if ((state & vtkCellValidator::State::FacesAreOrientedIncorrectly) !=
if ((state & vtkCellValidator::State::FacesAreOrientedIncorrectly) ==
vtkCellValidator::State::FacesAreOrientedIncorrectly)
{
os << indent << " - Faces are oriented incorrectly\n";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment