richelbilderbeek / ProjectRichelBilderbeek

Richel Bilderbeek's C++ work, before splitting it up
http://richelbilderbeek.nl/
6 stars 3 forks source link

TriangleMesh: IsConvex and MakeConvex bug #168

Closed richelbilderbeek closed 10 years ago

richelbilderbeek commented 10 years ago

The program has trouble with these coordinats:

(2.35114,3.23607,5)
(1.17557,2.35781,5)
(2.35114,3.23607,6)
(1.17557,2.35781,6)

Helper().MakeConvex should fix these to a convex order.

This is checked by trianglemeshfacefactory.cpp: "IsConvex, issue 168"

richelbilderbeek commented 10 years ago

Also these points fail:

(1.17557,2.35781,5)
(2.35114,3.23607,6)
(1.17557,2.35781,6)
(2.35114,3.23607,5)
richelbilderbeek commented 10 years ago

There was a bug with three 3D points not being acknowledged as convex, which is impossible if these three points differ.

richelbilderbeek commented 10 years ago

DrMemory report:

drmemory -- ToolTestTriangleMeshConsole.exe
Dr. Memory version 1.6.1 build 2 built on Dec 14 2013 12:27:10
Dr. Memory results for pid 4800: "ToolTestTriangleMeshConsole.exe"
Application cmdline: "ToolTestTriangleMeshConsole.exe"
Recorded 99 suppression(s) from default C:\Program Files\DrMemory\bin\suppress-default.txt

Error #1: UNINITIALIZED READ: reading 0x752351ac-0x752351ae 2 byte(s)
# 0 KERNELBASE.dll!OpenRegKey                                                 +0x178    (0x751fcfb3 <KERNELBASE.dll+0xcfb3>)
# 1 KERNELBASE.dll!CreateThreadpool                                           +0x27     (0x752057f2 <KERNELBASE.dll+0x157f2>)
# 2 Qt5Cored.dll!(anonymous namespace)::Q_QGS_systemLocalePrivate::innerFunction()::Holder::Holder() [tools/qlocale_win.cpp:138]
# 3 Qt5Cored.dll!(anonymous namespace)::Q_QGS_systemLocalePrivate::innerFunction() [tools/qlocale_win.cpp:138]
# 4 Qt5Cored.dll!QGlobalStatic<>::operator()()                                 [../../include/QtCore/../../src/corelib/global/qglobalstatic.h:123]
# 5 Qt5Cored.dll!QSystemLocale::query()                                        [tools/qlocale_win.cpp:660]
# 6 Qt5Cored.dll!QLocalePrivate::updateSystemPrivate()                         [tools/qlocale.cpp:589]
# 7 Qt5Cored.dll!systemData()                                                  [tools/qlocale.cpp:634]
# 8 Qt5Cored.dll!defaultData()                                                 [tools/qlocale.cpp:645]
# 9 Qt5Cored.dll!(anonymous namespace)::Q_QGS_defaultLocalePrivate::innerFunction()::Holder::Holder() [tools/qlocale.cpp:698]
#10 Qt5Cored.dll!(anonymous namespace)::Q_QGS_defaultLocalePrivate::innerFunction() [tools/qlocale.cpp:698]
#11 Qt5Cored.dll!QGlobalStatic<>::operator*()                                  [../../include/QtCore/../../src/corelib/global/qglobalstatic.h:125]
Note: @0:00:25.181 in thread 5032
Note: instruction: data16 cmp    0x0c(%esi) %ax

Error #2: UNINITIALIZED READ: reading 0x752351ae-0x752351b0 2 byte(s)
# 0 KERNELBASE.dll!GetNamedLocaleHashNode                                     +0x15     (0x751fcdc7 <KERNELBASE.dll+0xcdc7>)
# 1 KERNELBASE.dll!OpenRegKey                                                 +0x18b    (0x751fcfc7 <KERNELBASE.dll+0xcfc7>)
# 2 KERNELBASE.dll!CreateThreadpool                                           +0x27     (0x752057f2 <KERNELBASE.dll+0x157f2>)
# 3 Qt5Cored.dll!(anonymous namespace)::Q_QGS_systemLocalePrivate::innerFunction()::Holder::Holder() [tools/qlocale_win.cpp:138]
# 4 Qt5Cored.dll!(anonymous namespace)::Q_QGS_systemLocalePrivate::innerFunction() [tools/qlocale_win.cpp:138]
# 5 Qt5Cored.dll!QGlobalStatic<>::operator()()                                 [../../include/QtCore/../../src/corelib/global/qglobalstatic.h:123]
# 6 Qt5Cored.dll!QSystemLocale::query()                                        [tools/qlocale_win.cpp:660]
# 7 Qt5Cored.dll!QLocalePrivate::updateSystemPrivate()                         [tools/qlocale.cpp:589]
# 8 Qt5Cored.dll!systemData()                                                  [tools/qlocale.cpp:634]
# 9 Qt5Cored.dll!defaultData()                                                 [tools/qlocale.cpp:645]
#10 Qt5Cored.dll!(anonymous namespace)::Q_QGS_defaultLocalePrivate::innerFunction()::Holder::Holder() [tools/qlocale.cpp:698]
#11 Qt5Cored.dll!(anonymous namespace)::Q_QGS_defaultLocalePrivate::innerFunction() [tools/qlocale.cpp:698]
Note: @0:00:25.200 in thread 5032
Note: instruction: data16 cmp    (%edi) $0x0000

