help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Voronoi Diagrams


From: Ryan Matthew Balfanz
Subject: Re: Voronoi Diagrams
Date: Mon, 29 Dec 2008 13:50:02 -0600

Hi All,
I've changed the the lines starting from line number 127 to the following:
--
 #idx = find (!infi); # Original
 idx = find ( ! resize (infi, size(c))); # Modified

 ll = length (idx); # Original
 #ll = min (length (idx), length (c)); # Modified
--
and get strange output.

My input file can be found at http://www.phy.ilstu.edu/~rbalfanz/voronoi/inp.dat
The output can be found at
http://www.phy.ilstu.edu/~rbalfanz/voronoi/voronoi.pdf


To get my results do the following in octave:
--
load inp.dat
voronoi(inp(:,2), inp(:,3))
--

For the curious, columns 2 and 3 of inp.dat are positional data of
galaxies. I'm having no trouble in MatLab working with this data even
though individual points can be extremely close to one another.

Any help is appreciated.
-Ryan

On Mon, Dec 22, 2008 at 3:23 PM, David Bateman <address@hidden> wrote:
> Ben Abbott wrote:
>>
>> On Dec 22, 2008, at 1:43 PM, Søren Hauberg wrote:
>>
>>
>>>
>>> man, 22 12 2008 kl. 13:25 -0500, skrev Ben Abbott:
>>>
>>>>
>>>>        ll = min (length (idx), length (c));
>>>>
>>>
>>> Isn't that the same as
>>>
>>>  ll = length (c);
>>>
>>> ?
>>>
>>> Søren
>>>
>>>
>>
>> In this case yes. But I don't understand what the line below is
>>  accounting for.
>>
>>        idx = find (!infi);
>>
>> Ben
>>
>
> I suspect the issue is my fault and not Kai's ... When importing this code
> from octave-forge into Octave I tried to make it fully matlab compatible.
> Matlab draws lines in the Voronoi diagram with vertices at infinite, whereas
> the original octave-forge code didn't.. The get this behavior I added a big
> box around the vertices to simulate vertices at infinite, and then flagged
> the tesselations with a vertex at infinite with the third return argument of
> __voronoi__.. However I sized this return argument differently than the
> second return argument.. I suspect the attached is a better solution to the
> issue, though your proposed fix comes to much the same thing.. My patch
> tries to be a bit faster as it avoid multiple resizes of one of the return
> arrays as well.
>
> D.
>
>
>
> --
> David Bateman                                address@hidden
> 35 rue Gambetta                              +33 1 46 04 02 18 (Home)
> 92100 Boulogne-Billancourt FRANCE            +33 6 72 01 06 33 (Mob)
>
>
> # HG changeset patch
> # User David Bateman <address@hidden>
> # Date 1229980587 -3600
> # Node ID 9802e81c317a0772404ff54ea0a16e91b7f7d9f7
> # Parent  777fcb8a9da08541a3043dc489faae326c239880
> Reszie third arg of __voronoi__ before retuning it
>
> diff --git a/src/ChangeLog b/src/ChangeLog
> --- a/src/ChangeLog
> +++ b/src/ChangeLog
> @@ -1,3 +1,8 @@
> +2008-12-22  David Bateman  <address@hidden>
> +
> +       * DLD-FUNCTIONS/__voronoi__.cc (F__voronoi__): Resize AtInf array
> +       before returning it.
> +
>  2008-12-12  David Bateman  <address@hidden>
>
>        * DLD-FUNCTIONS/chol.cc (Fcholinv): Add test.
> diff --git a/src/DLD-FUNCTIONS/__voronoi__.cc
> b/src/DLD-FUNCTIONS/__voronoi__.cc
> --- a/src/DLD-FUNCTIONS/__voronoi__.cc
> +++ b/src/DLD-FUNCTIONS/__voronoi__.cc
> @@ -165,7 +165,7 @@
>       boolMatrix AtInf (np, 1);
>       for (i = 0; i < np; i++)
>        AtInf(i) = false;
> -      octave_value_list F;
> +      octave_value_list F (np, octave_value ());
>       k = 0;
>       i = 0;
>
> @@ -220,6 +220,7 @@
>
>       retval(0) = v;
>       retval(1) = C;
> +      AtInf.resize (r, 1);
>       retval(2) = AtInf;
>
>       // free long memory
>
>



-- 
Ryan Matthew Balfanz
Graduate Student
Department of Physics
Southern Illinois University Edwardsville
http://www.siue.edu/~rbalfan/



reply via email to

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