26 #if defined (HAVE_CONFIG_H)
40 inline
double max (
double a,
double b,
double c)
42 return (a > b) ? (a > c ? a : c) : (b > c ? b : c);
45 inline double min (
double a,
double b,
double c)
47 return (a < b) ? (a < c ? a : c) : (b < c ? b : c);
50 #define REF(x,k,i) x(static_cast<octave_idx_type> (elem((k), (i))) - 1)
60 DEFUN (tsearch, args, ,
71 if (args.length () != 5)
74 const double eps = 1.0e-12;
99 double x0 = 0.0, y0 = 0.0;
100 double a11 = 0.0, a12 = 0.0, a21 = 0.0, a22 = 0.0, det = 0.0;
101 double xt = 0.0, yt = 0.0;
102 double dx1 = 0.0, dx2 = 0.0, c1 = 0.0, c2 = 0.0;
119 c1 = (a22 * dx1 - a21 * dx2) / det;
120 c2 = (-a12 * dx1 + a11 * dx2) / det;
121 if (c1 >= -
eps && c2 >= -
eps && (c1 + c2) <= 1 +
eps)
129 for (k = 0; k < nelem; k++)
131 if (xt >= minx(k) && xt <= maxx(k) && yt >= miny(k) && yt <= maxy(k))
137 a11 =
REF (
x, k, 1) - x0;
138 a12 =
REF (y, k, 1) - y0;
139 a21 =
REF (
x, k, 2) - x0;
140 a22 =
REF (y, k, 2) - y0;
141 det = a11 * a22 - a21 * a12;
146 c1 = (a22 * dx1 - a21 * dx2) / det;
147 c2 = (-a12 * dx1 + a11 * dx2) / det;
148 if (c1 >= -
eps && c2 >= -
eps && (c1 + c2) <= 1 +
eps)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
OCTINTERP_API void print_usage(void)
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
double lo_ieee_nan_value(void)
F77_RET_T const F77_DBLE * x
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.
static const double xi[33]
double min(double a, double b, double c)
double max(double a, double b, double c)