The Sensor class methods for computing phase, incidence, and emission angle are all incorrect except for spheres.
Any cube for which the ShapeModel of the target is an EllipsoidShape will report different values for the emission and incidence angles because these values depend upon the normal vector (which is now being calculated differently). The difference will be more noticeable in highly elliptical shapes than in more spherical shapes.
The methods for computing phase, incidence, and emission angle in the Sensor class are incorrectly using the vector from the center of the body to the surface point as the normal vector. This vector is only normal if the target body is a sphere. See the Naif routine, surfnm.c, to see how to calculate the normal for an ellipsoid.
Note:: At the time of this posting the code for computing these angles is in the Sensor class. A new class, EllipsoidShape, is under construction, and it will eventually contain these methods.
The shape classes have been completed. See ShapeModel::calculateEllipsoidalSurfaceNormal() for the incorrect code.
- SPIKE: Research provided for how to correctly do this calculation.
- If a simple fix (and still have SP), fix it and test it; otherwise, create a ticket.
- Truth file will be added
Note: Truth will be hand calculated.
#8 Updated by Jean Backer almost 2 years ago
The EllipsoidShape class now exists and has methods calculateDefaultNormal(), calculateSurfaceNormal() and calculateLocalNormal().
The first two call calculateEllipsoidalSurfaceNormal() from the parent class (ShapeModel). This method calculates the ellipsoid normal by subtracting spacecraft position from the surface point position. This is only the surface normal if the shape is spherical.
The third method in EllipsoidShape (calculateLocalNormal) calculates the norm using NAIF's surfnm routine. This routine takes the triaxial radii values and the surface point position to find the correct normal for an ellipsoid.
It appears as though there should be a single method for the ellipsoid that uses the surfnm routine.
Note: When using an ellipsoidal shape model, the emission angle and local emission angle should be identical. However, calculateDefaultNormal() is used to get the emission angle and calculateLocalNormal() is used to get the local emission angle and these values do not match if the body is not spherical. You can use Enceladus test data to see the difference. (See Tammy Becker)
#19 Updated by Marjorie Hahn about 1 year ago
- Status changed from Code Review to Feedback
Code Review Comments:
- Check the spacing in DemShape's calculateDefaultNormal() and EllipsoidShape's calculateLocalNormal(), they do not seem to be indented correctly.
- It appears that calculateEllipsoidalSurfaceNormal() is still being called in ShapeModel's unit test, make sure to remove that.
- I think there are some leftover debugging lines commented out in EllipsoidShape's calculateLocalNormal()? Otherwise it is not clear why those are in there.
#21 Updated by Tyler Wilson 12 months ago
Marjorie's review suggests have been applied.
The script I used to verify the components for the normal vector can be find here:
The /work/projects/latest/m01028/testing/output.txt file displays surface point intersection (the pB values), the three radii of the target body, and the normal vector calculated by the EllipsoidShape class using these parameters after the bug fix was applied. The Python script takes a couple of these points from this file, and verifies that the solution matches what ISIS is outputting.
- Status changed from Resolved to Closed
I've tested this on a few varying target body images (sphere, triaxial). I ran phocube to produce emission and incidence angle cubes and displayed these with qview and compared with what the tracking tool reports for emission and incidence. Everything matches as expected. The local emission and local incidence angles with a shape model involved were not impacted by this fix.