HoareLea / sam-viewer

Online Sustainable Analytical Model (SAM) JSON file interactive 3D viewer
MIT License
4 stars 2 forks source link

Update: Sam Viewer v-2020-05-22 #3

Open theo-armour opened 4 years ago

theo-armour commented 4 years ago

https://hoarelea.github.io/sam-viewer/sam-viewer/

image

Updates include

Suggestion

In real-time 3D graphics "up" is more important than a side direction. For example see:

https://en.wikipedia.org/wiki/Gimbal_lock

It would simplify matters for coding the Viewer if the JSON files provided the Y-axis rather than ( or along with ) the X-axis. If nothing else it would negate the need for a rotation around the Z-axis as is needed in the current version.

Putting it another way, instead of negotiating a somewhat complex matrix multiply, there would be simple calls to use the Three.js Object3D.up vector and the Object.3D.lookAt point. These sorts of English-like calls make like much easier for junior programmers.

theo-armour commented 4 years ago

@ZiolkowskiJakub

Please have a look at the 'suggestion' section in the original post of this issue - and comment on the possibility of adding or changing to the Y-axis.

michaldengusiak commented 4 years ago

@theo-armour as requested we implemented AxisY this means all current examples will not work so I move them to subfolder and loaded new version for roofs and floors here , we need to fix some bug so more examples to follow

JSON example

    "PanelType": "Roof",
    "PlanarBoundary3D": {
      "_type": "SAM.Analytical.PlanarBoundary3D,SAM.Analytical",
      "Guid": "a11fa6b0-2705-46eb-8e0d-7d3a6769157f",
      "Plane": {
        "_type": "SAM.Geometry.Spatial.Plane,SAM.Geometry",
        "Origin": {
          "_type": "SAM.Geometry.Spatial.Point3D,SAM.Geometry",
          "X": 5.0,
          "Y": 2.5,
          "Z": 0.0
        },
        "Normal": {
          "_type": "SAM.Geometry.Spatial.Vector3D,SAM.Geometry",
          "X": 0.0,
          "Y": 0.0,
          "Z": 1.0
        },
        "AxisY": {
          "_type": "SAM.Geometry.Spatial.Vector3D,SAM.Geometry",
          "X": 0.0,
          "Y": 1.0,
          "Z": 0.0
        }