36 #ifndef GREATCIRCLE_H_
37 #define GREATCIRCLE_H_
201 double moveDirection[3];
224 void initialize(
const double* intermediatePoint,
const bool &shortestPath);
235 GeoTessGreatCircle() : firstPoint(NULL), lastPoint(NULL), deleteFirst(true), deleteLast(true), trnsfrm(NULL)
283 GeoTessGreatCircle(
const double* firstPoint,
const double* intermediatePoint,
const double* lastPoint,
284 const bool &shortestPath=
true);
302 GeoTessGreatCircle(
const double* firstPoint,
const double* lastPoint,
const bool &shortestPath=
true);
322 return firstPoint[0] == other.firstPoint[0]
323 && firstPoint[1] == other.firstPoint[1]
324 && firstPoint[2] == other.firstPoint[2]
325 && lastPoint[0] == other.lastPoint[0]
326 && lastPoint[1] == other.lastPoint[1]
327 && lastPoint[2] == other.lastPoint[2]
328 && normal[0] == other.normal[0]
329 && normal[1] == other.normal[1]
330 && normal[2] == other.normal[2];
368 void set(
double* firstPoint,
double* intermediatePoint,
double* lastPoint,
369 const bool& shortestPath=
true,
const bool& deleteWhenDone=
false);
392 void set(
double* frstPoint,
double* lstPoint,
393 const bool& shortestPath=
true,
const bool& deleteWhenDone=
false)
394 { set (frstPoint, NULL, lstPoint, shortestPath, deleteWhenDone); }
411 void set(
double* firstPoint,
const double& distance,
const double& azimuth,
412 const bool& deleteWhenDone=
false);
423 distance = GeoTessUtils::angle(firstPoint, lastPoint);
424 if (GeoTessUtils::scalarTripleProduct(firstPoint, lastPoint, normal) < 0.)
425 distance = 2*PI - distance;
437 return CPPUtils::toDegrees(getDistance());
452 double d = GeoTessUtils::angle(firstPoint, position);
454 if (GeoTessUtils::scalarTripleProduct(firstPoint, position, normal) < 0.)
472 return CPPUtils::toDegrees(getDistance(position));
526 double* location =
new double[3];
527 GeoTessUtils::move(firstPoint, moveDirection, dist, location);
540 void getPoint(
const double &dist,
double* location)
542 GeoTessUtils::move(firstPoint, moveDirection, dist, location);
559 static int getNPoints(
const double& dist,
const double& spacing,
const bool& onCenters=
false)
561 if (dist <= 0.)
return onCenters ? 1 : 2;
562 return onCenters ? (int)ceil(dist/spacing) : ((int)ceil(dist/spacing))+1;
578 int getNPoints(
const double& spacing,
const bool& onCenters=
false)
580 return getNPoints(getDistance(), spacing, onCenters);
601 double getPoints(
double** points,
const int &npoints,
const bool& onCenters=
false)
606 dx = getDistance()/npoints;
607 for (
int i=0; i<npoints; ++i) getPoint((i+0.5)*dx, points[i]);
611 dx = getDistance()/(npoints-1);
612 for (
int i=0; i<npoints; ++i) getPoint(i*dx, points[i]);
638 double getPoints(
const double &spacing,
double** points,
int &npoints,
const bool& onCenters=
false)
640 npoints = getNPoints(spacing, onCenters);
645 dx = getDistance()/npoints;
646 for (
int i=0; i<npoints; ++i) getPoint((i+0.5)*dx, points[i]);
650 dx = getDistance()/(npoints-1);
651 for (
int i=0; i<npoints; ++i) getPoint(i*dx, points[i]);
683 if (GeoTessUtils::crossNormal(normal, other.normal, intersection) == 0.)
685 intersection[0] = intersection[1] = intersection[2] = NaN_DOUBLE;
689 if (GeoTessUtils::scalarTripleProduct(firstPoint, intersection, normal) < 0.)
691 intersection[0] = -intersection[0];
692 intersection[1] = -intersection[1];
693 intersection[2] = -intersection[2];
696 if (inRange && (getDistance(intersection) >= getDistance()
699 intersection[0] = intersection[1] = intersection[2] = NaN_DOUBLE;
746 v[0] = x[0] * trnsfrm[0][0] + x[1] * trnsfrm[0][1] + x[2]
748 v[1] = x[0] * trnsfrm[1][0] + x[1] * trnsfrm[1][1] + x[2]
750 v[2] = x[0] * trnsfrm[2][0] + x[1] * trnsfrm[2][1] + x[2]
777 double* v =
new double[3];
Manages information about a great circle path that extends from one point to another point,...
double getDistanceDegrees()
int getNPoints(const double &spacing, const bool &onCenters=false)
GeoTessGreatCircle(const double *firstPoint, const double *intermediatePoint, const double *lastPoint, const bool &shortestPath=true)
void set(double *firstPoint, const double &distance, const double &azimuth, const bool &deleteWhenDone=false)
void set(double *frstPoint, double *lstPoint, const bool &shortestPath=true, const bool &deleteWhenDone=false)
double getDistanceDegrees(const double *position)
GeoTessGreatCircle(const double *firstPoint, const double &distance, const double &direction)
double * transform(const double *x)
double * getPoint(const double &dist)
bool getIntersection(GeoTessGreatCircle &other, const bool &inRange, double *intersection)
const double * getNormal()
void getPoint(const double &dist, double *location)
static int getNPoints(const double &dist, const double &spacing, const bool &onCenters=false)
GeoTessGreatCircle(const double *firstPoint, const double *lastPoint, const bool &shortestPath=true)
double getDistance(const double *position)
double getPoints(double **points, const int &npoints, const bool &onCenters=false)
void transform(const double *x, double *v)
virtual ~GeoTessGreatCircle()
GeoTessGreatCircle(GeoTessGreatCircle &other)
double getPoints(const double &spacing, double **points, int &npoints, const bool &onCenters=false)
void set(double *firstPoint, double *intermediatePoint, double *lastPoint, const bool &shortestPath=true, const bool &deleteWhenDone=false)