56 #if defined (HAVE_QHULL)
58 # if defined (NEED_QHULL_VERSION)
59 char qh_version[] =
"__delaunayn__.oct 2007-08-21";
76 if (dim > maxval || n > maxval)
78 error (
"%s: dimension too large for Qhull", who);
88 @deftypefn {Loadable Function} {@var{T} =} __delaunayn__ (@var{pts})\n\
89 @deftypefnx {Loadable Function} {@var{T} =} __delaunayn__ (@var{pts}, @var{options})\n\
90 Undocumented internal function.\n\
96 #if defined (HAVE_QHULL)
100 int nargin = args.
length ();
101 if (nargin < 1 || nargin > 2)
107 Matrix p (args(0).matrix_value ());
117 options =
"Qt Qbb Qc Qz";
119 options =
"Qt Qbb Qc Qx";
123 if (args(1).is_string ())
124 options = args(1).string_value ();
125 else if (args(1).is_empty ())
127 else if (args(1).is_cellstr ())
133 options += tmp(i) +
" ";
137 error (
"__delaunayn__: OPTIONS argument must be a string, cell array of strings, or empty");
146 boolT ismalloc =
false;
151 sprintf (flags,
"qhull d %s", options.c_str ());
156 #if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM)
157 FILE *outfile = gnulib::fopen (
"NUL",
"w");
159 FILE *outfile = gnulib::fopen (
"/dev/null",
"w");
161 FILE *errfile = stderr;
167 error (
"__delaunayn__: unable to create temporary file for output");
171 int exitcode = qh_new_qhull (dim, n, pt_array,
172 ismalloc, flags, outfile, errfile);
179 vertexT *vertex, **vertexp;
185 if (! facet->upperdelaunay)
189 if (! facet->simplicial)
191 error (
"__delaunayn__: Qhull returned non-simplicial facets -- try delaunayn with different options");
203 if (! facet->upperdelaunay)
207 FOREACHvertex_ (facet->vertices)
209 simpl(i, j++) = 1 + qh_pointid(vertex->point);
219 error (
"__delaunayn__: qhull failed");
222 qh_freeqhull (! qh_ALL);
224 int curlong, totlong;
225 qh_memfreeshort (&curlong, &totlong);
227 if (curlong || totlong)
228 warning (
"__delaunay__: did not free %d bytes of long memory (%d pieces)",
231 else if (n == dim + 1)
243 error (
"__delaunayn__: not available in this version of Octave");
OCTINTERP_API void print_usage(void)
octave_idx_type numel(void) const
Number of elements in the array.
octave_idx_type length(void) const
void error(const char *fmt,...)
octave_idx_type rows(void) const
static void close_fcn(FILE *f)
F77_RET_T const double const double * f
Matrix transpose(void) const
void warning(const char *fmt,...)
charNDArray max(char d, const charNDArray &m)
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
static bool octave_qhull_dims_ok(octave_idx_type dim, octave_idx_type n, const char *who)
#define DEFUN_DLD(name, args_name, nargout_name, doc)
const T * fortran_vec(void) const
octave_idx_type columns(void) const