sine and cosine

Forum Archive - from http://theuniversal.net
Locked
User avatar
Mattizme
Posts: 615
Joined: Sat Oct 04, 2003 6:23 pm
Location: At work/school/home
Contact:

sine and cosine

Post by Mattizme »

Just a quick question today - does anyone know the header file in C that contains sine and cosine? I have a feeling that it's math.h, but I'm not sure.

Anyone care to enlighten me?
User avatar
Magicfinger
Staff
Staff
Posts: 1078
Joined: Tue Sep 30, 2003 10:38 am
Location: here,there and everywhere

Post by Magicfinger »

yep math.h will do it and sin, tan, hsin, hcos, htan, asin, acos, atan, atan2, etc...
User avatar
Mattizme
Posts: 615
Joined: Sat Oct 04, 2003 6:23 pm
Location: At work/school/home
Contact:

Post by Mattizme »

Tanks.

Camouflaged ones. Lots of netting.
Ephialtes
Posts: 46
Joined: Wed Oct 08, 2003 4:12 pm
Location: UK
Contact:

Post by Ephialtes »

Oh no! C++ involves all that sin/cos/tan stuff? I hate that :S
User avatar
Mit
Staff
Staff
Posts: 3551
Joined: Sun Sep 21, 2003 10:14 pm
Location: Unknown

Post by Mit »

pretty much any graphics programming (in any language) will involve knowing about sin & cos (and vectors, matrices and trigonometry in general)
Ephialtes
Posts: 46
Joined: Wed Oct 08, 2003 4:12 pm
Location: UK
Contact:

Post by Ephialtes »

We are doing that at the moment :D
User avatar
Magicfinger
Staff
Staff
Posts: 1078
Joined: Tue Sep 30, 2003 10:38 am
Location: here,there and everywhere

Post by Magicfinger »

well if you want to do anything with 3d games wether it be modelling, programming or even modding learn it well coz ur gonna need it :)
User avatar
Mattizme
Posts: 615
Joined: Sat Oct 04, 2003 6:23 pm
Location: At work/school/home
Contact:

Post by Mattizme »

heh, I learnt an interesting fact the other day - sin x / cos x = tan x ;)
User avatar
Mit
Staff
Staff
Posts: 3551
Joined: Sun Sep 21, 2003 10:14 pm
Location: Unknown

Post by Mit »

particularly handy for 2d stuff is..

angle = asin(y/h)
angle = acos(x/h)
angle = atan(y/x)

etc.
Particularly handy as you'll often get in situations where u have the x,y coords or speeds of objects that you need to find the angle between.
Ya have to be careful with those tho, as there are special cases you need to take into account (like when the x in atan(y/x) is 0) and often you cannot get useful information from those equations without first knowing the relative positions of the objects involved.
User avatar
hedgehog
Staff
Staff
Posts: 1057
Joined: Tue Sep 30, 2003 2:57 am
Location: ann arbor, michigan
Contact:

Post by hedgehog »

yeah i know all about that stuff.

cosign is what you have to get from your parents when you're 19 and trying to get into a new apartment.

atan is what you get on the beach

asin is making a joke this lame.
Locked