Error #3: UNINITIALIZED READ: reading 0x75235774-0x75235778 4 byte(s)
# 0 KERNELBASE.dll!InterlockedCompareExchange                                 +0xc      (0x751f69de <KERNELBASE.dll+0x69de>)
# 1 KERNELBASE.dll!InternalLcidToName                                         +0x108    (0x751f7009 <KERNELBASE.dll+0x7009>)
# 2 KERNELBASE.dll!GetUserDefaultLCID                                         +0x4      (0x751f8df7 <KERNELBASE.dll+0x8df7>)
# 3 Qt5Cored.dll!QSystemLocalePrivate::update()                                [tools/qlocale_win.cpp:584]
# 4 Qt5Cored.dll!QSystemLocale::query()                                        [tools/qlocale_win.cpp:736]
# 5 Qt5Cored.dll!QLocalePrivate::updateSystemPrivate()                         [tools/qlocale.cpp:589]
# 6 Qt5Cored.dll!systemData()                                                  [tools/qlocale.cpp:634]
# 7 Qt5Cored.dll!defaultData()                                                 [tools/qlocale.cpp:645]
# 8 Qt5Cored.dll!(anonymous namespace)::Q_QGS_defaultLocalePrivate::innerFunction()::Holder::Holder() [tools/qlocale.cpp:698]
# 9 Qt5Cored.dll!(anonymous namespace)::Q_QGS_defaultLocalePrivate::innerFunction() [tools/qlocale.cpp:698]
#10 Qt5Cored.dll!QGlobalStatic<>::operator*()                                  [../../include/QtCore/../../src/corelib/global/qglobalstatic.h:125]
#11 Qt5Cored.dll!QLocale::QLocale()                                            [tools/qlocale.cpp:778]
Note: @0:00:25.296 in thread 5032
Note: instruction: lock cmpxchg %edx (%ecx) %eax -> (%ecx) %eax

Error #4: UNINITIALIZED READ: reading register ax
# 0 KERNELBASE.dll!GetUserInfo                                                +0x3f     (0x751fdc54 <KERNELBASE.dll+0xdc54>)
# 1 KERNELBASE.dll!SetProcessShutdownParameters                               +0x131    (0x75205f9b <KERNELBASE.dll+0x15f9b>)
# 2 KERNELBASE.dll!GetLocaleInfoW                                             +0x3a     (0x7520512a <KERNELBASE.dll+0x1512a>)
# 3 Qt5Cored.dll!QSystemLocalePrivate::getLocaleInfo()                         [tools/qlocale_win.cpp:149]
# 4 Qt5Cored.dll!QSystemLocalePrivate::getLocaleInfo_qchar()                   [tools/qlocale_win.cpp:172]
# 5 Qt5Cored.dll!QSystemLocalePrivate::decimalPoint()                          [tools/qlocale_win.cpp:226]
# 6 Qt5Cored.dll!QSystemLocale::query()                                        [tools/qlocale_win.cpp:663]
# 7 Qt5Cored.dll!QLocalePrivate::updateSystemPrivate()                         [tools/qlocale.cpp:607]
# 8 Qt5Cored.dll!systemData()                                                  [tools/qlocale.cpp:634]
# 9 Qt5Cored.dll!defaultData()                                                 [tools/qlocale.cpp:645]
#10 Qt5Cored.dll!(anonymous namespace)::Q_QGS_defaultLocalePrivate::innerFunction()::Holder::Holder() [tools/qlocale.cpp:698]
#11 Qt5Cored.dll!(anonymous namespace)::Q_QGS_defaultLocalePrivate::innerFunction() [tools/qlocale.cpp:698]
Note: @0:00:25.390 in thread 5032
Note: instruction: data16 cmp    %ax %cx

Error #5: UNINITIALIZED READ: reading register ax
# 0 KERNELBASE.dll!GetUserInfo                                                +0x3f     (0x751fdc54 <KERNELBASE.dll+0xdc54>)
# 1 KERNELBASE.dll!SetProcessShutdownParameters                               +0xb4     (0x75205f1e <KERNELBASE.dll+0x15f1e>)
# 2 KERNELBASE.dll!GetLocaleInfoW                                             +0x3a     (0x7520512a <KERNELBASE.dll+0x1512a>)
# 3 Qt5Cored.dll!QSystemLocalePrivate::getLocaleInfo()                         [tools/qlocale_win.cpp:149]
# 4 Qt5Cored.dll!QSystemLocalePrivate::getLocaleInfo_qchar()                   [tools/qlocale_win.cpp:172]
# 5 Qt5Cored.dll!QSystemLocalePrivate::groupSeparator()                        [tools/qlocale_win.cpp:231]
# 6 Qt5Cored.dll!QSystemLocale::query()                                        [tools/qlocale_win.cpp:665]
# 7 Qt5Cored.dll!QLocalePrivate::updateSystemPrivate()                         [tools/qlocale.cpp:611]
# 8 Qt5Cored.dll!systemData()                                                  [tools/qlocale.cpp:634]
# 9 Qt5Cored.dll!defaultData()                                                 [tools/qlocale.cpp:645]
#10 Qt5Cored.dll!(anonymous namespace)::Q_QGS_defaultLocalePrivate::innerFunction()::Holder::Holder() [tools/qlocale.cpp:698]
#11 Qt5Cored.dll!(anonymous namespace)::Q_QGS_defaultLocalePrivate::innerFunction() [tools/qlocale.cpp:698]
Note: @0:00:25.427 in thread 5032
Note: instruction: data16 cmp    %ax %cx

