Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pitch > 90 degrees #4851

Merged
merged 77 commits into from
Oct 28, 2024
Merged
Changes from 1 commit
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
f34aaa3
squashed changes to support pitch > 90
NathanMOlson Oct 19, 2024
10b38e7
fix merge conflicts
NathanMOlson Oct 17, 2024
83c9f32
fix changelog screwup
NathanMOlson Oct 17, 2024
f9dda9f
fix lint and adjust build size
NathanMOlson Oct 17, 2024
4843479
better naming
NathanMOlson Oct 18, 2024
4698d69
remove jumpToLLA (it can be made a plugin)
NathanMOlson Oct 18, 2024
4e3f107
fix render tests by breaking camera-centric behavior
NathanMOlson Oct 18, 2024
02ecf12
better naming
NathanMOlson Oct 18, 2024
2b0929c
add setRoll operation
NathanMOlson Oct 18, 2024
3ef2ad6
fix pitch95 render test
NathanMOlson Oct 18, 2024
1da2ea3
add pitch=90 roll=135 render test
NathanMOlson Oct 18, 2024
aed96e5
add render test for pitch95 with terrain
NathanMOlson Oct 18, 2024
39e7b23
test getMercatorHorizon() at high pitch
NathanMOlson Oct 18, 2024
d5bf672
add test for recalculateZoomAndCenter without terrain
NathanMOlson Oct 18, 2024
6054901
documentation
NathanMOlson Oct 18, 2024
17ef87e
<89 -> <=89
NathanMOlson Oct 18, 2024
589d0c8
LLA -> LngLatAlt
NathanMOlson Oct 18, 2024
9c05c31
fix lint
NathanMOlson Oct 18, 2024
39dec29
Merc -> Mercator
NathanMOlson Oct 18, 2024
8d5ff83
add public API function setCenterElevation(), and remove render test …
NathanMOlson Oct 18, 2024
845e32f
don't let camera distances go negative
NathanMOlson Oct 19, 2024
72aca37
change the mercator horizon heuristic to be continuous, and update re…
NathanMOlson Oct 19, 2024
7ec73ab
function to only set elevation if center point is below horizon
NathanMOlson Oct 19, 2024
3eb4a0a
update sky render tests
NathanMOlson Oct 19, 2024
9b29a53
update changelog
NathanMOlson Oct 19, 2024
d2dae37
revert unintended package changes.
NathanMOlson Oct 20, 2024
0bfdc8f
revert unnecessarry shader change
NathanMOlson Oct 20, 2024
9173573
updated maxPitch docs
NathanMOlson Oct 20, 2024
9e9c950
fix spelling
NathanMOlson Oct 20, 2024
06a0e22
add named constant maxMercatorHorizonAngle
NathanMOlson Oct 20, 2024
f514d75
use roll and pitch spec definitions in sky render tests
NathanMOlson Oct 20, 2024
a1b1fc0
move __setElevationIfCenterPointBelowHorizon() from Transform to Map
NathanMOlson Oct 20, 2024
52156b2
change mercator horizon limit from 89 to 89.25, so that horizon heuri…
NathanMOlson Oct 20, 2024
9cd34d6
update comment
NathanMOlson Oct 20, 2024
09cce24
fix lint
NathanMOlson Oct 20, 2024
339a0c3
update unit tests for new horizon heuristic
NathanMOlson Oct 20, 2024
1d76a42
revert unchanged render test results
NathanMOlson Oct 20, 2024
ea54dfa
add switch to control "centerClampedToGround" behavior
NathanMOlson Oct 21, 2024
b224639
fix render tests
NathanMOlson Oct 21, 2024
9c957f0
Update src/geo/projection/mercator_utils.ts
HarelM Oct 21, 2024
9ec4fa2
Apply suggestions from code review
HarelM Oct 21, 2024
365615d
Update src/geo/transform_interface.ts
HarelM Oct 21, 2024
3ded9f2
Don't update center point if there is nothing to do (this was causing…
NathanMOlson Oct 21, 2024
f045bd1
Add an example showing center point at the top of a building and pitc…
NathanMOlson Oct 21, 2024
c614f78
remove warnings about pitch angles > 60.
NathanMOlson Oct 21, 2024
98a6bd8
move cameraMercatorCoordinateFromCenterAndRotation() to mercator_utils
NathanMOlson Oct 21, 2024
f1fff70
Restore old setLocationAtPoint(). This fixes unit tests but breaks `c…
NathanMOlson Oct 21, 2024
692e788
better unit test coverage and documentation for calculateCenterFromCa…
NathanMOlson Oct 21, 2024
8fd3c93
add @internal
NathanMOlson Oct 21, 2024
bbfb97e
code cleanup
NathanMOlson Oct 21, 2024
fa33e02
Add calculateCameraOptionsFromCameraLngLatAltRotation() and unit tests
NathanMOlson Oct 21, 2024
418231f
add developer guide describing center point.
NathanMOlson Oct 21, 2024
b059f53
move high-pitch render tests to high-pitch folder
NathanMOlson Oct 21, 2024
56b7b6d
fix build
NathanMOlson Oct 21, 2024
1d40a3e
update high pitch + terrain render test to remove setPitch() call
NathanMOlson Oct 21, 2024
8b86f8e
use transform's elevation in setLocationAtPoint()
NathanMOlson Oct 22, 2024
818de68
fix jumps when using the mouse to rotate past 90 degrees pitch
NathanMOlson Oct 22, 2024
33779dd
further safety against numerical issues near the horizon
NathanMOlson Oct 22, 2024
95dab2f
fix spelling
NathanMOlson Oct 22, 2024
b730093
make centerClampedToGround get/set symmetric
NathanMOlson Oct 22, 2024
ee0e474
split recalculateZoomAndCenter unit tests.
NathanMOlson Oct 22, 2024
c8c8322
simplify center-point example
NathanMOlson Oct 22, 2024
0ae6699
add examples for calculateCameraOptionsFromTo() and calculateCameraOp…
NathanMOlson Oct 22, 2024
38aeaaf
origPixelPerMeter -> originalPixelPerMeter
NathanMOlson Oct 22, 2024
7389a0a
whitespace
NathanMOlson Oct 22, 2024
461487a
simplify center-point example
NathanMOlson Oct 22, 2024
f00d9a4
set minZoom in example so we don't lose the map
NathanMOlson Oct 22, 2024
11c0dde
remove unnecessary limit on _farZ
NathanMOlson Oct 22, 2024
e661375
change pseudocode to Typescript
NathanMOlson Oct 22, 2024
02d44fd
add unit tests to cover various code paths in _updateMapTransform()
NathanMOlson Oct 22, 2024
564b710
update build size
NathanMOlson Oct 22, 2024
612b070
Update developer-guides/center-point.md
HarelM Oct 23, 2024
6000c53
use local variables
NathanMOlson Oct 23, 2024
941037b
move "underground" check to _elevateCameraIfInsideTerrain()
NathanMOlson Oct 25, 2024
2ce4343
fix high-pitch render tests, which were having their pitch angle modi…
NathanMOlson Oct 25, 2024
4682db8
return early in case of no terrain and pitch < 90
NathanMOlson Oct 25, 2024
53e5f0e
Merge branch 'main' into camera-centric
HarelM Oct 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
change pseudocode to Typescript
  • Loading branch information
NathanMOlson committed Oct 22, 2024
commit e6613757ef8684183476423c9ce19bfee7bb352a
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