[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #46946] isosurface throws errors where Matlab
From: |
Markus Mützel |
Subject: |
[Octave-bug-tracker] [bug #46946] isosurface throws errors where Matlab does not |
Date: |
Wed, 17 Feb 2016 08:53:41 +0000 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:45.0) Gecko/20100101 Firefox/45.0 |
Follow-up Comment #7, bug #46946 (project octave):
No problem if it takes a little longer. Thus, the patch can "mature" a
little:
I realized that "unique" does not really do the job for recognizing shared
vertices. This is because very close doubles are treated as different values:
a = [2/3 0 0; 2/3 1 0; 1-1/3 0 0];
unique(a, "rows")
Result:
ans =
0.66667 0.00000 0.00000
0.66667 1.00000 0.00000
0.66667 0.00000 0.00000
This is because
>> a(1,:)-a(3,:)
ans =
-1.1102e-016 0.0000e+000 0.0000e+000
>> eps(2/3)
ans = 1.1102e-016
At first I thought this was a bug. But Matlab behaves exactly the same. And it
is true that 2/3 != 1-1/3 in double precision.
Therefore, I changed the logic for detection of shared vertices by calculating
the mutual distances between all vertices and comparing to "eps"
(isosurface_4.patch). There is probably a much better way than my current
implementation since it performs e.g. more than twice the calculations really
needed. But I cannot think of one without using loops which would perform even
worse in Octave.
So feel free to give advise.
(file #36360, file #36361)
_______________________________________________________
Additional Item Attachment:
File name: isosurface_4.patch Size:19 KB
File name: isosurface.m Size:18 KB
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?46946>
_______________________________________________
Nachricht gesendet von/durch Savannah
http://savannah.gnu.org/