Error #6: UNINITIALIZED READ: reading register ax
# 0 KERNELBASE.dll!GetUserInfo                                                +0x3f     (0x751fdc54 <KERNELBASE.dll+0xdc54>)
# 1 KERNELBASE.dll!SetStdHandle                                               +0xbe     (0x75205c95 <KERNELBASE.dll+0x15c95>)
# 2 KERNELBASE.dll!GetLocaleInfoW                                             +0x3a     (0x7520512a <KERNELBASE.dll+0x1512a>)
# 3 Qt5Cored.dll!QSystemLocalePrivate::getLocaleInfo()                         [tools/qlocale_win.cpp:149]
# 4 Qt5Cored.dll!QSystemLocalePrivate::getLocaleInfo_qchar()                   [tools/qlocale_win.cpp:172]
# 5 Qt5Cored.dll!QSystemLocalePrivate::zeroDigit()                             [tools/qlocale_win.cpp:220]
# 6 Qt5Cored.dll!QSystemLocale::query()                                        [tools/qlocale_win.cpp:705]
# 7 Qt5Cored.dll!QLocalePrivate::updateSystemPrivate()                         [tools/qlocale.cpp:615]
# 8 Qt5Cored.dll!systemData()                                                  [tools/qlocale.cpp:634]
# 9 Qt5Cored.dll!defaultData()                                                 [tools/qlocale.cpp:645]
#10 Qt5Cored.dll!(anonymous namespace)::Q_QGS_defaultLocalePrivate::innerFunction()::Holder::Holder() [tools/qlocale.cpp:698]
#11 Qt5Cored.dll!(anonymous namespace)::Q_QGS_defaultLocalePrivate::innerFunction() [tools/qlocale.cpp:698]
Note: @0:00:25.456 in thread 5032
Note: instruction: data16 cmp    %ax %cx

Error #7: UNINITIALIZED READ: reading register ax
# 0 KERNELBASE.dll!GetUserInfo                                                +0x3f     (0x751fdc54 <KERNELBASE.dll+0xdc54>)
# 1 KERNELBASE.dll!GetLocaleInfoW                                             +0xe1     (0x752051d1 <KERNELBASE.dll+0x151d1>)
# 2 KERNELBASE.dll!GetLocaleInfoW                                             +0x3a     (0x7520512a <KERNELBASE.dll+0x1512a>)
# 3 Qt5Cored.dll!QSystemLocalePrivate::getLocaleInfo()                         [tools/qlocale_win.cpp:149]
# 4 Qt5Cored.dll!QSystemLocalePrivate::getLocaleInfo_qchar()                   [tools/qlocale_win.cpp:172]
# 5 Qt5Cored.dll!QSystemLocalePrivate::negativeSign()                          [tools/qlocale_win.cpp:236]
# 6 Qt5Cored.dll!QSystemLocale::query()                                        [tools/qlocale_win.cpp:667]
# 7 Qt5Cored.dll!QLocalePrivate::updateSystemPrivate()                         [tools/qlocale.cpp:619]
# 8 Qt5Cored.dll!systemData()                                                  [tools/qlocale.cpp:634]
# 9 Qt5Cored.dll!defaultData()                                                 [tools/qlocale.cpp:645]
#10 Qt5Cored.dll!(anonymous namespace)::Q_QGS_defaultLocalePrivate::innerFunction()::Holder::Holder() [tools/qlocale.cpp:698]
#11 Qt5Cored.dll!(anonymous namespace)::Q_QGS_defaultLocalePrivate::innerFunction() [tools/qlocale.cpp:698]
Note: @0:00:25.485 in thread 5032
Note: instruction: data16 cmp    %ax %cx

Error #8: UNINITIALIZED READ: reading register ax
# 0 KERNELBASE.dll!GetUserInfo                                                +0x3f     (0x751fdc54 <KERNELBASE.dll+0xdc54>)
# 1 KERNELBASE.dll!SetProcessShutdownParameters                               +0x322    (0x7520618c <KERNELBASE.dll+0x1618c>)
# 2 KERNELBASE.dll!GetLocaleInfoW                                             +0x3a     (0x7520512a <KERNELBASE.dll+0x1512a>)
# 3 Qt5Cored.dll!QSystemLocalePrivate::getLocaleInfo()                         [tools/qlocale_win.cpp:149]
# 4 Qt5Cored.dll!QSystemLocalePrivate::getLocaleInfo_qchar()                   [tools/qlocale_win.cpp:172]
# 5 Qt5Cored.dll!QSystemLocalePrivate::positiveSign()                          [tools/qlocale_win.cpp:241]
# 6 Qt5Cored.dll!QSystemLocale::query()                                        [tools/qlocale_win.cpp:669]
# 7 Qt5Cored.dll!QLocalePrivate::updateSystemPrivate()                         [tools/qlocale.cpp:623]
# 8 Qt5Cored.dll!systemData()                                                  [tools/qlocale.cpp:634]
# 9 Qt5Cored.dll!defaultData()                                                 [tools/qlocale.cpp:645]
#10 Qt5Cored.dll!(anonymous namespace)::Q_QGS_defaultLocalePrivate::innerFunction()::Holder::Holder() [tools/qlocale.cpp:698]
#11 Qt5Cored.dll!(anonymous namespace)::Q_QGS_defaultLocalePrivate::innerFunction() [tools/qlocale.cpp:698]
Note: @0:00:25.514 in thread 5032
Note: instruction: data16 cmp    %ax %cx

