Skip to content

Commit

Permalink
change pseudocode to Typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanMOlson committed Oct 22, 2024
1 parent 7f1a442 commit a5cf6fa
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions developer-guides/center-point.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ The `Transform` variables `center`, `elevation`, `zoom`, `pitch`, `bearing`, and

Together, `zoom`, `elevation`, and `pitch` set the altitude of the camera:

Pseudocode (implemented in `MercatorTransform::_calcMatrices()`):
```
cameraToCenterDistancePixels = 0.5 / tan(fov/2) * viewportHeight
pixelPerMeter = mercatorUnitsPerMeter(center.lat) * worldSize
cameraToCenterDistanceMeters = cameraToCenterDistancePixels / pixelsPerMeter
cameraAltitude = centerElevation + cameraToCenterDistanceMeters*cos(pitch)
See `MercatorTransform::getCameraAltitude()`:
```typescript
getCameraAltitude(): number {
const altitude = Math.cos(this.pitchInRadians) * this._cameraToCenterDistance / this._helper._pixelPerMeter;
return altitude + this.elevation;
}
```

![image](assets/center-point_nominal.png)
Expand Down

0 comments on commit a5cf6fa

Please sign in to comment.