confuse over sin and cos

Started by
6 comments, last by kayX 22 years, 6 months ago
i see a lot of ppl using cos function for their x value i mean pos.x = cos(theta) pos.z= sin(theta) how come? i use sin for pos.x and cos for pos.z very confusing
Advertisement
You should post this question in the Math forum.
Not the Dx forum
oopppppsssssss
i forgot bout that
Preference I suppose. Why do you use sin for x? I like to picture a xz plane the same way as a xy plane, with z taking y''s place. In an xy plane, angles typically come out of the x-axis. So, x=cos(theta), y=sin(theta). If it''s xz, then I''d use x=cos(theta), z=sin(theta). You''re measuring angles coming off the z-axis. Hence, the sin/cos are switched. I had this with somebody I was working with. I wrote all my math functions assuming the angles came out of x, they did it your way. Yes, it was annoying to wrap my head around it at times.
It all comes out of convention. By default, theta (or the angle) is measured in respect to the x-axis. Thus, when a right triangle is drawn, the x component (the horizontal leg of the triangle), it is equal to R cos theta where R is the length of the hypotenuse, and the y component (the vertical leg of the triangle) is R sin theta.

Free Speech, Free Sklyarov
Fight the unconstitutional DMCA.

Commander M
But what about an xz plane? (zx plane?)
It doesn''t make one bit of difference if you use sin for x or cos for x, just so long as you stay consistent. R cos theta for x was derieved from a trig circle, and that is why it is used, however, if you want to make sin x, that''s fine, but you had better make sure theta agrees! For instance, if you want theta to be a 0 degree angle and it points -> that way, then when you pass 0 to sine, sine will return 0, so that means that the velocity in terms of sine will be 0. Now, obviously, if an object were moving this direction ( -> ) and x velocity = sin(theta) and theta equaled 0, then the x velocity would be 0 which is wrong. It should obviously be 1. Now what returns 1 when theta equals 0? Our good old friend cosine. That is why x velocity = scale_coeffincent cos theta. So if you want x velocity to equal sin theta, then you must rotate your trig circle 90 degrees so that at the direction ->, theta would be 90 degrees and 0 degrees theta would be a directional vector of ^ (up). Also, 3-dimensional problems are the same as 2d, just pretend the motion is on one plane. Hope this explains things.
Cheers,
Jesse
Je est un Autre.
Physics and math use slightly different coordinate systems. Mathematicians like to measure theta counterclockwise from "east," and physicists like to measure it clockwise from "north." Personally, I much prefer the approach physicists use, but there''s no logical reason that it''s better. You need to know which system you''re in though, because, if it''s the physicist''s system, then x is found with sine and y with cosine, and if you''re using the mathematician''s system, then it''s the other way around.

This topic is closed to new replies.

Advertisement