Error #9: UNINITIALIZED READ: reading 0x0022f508-0x0022f510 8 byte(s)
# 0 boost::geometry::traits::access<>::get()                                   [../../Libraries/boost_1_54_0/boost/geometry/geometries/point.hpp:168]
# 1 boost::geometry::core_dispatch::access<>::get()                            [../../Libraries/boost_1_54_0/boost/geometry/core/access.hpp:169]
# 2 boost::geometry::get<>()                                                   [../../Libraries/boost_1_54_0/boost/geometry/core/access.hpp:285]
# 3 ribi::trim::operator+()                                                    [../../Classes/CppTriangleMesh/trianglemeshhelper.cpp:999]
# 4 _ZZNK4ribi4trim4Face10CalcCenterEvENKUlRKN5boost8geometry5model5pointIdLj3ENS3_2cs9cartesianEEERKNS2_10shared_ptrIKNS0_5PointEEEE_clESA_SG_ [../../Classes/CppTriangleMesh/trianglemeshface.cpp:100]
# 5 std::accumulate                                                            [c:/qt/tools/mingw48_32/lib/gcc/i686-w64-mingw32/4.8.0/include/c++/bits/stl_numeric.h:154]
# 6 ribi::trim::Face::CalcCenter()                                             [../../Classes/CppTriangleMesh/trianglemeshface.cpp:102]
# 7 _fu388___ZSt4clog                                                          [../ToolTestTriangleMesh/testtrianglemeshmaindialog.cpp:164]
# 8 main                                                                       [../ToolTestTriangleMesh/main.cpp:56]
Note: @0:01:15.042 in thread 5032
Note: instruction: fld    (%eax) -> %st0

Error #10: UNINITIALIZED READ: reading 0x0022f500-0x0022f508 8 byte(s)
# 0 boost::geometry::traits::access<>::get()                                   [../../Libraries/boost_1_54_0/boost/geometry/geometries/point.hpp:168]
# 1 boost::geometry::core_dispatch::access<>::get()                            [../../Libraries/boost_1_54_0/boost/geometry/core/access.hpp:169]
# 2 boost::geometry::get<>()                                                   [../../Libraries/boost_1_54_0/boost/geometry/core/access.hpp:285]
# 3 ribi::trim::operator+()                                                    [../../Classes/CppTriangleMesh/trianglemeshhelper.cpp:998]
# 4 _ZZNK4ribi4trim4Face10CalcCenterEvENKUlRKN5boost8geometry5model5pointIdLj3ENS3_2cs9cartesianEEERKNS2_10shared_ptrIKNS0_5PointEEEE_clESA_SG_ [../../Classes/CppTriangleMesh/trianglemeshface.cpp:100]
# 5 std::accumulate                                                            [c:/qt/tools/mingw48_32/lib/gcc/i686-w64-mingw32/4.8.0/include/c++/bits/stl_numeric.h:154]
# 6 ribi::trim::Face::CalcCenter()                                             [../../Classes/CppTriangleMesh/trianglemeshface.cpp:102]
# 7 _fu388___ZSt4clog                                                          [../ToolTestTriangleMesh/testtrianglemeshmaindialog.cpp:164]
# 8 main                                                                       [../ToolTestTriangleMesh/main.cpp:56]
Note: @0:01:15.064 in thread 5032
Note: instruction: fld    (%eax) -> %st0

Error #11: UNINITIALIZED READ: reading 0x0022f4f8-0x0022f500 8 byte(s)
# 0 boost::geometry::traits::access<>::get()                                   [../../Libraries/boost_1_54_0/boost/geometry/geometries/point.hpp:168]
# 1 boost::geometry::core_dispatch::access<>::get()                            [../../Libraries/boost_1_54_0/boost/geometry/core/access.hpp:169]
# 2 boost::geometry::get<>()                                                   [../../Libraries/boost_1_54_0/boost/geometry/core/access.hpp:285]
# 3 ribi::trim::operator+()                                                    [../../Classes/CppTriangleMesh/trianglemeshhelper.cpp:997]
# 4 _ZZNK4ribi4trim4Face10CalcCenterEvENKUlRKN5boost8geometry5model5pointIdLj3ENS3_2cs9cartesianEEERKNS2_10shared_ptrIKNS0_5PointEEEE_clESA_SG_ [../../Classes/CppTriangleMesh/trianglemeshface.cpp:100]
# 5 std::accumulate                                                            [c:/qt/tools/mingw48_32/lib/gcc/i686-w64-mingw32/4.8.0/include/c++/bits/stl_numeric.h:154]
# 6 ribi::trim::Face::CalcCenter()                                             [../../Classes/CppTriangleMesh/trianglemeshface.cpp:102]
# 7 _fu388___ZSt4clog                                                          [../ToolTestTriangleMesh/testtrianglemeshmaindialog.cpp:164]
# 8 main                                                                       [../ToolTestTriangleMesh/main.cpp:56]
Note: @0:01:15.085 in thread 5032
Note: instruction: fld    (%eax) -> %st0

