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)
250 GeoTessGreatCircle(
const double* firstPoint,
const double& distance,
const double& direction);
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;
720 double** getTransform();
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];
static int getNPoints(const double &dist, const double &spacing, const bool &onCenters=false)
Return number of points required to span specified great circle distance with points that have spacin...
Definition: GeoTessGreatCircle.h:559
Definition: ArrayReuse.h:55
double getPoints(double **points, const int &npoints, const bool &onCenters=false)
Retrieve a bunch of unit vectors equally spaced along the great circle between initial and final poin...
Definition: GeoTessGreatCircle.h:601
double getDistanceDegrees(const double *position)
Retrieve the distance in degrees measured from firstPoint to specified unit vector, measured in direction from firstPoint to lastPoint.
Definition: GeoTessGreatCircle.h:470
double * getFirst()
Retrieve a reference to the first unit vector on this GreatCircle.
Definition: GeoTessGreatCircle.h:482
double getPoints(const double &spacing, double **points, int &npoints, const bool &onCenters=false)
Retrieve a bunch of unit vectors equally spaced along the great circle between initial and final poin...
Definition: GeoTessGreatCircle.h:638
double * transform(const double *x)
Project vector x onto the plane of this GreatCircle.
Definition: GeoTessGreatCircle.h:775
Manages information about a great circle path that extends from one point to another point...
Definition: GeoTessGreatCircle.h:168
void transform(const double *x, double *v)
Project vector x onto the plane of this GreatCircle.
Definition: GeoTessGreatCircle.h:742
double getDistance()
Retrieve the angular distance from firstPoint to lastPoint, in radians.
Definition: GeoTessGreatCircle.h:419
bool getIntersection(GeoTessGreatCircle &other, const bool &inRange, double *intersection)
Retrieve the unit vector that lies at the intersection of this GreatCircle and another GreatCircle...
Definition: GeoTessGreatCircle.h:681
double getDistanceDegrees()
Retrieve the angular distance from firstPoint to lastPoint, in degrees.
Definition: GeoTessGreatCircle.h:435
GeoTessGreatCircle()
Default constructor initializes everything to NULL.
Definition: GeoTessGreatCircle.h:235
double getDistance(const double *position)
Retrieve the distance in radians measured from firstPoint to specified unit vector, measured in direction from firstPoint to lastPoint.
Definition: GeoTessGreatCircle.h:449
void set(double *frstPoint, double *lstPoint, const bool &shortestPath=true, const bool &deleteWhenDone=false)
Set the components of this GreatCircle to specified values.
Definition: GeoTessGreatCircle.h:392
double * getPoint(const double &dist)
Retrieve a unit vector object located on the great circle path a specified distance from firstPoint...
Definition: GeoTessGreatCircle.h:524
const double * getNormal()
Retrieve a reference to the unit vector that is normal to the plane of this great circle (firstPoint ...
Definition: GeoTessGreatCircle.h:508
double * getLast()
Retrieve a reference to the last unit vector on this GreatCircle.
Definition: GeoTessGreatCircle.h:494
int getNPoints(const double &spacing, const bool &onCenters=false)
Return number of points required to span this great circle with points that have spacing not to excee...
Definition: GeoTessGreatCircle.h:578
void getPoint(const double &dist, double *location)
Retrieve a unit vector object located on the great circle path a specified distance from firstPoint...
Definition: GeoTessGreatCircle.h:540
#define GEOTESS_EXP_IMP
Definition: CPPGlobals.h:71