comparison src/DLD-FUNCTIONS/convhulln.cc @ 15885:065bc7944335 stable

fix incorrect results for convhulln in some cases (bug #38013) * convhulln.cc (Fconvhulln): Skip check for non-simplicial facets for 2-dimensional hull. New test.
author John W. Eaton <jwe@octave.org>
date Thu, 03 Jan 2013 11:16:40 -0500
parents 3e4350f09a55
children
comparison
equal deleted inserted replaced
15871:878623ca15e1 15885:065bc7944335
177 177
178 FORALLfacets 178 FORALLfacets
179 { 179 {
180 octave_idx_type j = 0; 180 octave_idx_type j = 0;
181 181
182 if (! nonsimp_seen && ! facet->simplicial) 182 if (! (nonsimp_seen || facet->simplicial || qh hull_dim == 2))
183 { 183 {
184 nonsimp_seen = true; 184 nonsimp_seen = true;
185 185
186 if (cmd.find ("QJ") != std::string::npos) 186 if (cmd.find ("QJ") != std::string::npos)
187 { 187 {
311 %! tetrahedron = [1 1 1;-1 -1 1;-1 1 -1;1 -1 -1]; 311 %! tetrahedron = [1 1 1;-1 -1 1;-1 1 -1;1 -1 -1];
312 %! [h, v] = convhulln (tetrahedron); 312 %! [h, v] = convhulln (tetrahedron);
313 %! h = sortrows (sort (h, 2), [1 2 3]); 313 %! h = sortrows (sort (h, 2), [1 2 3]);
314 %! assert (h, [1 2 3;1 2 4; 1 3 4; 2 3 4]); 314 %! assert (h, [1 2 3;1 2 4; 1 3 4; 2 3 4]);
315 %! assert (v, 8/3, 10*eps); 315 %! assert (v, 8/3, 10*eps);
316
317 %!testif HAVE_QHULL
318 %! triangle=[0 0; 1 1; 1 0; 1 2];
319 %! h = convhulln (triangle);
320 %! assert (size (h), [3 2]);
316 */ 321 */