MCPcopy Create free account
hub / github.com/Kitware/VTK / IsInsideOut

Method IsInsideOut

Common/DataModel/vtkCell3D.cxx:46–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46bool vtkCell3D::IsInsideOut()
47{
48 // Strategy:
49 // - Compute the centroid of the cell.
50 // - Accumulate a signed projected distance on the normal between the faces and the centroid.
51 // - Check the sign to see if the cell is inside out or not.
52 double centroid[3], point[3], normal[3];
53 if (!this->GetCentroid(centroid))
54 {
55 return false;
56 }
57 double signedDistanceToCentroid = 0.0;
58 for (vtkIdType faceId = 0; faceId < this->GetNumberOfFaces(); ++faceId)
59 {
60 const vtkIdType* pointIds;
61 vtkIdType faceSize = this->GetFacePoints(faceId, pointIds);
62 if (faceSize)
63 {
64 this->Points->GetPoint(pointIds[0], point);
65 vtkPolygon::ComputeNormal(this->Points, faceSize, pointIds, normal);
66 signedDistanceToCentroid +=
67 vtkPolygon::ComputeArea(this->Points, faceSize, pointIds, normal) *
68 (vtkMath::Dot(normal, centroid) - vtkMath::Dot(normal, point));
69 }
70 }
71 return signedDistanceToCentroid > 0.0;
72}
73
74//----------------------------------------------------------------------------
75int vtkCell3D::Inflate(double dist)

Callers 1

InflateMethod · 0.95

Calls 6

ComputeNormalFunction · 0.70
DotFunction · 0.70
GetCentroidMethod · 0.45
GetNumberOfFacesMethod · 0.45
GetFacePointsMethod · 0.45
GetPointMethod · 0.45

Tested by

no test coverage detected