36 #ifndef GREATCIRCLE_H_
37 #define GREATCIRCLE_H_
199 double moveDirection[3];
222 void initialize(
const double* intermediatePoint,
const bool &shortestPath);
233 GreatCircle() : firstPoint(NULL), lastPoint(NULL), deleteFirst(true), deleteLast(true), trnsfrm(NULL)
248 GreatCircle(
const double* firstPoint,
const double& distance,
const double& direction);
281 GreatCircle(
const double* firstPoint,
const double* intermediatePoint,
const double* lastPoint,
282 const bool &shortestPath=
true);
300 GreatCircle(
const double* firstPoint,
const double* lastPoint,
const bool &shortestPath=
true);
315 return firstPoint[0] == other.firstPoint[0]
316 && firstPoint[1] == other.firstPoint[1]
317 && firstPoint[2] == other.firstPoint[2]
318 && lastPoint[0] == other.lastPoint[0]
319 && lastPoint[1] == other.lastPoint[1]
320 && lastPoint[2] == other.lastPoint[2]
321 && normal[0] == other.normal[0]
322 && normal[1] == other.normal[1]
323 && normal[2] == other.normal[2];
327 void set(
double* firstPoint,
double* intermediatePoint,
double* lastPoint,
328 const bool& shortestPath=
true,
const bool& deleteWhenDone=
true);
330 void set(
double* frstPoint,
double* lstPoint,
331 const bool& shortestPath=
true,
const bool& deleteWhenDone=
true)
332 {
set (frstPoint, NULL, lstPoint, shortestPath, deleteWhenDone); }
334 void set(
double* firstPoint,
const double& distance,
const double& azimuth,
335 const bool& deleteWhenDone=
true);
346 distance = GeoTessUtils::angle(firstPoint, lastPoint);
347 if (GeoTessUtils::scalarTripleProduct(firstPoint, lastPoint, normal) < 0.)
348 distance = 2*PI - distance;
358 double getDistanceDegrees()
360 return CPPUtils::toDegrees(getDistance());
372 double getDistance(
const double *position)
375 double d = GeoTessUtils::angle(firstPoint, position);
377 if (GeoTessUtils::scalarTripleProduct(firstPoint, position, normal) < 0.)
393 double getDistanceDegrees(
const double *position)
395 return CPPUtils::toDegrees(getDistance(position));
431 const double* getNormal()
447 double* getPoint(
const double &dist)
449 double* location =
new double[3];
450 GeoTessUtils::move(firstPoint, moveDirection, dist, location);
463 void getPoint(
const double &dist,
double* location)
465 GeoTessUtils::move(firstPoint, moveDirection, dist, location);
493 bool getIntersection(
GreatCircle& other,
const bool& inRange,
double* intersection)
495 if (GeoTessUtils::crossNormal(normal, other.normal, intersection) == 0.)
497 intersection[0] = intersection[1] = intersection[2] = NaN_DOUBLE;
501 if (GeoTessUtils::scalarTripleProduct(firstPoint, intersection, normal) < 0.)
503 intersection[0] = -intersection[0];
504 intersection[1] = -intersection[1];
505 intersection[2] = -intersection[2];
508 if (inRange && (getDistance(intersection) >= getDistance()
511 intersection[0] = intersection[1] = intersection[2] = NaN_DOUBLE;
532 double** getTransform();
554 void transform(
const double* x,
double* v)
558 v[0] = x[0] * trnsfrm[0][0] + x[1] * trnsfrm[0][1] + x[2]
560 v[1] = x[0] * trnsfrm[1][0] + x[1] * trnsfrm[1][1] + x[2]
562 v[2] = x[0] * trnsfrm[2][0] + x[1] * trnsfrm[2][1] + x[2]
587 double* transform(
const double* x)
589 double* v =
new double[3];