Results 1 to 6 of 6
  1. #1
    Duesentrieb is offline Member
    Join Date
    Jan 2009
    Posts
    3
    Rep Power
    0

    Default Java3D Vector3d.angle(Vector3d)

    Hello Folks

    I am new here and i hope you can help me. Here my question:

    Java Code:
    		_v3dA = new Vector3d(1, [B]0[/B], 0);
    		_v3dB = new Vector3d(1, [B]1[/B], 0);
    
    		double angleZ = _v3dA.angle(_v3dB);
    and

    Java Code:
    		_v3dA = new Vector3d(1, [B]1[/B], 0);
    		_v3dB = new Vector3d(1, [B]0[/B], 0);
    
    		double angleZ = _v3dA.angle(_v3dB);
    is always 45 Degrees without a prefix. How can I know in which direction the angle is? Or do i misunderstand something?

    Thanks for hints,
    Duesentrieb

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    what do you mean "without a prefix"? angles don't have direction, they just have value. In other words, an angle is a scalar value.
    Last edited by Fubarable; 01-20-2009 at 03:52 PM.

  3. #3
    Duesentrieb is offline Member
    Join Date
    Jan 2009
    Posts
    3
    Rep Power
    0

    Default

    So how can I know the angle is for example 90 degrees and nor 270 degrees?

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    You don't. If you go to the API for Vector3D#angle(...), it tells you that the return value is constrained to be between 0 and PI (180 degrees). Thus it will never return 270 degrees.

    And this makes sense because in 3 dimensions there really is little difference between 90 and 270 degrees.

  5. #5
    Duesentrieb is offline Member
    Join Date
    Jan 2009
    Posts
    3
    Rep Power
    0

    Default

    Yes thank you. The result is between 0 and pi.

    So how can I do this for example:

    I have 2 different (a+b) line in a 3d room. now i wanna translate line a parallel to line b. How can I do this?

  6. #6
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    I'm not sure how to do this in Java3D as I'm not really versed in this library. Best of luck.

Similar Threads

  1. Calculate X and Y given starting angle and distance
    By nidhirastogi in forum Java 2D
    Replies: 5
    Last Post: 08-18-2008, 11:24 PM
  2. Java3D
    By gowry in forum Advanced Java
    Replies: 0
    Last Post: 04-21-2008, 09:07 AM
  3. Rotations and traslations in java3d
    By elberral in forum AWT / Swing
    Replies: 0
    Last Post: 04-15-2008, 04:38 PM
  4. Java3D: Clicking and getting coordinates?
    By seabhcan in forum Advanced Java
    Replies: 0
    Last Post: 01-11-2008, 03:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •