# xyz

This topic is 4389 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I would like to get the End Point (x,y,z) of a certain line with fixed Radius and at fixed vertex at (0,0,0). I have an instrument to give me angle (theta) when the line moves either up or down. I also placed an angular meter to give me angle when the line moves either clockwise or counterclockwise. I would appreciate any advice on how to calculate the end points. Thank you very much.

##### Share on other sites
It's not very clear... Could you post a image to illustrate your problem?

##### Share on other sites
end_point(x,y,z) = origin(x,y,z) + line_direction(x,y,z) * line_length(radius)

eg, origin = (0,0,0), direction = (0.5,0.5,0), length = 100

End(x) = 0 + 0.5 * 100
End(y) = 0 + 0.5 * 100
End(z) = 0 + 0 * 100
End = (50,50,0)

Is that what you were asking for?

##### Share on other sites
I want to attach a sketch but I dont know how.

Anyway, please imagine am holding a straight stick pointing to the sun. The lenght of stick is known as Radius (R).
1. With a given instrument I will be able to know the angle of the stick with reference to the ground (theta).
2. With another given instrument, I will be able to know the angle when the stick either moves to the left or right direction (phi).

Now, i want to calculate the (x,y,z) point at the end of the stick. How can i do that? Thank you very much for your kind help.

##### Share on other sites
You need trigonometry.

Its slightly easier if we do it for Radius=1, then multiply by the real radius at the end.

First, lets look at the horizontal angle, Theta - this will give us x and z

Sin(angle) = Opposite/Hypotenuse

h=1, o=z, a=x

z = Sin(theta)
x = Cos(theta)

Now we have the line in two dimensions, but we need the vertical component from Phi.

y = Sin(phi)
ratio = Cos(phi)

Now we need to combine the first 2D line with the vertical component using the "Horizontal_To_Vertical_Ratio". Then we can multiply by the radius

Here's an explanation of trigonometry:
http://www.mathwords.com/s/sohcahtoa.htm

[Edited by - PhilMorton on October 16, 2006 1:19:45 AM]

##### Share on other sites
The OP actually means a conversion from spherical to cartesian co-ordinates.
Look e.g. here:
http://mathworld.wolfram.com/SphericalCoordinates.html
http://en.wikipedia.org/wiki/Spherical_coordinates

##### Share on other sites
Quote:
 Original post by haegarrThis is actually a conversion from spherical to cartesian co-ordinates.Look e.g. here:http://mathworld.wolfram.com/SphericalCoordinates.htmlhttp://en.wikipedia.org/wiki/Spherical_coordinates

I guess my explanation is just a manually derived version of this wikipedia image...

Go Wikipedia!

##### Share on other sites
Quote:
Original post by PhilMorton
Quote:
 Original post by haegarrThis is actually a conversion from spherical to cartesian co-ordinates.Look e.g. here:http://mathworld.wolfram.com/SphericalCoordinates.htmlhttp://en.wikipedia.org/wiki/Spherical_coordinates

I guess my explanation is just a manually derived version of this wikipedia image...

Sorry, the formulation I've chosen wasn't clear: With "This is actually ..." I meant the OP's problem but wasn't concerning your above answer .

You are right in using trigonometrics for this problem. However, I suspect the conclusions in your 2nd reply, since after cancelling there remains
1 - ratio = ratio
Perhaps it would be nice for the OP if you give him some explanations for what you mean there.

##### Share on other sites
Hi Haegarr and Phil,

Thanks a lot. I think that is what I am looking for. Spherical Coordinates. I am now making my algorithm for my application and so far i am getting the correct results.

Thank you very much.

1. 1
Rutin
44
2. 2
3. 3
4. 4
5. 5

• 11
• 9
• 12
• 10
• 13
• ### Forum Statistics

• Total Topics
632984
• Total Posts
3009713
• ### Who's Online (See full list)

There are no registered users currently online

×