Error #12: UNINITIALIZED READ: reading register eax
# 0 Qt5Cored.dll!QArrayData::data()                                      [../../include/QtCore/../../src/corelib/tools/qarraydata.h:62]
# 1 Qt5Cored.dll!QTypedArrayData<>::data()                               [../../include/QtCore/../../src/corelib/tools/qarraydata.h:207]
# 2 Qt5Cored.dll!qUncompress()                                           [tools/qbytearray.cpp:560]
# 3 Qt5Cored.dll!QResourceFileEngine::QResourceFileEngine()              [Q:\qt5_workdir\w\s\qtbase\src\corelib/io/qresource.cpp:1227]
# 4 Qt5Cored.dll!_q_resolveEntryAndCreateLegacyEngine_recursive()        [Q:\qt5_workdir\w\s\qtbase\src\corelib/io/qfilesystemengine.cpp:154]
# 5 Qt5Cored.dll!QFileSystemEngine::resolveEntryAndCreateLegacyEngine()  [Q:\qt5_workdir\w\s\qtbase\src\corelib/io/qfilesystemengine.cpp:200]
# 6 Qt5Cored.dll!QAbstractFileEngine::create()                           [Q:\qt5_workdir\w\s\qtbase\src\corelib/io/qabstractfileengine.cpp:210]
# 7 Qt5Cored.dll!QFilePrivate::engine()                                  [Q:\qt5_workdir\w\s\qtbase\src\corelib/io/qfile.cpp:107]
# 8 Qt5Cored.dll!QFile::copy()                                           [Q:\qt5_workdir\w\s\qtbase\src\corelib/io/qfile.cpp:755]
# 9 _fu196___ZSt4clog                                                    [../../Classes/CppOpenFoam/openfoamboundaryfile.cpp:194]
#10 ribi::foam::BoundaryFile::BoundaryFile()                             [../../Classes/CppOpenFoam/openfoamboundaryfile.cpp:34]
#11 _fu355___ZSt4clog                                                    [../../Classes/CppTriangleMesh/trianglemeshbuilder.cpp:330]
Note: @0:01:29.188 in thread 5032
Note: instruction: test   %eax %eax

Error #13: POSSIBLE LEAK 12 direct bytes 0x0487f2a0-0x0487f2ac + 0 indirect bytes
# 0 replace_malloc                           [d:\drmemory_package\common\alloc_replace.c:2292]
# 1 libgcc_s_dw2-1.dll!__emutls_get_address  [../../../../../src/gcc-4.8.0/libgcc/emutls.c:102]
# 2 libstdc++-6.dll!?                       +0x0      (0x6fcae44f <libstdc++-6.dll+0x6e44f>)
# 3 ribi::PlaneY::ToFunction()               [../../Classes/CppPlane/planey.cpp:423]
# 4 ribi::Plane::ToFunctionY()               [../../Classes/CppPlane/plane.cpp:410]
# 5 _fu248___ZSt4clog                        [../../Classes/CppPlane/plane.cpp:287]
# 6 ribi::Plane::Plane()                     [../../Classes/CppPlane/plane.h:83]
# 7 _fu66___ZSt4clog                         [../../Classes/CppGeometry/geometry.cpp:635]
# 8 ribi::Geometry::IsConvex()               [../../Classes/CppGeometry/geometry.cpp:447]
# 9 _fu80___ZSt4clog                         [../../Classes/CppGeometry/geometry.cpp:1071]
#10 ribi::Geometry::Geometry()               [../../Classes/CppGeometry/geometry.cpp:41]
#11 ribi::PlaneZ::CalcPlaneZ()               [../../Classes/CppPlane/planez.cpp:53]

===========================================================================
FINAL SUMMARY:

DUPLICATE ERROR COUNTS:
    Error #   9:     81
    Error #  10:     81
    Error #  11:     81
    Error #  12:      5

SUPPRESSIONS USED:

ERRORS FOUND:
      0 unique,     0 total unaddressable access(es)
     12 unique,   256 total uninitialized access(es)
      0 unique,     0 total invalid heap argument(s)
      0 unique,     0 total GDI usage error(s)
      0 unique,     0 total warning(s)
      0 unique,     0 total,      0 byte(s) of leak(s)
      1 unique,     1 total,     12 byte(s) of possible leak(s)
ERRORS IGNORED:
     11 potential error(s) (suspected false positives)
         (details: C:\Users\rbilderbeek\AppData\Roaming\Dr. Memory\DrMemory-ToolTestTriangleMeshConsole.exe.4800.000\potential_errors.txt)
      7 potential leak(s) (suspected false positives)
         (details: C:\Users\rbilderbeek\AppData\Roaming\Dr. Memory\DrMemory-ToolTestTriangleMeshConsole.exe.4800.000\potential_errors.txt)
     21 unique,    21 total,  35033 byte(s) of still-reachable allocation(s)
         (re-run with "-show_reachable" for details)
Details: C:\Users\rbilderbeek\AppData\Roaming\Dr. Memory\DrMemory-ToolTestTriangleMeshConsole.exe.4800.000\results.txt
richelbilderbeek commented 10 years ago

Issue 9,10,11 and 13 look useful pointers. Especially that 9,10 and 11 all mention Face::CalcCenter....

richelbilderbeek commented 10 years ago

Upgraded from Boost 1.54.0 to Boost 1.55.0, perhaps this detects the errors.

richelbilderbeek commented 10 years ago

Changing Face::CalcCenter resulted in the loss of three DrMemory suggestions:

boost::geometry::model::point<double,3,boost::geometry::cs::cartesian> ribi::trim::Face::CalcCenter() const noexcept
{
  assert(!m_points.empty());
  using boost::geometry::get;
  const Coordinat3D sum(
    std::accumulate(m_points.begin(),m_points.end(),
      Geometry().CreatePoint(0.0,0.0,0.0),
      [](const Coordinat3D& init, const boost::shared_ptr<const Point>& point)
      {
        assert(point);
        return init + point->GetCoordinat3D();
        //return init + Geometry().CreatePoint(
        //  get<0>(*point->GetCoordinat()),
        //  get<1>(*point->GetCoordinat()),
        //  point->GetZ().value()
        //);
      }
    )
  );
  const Coordinat3D center(
    sum / static_cast<double>(m_points.size())
  );
  return center;
}

Feedback left:

