[beznode.hxx] Maintenance
This commit is contained in:
parent
f9575d0d4e
commit
a077dbe97a
1 changed files with 27 additions and 29 deletions
|
@ -20,12 +20,11 @@ inline SGGeod CalculateLinearLocation(const SGGeod& p0, const SGGeod& p1, double
|
||||||
// how expensive would this be to do in Geodetic math?
|
// how expensive would this be to do in Geodetic math?
|
||||||
SGVec2d v0 = SGVec2d(p0.getLongitudeDeg(), p0.getLatitudeDeg());
|
SGVec2d v0 = SGVec2d(p0.getLongitudeDeg(), p0.getLatitudeDeg());
|
||||||
SGVec2d v1 = SGVec2d(p1.getLongitudeDeg(), p1.getLatitudeDeg());
|
SGVec2d v1 = SGVec2d(p1.getLongitudeDeg(), p1.getLatitudeDeg());
|
||||||
SGVec2d result;
|
|
||||||
|
|
||||||
double term1 = (1.0f - t);
|
double term1 = (1.0f - t);
|
||||||
double term2 = t;
|
double term2 = t;
|
||||||
|
|
||||||
result = (v0 * term1) + (v1 * term2);
|
SGVec2d result = (v0 * term1) + (v1 * term2);
|
||||||
|
|
||||||
return SGGeod::fromDeg(result.x(), result.y());
|
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 v0 = SGVec2d(p0.getLongitudeDeg(), p0.getLatitudeDeg());
|
||||||
SGVec2d v1 = SGVec2d(p1.getLongitudeDeg(), p1.getLatitudeDeg());
|
SGVec2d v1 = SGVec2d(p1.getLongitudeDeg(), p1.getLatitudeDeg());
|
||||||
SGVec2d vcp = SGVec2d(cp.getLongitudeDeg(), cp.getLatitudeDeg());
|
SGVec2d vcp = SGVec2d(cp.getLongitudeDeg(), cp.getLatitudeDeg());
|
||||||
SGVec2d result;
|
|
||||||
|
|
||||||
double term1 = (1.0f - t) * (1.0f - t);
|
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;
|
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());
|
return SGGeod::fromDeg(result.x(), result.y());
|
||||||
}
|
}
|
||||||
|
@ -65,8 +63,8 @@ inline SGGeod CalculateCubicLocation(const SGGeod& p0, const SGGeod& cp0, const
|
||||||
SGVec2d result;
|
SGVec2d result;
|
||||||
|
|
||||||
double term1 = (1.0f - t) * (1.0f - t) * (1.0f - t);
|
double term1 = (1.0f - t) * (1.0f - t) * (1.0f - t);
|
||||||
double term2 = 3 * (1.0f - t) * (1.0f - t) * t;
|
double term2 = 3.0 * (1.0f - t) * (1.0f - t) * t;
|
||||||
double term3 = 3 * (1.0f - t) * t * t;
|
double term3 = 3.0 * (1.0f - t) * t * t;
|
||||||
double term4 = t * t * t;
|
double term4 = t * t * t;
|
||||||
|
|
||||||
result = (v0 * term1) + (vcp0 * term2) + (vcp1 * term3) + (v1 * term4);
|
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 BEZIER_DETAIL (8)
|
||||||
#define LINE_WIDTH (0.75)
|
#define LINE_WIDTH (0.75)
|
||||||
#define WIREFRAME (1)
|
#define WIREFRAME (1)
|
||||||
|
|
||||||
#define CURVE_NONE (0)
|
#define CURVE_NONE (0)
|
||||||
#define CURVE_LINEAR (1)
|
#define CURVE_LINEAR (1)
|
||||||
#define CURVE_QUADRATIC (2)
|
#define CURVE_QUADRATIC (2)
|
||||||
#define CURVE_CUBIC (3)
|
#define CURVE_CUBIC (3)
|
||||||
|
|
||||||
|
|
||||||
class BezNode
|
class BezNode
|
||||||
|
@ -150,13 +148,13 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
SGGeod Mirror(const SGGeod& pt)
|
SGGeod Mirror(const SGGeod& pt) const
|
||||||
{
|
{
|
||||||
double heading, az2, dist;
|
double heading, az2, dist;
|
||||||
|
|
||||||
// mirror given point about our location
|
// mirror given point about our location
|
||||||
SGGeodesy::inverse(loc, pt, heading, az2, dist);
|
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);
|
return SGGeodesy::direct(loc, heading, dist);
|
||||||
}
|
}
|
||||||
|
@ -166,7 +164,7 @@ public:
|
||||||
mark = m;
|
mark = m;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int GetMarking()
|
unsigned int GetMarking() const
|
||||||
{
|
{
|
||||||
return mark;
|
return mark;
|
||||||
}
|
}
|
||||||
|
@ -176,7 +174,7 @@ public:
|
||||||
light = l;
|
light = l;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int GetLighting()
|
unsigned int GetLighting() const
|
||||||
{
|
{
|
||||||
return light;
|
return light;
|
||||||
}
|
}
|
||||||
|
@ -191,37 +189,37 @@ public:
|
||||||
term = t;
|
term = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsAt(double lat, double lon)
|
bool IsAt(double lat, double lon) const
|
||||||
{
|
{
|
||||||
return ((loc.getLatitudeDeg() == lat) && (loc.getLongitudeDeg() == lon));
|
return ((loc.getLatitudeDeg() == lat) && (loc.getLongitudeDeg() == lon));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HasPrevCp()
|
bool HasPrevCp() const
|
||||||
{
|
{
|
||||||
return has_prev_cp;
|
return has_prev_cp;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HasNextCp()
|
bool HasNextCp() const
|
||||||
{
|
{
|
||||||
return has_next_cp;
|
return has_next_cp;
|
||||||
}
|
}
|
||||||
|
|
||||||
SGGeod GetLoc()
|
SGGeod GetLoc() const
|
||||||
{
|
{
|
||||||
return loc;
|
return loc;
|
||||||
}
|
}
|
||||||
|
|
||||||
SGGeod GetPrevCp()
|
SGGeod GetPrevCp() const
|
||||||
{
|
{
|
||||||
return prev_cp;
|
return prev_cp;
|
||||||
}
|
}
|
||||||
|
|
||||||
SGGeod GetNextCp()
|
SGGeod GetNextCp() const
|
||||||
{
|
{
|
||||||
return next_cp;
|
return next_cp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClearNextCp(void)
|
void ClearNextCp()
|
||||||
{
|
{
|
||||||
has_next_cp = false;
|
has_next_cp = false;
|
||||||
}
|
}
|
||||||
|
@ -232,12 +230,12 @@ public:
|
||||||
has_next_cp = true;
|
has_next_cp = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Print()
|
void Print() const
|
||||||
{
|
{
|
||||||
TG_LOG(SG_GENERAL, SG_DEBUG,
|
TG_LOG(SG_GENERAL, SG_DEBUG,
|
||||||
"\tLoc: " << loc << "\n"
|
"\tLoc: " << loc << "\n"
|
||||||
<< "\tprev_cp: " << prev_cp << "\n"
|
<< "\tprev_cp: " << prev_cp << "\n"
|
||||||
<< "\tnext_cp: " << next_cp << "\n");
|
<< "\tnext_cp: " << next_cp << "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -247,8 +245,8 @@ private:
|
||||||
SGGeod next_cp;
|
SGGeod next_cp;
|
||||||
bool has_next_cp;
|
bool has_next_cp;
|
||||||
|
|
||||||
unsigned int mark;
|
unsigned mark;
|
||||||
unsigned int light;
|
unsigned light;
|
||||||
bool term;
|
bool term;
|
||||||
bool close;
|
bool close;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue