bugGNU Octave - Bugs: bug #37270, Voronoi function fails with...

 
 

bug #37270: Voronoi function fails with duplicate input points

Submitter:  None
Submitted:  Tue 04 Sep 2012 08:52:38 PM UTC
   
 
Category:  Libraries Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Nicholas Musolino Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.6.2
Operating System:  * Mac OS Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 15 Sep 2012 08:08:22 PM UTC, comment #1: 

I fixed this and cleaned up the code in general in this changeset (http://hg.savannah.gnu.org/hgweb/octave/rev/b99c52303d0b).  To see the fix you will need to either build from Mercurial sources or wait until the next development release (3.8).

Rik <rik5>
Group administrator
Tue 04 Sep 2012 08:52:38 PM UTC, original submission:  

The voronoi(...) function fails when an two points in the input share (x,y) coordinates.

x = rand(20,1); y = rand(size(x));
voronoi(x,y);  ## works as expected

## Add duplicate points.
 x(end+1)= x(end); y(end+1) = y(end);
voronoi(x,y);  ## fails with message below.


The error message is:
subscript indices must be either positive integers or logicals
error: evaluating argument list element number 1
error: called from:
error:   /opt/share/octave/3.6.2/m/geometry/voronoi.m at line 140, column 9

The code in voronoi.m is:

  [p, c, infi] = __voronoi__ ("voronoi",
                              [[x(:) ; xbox(:)], [y(:); ybox(:)]],
                              opts{:});

  idx = find (! infi);
  ll = length (idx);
  c = c(idx).';
  k = sum (cellfun ("length", c));
  edges = cell2mat (cellfun (@(x) [x ; [x(end), x(1:end-1)]], c,
                             "uniformoutput", false));    # Line 140


I'm not familiar enough with the code to suggest a fix.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-09-15 rik5 StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code