Isis 3 Programmer Reference
IsisShape.cpp
1
6/* SPDX-License-Identifier: CC0-1.0 */
7#include "IsisShape.h"
8
9#include <QVector>
10
11#include "ShapeModel.h"
12#include "SurfacePoint.h"
13
14using namespace std;
15
16namespace Isis {
21 m_shape = shape;
22 }
23
24
32 SensorUtilities::Intersection IsisShape::intersect(const SensorUtilities::Vec &sensorPos, const SensorUtilities::Vec &lookVec, bool computeLocalNormal) {
33 vector<double> pos = {sensorPos.x, sensorPos.y, sensorPos.z};
34 vector<double> look = {lookVec.x, lookVec.y, lookVec.z};
35 m_shape->intersectSurface(pos, look);
36 SurfacePoint *intersection = m_shape->surfaceIntersection();
37 if (computeLocalNormal && !m_shape->isDEM()) {
38 QVector<double *> unusedNeighborPoints(4);
39 double origin[3] = {0, 0, 0};
40 unusedNeighborPoints.fill(origin);
41 m_shape->calculateLocalNormal(unusedNeighborPoints);
42 }
43 else {
44 m_shape->calculateSurfaceNormal();
45 }
46 vector<double> normal = m_shape->normal();
47 return {
48 {intersection->GetX().meters(), intersection->GetY().meters(), intersection->GetZ().meters()},
49 {normal[0], normal[1], normal[2]}};
50 }
51}
double meters() const
Get the displacement in meters.
virtual SensorUtilities::Intersection intersect(const SensorUtilities::Vec &sensorPos, const SensorUtilities::Vec &lookVec, bool computeLocalNormal=true)
Intersect the ShapeModel.
Definition IsisShape.cpp:32
IsisShape(ShapeModel *shape)
Create an IsisShape that wraps an ISIS ShapeModel.
Definition IsisShape.cpp:20
Define shapes and provide utilities for Isis targets.
Definition ShapeModel.h:66
virtual bool isDEM() const =0
Indicates whether this shape model is from a DEM.
virtual SurfacePoint * surfaceIntersection() const
Returns the surface intersection for this ShapeModel.
virtual std::vector< double > normal()
Returns the surface normal at the current intersection point.
This class defines a body-fixed surface point.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
Namespace for the standard library.