Action #2473
Reduce calls to std::acos in model evaluations
| Status: | New | Start date: | 04/27/2018 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assigned To: | % Done: | 0% | ||
| Category: | - | |||
| Target version: | - | |||
| Duration: |
Description
There are many calls to std::acos that are done when computing the offset angle for various spatial models, specifically for the radial models where:
std::acos is fairly computationally intensive, and unnecessary for models like GModelSpatialRadialDisk and GModelSpatialRadialShell. These can be simplified to use the cosine of the offset (or theta in the above equation), thus avoiding computing the arccosine.
GModelSpatialRadialDisk:
The model simply compares the offset value to the radius and returns the value if the offset < radius. Instead, the cosine of the distance can be compared to the cosine of the radius. This is similar to the method used in issue #2309 to speedup ctskymap.
GModelSpatialRadialShell:
This method uses the sine of the offset. There’s a relation for this that could speed things up:
Recurrence
No recurrence.