Official websites use .gov
A .gov website belongs to an official government organization in the United States.

Secure .gov websites use HTTPS
A lock ( ) or https:// means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.

Isis 3 Programmer Reference
EllipsoidShape.cpp
1
5
6/* SPDX-License-Identifier: CC0-1.0 */
7#include "EllipsoidShape.h"
8
9#include <QVector>
10
11
12#include <SpiceUsr.h>
13#include <SpiceZfc.h>
14#include <SpiceZmc.h>
15
16#include "Distance.h"
17#include "IException.h"
18#include "IString.h"
19#include "Latitude.h"
20#include "Longitude.h"
21#include "NaifStatus.h"
22#include "ShapeModel.h"
23#include "SurfacePoint.h"
24
25using namespace std;
26
27namespace Isis {
28
35 setName("Ellipsoid");
36 }
37
38
45 setName("Ellipsoid");
46 }
47
48
52 bool EllipsoidShape::intersectSurface (std::vector<double> observerPos,
53 std::vector<double> lookDirection) {
54
55 return (intersectEllipsoid(observerPos, lookDirection));
56 }
57
58
66 bool EllipsoidShape::isDEM() const {
67 return false;
68 }
69
70
91 if(!hasNormal()) {
93 }
94
96 }
97
98
107
108 std::vector<Distance> radii = targetRadii();
109
110 double a = radii[0].kilometers();
111 double b = radii[1].kilometers();
112 double c = radii[2].kilometers();
113
114 double rlat = lat.radians();
115 double rlon = lon.radians();
116
117 double xyradius = a * b / sqrt(pow(b * cos(rlon), 2) +
118 pow(a * sin(rlon), 2));
119 const double &radius = xyradius * c / sqrt(pow(c * cos(rlat), 2) +
120 pow(xyradius * sin(rlat), 2));
121
122 return Distance(radius, Distance::Kilometers);
123 }
124
125}
double radians() const
Convert an angle to a double.
Definition Angle.h:226
Distance measurement, usually in meters.
Definition Distance.h:34
@ Kilometers
The distance is being specified in kilometers.
Definition Distance.h:45
EllipsoidShape()
Initialize the EllipsoidShape.
bool intersectSurface(std::vector< double > observerPos, std::vector< double > lookDirection)
Intersect the shape model.
bool isDEM() const
Indicates that this shape model is not from a DEM.
void calculateLocalNormal(QVector< double * > cornerNeighborPoints)
Calculate the local surface normal of the current intersection point.
Distance localRadius(const Latitude &lat, const Longitude &lon)
Get the local radius for a point on the surface.
This class is designed to encapsulate the concept of a Latitude.
Definition Latitude.h:51
This class is designed to encapsulate the concept of a Longitude.
Definition Longitude.h:40
void setLocalNormal(const std::vector< double >)
Sets the local normal for the currect intersection point.
bool intersectEllipsoid(const std::vector< double > observerPosRelativeToTarget, const std::vector< double > &observerLookVectorToTarget)
Finds the intersection point on the ellipsoid model using the given position of the observer (spacecr...
virtual void calculateSurfaceNormal()
Calculate surface normal.
virtual std::vector< double > normal()
Returns the surface normal at the current intersection point.
std::vector< Distance > targetRadii() const
Returns the radii of the body in km.
ShapeModel()
Default constructor creates ShapeModel object, initializing name to an empty string,...
bool hasNormal() const
Returns surface point normal status.
void setName(QString name)
Sets the shape name.
This class is used to create and store valid Isis targets.
Definition Target.h:63
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
Namespace for the standard library.