octave-bug-tracker
[Top][All Lists]
Advanced

[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: Tue, 26 Apr 2016 17:14:24 +0000
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:46.0) Gecko/20100101 Firefox/46.0

Follow-up Comment #9, bug #46946 (project octave):

Dear Marco,

thank you for having a look at this patch. I am happy it could help you.

You raised some valid points. It is not correct to use the same eps for all
distances. Like you have pointed out, it should be different for each two
points. I did not consider sets of vertices that span over several orders of
magnitudes.

I like your approach of calculating the mutual distances between all points.
It should save memory and be faster than the trivial approach I took.

However, I think it is not correct to compare to eps^2. Usually, the error
always increases when a value is squared. Probably, it is better to assume
that the uncertainties (floating point precission) are independent in each
coordinate and use the laws of error propagation (e.g. here [1]). Simplifying
by the assumption that the uncertainties are similar in each coordinate, that
would read (employing your approach for calculating the mutual distances):

IP = fvc.vertices * fvc.vertices';
norms = diag (IP);
mutual_dist = norms + norms' - 2*IP;
is_very_close = mutual_dist < 2 * sqrt (3) * eps (max (norms, norms'));


I had forgotten the squareroot in the patch.
I hope this is right. Please, correct me if I am wrong.

But that call to eps takes enormous time on my machine ("demo surface 1" takes
22 seconds on my system). Making the simplification "eps (x) = x * eps"
performs much faster (0.02 seconds):

IP = fvc.vertices * fvc.vertices';
norms = diag (IP);
mutual_dist = norms + norms' - 2*IP;
is_very_close = mutual_dist < 2 * sqrt (3) * eps * max (norms, norms');


But this still uses a lot of memory. The following example does not run for me
(out of memory):

[x,y,z] = meshgrid (-2:0.05:2, -2:0.05:2, -2:0.5:2);
val = x.^2 + y.^2 + z.^2;
isosurface2 (x, y, z, val, 1);


I ran into a similar issue for reducepatch (patch #8912). Using
__unite_shared_vertices__ from that patch, the above example runs in below
1.2s for me (not very fast but maybe acceptable). "demo surface 1" takes 0.03
seconds (still ok imho).

Attached please find an updated patch with those changes. I incorporated your
change in lines 51&52 of __unite_shared_vertices__.m.

[1] https://en.wikipedia.org/wiki/Propagation_of_uncertainty#Simplification


(file #36998)
    _______________________________________________________

Additional Item Attachment:

File name: isosurface_5.patch             Size:25 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?46946>

_______________________________________________
  Nachricht gesendet von/durch Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]