Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7738307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:13:50+00:00 2026-06-01T08:13:50+00:00

I am working on L-system interpreter and I use quaternion as internal representation of

  • 0

I am working on L-system interpreter and I use quaternion as internal representation of rotation. I need to export result to ThreeJs JavaScript scene and I found json scene as the best way how to do that.

I found one example of scene on https://github.com/mrdoob/three.js/blob/master/examples/scenes/test_scene.js but there is nothing about quaternion rotations.

So I used help at http://threejs.org/io/s/quaternion and found, that THREE.Object3D has properties quaternion and useQuaternion but It seems to do not work, the error is raised by scene loader (probably because of missing “rotation” attribute, see EDIT at the end):

"obj": {
    ...
    "quaternion": [0.38268343236509,0,0,0.923879532511287],
    "useQuaternion": true
}

I’ve also tried to convert quaternion to Euler angles but It wont work for me, probably because of other order of applying of angles (I assume order Y, Z, X). In the above example, quaternion is representing rotation about the Z axis (pitch) by 135 degrees which is converted to Euler angles [pi,pi,pi/4] but it is displayed not correct in the scene.

Following picture shows blocks each rotated by 11 deg more than other by Z axis. Axes are X(red), Y(green) and Z (blue). The upper half is rotated incorrectly due to incorrect conversion quaternion to Euclid (I used this page for implementation: http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/ ).

ilustration of the problem

EDIT: After further examination the error raised by scene loader is because of missing “rotation” attribute on object. Following output do not throw error and scene is loaded but it is wrong (in the same way as shown image) because quaternion rotations are ignored.

"obj": {
    ...
    "rotation": [3.14159265358979,3.14159265358979,0.785398163397449],
    "quaternion": [0.38268343236509,0,0,0.923879532511287],
    "useQuaternion": true
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T08:13:52+00:00Added an answer on June 1, 2026 at 8:13 am

    I think I solved my problem. This is not direct answer to my question, just how I workaround that.

    Problem is in scene loader, which does not work with quaternion rotations. I rewritten scene generation script to generate scene directly in JS.

    var mesh = new THREE.Mesh(geometry, material);
    ... set position & scale ...
    mesh.rotation.x = 3.141;
    mesh.rotation.y = 3.141;
    mesh.rotation.z = 0.785;
    mesh.updateMatrix();
    scene.add(mesh);
    

    Then I found magic property eulerOrder on THREE.Object3D which is set to ‘XYZ’ in default which was causing my problems (attached image in question), my quaternion-euler conversion was designed for ‘YZX’ so I changed that.

    mesh.eulerOrder = 'YZX';
    

    Thats it. I have no time for experimenting with scene loader but IF it is possible to set eulerOrder property with scene loader than it will be sollution to second part of my question.

    The best would be setting quaternion directly in scene definition but it will probably require changes in scene loader itself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working in an insane mess of a CMS system where php, javascript, and
In .NET 3.5, I'm going to be working with System.Reflection to use AOP (probably
I am working with System.Func but have reached a stumbling block with it. System.Func<TReturn>
So i am trying to get a simple system working where i have an
I am working on a system (PHP based, but unimportant for this) that keeps
I am working in embedded system domain. I would like to know how a
I'm working with a system that consists of several applications and services, almost all
I am working on a system on which currently linux kernel and microwindows windowing
I'm working on a system than has to be pretty scalable from the beginning.
I'm working on a system that relies in $_SERVER['REMOTE_ADDR'] to get the user address

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.