Index: src/DLD-FUNCTIONS/__contourc__.cc =================================================================== RCS file: /cvs/octave/src/DLD-FUNCTIONS/__contourc__.cc,v retrieving revision 1.6 diff -c -p -r1.6 __contourc__.cc *** src/DLD-FUNCTIONS/__contourc__.cc 19 Oct 2007 20:43:33 -0000 1.6 --- src/DLD-FUNCTIONS/__contourc__.cc 25 Oct 2007 08:40:06 -0000 *************** start_contour (double lvl, double x, dou *** 94,103 **** static void drawcn (const RowVector& X, const RowVector& Y, const Matrix& Z, double lvl, int r, int c, double ct_x, double ct_y, ! uint start_edge, bool first, charMatrix& mark) { double px[4], py[4], pz[4], tmp; ! uint stop_edge, next_edge, pt[2]; int next_r, next_c; //get x, y, and z - lvl for current facet --- 94,103 ---- 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) { double px[4], py[4], pz[4], tmp; ! unsigned int stop_edge, next_edge, pt[2]; int next_r, next_c; //get x, y, and z - lvl for current facet *************** drawcn (const RowVector& X, const RowVec *** 127,134 **** if (start_edge == 255) { // Find start edge. ! for (uint k = 0; k < 4; k++) ! if (static_cast (pow(2, k)) & id) start_edge = k; } --- 127,134 ---- if (start_edge == 255) { // Find start edge. ! for (unsigned int k = 0; k < 4; k++) ! if (static_cast (1 << k) & id) start_edge = k; } *************** drawcn (const RowVector& X, const RowVec *** 136,142 **** return; // Decrease mark value of current facet for start edge. ! mark(r, c) -= static_cast (pow(2, start_edge)); // Next point (clockwise). pt[0] = start_edge; --- 136,142 ---- return; // Decrease mark value of current facet for start edge. ! mark(r, c) -= static_cast (1 << start_edge); // Next point (clockwise). pt[0] = start_edge; *************** drawcn (const RowVector& X, const RowVec *** 159,172 **** } // Find stop edge FIXME: control flow --> while. ! for (uint k = 1; k <= 4; k++) { if (start_edge == 0 || start_edge == 2) stop_edge = (start_edge + k) % 4; else stop_edge = (start_edge - k) % 4; ! if (static_cast (pow(2, stop_edge)) & id) break; } --- 159,172 ---- } // Find stop edge FIXME: control flow --> while. ! for (unsigned int k = 1; k <= 4; k++) { if (start_edge == 0 || start_edge == 2) stop_edge = (start_edge + k) % 4; else stop_edge = (start_edge - k) % 4; ! if (static_cast (1 << stop_edge) & id) break; } *************** drawcn (const RowVector& X, const RowVec *** 186,192 **** add_point (ct_x, ct_y); // Decrease id value of current facet for start edge. ! mark(r, c) -= static_cast(pow(2,stop_edge)); // Find next facet. next_c = c; --- 186,192 ---- add_point (ct_x, ct_y); // Decrease id value of current facet for start edge. ! mark(r, c) -= static_cast(1 << stop_edge); // Find next facet. next_c = c; *************** drawcn (const RowVector& X, const RowVec *** 214,233 **** static void mark_facets (const Matrix& Z, charMatrix& mark, double lvl) { ! uint nr = mark.rows (); ! uint nc = mark.cols (); double f[4]; ! for (uint c = 0; c < nc; c++) ! for (uint r = 0; r < nr; r++) { f[0] = Z(r, c) - lvl; f[1] = Z(r, c+1) - lvl; f[3] = Z(r+1, c) - lvl; f[2] = Z(r+1, c+1) - lvl; ! for (uint i = 0; i < 4; i++) if (fabs(f[i]) < DBL_EPSILON) f[i] = DBL_EPSILON; --- 214,233 ---- static void mark_facets (const Matrix& Z, charMatrix& mark, double lvl) { ! unsigned int nr = mark.rows (); ! unsigned int nc = mark.cols (); double f[4]; ! for (unsigned int c = 0; c < nc; c++) ! for (unsigned int r = 0; r < nr; r++) { f[0] = Z(r, c) - lvl; f[1] = Z(r, c+1) - lvl; f[3] = Z(r+1, c) - lvl; f[2] = Z(r+1, c+1) - lvl; ! for (unsigned int i = 0; i < 4; i++) if (fabs(f[i]) < DBL_EPSILON) f[i] = DBL_EPSILON; *************** mark_facets (const Matrix& Z, charMatrix *** 238,252 **** mark(r, c) += 8; } ! for (uint r = 0; r < nr; r++) ! for (uint c = 0; c < nc; c++) { f[0] = Z(r, c) - lvl; f[1] = Z(r, c+1) - lvl; f[3] = Z(r+1, c) - lvl; f[2] = Z(r+1, c+1) - lvl; ! for (uint i = 0; i < 4; i++) if (fabs(f[i]) < DBL_EPSILON) f[i] = DBL_EPSILON; --- 238,252 ---- mark(r, c) += 8; } ! for (unsigned int r = 0; r < nr; r++) ! for (unsigned int c = 0; c < nc; c++) { f[0] = Z(r, c) - lvl; f[1] = Z(r, c+1) - lvl; f[3] = Z(r+1, c) - lvl; f[2] = Z(r+1, c+1) - lvl; ! for (unsigned int i = 0; i < 4; i++) if (fabs(f[i]) < DBL_EPSILON) f[i] = DBL_EPSILON; *************** mark_facets (const Matrix& Z, charMatrix *** 261,268 **** static void cntr (const RowVector& X, const RowVector& Y, const Matrix& Z, double lvl) { ! uint nr = Z.rows (); ! uint nc = Z.cols (); charMatrix mark (nr - 1, nc - 1, 0); --- 261,268 ---- static void cntr (const RowVector& X, const RowVector& Y, const Matrix& Z, double lvl) { ! unsigned int nr = Z.rows (); ! unsigned int nc = Z.cols (); charMatrix mark (nr - 1, nc - 1, 0); *************** cntr (const RowVector& X, const RowVecto *** 270,276 **** // Find contours that start at a domain edge. ! for (uint c = 0; c < nc - 1; c++) { // Top. if (mark(0, c) & 1) --- 270,276 ---- // Find contours that start at a domain edge. ! for (unsigned int c = 0; c < nc - 1; c++) { // Top. if (mark(0, c) & 1) *************** cntr (const RowVector& X, const RowVecto *** 281,287 **** drawcn (X, Y, Z, lvl, nr - 2, c, 0.0, 0.0, 2, true, mark); } ! for (uint r = 0; r < nr - 1; r++) { // Left. if (mark(r, 0) & 8) --- 281,287 ---- drawcn (X, Y, Z, lvl, nr - 2, c, 0.0, 0.0, 2, true, mark); } ! for (unsigned int r = 0; r < nr - 1; r++) { // Left. if (mark(r, 0) & 8) *************** cntr (const RowVector& X, const RowVecto *** 292,299 **** drawcn (X, Y, Z, lvl, r, nc - 2, 0.0, 0.0, 1, true, mark); } ! for (uint r = 0; r < nr - 1; r++) ! for (uint c = 0; c < nc - 1; c++) if (mark (r, c) > 0) drawcn (X, Y, Z, lvl, r, c, 0.0, 0.0, 255, true, mark); } --- 292,299 ---- drawcn (X, Y, Z, lvl, r, nc - 2, 0.0, 0.0, 1, true, mark); } ! for (unsigned int r = 0; r < nr - 1; r++) ! for (unsigned int c = 0; c < nc - 1; c++) if (mark (r, c) > 0) drawcn (X, Y, Z, lvl, r, c, 0.0, 0.0, 255, true, mark); }