Mercurial > octave-nkf
comparison src/DLD-FUNCTIONS/convhulln.cc @ 11586:12df7854fa7c
strip trailing whitespace from source files
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 20 Jan 2011 17:24:59 -0500 |
parents | 01f703952eff |
children | 7ff0bdc3dc4c |
comparison
equal
deleted
inserted
replaced
11585:1473d0cf86d2 | 11586:12df7854fa7c |
---|---|
71 | 71 |
72 #ifdef HAVE_QHULL | 72 #ifdef HAVE_QHULL |
73 std::string options; | 73 std::string options; |
74 | 74 |
75 int nargin = args.length (); | 75 int nargin = args.length (); |
76 if (nargin < 1 || nargin > 2) | 76 if (nargin < 1 || nargin > 2) |
77 { | 77 { |
78 print_usage (); | 78 print_usage (); |
79 return retval; | 79 return retval; |
80 } | 80 } |
81 | 81 |
82 if (nargin == 2) | 82 if (nargin == 2) |
83 { | 83 { |
84 if (args (1).is_string ()) | 84 if (args (1).is_string ()) |
85 options = args(1).string_value (); | 85 options = args(1).string_value (); |
86 else if (args(1).is_cell ()) | 86 else if (args(1).is_cell ()) |
87 { | 87 { |
88 Cell c = args(1).cell_value (); | 88 Cell c = args(1).cell_value (); |
89 options = ""; | 89 options = ""; |
131 | 131 |
132 OCTAVE_LOCAL_BUFFER (char, flags, buf_string.length () + 1); | 132 OCTAVE_LOCAL_BUFFER (char, flags, buf_string.length () + 1); |
133 | 133 |
134 strcpy (flags, buf_string.c_str ()); | 134 strcpy (flags, buf_string.c_str ()); |
135 | 135 |
136 if (! qh_new_qhull (dim, n, pt_array, ismalloc, flags, 0, stderr)) | 136 if (! qh_new_qhull (dim, n, pt_array, ismalloc, flags, 0, stderr)) |
137 { | 137 { |
138 // If you want some debugging information replace the NULL | 138 // If you want some debugging information replace the NULL |
139 // pointer with stdout | 139 // pointer with stdout |
140 | 140 |
141 vertexT *vertex, **vertexp; | 141 vertexT *vertex, **vertexp; |
144 unsigned int nf = qh num_facets; | 144 unsigned int nf = qh num_facets; |
145 | 145 |
146 Matrix idx (nf, dim); | 146 Matrix idx (nf, dim); |
147 | 147 |
148 octave_idx_type j, i = 0; | 148 octave_idx_type j, i = 0; |
149 FORALLfacets | 149 FORALLfacets |
150 { | 150 { |
151 j = 0; | 151 j = 0; |
152 if (! facet->simplicial) | 152 if (! facet->simplicial) |
153 // should never happen with QJ | 153 // should never happen with QJ |
154 error ("convhulln: non-simplicial facet"); | 154 error ("convhulln: non-simplicial facet"); |
155 | 155 |
156 if (dim == 3) | 156 if (dim == 3) |
157 { | 157 { |
158 vertices = qh_facet3vertex (facet); | 158 vertices = qh_facet3vertex (facet); |
159 FOREACHvertex_ (vertices) | 159 FOREACHvertex_ (vertices) |
160 idx(i, j++) = 1 + qh_pointid(vertex->point); | 160 idx(i, j++) = 1 + qh_pointid(vertex->point); |
161 qh_settempfree (&vertices); | 161 qh_settempfree (&vertices); |
162 } | 162 } |
163 else | 163 else |
164 { | 164 { |
165 if (facet->toporient ^ qh_ORIENTclock) | 165 if (facet->toporient ^ qh_ORIENTclock) |
166 { | 166 { |
167 FOREACHvertex_ (facet->vertices) | 167 FOREACHvertex_ (facet->vertices) |
168 idx(i, j++) = 1 + qh_pointid(vertex->point); | 168 idx(i, j++) = 1 + qh_pointid(vertex->point); |
169 } | 169 } |
170 else | 170 else |
171 { | 171 { |
172 FOREACHvertexreverse12_ (facet->vertices) | 172 FOREACHvertexreverse12_ (facet->vertices) |
173 idx(i, j++) = 1 + qh_pointid(vertex->point); | 173 idx(i, j++) = 1 + qh_pointid(vertex->point); |
174 } | 174 } |
175 } | 175 } |
221 | 221 |
222 // free short memory and memory allocator | 222 // free short memory and memory allocator |
223 int curlong, totlong; | 223 int curlong, totlong; |
224 qh_memfreeshort (&curlong, &totlong); | 224 qh_memfreeshort (&curlong, &totlong); |
225 | 225 |
226 if (curlong || totlong) | 226 if (curlong || totlong) |
227 warning ("convhulln: did not free %d bytes of long memory (%d pieces)", | 227 warning ("convhulln: did not free %d bytes of long memory (%d pieces)", |
228 totlong, curlong); | 228 totlong, curlong); |
229 #else | 229 #else |
230 error ("convhulln: not available in this version of Octave"); | 230 error ("convhulln: not available in this version of Octave"); |
231 #endif | 231 #endif |