Isis 3 Programmer Reference
CsmSensor.cpp
1
6/* SPDX-License-Identifier: CC0-1.0 */
7#include "CsmSensor.h"
8
9#include "RasterGM.h"
10
11#include "Orientations.h"
12
13#include "csm.h"
14
15using namespace std;
16
17namespace Isis {
25 CsmSensor::CsmSensor(csm::RasterGM* cam, ale::Orientations *j2000Rot) {
26 m_cam = cam;
27 m_j2000Rot = j2000Rot;
28 }
29
30
37 SensorUtilities::ObserverState CsmSensor::getState(const SensorUtilities::ImagePt &imagePoint) {
38
39 csm::ImageCoord csmImagePt(imagePoint.line, imagePoint.sample);
40
41 double sensorTime = m_cam->getImageTime(csmImagePt);
42
43 csm::EcefLocus locus = m_cam->imageToRemoteImagingLocus(csmImagePt);
44
45 SensorUtilities::Vec lookVec = {locus.direction.x, locus.direction.y, locus.direction.z};
46
47 ale::Vec3d aleLookVec = {locus.direction.x, locus.direction.y, locus.direction.z};
48 ale::Vec3d aleJ2000LookVec = m_j2000Rot->rotateVectorAt(sensorTime, aleLookVec);
49 SensorUtilities::Vec lookVecJ2000 = {aleJ2000LookVec.x, aleJ2000LookVec.y, aleJ2000LookVec.z};
50
51 SensorUtilities::Vec sensorPos = {locus.point.x, locus.point.y, locus.point.z};
52
53 SensorUtilities::ObserverState sensorState = {
54 lookVec,
55 lookVecJ2000,
56 sensorPos,
57 sensorTime,
58 imagePoint};
59
60 return sensorState;
61 }
62
63
71 SensorUtilities::ObserverState CsmSensor::getState(const SensorUtilities::GroundPt3D &groundPt) {
72 SensorUtilities::Vec groundCoord = SensorUtilities::sphericalToRect(groundPt);
73 csm::EcefCoord csmGroundPt = {groundCoord.x, groundCoord.y, groundCoord.z};
74 csm::ImageCoord csmImagePt = m_cam->groundToImage(csmGroundPt);
75 SensorUtilities::ImagePt imagePoint = {csmImagePt.line, csmImagePt.samp};
76 return getState(imagePoint);
77 }
78
79}
ale::Orientations * m_j2000Rot
The time dependent rotation from object space to J2000.
Definition CsmSensor.h:37
virtual SensorUtilities::ObserverState getState(const SensorUtilities::ImagePt &imagePoint)
Get the state of the model at a given image point.
Definition CsmSensor.cpp:37
CsmSensor(csm::RasterGM *cam, ale::Orientations *j2000Rot)
Create a CSMSensor from a CSM RasterGM model and the rotation to J2000.
Definition CsmSensor.cpp:25
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
Namespace for the standard library.