Dr. Memory version 1.6.1 build 2 built on Dec 14 2013 12:27:10
Dr. Memory results for pid 4844: "ToolTestTriangleMeshConsole.exe"
Application cmdline: "ToolTestTriangleMeshConsole.exe"
Recorded 99 suppression(s) from default C:\Program Files\DrMemory\bin\suppress-default.txt

Error #1: POSSIBLE LEAK 12 direct bytes 0x048df260-0x048df26c + 0 indirect bytes
# 0 replace_malloc                           [d:\drmemory_package\common\alloc_replace.c:2292]
# 1 libgcc_s_dw2-1.dll!__emutls_get_address  [../../../../../src/gcc-4.8.0/libgcc/emutls.c:102]
# 2 libstdc++-6.dll!?                       +0x0      (0x6fcae44f <libstdc++-6.dll+0x6e44f>)
# 3 ribi::PlaneY::ToFunction()               [../../Classes/CppPlane/planey.cpp:423]
# 4 ribi::Plane::ToFunctionY()               [../../Classes/CppPlane/plane.cpp:410]
# 5 _fu248___ZSt4clog                        [../../Classes/CppPlane/plane.cpp:287]
# 6 ribi::Plane::Plane()                     [../../Classes/CppPlane/plane.h:83]
# 7 _fu66___ZSt4clog                         [../../Classes/CppGeometry/geometry.cpp:645]
# 8 ribi::Geometry::IsConvex()               [../../Classes/CppGeometry/geometry.cpp:457]
# 9 _fu80___ZSt4clog                         [../../Classes/CppGeometry/geometry.cpp:1081]
#10 ribi::Geometry::Geometry()               [../../Classes/CppGeometry/geometry.cpp:41]
#11 main                                     [../ToolTestTriangleMesh/main.cpp:27]

===========================================================================
FINAL SUMMARY:

DUPLICATE ERROR COUNTS:

SUPPRESSIONS USED:

ERRORS FOUND:
      0 unique,     0 total unaddressable access(es)
      0 unique,     0 total uninitialized access(es)
      0 unique,     0 total invalid heap argument(s)
      0 unique,     0 total GDI usage error(s)
      0 unique,     0 total warning(s)
      0 unique,     0 total,      0 byte(s) of leak(s)
      1 unique,     1 total,     12 byte(s) of possible leak(s)
ERRORS IGNORED:
      6 potential leak(s) (suspected false positives)
         (details: C:\Users\rbilderbeek\AppData\Roaming\Dr. Memory\DrMemory-ToolTestTriangleMeshConsole.exe.4844.000\potential_errors.txt)
     21 unique,    21 total,  35033 byte(s) of still-reachable allocation(s)
         (re-run with "-show_reachable" for details)
Details: C:\Users\rbilderbeek\AppData\Roaming\Dr. Memory\DrMemory-ToolTestTriangleMeshConsole.exe.4844.000\results.txt
richelbilderbeek commented 10 years ago

ApplicationVerifier does not detect anything:

<?xml version="1.0" encoding="UTF-8"?>
-<avrf:logfile xmlns:avrf="Application Verifier">
<avrf:logSession Version="2" PID="3764" TimeStarted="2014-03-31 : 14:36:07"/>
</avrf:logfile>
richelbilderbeek commented 10 years ago

MakeConvex fails only twice for a complete mesh, for these coordinats:

'(-2,3,5) (index: 660)'
'(-1,2,5) (index: 672)'
'(-2,3,6) (index: 684)'
'(-1,2,6) (index: 696)'

and

'(1,2,5) (index: 673)'
'(2,3,5) (index: 659)'
'(1,2,6) (index: 697)'
'(2,3,6) (index: 683)'

The error occurs during the actual building of the mesh, instead of the test cases, that have the same coordinats

richelbilderbeek commented 10 years ago

Files here.

/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.1                                   |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
/*   Windows 32 and 64 bit porting by blueCAPE: http://www.bluecape.com.pt   *\
|  Based on Windows porting (2.0.x v4) by Symscape: http://www.symscape.com   |
\*---------------------------------------------------------------------------*/
Build  : 2.1-88b2f2ae3a0b
Exec   : checkMesh
Date   : Apr 03 2014
Time   : 14:36:42
Host   : "AIRBEAR-W7-I5"
PID    : 2428
Case   : D:/Projects/Tools/build-ToolTestTriangleMeshConsole-Desktop_Qt_5_1_1_Mi
nGW_32bit-Release
nProcs : 1
SigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMas
ter
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create polyMesh for time = 0

Time = 0

Mesh stats
    points:           2398
    faces:            8826
    internal faces:   4909
    cells:            2747
    boundary patches: 6
    point zones:      0
    face zones:       0
    cell zones:       0

Overall number of cells of each type:
    hexahedra:     0
    prisms:        1441
    wedges:        0
    pyramids:      0
    tet wedges:    0
    tetrahedra:    0
    polyhedra:     1306

Checking topology...
    Boundary definition OK.
    Cell to face addressing OK.
    Point usage OK.
 ***Faces not in upper triangular order.
  <<Writing 3187 unordered faces to set upperTriangularFace
    Face vertices OK.
   *Number of regions: 5
    The mesh has multiple regions which are not connected by any face.
  <<Writing region information to "0/cellToRegion"

Checking patch topology for multiply connected surfaces ...
    Patch               Faces    Points   Surface topology
    top                 1364     2034     ok (non-closed singly connected)
    right               678      897      multiply connected (shared edge)
    left                620      874      multiply connected (shared edge)
    front               592      857      multiply connected (shared edge)
    bottom              30       24       ok (non-closed singly connected)
    back                633      880      multiply connected (shared edge)
  <<Writing 599 conflicting points to set nonManifoldPoints

