Changeset 1005 for cpp/common/Convert.h


Ignore:
Timestamp:
07/14/20 15:54:43 (4 years ago)
Author:
Maciej Komosinski
Message:

Higher conformance with C++17, but gave up after missing M_PI, M_PI_2, strdup() and more; other cosmetic improvements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/common/Convert.h

    r913 r1005  
    1111#include "2d.h"
    1212#include <stdint.h>
     13#include <cmath>
    1314
    1415
     
    3940        static uint32_t hexToInt(const string& col);
    4041
    41         static double toRadians(double angle) { return angle*M_PI / 180; }
     42        static double toRadians(double angle) { return angle * M_PI / 180; }
    4243        static double toDegrees(double angle) { return angle / M_PI * 180; }
    4344        static double atan_2(double y, double x) { if (x == 0 && y == 0) return 0; else return atan2(y, x); } //needed by borland 5/6 only?
     
    4647        {
    4748                double dx = x2 - x1, dy = y2 - y1;
    48                 return dx*dx + dy*dy;
     49                return dx * dx + dy * dy;
    4950        }
    5051        static double odleglosc_sq(const Pt2D& p1, const Pt2D& p2) //odleglosc do kwadratu
     
    5354        }
    5455
    55         static double odleglosc(double x1, double y1, double x2, double y2)     { return sqrt(odleglosc_sq(x1, y1, x2, y2)); }
     56        static double odleglosc(double x1, double y1, double x2, double y2) { return sqrt(odleglosc_sq(x1, y1, x2, y2)); }
    5657        static double odleglosc(const Pt2D& p1, const Pt2D& p2)
    5758        {
Note: See TracChangeset for help on using the changeset viewer.