# HG changeset patch # User jwe # Date 1193344877 0 # Node ID 7593f8e83a2e52704f886fac38262ca834df9f05 # Parent c76471cc72d19e2ce607a2dbf4d7955a4c145c94 [project @ 2007-10-25 20:41:16 by jwe] diff -r c76471cc72d1 -r 7593f8e83a2e src/ChangeLog --- a/src/ChangeLog Thu Oct 25 07:16:07 2007 +0000 +++ b/src/ChangeLog Thu Oct 25 20:41:17 2007 +0000 @@ -1,3 +1,13 @@ +2007-10-25 John W. Eaton + + * graphics.cc (figure::properties::set_currentaxes): + Allow currentfigure to be NaN. + +2007-10-25 Michael Goffioul + + * DLD-FUNCTIONS/__contourc__.cc: Use unsigned int instead of uint. + (drawcn): Use 1 << k instead of pow (2, k). + 2007-10-25 John W. Eaton * symtab.h (symbol_record::TYPE): Delete trailing comma in enum decl. diff -r c76471cc72d1 -r 7593f8e83a2e src/DLD-FUNCTIONS/__contourc__.cc --- a/src/DLD-FUNCTIONS/__contourc__.cc Thu Oct 25 07:16:07 2007 +0000 +++ b/src/DLD-FUNCTIONS/__contourc__.cc Thu Oct 25 20:41:17 2007 +0000 @@ -94,10 +94,10 @@ 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) + unsigned int start_edge, bool first, charMatrix& mark) { double px[4], py[4], pz[4], tmp; - uint stop_edge, next_edge, pt[2]; + unsigned int stop_edge, next_edge, pt[2]; int next_r, next_c; //get x, y, and z - lvl for current facet @@ -127,8 +127,8 @@ if (start_edge == 255) { // Find start edge. - for (uint k = 0; k < 4; k++) - if (static_cast (pow(2, k)) & id) + for (unsigned int k = 0; k < 4; k++) + if (static_cast (1 << k) & id) start_edge = k; } @@ -136,7 +136,7 @@ return; // Decrease mark value of current facet for start edge. - mark(r, c) -= static_cast (pow(2, start_edge)); + mark(r, c) -= static_cast (1 << start_edge); // Next point (clockwise). pt[0] = start_edge; @@ -159,14 +159,14 @@ } // Find stop edge FIXME: control flow --> while. - for (uint k = 1; k <= 4; k++) + 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 (pow(2, stop_edge)) & id) + if (static_cast (1 << stop_edge) & id) break; } @@ -186,7 +186,7 @@ add_point (ct_x, ct_y); // Decrease id value of current facet for start edge. - mark(r, c) -= static_cast(pow(2,stop_edge)); + mark(r, c) -= static_cast (1 << stop_edge); // Find next facet. next_c = c; @@ -214,20 +214,20 @@ static void mark_facets (const Matrix& Z, charMatrix& mark, double lvl) { - uint nr = mark.rows (); - uint nc = mark.cols (); + unsigned int nr = mark.rows (); + unsigned int nc = mark.cols (); double f[4]; - for (uint c = 0; c < nc; c++) - for (uint r = 0; r < nr; r++) + 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 (uint i = 0; i < 4; i++) + for (unsigned int i = 0; i < 4; i++) if (fabs(f[i]) < DBL_EPSILON) f[i] = DBL_EPSILON; @@ -238,15 +238,15 @@ mark(r, c) += 8; } - for (uint r = 0; r < nr; r++) - for (uint c = 0; c < nc; c++) + 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 (uint i = 0; i < 4; i++) + for (unsigned int i = 0; i < 4; i++) if (fabs(f[i]) < DBL_EPSILON) f[i] = DBL_EPSILON; @@ -261,8 +261,8 @@ static void cntr (const RowVector& X, const RowVector& Y, const Matrix& Z, double lvl) { - uint nr = Z.rows (); - uint nc = Z.cols (); + unsigned int nr = Z.rows (); + unsigned int nc = Z.cols (); charMatrix mark (nr - 1, nc - 1, 0); @@ -270,7 +270,7 @@ // Find contours that start at a domain edge. - for (uint c = 0; c < nc - 1; c++) + for (unsigned int c = 0; c < nc - 1; c++) { // Top. if (mark(0, c) & 1) @@ -281,7 +281,7 @@ drawcn (X, Y, Z, lvl, nr - 2, c, 0.0, 0.0, 2, true, mark); } - for (uint r = 0; r < nr - 1; r++) + for (unsigned int r = 0; r < nr - 1; r++) { // Left. if (mark(r, 0) & 8) @@ -292,8 +292,8 @@ 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++) + 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); } diff -r c76471cc72d1 -r 7593f8e83a2e src/graphics.cc --- a/src/graphics.cc Thu Oct 25 07:16:07 2007 +0000 +++ b/src/graphics.cc Thu Oct 25 20:41:17 2007 +0000 @@ -842,7 +842,7 @@ if (error_state) return; - if (is_handle (val)) + if (xisnan (val.value ()) || is_handle (val)) currentaxes = val; else gripe_set_invalid ("currentaxes");