41 #if defined (HAVE_CONFIG_H)
57 #if defined (HAVE_QHULL)
61 # if defined (NEED_QHULL_VERSION)
62 char qh_version[] =
"__delaunayn__.oct 2007-08-21";
78 if (dim > maxval || n > maxval)
79 error (
"%s: dimension too large for Qhull", who);
95 #if defined (HAVE_QHULL)
99 if (nargin < 1 || nargin > 2)
116 options =
"Qt Qbb Qc Qz";
118 options =
"Qt Qbb Qc Qx";
122 if (
args(1).is_string ())
123 options =
args(1).string_value ();
124 else if (
args(1).is_empty ())
126 else if (
args(1).is_cellstr ())
132 options +=
tmp(
i) +
" ";
135 error (
"__delaunayn__: OPTIONS argument must be a string, cell array of strings, or empty");
142 boolT ismalloc =
false;
147 sprintf (flags,
"qhull d %s", options.c_str ());
152 #if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM)
153 FILE *outfile = std::fopen (
"NUL",
"w");
155 FILE *outfile = std::fopen (
"/dev/null",
"w");
157 FILE *errfile = stderr;
160 error (
"__delaunayn__: unable to create temporary file for output");
164 int exitcode = qh_new_qhull (dim, n, pt_array,
165 ismalloc, flags, outfile, errfile);
167 error (
"__delaunayn__: qhull failed");
173 vertexT *vertex, **vertexp;
179 if (! facet->upperdelaunay)
183 if (! facet->simplicial)
184 error (
"__delaunayn__: Qhull returned non-simplicial facets -- try delaunayn with different options");
193 if (! facet->upperdelaunay)
197 FOREACHvertex_ (facet->vertices)
199 simpl(i, j++) = 1 + qh_pointid(vertex->point);
209 qh_freeqhull (! qh_ALL);
211 int curlong, totlong;
212 qh_memfreeshort (&curlong, &totlong);
214 if (curlong || totlong)
215 warning (
"__delaunay__: did not free %d bytes of long memory (%d pieces)",
218 else if (n == dim + 1)
233 octave_unused_parameter (
args);
OCTINTERP_API void print_usage(void)
octave_idx_type numel(void) const
Number of elements in the array.
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &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 F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE const F77_DBLE * f
void error(const char *fmt,...)
octave_idx_type rows(void) const
static void close_fcn(FILE *f)
Matrix transpose(void) const
void warning(const char *fmt,...)
octave::unwind_protect frame
charNDArray max(char d, const charNDArray &m)
=val(i)}if ode{val(i)}occurs in table i
OCTAVE_EXPORT octave_value_list only variables visible in the local scope are displayed The following are valid options
#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
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
octave_idx_type columns(void) const