Convert between Three.js's euler rotation and Openscad's camera #236

Merged
Irev-Dev merged 1 commits from kurt/235 into main 2021-03-12 09:56:57 +01:00
Irev-Dev commented 2021-03-11 22:36:06 +01:00 (Migrated from github.com)

This felt like it was so much harder than it needed to be. Finally figured it out. The main thing I was struggling with was that I needed to change the order that the euler rotations were applied to match what openscad does (which is just sorta implicit in openscad I believe), but kinda went down a deep rabbit hole of learning about quaternions, then coming back out to realise there was a simple solution there. Feel like I have a bit more concepts under by belt now though.

https://user-images.githubusercontent.com/29681384/110857832-6bb88380-830d-11eb-9e14-c6024aa68899.mov

I managed to get the position to work as well (needs to be scaled by 10 exactly? not sure where that magic number comes from). Perspective seems off between the two cameras, more work to do I guess is what I'm saying.

Resolves #235

This felt like it was so much harder than it needed to be. Finally figured it out. The main thing I was struggling with was that I needed to change the order that the euler rotations were applied to match what openscad does (which is just sorta implicit in openscad I believe), but kinda went down a deep rabbit hole of learning about quaternions, then coming back out to realise there was a simple solution there. Feel like I have a bit more concepts under by belt now though. https://user-images.githubusercontent.com/29681384/110857832-6bb88380-830d-11eb-9e14-c6024aa68899.mov I managed to get the position to work as well (needs to be scaled by 10 exactly? not sure where that magic number comes from). Perspective seems off between the two cameras, more work to do I guess is what I'm saying. Resolves #235
franknoirot (Migrated from github.com) approved these changes 2021-03-12 02:31:42 +01:00
franknoirot (Migrated from github.com) left a comment

This is working great! A few thoughts:

  • I don't think you need that explanatory paragraph up top after this resolution right?
  • Trying it out I actually enjoyed having the image remain slightly visible while dragging the cube, maybe 20-30%, because I could better gauge how much I was changing the view. What are your thoughts?
  • I think we should update the default OpenSCAD camera state to match your ThreeJS camera, because as of now the initial render doesn't align to the view cube but it starts to after your first adjustment with the cube.
This is working great! A few thoughts: - I don't think you need that explanatory paragraph up top after this resolution right? - Trying it out I actually enjoyed having the image remain slightly visible while dragging the cube, maybe 20-30%, because I could better gauge how much I was changing the view. What are your thoughts? - I think we should update the default OpenSCAD camera state to match your ThreeJS camera, because as of now the initial render doesn't align to the view cube but it starts to after your first adjustment with the cube.
franknoirot (Migrated from github.com) commented 2021-03-12 02:25:45 +01:00

Love this addition of markers.

Love this addition of markers.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: h3n3/cadhub#236