41 #if defined (HAVE_CONFIG_H) 61 #if defined (HAVE_QHULL) 65 # if defined (NEED_QHULL_VERSION) 66 char qh_version[] =
"__delaunayn__.oct 2007-08-21";
78 qh_freeqhull (! qh_ALL);
81 qh_memfreeshort (&curlong, &totlong);
83 if (curlong || totlong)
84 warning (
"__delaunayn__: did not free %d bytes of long memory (%d pieces)",
95 if (dim > maxval || n > maxval)
96 error (
"%s: dimension too large for Qhull", who);
112 #if defined (HAVE_QHULL) 114 int nargin = args.length ();
123 Matrix p (args(0).matrix_value ());
139 if (args(1).is_string ())
140 options = args(1).string_value ();
141 else if (args(1).isempty ())
152 error (
"__delaunayn__: OPTIONS argument must be a string, cell array of strings, or empty");
158 double *pt_array =
p.fortran_vec ();
159 boolT ismalloc =
false;
164 sprintf (flags,
"qhull d %s",
options.c_str ());
169 #if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM) 170 FILE *outfile = std::fopen (
"NUL",
"w");
172 FILE *outfile = std::fopen (
"/dev/null",
"w");
174 FILE *errfile = stderr;
177 error (
"__delaunayn__: unable to create temporary file for output");
181 int exitcode = qh_new_qhull (dim, n, pt_array,
182 ismalloc, flags, outfile, errfile);
187 error (
"__delaunayn__: qhull failed");
193 vertexT *vertex, **vertexp;
199 if (! facet->upperdelaunay)
203 if (! facet->simplicial)
204 error (
"__delaunayn__: Qhull returned non-simplicial facets -- try delaunayn with different options");
213 if (! facet->upperdelaunay)
217 FOREACHvertex_ (facet->vertices)
219 simpl(
i, j++) = 1 + qh_pointid(vertex->point);
228 else if (n == dim + 1)
243 octave_unused_parameter (args);
static void free_qhull_memory()
OCTINTERP_API void print_usage(void)
F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE * f
void add_fcn(void(*fcn)(void))
void error(const char *fmt,...)
static void close_fcn(FILE *f)
OCTAVE_EXPORT octave_value_list or both For fclose
OCTAVE_EXPORT octave_value_list iscellstr
void warning(const char *fmt,...)
octave::unwind_protect frame
charNDArray max(char d, const charNDArray &m)
OCTAVE_EXPORT octave_value_list only variables visible in the local scope are displayed The following are valid options
octave_idx_type length(void) const
#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)
Macro to define an at run time dynamically loadable builtin function.
void err_disabled_feature(const std::string &fcn, const std::string &feature, const std::string &pkg)
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string