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

  • Home
  • SEARCH
  • 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 8993267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:09:22+00:00 2026-06-15T23:09:22+00:00

I am working on showing a 3D model (IFC) in Java3D. I need to

  • 0

I am working on showing a 3D model (IFC) in Java3D. I need to rotate the object with 2 vectors, a direction vector and a axis vector that are given by the IFC model.

But I can’t figure out how to get the right angle.

Code:

// Create vectors
Vector3f directionVector = new Vector3f(dx, dy, dz);
Vector3f axisVector = new Vector3f(ax, ay, az);

//Calculate angle
float angle = axisVector.angle(directionVector);

//create AxisAngle4f
AxisAngle4f axisAngle = new AxisAngle4f(axisVector, angle);

The axisVector is always (0.0, 0.0, 1.0), so it needs to be rotated on the Z-axis

But when I calculate the angle it seems always 1.5707964 (90°):

Example 1:
dir:    (-1.0, 0.0, 0.0)
axis:   (0.0, 0.0, 1.0)
angle:  1.5707964 (90.00000250447816)
AA:     (0.0, 0.0, 1.0, 1.5707964)

Example 2:
dir:    (0.0, 1.0, 0.0)
axis:   (0.0, 0.0, 1.0)
angle:  1.5707964 (90.00000250447816)
AA:     (0.0, 0.0, 1.0, 1.5707964)

Example 3:
dir:    (1.0, 0.0, 0.0)
axis:   (0.0, 0.0, 1.0)
angle:  1.5707964 (90.00000250447816)
AA:     (0.0, 0.0, 1.0, 1.5707964)

I know through testing that -1.0 means inverted so 180°.

Can some one help me understanding what I am doing wrong?

Edit

Documentation for the placement object (Direction and axis)

Screenshots of the results:

  • Orange: are the floors
  • Green: is the roof
  • Red: is de rotation point
  • Left: Side perspective
  • Right: Top perspective
  • The group of 3 slabs have direction direction (0.0, 1.0, 0.0)
  • The group of 2 slabs have direction direction (1.0, 0.0, 0.0)
  • Roof has direction: (-1.0, 0.0, 0.0)

I did the *2 test to simulate the 180° of -1.0. as you can see in the last example the roof is correctly drawn.

enter image description here

enter image description here

  • 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-15T23:09:23+00:00Added an answer on June 15, 2026 at 11:09 pm

    You don’t need the angle between the direction vector and the axis vector. Since your axis vector is always (0.0, 0.0, 1.0), you can define a constant vector of (1.0, 0.0, 0.0) to which you can compare the direction vector, i.e.:

    // Create vectors
    Vector3f directionVector = new Vector3f(dx, dy, dz);
    Vector3f axisVector = new Vector3f(ax, ay, az);
    Vector3f constantBaseVector = new Vector3f(1, 0, 0);
    
    //Calculate angle
    float angle = constantBaseVector.angle(directionVector);
    
    //create AxisAngle4f
    AxisAngle4f axisAngle = new AxisAngle4f(axisVector, angle);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am little bit confuse that I am showing images through css it's working
I am working on an MVC 4 project that is constantly showing the ValidationMessage
I have errors in a model that are showing up in the view when
I am working in a project that have a Person model. I display the
I have a method that will provide an array of model object. Some of
I am working on MVC and in the model I created a class that
I'm working with an Article like model that has a DateTimeField(auto_now_add=True) to capture the
I am currently working on calendar showing starting date and ending date of various
i created one grid view application, it's working fine now showing all images in
Currently working with NSURLConnection. Found a great website showing important delegate methods coming with

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.