[vtkusers] Potential bug in vtkPolygon normal and area calculations

Andrew Parker andy.john.parker at googlemail.com
Fri Aug 29 13:17:21 EDT 2014


Dear all,

This is driving me round the bend. When I have a meshing coming from a
rectilinear source, I get NANs from my normal and face area calculations.
 When all other input meshes are used, i.e. unstructured, the results are
correct. To test this I've written the following test code which makes a
single cell mesh and produces the NANs.  I then demonstrate that by using
the transform classes, with zero rotation, I can then extract the same mesh
back as a structured grid, and the errors disappear.  I can also apply a
non-zero rotation and the errors disappear too.

Note I apply a rotation, zero or otherwise, because my hypothesis having
stepped through 6.1 in the debugger, is that the vtk_pixel cell type (axis
aligned) coming from the rectilinear grid does not play well with the
normal calculation.  But I can't find the bug, only that all entries of the
normal are zero and the rest of the function fails.

Clearly, and more likely, is that I could also not be using the classes
correctly, and if so please let me know??  Hope somebody can find the bug,
I've got nowhere on this after a day of looking.  Again, anything non-axis
aligned and or non vtk_pixel would appear to work as expected.

Help appreciated,

Cheers again,
Andy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20140829/96c9259b/attachment.html>
-------------- next part --------------
cmake_minimum_required(VERSION 2.8)
PROJECT(weird)

set(CMAKE_COLOR_MAKEFILE ON)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra -Wall -Wconversion -pedantic -Wuninitialized -std=c++11 -Wno-extra-semi")
 
FIND_PACKAGE(VTK REQUIRED NO_MODULE)
INCLUDE(${VTK_USE_FILE})

find_package(Qt5Widgets REQUIRED)
                
set(SOURCES main.cxx)

ADD_EXECUTABLE(weird ${SOURCES})

TARGET_LINK_LIBRARIES(weird ${VTK_LIBRARIES})

-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.cxx
Type: text/x-c++src
Size: 3883 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20140829/96c9259b/attachment.cxx>


More information about the vtkusers mailing list