 Timestamp:
 01/21/15 13:05:54 (9 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

cpp/frams/util/3d.cpp
r286 r303 17 17 { 18 18 double q = x*x + y*y + z*z; 19 if (q < 0) { if (report_errors) F ramMessage("Pt3D", "operator()", "sqrt domain error", 3); return 0; }19 if (q < 0) { if (report_errors) FMprintf("Pt3D", "operator()", FMLV_ERROR, "sqrt(%g): domain error", q); return 0; } 20 20 return sqrt(q); 21 21 } … … 24 24 { 25 25 double len = length(); 26 if (fabs(len) < 1e50) { if (report_errors) F ramMessage("Pt3D", "normalize()", "vector too small", 1); x = 1; y = 0; z = 0; return false; }26 if (fabs(len) < 1e50) { if (report_errors) FMprintf("Pt3D", "normalize()", FMLV_WARN, "vector[%g,%g,%g] too small", x, y, z); x = 1; y = 0; z = 0; return false; } 27 27 operator/=(len); 28 28 return true; … … 41 41 Orient Orient_1(Pt3D(1, 0, 0), Pt3D(0, 1, 0), Pt3D(0, 0, 1)); 42 42 43 // prosty obrot43 // simple rotation 44 44 void rotate2D(double k, double &x, double &y) 45 45 { … … 64 64 Pt3D t1(X), t2(dir); 65 65 if (getAngle(t1.x, t1.y, z)) // nonvertical 66 { 66 { 67 67 rotate2D(z, t1.x, t1.y); 68 68 rotate2D(z, t2.x, t2.y); … … 70 70 } 71 71 else // vertical 72 { 72 { 73 73 z = 0; 74 74 if (t1.z < 0) … … 120 120 { 121 121 y.x = 0; y.y = x.z; y.z = x.y; // (0,z,y) 122 } 122 } 123 123 if ((ay <= ax) && (ay <= az)) // y 124 124 { 125 125 y.x = x.z; y.y = 0; y.z = x.x; // (z,0,x) 126 } 126 } 127 127 else // z 128 128 { 129 129 y.x = x.y; y.y = x.x; y.z = 0; // (y,x,0) 130 } 130 } 131 131 y.normalize(); 132 132 z.vectorProduct(x, y); … … 137 137 { 138 138 double q = x*x + y*y; 139 if (q < 0) { if (Pt3D::report_errors) F ramMessage("", "d2()", "sqrt domain error", 3); return 0; }139 if (q < 0) { if (Pt3D::report_errors) FMprintf("", "d2()", FMLV_ERROR, "sqrt(%g): domain error", q); return 0; } 140 140 return sqrt(q); 141 141 }
Note: See TracChangeset
for help on using the changeset viewer.