Checking geometry...
    Overall domain bounding box (-3.80423 -4 0) (3.80423 3.23607 99)
    Mesh (non-empty, non-wedge) directions (1 1 1)
    Mesh (non-empty) directions (1 1 1)
    Boundary openness (1.58222e-016 9.75936e-017 -2.16434e-018) OK.
 ***Open cells found, max cell openness: 1, number of open cells 2346
  <<Writing 2346 non closed cells to set nonClosedCells
  <<Writing 17 cells with high aspect ratio to set highAspectRatioCells
    Minimum face area = 0.201641. Maximum face area = 4.70228.  Face area magnit
udes OK.
    Min volume = 1.66667e-300. Max volume = 1.90211.  Total volume = 1798.98.  C
ell volumes OK.
    Mesh non-orthogonality Max: 180 average: 91.0405
 ***Number of non-orthogonality errors: 2514.
  <<Writing 2514 non-orthogonal faces to set nonOrthoFaces
 ***Error in face pyramids: 5028 faces are incorrectly oriented.
  <<Writing 2514 faces with incorrect orientation to set wrongOrientedFaces
    Max skewness = 1.5403 OK.
    Coupled point location match (average 0) OK.

Failed 4 mesh checks.

Time = 1

Mesh stats
    points:           2398
    faces:            8826
    internal faces:   4909
    cells:            2747
    boundary patches: 6
    point zones:      0
    face zones:       0
    cell zones:       0

Overall number of cells of each type:
    hexahedra:     0
    prisms:        1482
    wedges:        0
    pyramids:      0
    tet wedges:    0
    tetrahedra:    0
    polyhedra:     1265

Checking topology...
    Boundary definition OK.
    Cell to face addressing OK.
    Point usage OK.
    Upper triangular ordering OK.
    Face vertices OK.
   *Number of regions: 5
    The mesh has multiple regions which are not connected by any face.
  <<Writing region information to "1/cellToRegion"

Checking patch topology for multiply connected surfaces ...
    Patch               Faces    Points   Surface topology
    top                 1364     2034     ok (non-closed singly connected)
    right               678      897      multiply connected (shared edge)
    left                620      874      multiply connected (shared edge)
    front               592      857      multiply connected (shared edge)
    bottom              30       24       ok (non-closed singly connected)
    back                633      880      multiply connected (shared edge)
  <<Writing 599 conflicting points to set nonManifoldPoints

Checking geometry...
    Overall domain bounding box (-3.80423 -4 0) (3.80423 3.23607 99)
    Mesh (non-empty, non-wedge) directions (1 1 1)
    Mesh (non-empty) directions (1 1 1)
    Boundary openness (-1.1636e-016 3.15733e-018 6.39549e-019) OK.
 ***Open cells found, max cell openness: 1, number of open cells 2346
  <<Writing 2346 non closed cells to set nonClosedCells
  <<Writing 17 cells with high aspect ratio to set highAspectRatioCells
    Minimum face area = 0.201641. Maximum face area = 4.70229.  Face area magnit
udes OK.
    Min volume = 1.66667e-300. Max volume = 1.90211.  Total volume = 1798.98.  C
ell volumes OK.
    Mesh non-orthogonality Max: 180 average: 91.0405
 ***Number of non-orthogonality errors: 2514.
  <<Writing 2514 non-orthogonal faces to set nonOrthoFaces
 ***Error in face pyramids: 5028 faces are incorrectly oriented.
  <<Writing 2514 faces with incorrect orientation to set wrongOrientedFaces
    Max skewness = 1.5403 OK.
    Coupled point location match (average 0) OK.

Failed 3 mesh checks.
richelbilderbeek commented 10 years ago

Progress!

Output without FIX_ISSUE_168_TO_ADD_TO_VIEW_CHANGE defined:

TRACE 't.str()' line 445 in file '..\..\Classes\CppTriangleMesh\trianglemeshhelp
er.cpp': 'Not convex: (-6.9499,148.964),(-6.9499,171.159),(-5.93211,162.695),(-5
.93211,141.073)'
TRACE 's.str()' line 432 in file '..\..\Classes\CppTriangleMesh\trianglemeshhelp
er.cpp': 'Not convex: (-0.866026,-0.5,9)->734,(0.191342,-0.46194,9)->720,(-0.866
026,-0.5,10)->755,(0.191342,-0.46194,10)->741
'
TRACE 't.str()' line 445 in file '..\..\Classes\CppTriangleMesh\trianglemeshhelp
er.cpp': 'Not convex: (-6.9499,148.964),(-5.93211,141.073),(-6.9499,171.159),(-5
.93211,162.695)'
TRACE 'p' line 450 in file '..\..\Classes\CppTriangleMesh\trianglemeshhelper.cpp
': '0x4afc1c8'
TRACE '*p' line 450 in file '..\..\Classes\CppTriangleMesh\trianglemeshhelper.cp
p': '(-0.866026,-0.5,9) (index: 734)'
TRACE 'p' line 450 in file '..\..\Classes\CppTriangleMesh\trianglemeshhelper.cpp
': '0x4afbeb8'
TRACE '*p' line 450 in file '..\..\Classes\CppTriangleMesh\trianglemeshhelper.cp
p': '(0.191342,-0.46194,9) (index: 720)'
TRACE 'p' line 450 in file '..\..\Classes\CppTriangleMesh\trianglemeshhelper.cpp
': '0x4b086a0'
TRACE '*p' line 450 in file '..\..\Classes\CppTriangleMesh\trianglemeshhelper.cp
p': '(-0.866026,-0.5,10) (index: 755)'
TRACE 'p' line 450 in file '..\..\Classes\CppTriangleMesh\trianglemeshhelper.cpp
': '0x4afc350'
TRACE '*p' line 450 in file '..\..\Classes\CppTriangleMesh\trianglemeshhelper.cp
p': '(0.191342,-0.46194,10) (index: 741)'
TRACE '"ERROR"' line 363 in file '..\..\Classes\CppTriangleMesh\trianglemeshcell
screator.cpp': 'ERROR'
Assertion failed!

