From a077dbe97ab5268d746fe6bc87800c19783687a6 Mon Sep 17 00:00:00 2001 From: scttgs0 Date: Sun, 14 May 2023 02:30:21 -0500 Subject: [PATCH] [beznode.hxx] Maintenance --- src/Airports/GenAirports/beznode.hxx | 56 ++++++++++++++-------------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/src/Airports/GenAirports/beznode.hxx b/src/Airports/GenAirports/beznode.hxx index a842f797..4265e242 100644 --- a/src/Airports/GenAirports/beznode.hxx +++ b/src/Airports/GenAirports/beznode.hxx @@ -20,12 +20,11 @@ inline SGGeod CalculateLinearLocation(const SGGeod& p0, const SGGeod& p1, double // how expensive would this be to do in Geodetic math? SGVec2d v0 = SGVec2d(p0.getLongitudeDeg(), p0.getLatitudeDeg()); SGVec2d v1 = SGVec2d(p1.getLongitudeDeg(), p1.getLatitudeDeg()); - SGVec2d result; double term1 = (1.0f - t); double term2 = t; - result = (v0 * term1) + (v1 * term2); + SGVec2d result = (v0 * term1) + (v1 * term2); return SGGeod::fromDeg(result.x(), result.y()); } @@ -40,13 +39,12 @@ inline SGGeod CalculateQuadraticLocation(const SGGeod& p0, const SGGeod& cp, con SGVec2d v0 = SGVec2d(p0.getLongitudeDeg(), p0.getLatitudeDeg()); SGVec2d v1 = SGVec2d(p1.getLongitudeDeg(), p1.getLatitudeDeg()); SGVec2d vcp = SGVec2d(cp.getLongitudeDeg(), cp.getLatitudeDeg()); - SGVec2d result; double term1 = (1.0f - t) * (1.0f - t); - double term2 = 2 * (1.0f - t) * t; + double term2 = 2.0 * (1.0f - t) * t; double term3 = t * t; - result = (v0 * term1) + (vcp * term2) + (v1 * term3); + SGVec2d result = (v0 * term1) + (vcp * term2) + (v1 * term3); return SGGeod::fromDeg(result.x(), result.y()); } @@ -65,8 +63,8 @@ inline SGGeod CalculateCubicLocation(const SGGeod& p0, const SGGeod& cp0, const SGVec2d result; double term1 = (1.0f - t) * (1.0f - t) * (1.0f - t); - double term2 = 3 * (1.0f - t) * (1.0f - t) * t; - double term3 = 3 * (1.0f - t) * t * t; + double term2 = 3.0 * (1.0f - t) * (1.0f - t) * t; + double term3 = 3.0 * (1.0f - t) * t * t; double term4 = t * t * t; result = (v0 * term1) + (vcp0 * term2) + (vcp1 * term3) + (v1 * term4); @@ -105,14 +103,14 @@ inline double CalculateTheta(const SGVec3d& dirCur, const SGVec3d& dirNext, cons } -#define BEZIER_DETAIL (8) -#define LINE_WIDTH (0.75) -#define WIREFRAME (1) +#define BEZIER_DETAIL (8) +#define LINE_WIDTH (0.75) +#define WIREFRAME (1) -#define CURVE_NONE (0) -#define CURVE_LINEAR (1) +#define CURVE_NONE (0) +#define CURVE_LINEAR (1) #define CURVE_QUADRATIC (2) -#define CURVE_CUBIC (3) +#define CURVE_CUBIC (3) class BezNode @@ -150,13 +148,13 @@ public: { } - SGGeod Mirror(const SGGeod& pt) + SGGeod Mirror(const SGGeod& pt) const { double heading, az2, dist; // mirror given point about our location SGGeodesy::inverse(loc, pt, heading, az2, dist); - heading = SGMiscd::normalizePeriodic(0, 360, heading + 180); + heading = SGMiscd::normalizePeriodic(0.0, 360.0, heading + 180.0); return SGGeodesy::direct(loc, heading, dist); } @@ -166,7 +164,7 @@ public: mark = m; } - unsigned int GetMarking() + unsigned int GetMarking() const { return mark; } @@ -176,7 +174,7 @@ public: light = l; } - unsigned int GetLighting() + unsigned int GetLighting() const { return light; } @@ -191,37 +189,37 @@ public: term = t; } - bool IsAt(double lat, double lon) + bool IsAt(double lat, double lon) const { return ((loc.getLatitudeDeg() == lat) && (loc.getLongitudeDeg() == lon)); } - bool HasPrevCp() + bool HasPrevCp() const { return has_prev_cp; } - bool HasNextCp() + bool HasNextCp() const { return has_next_cp; } - SGGeod GetLoc() + SGGeod GetLoc() const { return loc; } - SGGeod GetPrevCp() + SGGeod GetPrevCp() const { return prev_cp; } - SGGeod GetNextCp() + SGGeod GetNextCp() const { return next_cp; } - void ClearNextCp(void) + void ClearNextCp() { has_next_cp = false; } @@ -232,12 +230,12 @@ public: has_next_cp = true; } - void Print() + void Print() const { TG_LOG(SG_GENERAL, SG_DEBUG, "\tLoc: " << loc << "\n" - << "\tprev_cp: " << prev_cp << "\n" - << "\tnext_cp: " << next_cp << "\n"); + << "\tprev_cp: " << prev_cp << "\n" + << "\tnext_cp: " << next_cp << "\n"); } private: @@ -247,8 +245,8 @@ private: SGGeod next_cp; bool has_next_cp; - unsigned int mark; - unsigned int light; + unsigned mark; + unsigned light; bool term; bool close; };