1. Member
Join Date
Jan 2009
Posts
3
Rep Power
0

## 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. 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. Member
Join Date
Jan 2009
Posts
3
Rep Power
0
So how can I know the angle is for example 90 degrees and nor 270 degrees?

4. 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. Member
Join Date
Jan 2009
Posts
3
Rep Power
0
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. I'm not sure how to do this in Java3D as I'm not really versed in this library. Best of luck.

#### Posting Permissions

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