Program: D:\Projects\Tools\build-ToolTestTriangleMeshConsole-Desktop_Qt_5_1_1_Mi
nGW_32bit-Debug\debug\ToolTestTriangleMeshConsole.exe
File: ..\..\Classes\CppTriangleMesh\trianglemeshcellscreator.cpp, Line 369

Expression: helper.IsConvex(face_points)

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
Press <RETURN> to close this window...

With FIX_ISSUE_168_TO_ADD_TO_VIEW_CHANGE defined:

TRACE 't.str()' line 445 in file '..\..\Classes\CppTriangleMesh\trianglemeshhelp
er.cpp': 'Not convex: (15.9835,631.923),(15.9835,682.926),(8.24075,679.58),(8.24
075,628.579)'
TRACE 's.str()' line 432 in file '..\..\Classes\CppTriangleMesh\trianglemeshhelp
er.cpp': 'Not convex: (-2.35114,3.23607,25)->1066,(-1.29904,2.32362,25)->1075,(-
2.35114,3.23607,26)->1087,(-1.29904,2.32362,26)->1096
'
TRACE 't.str()' line 445 in file '..\..\Classes\CppTriangleMesh\trianglemeshhelp
er.cpp': 'Not convex: (15.9835,631.923),(8.24075,628.579),(15.9835,682.926),(8.2
4075,679.58)'
TRACE 'p' line 450 in file '..\..\Classes\CppTriangleMesh\trianglemeshhelper.cpp
': '0x4b2cbb0'
TRACE '*p' line 450 in file '..\..\Classes\CppTriangleMesh\trianglemeshhelper.cp
p': '(-2.35114,3.23607,25) (index: 1066)'
TRACE 'p' line 450 in file '..\..\Classes\CppTriangleMesh\trianglemeshhelper.cpp
': '0x4b2cda8'
TRACE '*p' line 450 in file '..\..\Classes\CppTriangleMesh\trianglemeshhelper.cp
p': '(-1.29904,2.32362,25) (index: 1075)'
TRACE 'p' line 450 in file '..\..\Classes\CppTriangleMesh\trianglemeshhelper.cpp
': '0x4b2d048'
TRACE '*p' line 450 in file '..\..\Classes\CppTriangleMesh\trianglemeshhelper.cp
p': '(-2.35114,3.23607,26) (index: 1087)'
TRACE 'p' line 450 in file '..\..\Classes\CppTriangleMesh\trianglemeshhelper.cpp
': '0x4b2d240'
TRACE '*p' line 450 in file '..\..\Classes\CppTriangleMesh\trianglemeshhelper.cp
p': '(-1.29904,2.32362,26) (index: 1096)'
TRACE '"ERROR"' line 363 in file '..\..\Classes\CppTriangleMesh\trianglemeshcell
screator.cpp': 'ERROR'
Assertion failed!

Program: D:\Projects\Tools\build-ToolTestTriangleMeshConsole-Desktop_Qt_5_1_1_Mi
nGW_32bit-Debug\debug\ToolTestTriangleMeshConsole.exe
File: ..\..\Classes\CppTriangleMesh\trianglemeshcellscreator.cpp, Line 369

Expression: helper.IsConvex(face_points)

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
Press <RETURN> to close this window...
richelbilderbeek commented 10 years ago

The progress was about choosing three different points (out of four) to make up a Plane. Sadly, trying all other combinations does not result in improvements,

richelbilderbeek commented 10 years ago

Commit c3d04601cd0b4570f0c033dd4d02a703b88c07e8 proves that Face::SetCorrectWinding does not cause the error.

richelbilderbeek commented 10 years ago

Commit fc42a4639bf0871c7669e21d1af69d9f90594580 brings the bug out in the clear.

Bug caused by boost::geometry::correct adding an extra point:

bool ribi::Geometry::IsConvex(Polygon polygon
  #ifndef NDEBUG
  ,const std::vector<Coordinat2D>& points
  #endif
  ) const noexcept
{
  assert(boost::geometry::num_points(polygon) == points.size()
    && "Points and polygon have the same number of points");
  boost::geometry::correct(polygon); //CAUSES ISSUE_168
  #ifndef NDEBUG
  if(boost::geometry::num_points(polygon) != points.size())
  {
    TRACE(boost::geometry::num_points(polygon));
    TRACE(points.size());
    TRACE("ERROR");
  }
  #endif
  assert(boost::geometry::num_points(polygon) == points.size()
    && "BUG: ISSUE_168: points and polygon do not have the same number of points anymore"
  );
Expression: boost::geometry::num_points(polygon) == points.size() && "BUG: ISSUE
_168: points and polygon do not have the same number of points anymore"
richelbilderbeek commented 10 years ago

Sent bug report to Boost.Trac: https://svn.boost.org/trac/boost/ticket/9873

richelbilderbeek commented 10 years ago

Added workaround with commit d1ae4c20ec298649a21ee5158ea0903a4ac8012d