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

Function IsCellInverted

IO/NetCDF/vtkNetCDFCAMReader.cxx:33–48  ·  view source on GitHub ↗

determine if this is a cell that wraps from 360 to 0 (i.e. if it's a cell that wraps from the right side of the domain to the left side)

Source from the content-addressed store, hash-verified

31// determine if this is a cell that wraps from 360 to 0 (i.e. if it's
32// a cell that wraps from the right side of the domain to the left side)
33bool IsCellInverted(double points[4][3])
34{
35 // We test the normal 3 points at a time. Not all grids are well-behaved
36 // i.e. consistently use 0 or 360. We've had grid where 3 points on the left
37 // side, and just 1 on the right. Just checking the first 3 points (which is
38 // what ComputeNormal() does, we may (and do) miss a few cells.
39 // See BUG #0014897.
40 double normal[3];
41 vtkPolygon::ComputeNormal(3, points[0], normal);
42 if (normal[2] > 0)
43 {
44 return true;
45 }
46 vtkPolygon::ComputeNormal(3, points[1], normal);
47 return normal[2] > 0;
48}
49
50template <class T>
51inline bool IsZero(const T& val)

Callers 1

RequestDataMethod · 0.85

Calls 1

ComputeNormalFunction · 0.50

Tested by

no test coverage detected