Mercurial > octave-nkf
diff src/DLD-FUNCTIONS/__voronoi__.cc @ 10154:40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 20 Jan 2010 17:33:41 -0500 |
parents | 2c279308f6ab |
children | 89f4d7e294cc |
line wrap: on
line diff
--- a/src/DLD-FUNCTIONS/__voronoi__.cc Wed Jan 20 17:24:23 2010 -0500 +++ b/src/DLD-FUNCTIONS/__voronoi__.cc Wed Jan 20 17:33:41 2010 -0500 @@ -78,10 +78,10 @@ if (nargin == 2) { if (! args (1).is_string ()) - { - error ("__voronoi__: second argument must be a string"); - return retval; - } + { + error ("__voronoi__: second argument must be a string"); + return retval; + } options = args (1).string_value().c_str (); } @@ -100,9 +100,9 @@ //for (int i = 0; i < np; i++) // { // for (int j = 0; j < dim; j++) - // { - // pt_array[j+i*dim] = p(i,j); - // } + // { + // pt_array[j+i*dim] = p(i,j); + // } // } boolT ismalloc = false; @@ -127,102 +127,102 @@ OCTAVE_LOCAL_BUFFER (octave_idx_type, ni, np); for (i = 0; i < np; i++) - ni[i] = 0; + ni[i] = 0; qh_setvoronoi_all (); bool infinity_seen = false; facetT *neighbor, **neighborp; coordT *voronoi_vertex; FORALLfacets - { - facet->seen = false; - } + { + facet->seen = false; + } FORALLvertices - { - if (qh hull_dim == 3) - qh_order_vertexneighbors (vertex); - infinity_seen = false; + { + if (qh hull_dim == 3) + qh_order_vertexneighbors (vertex); + infinity_seen = false; - FOREACHneighbor_ (vertex) - { - if (! neighbor->upperdelaunay) - { - if (! neighbor->seen) - { - n++; - neighbor->seen = true; - } - ni[k]++; - } - else if (! infinity_seen) - { - infinity_seen = true; - ni[k]++; - } - } - k++; - } + FOREACHneighbor_ (vertex) + { + if (! neighbor->upperdelaunay) + { + if (! neighbor->seen) + { + n++; + neighbor->seen = true; + } + ni[k]++; + } + else if (! infinity_seen) + { + infinity_seen = true; + ni[k]++; + } + } + k++; + } Matrix v (n, dim); for (octave_idx_type d = 0; d < dim; d++) - v(0,d) = octave_Inf; + v(0,d) = octave_Inf; boolMatrix AtInf (np, 1); for (i = 0; i < np; i++) - AtInf(i) = false; + AtInf(i) = false; octave_value_list F (np, octave_value ()); k = 0; i = 0; FORALLfacets - { - facet->seen = false; - } + { + facet->seen = false; + } FORALLvertices - { - if (qh hull_dim == 3) - qh_order_vertexneighbors(vertex); - infinity_seen = false; - RowVector facet_list (ni[k++]); - m = 0; + { + if (qh hull_dim == 3) + qh_order_vertexneighbors(vertex); + infinity_seen = false; + RowVector facet_list (ni[k++]); + m = 0; - FOREACHneighbor_(vertex) - { - if (neighbor->upperdelaunay) - { - if (! infinity_seen) - { - infinity_seen = true; - facet_list(m++) = 1; - AtInf(j) = true; - } - } - else - { - if (! neighbor->seen) - { - voronoi_vertex = neighbor->center; - fidx = neighbor->id; - i++; - for (octave_idx_type d = 0; d < dim; d++) - { - v(i,d) = *(voronoi_vertex++); - } - neighbor->seen = true; - neighbor->visitid = i; - } - facet_list(m++) = neighbor->visitid + 1; - } - } - F(r++) = facet_list; - j++; - } + FOREACHneighbor_(vertex) + { + if (neighbor->upperdelaunay) + { + if (! infinity_seen) + { + infinity_seen = true; + facet_list(m++) = 1; + AtInf(j) = true; + } + } + else + { + if (! neighbor->seen) + { + voronoi_vertex = neighbor->center; + fidx = neighbor->id; + i++; + for (octave_idx_type d = 0; d < dim; d++) + { + v(i,d) = *(voronoi_vertex++); + } + neighbor->seen = true; + neighbor->visitid = i; + } + facet_list(m++) = neighbor->visitid + 1; + } + } + F(r++) = facet_list; + j++; + } Cell C(r, 1); for (i = 0; i < r; i++) - C.elem (i) = F(i); + C.elem (i) = F(i); retval(0) = v; retval(1) = C; @@ -237,7 +237,7 @@ qh_memfreeshort (&curlong, &totlong); if (curlong || totlong) - warning ("__voronoi__: did not free %d bytes of long memory (%d pieces)", totlong, curlong); + warning ("__voronoi__: did not free %d bytes of long memory (%d pieces)", totlong, curlong); } else error ("__voronoi__: qhull failed");