Changeset 372 for cpp/frams/util/3d.cpp


Ignore:
Timestamp:
04/22/15 04:14:59 (9 years ago)
Author:
sz
Message:

Renamed some classes and functions to make their purpose more obvious:

All MessageHandlers? must now be given the explicit "Enable" argument if you want them to automatically become active. This makes side effects clearly visible.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/util/3d.cpp

    r321 r372  
    44
    55#include <common/nonstd_math.h>
    6 #include <common/framsg.h>
     6#include <common/hmessage.h>
    77#include "3d.h"
    88
     
    1717{
    1818        double q = x*x + y*y + z*z;
    19         if (q < 0) { if (report_errors) FMprintf("Pt3D", "operator()", FMLV_ERROR, "sqrt(%g): domain error", q); return 0; }
     19        if (q < 0) { if (report_errors) Hprintf("Pt3D", "operator()", HMLV_ERROR, "sqrt(%g): domain error", q); return 0; }
    2020        return sqrt(q);
    2121}
     
    2424{
    2525        double len = length();
    26         if (fabs(len) < 1e-50) { 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; }
     26        if (fabs(len) < 1e-50) { if (report_errors) Hprintf("Pt3D", "normalize()", HMLV_WARN, "vector[%g,%g,%g] too small", x, y, z); x = 1; y = 0; z = 0; return false; }
    2727        operator/=(len);
    2828        return true;
     
    6464        if (dx == 0 && dy == 0)
    6565        {
    66                 if (report_errors) FMprintf("Pt3D", "getAngle()", FMLV_WARN, "atan2(%g,%g)", dy, dx);
     66                if (report_errors) Hprintf("Pt3D", "getAngle()", HMLV_WARN, "atan2(%g,%g)", dy, dx);
    6767                return 0; // incorrect result, but there is no correct one
    6868        }
     
    147147{
    148148        double q = x*x + y*y;
    149         if (q < 0) { if (Pt3D::report_errors) FMprintf("", "d2()", FMLV_ERROR, "sqrt(%g): domain error", q); return 0; }
     149        if (q < 0) { if (Pt3D::report_errors) Hprintf("", "d2()", HMLV_ERROR, "sqrt(%g): domain error", q); return 0; }
    150150        return sqrt(q);
    151151}
Note: See TracChangeset for help on using the changeset viewer.