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

Method ComputeNormal

Common/DataModel/vtkPixel.cxx:171–191  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

169
170//------------------------------------------------------------------------------
171int vtkPixel::ComputeNormal(double n[3])
172{
173 double p0[3], p1[3], p2[3];
174 this->Points->GetPoint(0, p0);
175 this->Points->GetPoint(1, p1);
176 this->Points->GetPoint(2, p2);
177 p1[0] -= p0[0];
178 p1[1] -= p0[1];
179 p1[2] -= p0[2];
180 p2[0] -= p0[0];
181 p2[1] -= p0[1];
182 p2[2] -= p0[2];
183 vtkMath::Cross(p1, p2, n);
184 if (std::abs(n[0]) < VTK_DBL_EPSILON && std::abs(n[1]) < VTK_DBL_EPSILON &&
185 std::abs(n[2]) < VTK_DBL_EPSILON)
186 {
187 return -1;
188 }
189 vtkMath::Normalize(n);
190 return (std::abs(n[1]) > 0.5) + (std::abs(n[2]) > 0.5) * 2;
191}
192
193//----------------------------------------------------------------------------
194int vtkPixel::Inflate(double dist)

Callers 2

ReadMultiSurfaceMethod · 0.45
testMethod · 0.45

Calls 4

NormalizeFunction · 0.70
CrossFunction · 0.50
absFunction · 0.50
GetPointMethod · 0.45

Tested by 1

testMethod · 0.36