35 #if defined (HAVE_CONFIG_H)
53 #define CONTOUR_QUANT 50
90 this_contour.
resize (2, 0);
97 double lvl,
int r,
int c,
double ct_x,
double ct_y,
100 double px[4], py[4], pz[4],
tmp;
101 unsigned int stop_edge, pt[2];
104 while (r >= 0 && c >= 0 && r < mark.
rows () && c < mark.
cols ()
109 px[0] = px[3] = X(c);
110 px[1] = px[2] = X(c+1);
112 py[0] = py[1] =
Y(r);
113 py[2] = py[3] =
Y(r+1);
115 pz[3] =
Z(r+1, c) - lvl;
116 pz[2] =
Z(r+1, c + 1) - lvl;
117 pz[1] =
Z(r, c+1) - lvl;
118 pz[0] =
Z(r, c) - lvl;
129 char id =
static_cast<char> (mark(r, c));
132 if (start_edge == 255)
135 for (
unsigned int k = 0;
k < 4;
k++)
136 if (static_cast<char> (1 <<
k) &
id)
140 if (start_edge == 255)
144 mark(r, c) -=
static_cast<char> (1 << start_edge);
148 pt[1] = (pt[0] + 1) % 4;
153 tmp = fabs (pz[pt[1]]) / fabs (pz[pt[0]]);
159 ct_x = px[pt[0]] + (px[pt[1]] - px[pt[0]])/(1 + tmp);
160 ct_y = py[pt[0]] + (py[pt[1]] - py[pt[0]])/(1 + tmp);
169 for (
unsigned int k = 1;
k <= 4;
k++)
171 if (start_edge == 0 || start_edge == 2)
172 stop_edge = (start_edge +
k) % 4;
174 stop_edge = (start_edge -
k) % 4;
176 if (static_cast<char> (1 << stop_edge) &
id)
181 pt[1] = (pt[0] + 1) % 4;
182 tmp = fabs (pz[pt[1]]) / fabs (pz[pt[0]]);
188 ct_x = px[pt[0]] + (px[pt[1]] - px[pt[0]])/(1 + tmp);
189 ct_y = py[pt[0]] + (py[pt[1]] - py[pt[0]])/(1 + tmp);
196 mark(r, c) -=
static_cast<char> (1 << stop_edge);
201 else if (stop_edge == 1)
203 else if (stop_edge == 2)
205 else if (stop_edge == 3)
209 start_edge = (stop_edge + 2) % 4;
217 unsigned int nr = mark.
rows ();
218 unsigned int nc = mark.
cols ();
222 for (
unsigned int c = 0;
c < nc;
c++)
223 for (
unsigned int r = 0; r < nr; r++)
225 f[0] =
Z(r,
c) - lvl;
226 f[1] =
Z(r,
c+1) - lvl;
227 f[3] =
Z(r+1,
c) - lvl;
228 f[2] =
Z(r+1,
c+1) - lvl;
230 for (
unsigned int i = 0;
i < 4;
i++)
231 if (fabs(f[
i]) < std::numeric_limits<double>::epsilon ())
232 f[
i] = std::numeric_limits<double>::epsilon ();
241 for (
unsigned int r = 0; r < nr; r++)
242 for (
unsigned int c = 0;
c < nc;
c++)
244 f[0] =
Z(r,
c) - lvl;
245 f[1] =
Z(r,
c+1) - lvl;
246 f[3] =
Z(r+1,
c) - lvl;
247 f[2] =
Z(r+1,
c+1) - lvl;
249 for (
unsigned int i = 0;
i < 4;
i++)
250 if (fabs(f[
i]) < std::numeric_limits<double>::epsilon ())
251 f[
i] = std::numeric_limits<double>::epsilon ();
264 unsigned int nr = Z.
rows ();
265 unsigned int nc = Z.
cols ();
273 for (
unsigned int c = 0;
c < nc - 1;
c++)
277 drawcn (X, Y, Z, lvl, 0,
c, 0.0, 0.0, 0,
true, mark);
280 if (mark(nr - 2,
c) & 4)
281 drawcn (X, Y, Z, lvl, nr - 2,
c, 0.0, 0.0, 2,
true, mark);
284 for (
unsigned int r = 0; r < nr - 1; r++)
288 drawcn (X, Y, Z, lvl, r, 0, 0.0, 0.0, 3,
true, mark);
291 if (mark(r, nc - 2) & 2)
292 drawcn (X, Y, Z, lvl, r, nc - 2, 0.0, 0.0, 1,
true, mark);
295 for (
unsigned int r = 0; r < nr - 1; r++)
296 for (
unsigned int c = 0;
c < nc - 1;
c++)
298 drawcn (X, Y, Z, lvl, r,
c, 0.0, 0.0, 255,
true, mark);
307 if (
args.length () != 4)
317 for (
int i = 0;
i < L.
numel ();
i++)
318 cntr (X, Y, Z, L (
i));
void resize(octave_idx_type nr, octave_idx_type nc, double rfv=0)
static Matrix this_contour
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
OCTAVE_EXPORT octave_value_list return the value of the option it must match the dimension of the state and the relative tolerance must also be a vector of the same length tem it must match the dimension of the state and the absolute tolerance must also be a vector of the same length The local error test applied at each integration step is xample roup so it is best to provide a consistent set and leave this option set to zero tem it may help to set this parameter to a nonzero value it is probably best to try leaving this option set to zero first
Matrix extract_n(octave_idx_type r1, octave_idx_type c1, octave_idx_type nr, octave_idx_type nc) const
#define DEFUN(name, args_name, nargout_name, doc)
octave_idx_type rows(void) const
static void start_contour(double lvl, double x, double y)
OCTAVE_EXPORT octave_value_list return the value of the option it must match the dimension of the state and the relative tolerance must also be a vector of the same length tem it must match the dimension of the state and the absolute tolerance must also be a vector of the same length The local error test applied at each integration step is xample roup calculate Y_a and Y _d item Given Y
static void cntr(const RowVector &X, const RowVector &Y, const Matrix &Z, double lvl)
F77_RET_T const F77_INT const F77_INT const F77_INT F77_DBLE const F77_INT F77_DBLE const F77_INT F77_DBLE const F77_INT F77_DBLE * Z
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the c
static void drawcn(const RowVector &X, const RowVector &Y, const Matrix &Z, double lvl, int r, int c, double ct_x, double ct_y, unsigned int start_edge, bool first, charMatrix &mark)
static void end_contour(void)
static void mark_facets(const Matrix &Z, charMatrix &mark, double lvl)
=val(i)}if ode{val(i)}occurs in table i
the element is set to zero In other the statement xample y
static void add_point(double x, double y)
octave_idx_type cols(void) const
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 * x
return octave_value(v1.char_array_value().concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string())? '\'': '"'))
Matrix append(const Matrix &a) const