Hi there, I am having some syntax and logical implementation problems with a really very simple requirment and I am hopeing someone can help point me in the right direction.

The problem I am having concrens trignometric functions in 3d space and what I am trying to do is find the angle of tragectory between 2 points in 3d space. I have solved the problem on paper and con not seem to understand the syntax to implement in java. I hope the following example explains the intent a little better.

point1 = x1, y1, z1 (starting point)

point2 = x2, y2, z2 (end point)

the first step I used was to calculate the distance between each point element

xd = x2 - x1

yd = y2 - y1

zd = z2 - z1

the second step was to calculate the magnitude of the vector x1,z1 to x2,z2

Vxz = sqrroot(xd^2 + zd^2)

Vxz is then to be used to calculate the angle (a) based on trig functions

tan a = yd / Vxz

once I have this i can then use that angle to move the point2 to a given distance from point1, working in reverse by first calculating new values for yd and Vxz via

yd = distance * Cos a

Vxz = distance * Sin a

etc

I am aware that I will also need to calculate the angle of tragectory from point x1,z1 to x2,z2 in order for the new cordinates to give the required location.

This seems a long way around the problem, so if anyone has any ideas on how to speed up the process please let me know, if not any help with the syntax required for the trig functions would be greatly apreciated.

Thanks and sorry for the bad spelling.