# Thread: Vector Rotation 3D - determine correct angle

1. ## Vector Rotation 3D - determine correct angle

Hi,

I am hoping someone can help me with this.

Background:

I am writing a program to automate some finite element analysis. My program initally describes a setof connected lines which can be directed anywhere in 3D space. I then mesh these lines with elements that have an orientation vector perpendicular to the lines.

What I need to do is determine the element orientation vector from points describing the lines and the angle of rotation at the apexs. I do this by defining an initial orientation vector and then using Rodrigues' Rotation Formula to rotate the vector as required, which appears to be working (although I have only tested simple examples so far).

The Problem:

The problem I am having is this: The angle that decribes the rotation is always an angle less than pi and rotation is always anti-clockwise. However I need my orientation vectors to always remain on the same side of the curve. I have attached a couple of small diagrams to help demonstrate this (i think the rotation arrows point the wrong way - please excuse this).

I am looking for a way to tell if I need to reverse the direction of the vector I obtain after rotation.

I hope that this is explained okay, please let me know if you need more information and if any help given could be in fairly simplistic terms it would be appreciated, my maths isn't great.

Robyn

2. I have been doing a bit more research into this and i think that I basically need to know which of the two vectors described by the lines is head. then if the 2nd vector is ahead I use the angle and if the first vector is head I use -angle in the rotation.

I've seen something about using atan rather than acos for vectors in 2D, is it possible to extend this to 3D vectors?

I need to write up my logic on how I have to go the point i am so far for the programs user guide and so when I ahve done that I will upload it to give more details on the logic I have followed so far.

Regards

Robyn