richelbilderbeek / ProjectRichelBilderbeek

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

TriangleMesh v.1.5 crashes with linestring #218

Closed richelbilderbeek closed 10 years ago

richelbilderbeek commented 10 years ago

These four points are in a plane, but Geometry::IsPlane returns false.

TRACE 'face_points.size()' line 383 in file '..\..\Classes\CppTriangleMesh\trianglemeshcellscreator.cpp': '4'
TRACE 'point->ToStr()' line 384 in file '..\..\Classes\CppTriangleMesh\trianglemeshcellscreator.cpp': '(-0.55,2,0) (index: 682)'
TRACE 'point->ToStr()' line 384 in file '..\..\Classes\CppTriangleMesh\trianglemeshcellscreator.cpp': '(-3.78624,2,0) (index: 694)'
TRACE 'point->ToStr()' line 384 in file '..\..\Classes\CppTriangleMesh\trianglemeshcellscreator.cpp': '(-0.55,2,10) (index: 723)'
TRACE 'point->ToStr()' line 384 in file '..\..\Classes\CppTriangleMesh\trianglemeshcellscreator.cpp': '(-3.78624,2,10) (index: 735)'
richelbilderbeek commented 10 years ago

Error is in the IsPlane calculation for planes near being parallel to X,Y or Z plane.

Point 1: (2,0,0)
Point 2: (0,3,0)
Point 3: (0,0,5)
Function (X): x=(-0.666667*y) + (-0.4*z) + 2
Coefficients (X): 
 - A: -2e+001
 - B: -1e+001
 - C: -6
 - D: -3e+001
Function (Y): y=(-1.5*x) + (-0.6*z) + 3
Coefficients (Y): 
 - A: 6
 - B: 1e+001
 - C: 2e+001
 - D: 3e+001
Function (Z): z=(-2.5*x) + (-1.66667*y) + 5
Coefficients (Z): 
 - A: -2e+001
 - B: -1e+001
 - C: -6
 - D: -3e+001
X(Y,Z) = X(3,5) = -2
Y(X,Z) = Y(2,5) = -3
Z(X,Y) = Z(2,3) = -5
Plane: ((2,0,0),(0,3,0),(0,0,5)),x=(-0.7*y) + (-0.4*z) + 2,y=(-2*x) + (-0.6*z) + 3,z=(-2*x) + (-2*y) + 5
richelbilderbeek commented 10 years ago

Solved, as it works:

issue218solved