Skip to content

Commit 7dc4ef8

Browse files
authored
Merge pull request #564 from pro3d-space/bugs/planetsForTrafos
bugfix: rework planets for transformations
2 parents 95433df + 7f50e7a commit 7dc4ef8

5 files changed

Lines changed: 45 additions & 11 deletions

File tree

PRODUCT_RELEASE_NOTES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2+
## 5.4.0
3+
- planets updates for local resSys in transforamtions
4+
15
## 5.3.0-prerelease1
26
- axis-ellipses added
37
- area calculation for closed polygons and ellipses included

aardium/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "PRo3D",
33
"productName": "PRo3D.Viewer",
4-
"version": "5.3.0-prerelease1",
4+
"version": "5.4.0",
55
"description": "PRo3D, short for Planetary Robotics 3D Viewer, is an interactive 3D visualization tool to allow planetary scientists to work with high-resolution 3D reconstructions of the Martian surface.",
66
"license": "AGPL",
77
"copyright": "VRVis Zentrum für Virtual Reality und Visualisierung Forschungs-GmbH",
@@ -37,8 +37,8 @@
3737
"run-script-os": "^1.1.1"
3838
},
3939
"build": {
40-
"appId": "space.pro3d.app",
41-
"buildVersion": "${version}.0",
40+
"appId": "space.pro3d.app",
41+
"buildVersion": "${version}.0",
4242
"extraFiles": [
4343
"build/build"
4444
],

src/PRo3D.Core/TransformationApp.fs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ module TransformationApp =
6767
| ImportTrafoData of list<string>
6868
| SetRefSysMode of ReferenceSystemMode
6969
| SetPivotMode of PivotMode
70+
| UpdatePlanetInLocalRefSys
7071

7172

7273
// calc reference system from pivot
@@ -102,9 +103,10 @@ module TransformationApp =
102103
let northCorrection = Trafo3d.RotationZInDegrees(refSystem.noffset.value)
103104

104105
match refSystem.planet with
105-
| Planet.Earth
106-
| Planet.ENU ->
106+
| Planet.Earth ->
107107
Trafo3d.FromOrthoNormalBasis(V3d.IOO, V3d.OIO, V3d.OOI) * northCorrection
108+
| Planet.ENU ->
109+
Trafo3d.FromOrthoNormalBasis( V3d.OIO, V3d.IOO, V3d.OOI) * northCorrection
108110
| Planet.Mars | Planet.Moon | Planet.Phobos | Planet.Deimos ->
109111
let north, up, east =
110112
let north = refSystem.northO.Normalized
@@ -118,17 +120,19 @@ module TransformationApp =
118120
| Planet.JPL ->
119121
Trafo3d.FromOrthoNormalBasis(-V3d.IOO, V3d.OIO, -V3d.OOI) * northCorrection
120122
| Planet.None ->
121-
northCorrection
123+
// northCorrection
124+
Trafo3d.FromOrthoNormalBasis(V3d.IOO, V3d.OIO, V3d.OOI) * northCorrection
122125
| _ -> failwith ""
123126

124127
let getReferenceSystemBasis_local
125128
(directions : Affine3d)
126129
(planet : Planet) =
127130

128131
match planet with
129-
| Planet.Earth
130-
| Planet.ENU ->
132+
| Planet.Earth ->
131133
Trafo3d.FromOrthoNormalBasis(V3d.IOO, V3d.OIO, V3d.OOI)
134+
| Planet.ENU ->
135+
Trafo3d.FromOrthoNormalBasis( V3d.OIO, V3d.IOO, V3d.OOI)
132136
| Planet.Mars ->
133137
let north, up, east = getNorthUpEastFromLocalRefSys directions
134138
let refSysRotation =
@@ -137,7 +141,8 @@ module TransformationApp =
137141
| Planet.JPL ->
138142
Trafo3d.FromOrthoNormalBasis(-V3d.IOO, V3d.OIO, -V3d.OOI)
139143
| Planet.None ->
140-
Trafo3d(directions)
144+
//Trafo3d(directions)
145+
Trafo3d.FromOrthoNormalBasis(V3d.IOO, V3d.OIO, V3d.OOI)
141146
| _ -> failwith ""
142147

143148
let translationFromReferenceSystemBasis
@@ -435,6 +440,13 @@ module TransformationApp =
435440
p', af
436441
| _ -> model.pivot, model.refSys
437442
{ model with pivotMode = mode; pivot = pivot; refSys = af}
443+
| UpdatePlanetInLocalRefSys ->
444+
match model.refSys with
445+
| Some rf ->
446+
let af = getLocalRefSys refSys rf.Trans
447+
{ model with refSys = Some af}
448+
| None -> model
449+
438450

439451
module UI =
440452

src/PRo3D.Viewer/Program.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ type Result =
5252
result : string;
5353
}
5454

55-
let viewerVersion = "5.0.7-prerelease1"
55+
let viewerVersion = "5.4.0"
5656
let catchDomainErrors = false
5757

5858
open System.IO

src/PRo3D.Viewer/Viewer/Viewer.fs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1371,7 +1371,25 @@ module ViewerApp =
13711371
let m =
13721372
m
13731373
|> Optic.set _refSystem refsystem'
1374-
|> SceneLoader.updateCameraUp
1374+
|> SceneLoader.updateCameraUp
1375+
1376+
//changing the planet requires update of local reference systems
1377+
let m =
1378+
match a with
1379+
| ReferenceSystemAction.SetPlanet planet ->
1380+
let flat' =
1381+
m.scene.surfacesModel.surfaces.flat
1382+
|> HashMap.map (fun k v ->
1383+
let s = Leaf.toSurface v
1384+
let sgSurface = m.scene.surfacesModel.sgSurfaces |> HashMap.find k
1385+
let bbCenter = sgSurface.globalBB.Center
1386+
Leaf.Surfaces {
1387+
s with transformation =
1388+
(TransformationApp.update s.transformation TransformationApp.Action.UpdatePlanetInLocalRefSys m.scene.referenceSystem bbCenter)
1389+
}
1390+
)
1391+
{ m with scene = { m.scene with surfacesModel = { m.scene.surfacesModel with surfaces = { m.scene.surfacesModel.surfaces with flat = flat' }}}}
1392+
|_ -> m
13751393

13761394
//changing the reference system also requires adaptation of angular measurement values
13771395
Log.startTimed "[Viewer.fs] recalculating angular values in annos"

0 commit comments

Comments
 (0)