Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Cos, Sin, and the 3d Math Command Set

Author
Message
Preston C
23
Years of Service
User Offline
Joined: 16th May 2003
Location: Penn State University Park
Posted: 25th Sep 2003 04:58
I know they're all used to calculate certain 3D maths, but how do you use them? This has been puzzling me since I read the 3d math command set in the reference manual, and since documentation is a laugh for the 3d command set, why not post on the forums and see what everyone has to say about em.

PS: Why do I feel like this should be posted in the Newcomers section? Maybe its because I'm not used to all the new features in Pro yet.


Dark Basic Pro has arived! I can feel the power!
Zeal
23
Years of Service
User Offline
Joined: 10th Oct 2002
Location: Colorado Springs, CO
Posted: 25th Sep 2003 06:14 Edited at: 25th Sep 2003 06:19
I slept threw my geometry and trig classes in highschool, so I also had no idea what these commands did. Trust me, you NEED to learn them if youre going to do any serious work in 3d. But dont worry, they really arent that hard to understand. Heres my sin/cos in a nutshell, if at anypoint my explanation confuses you, skip it and go to the link below, they explain it better...

Sin and cos represent ratios of two sides of a triangle based on a angle. The 'sin' of a angle represents the ratio of the Opposit length over the Hypotenuse length. The 'cos' represents the ratio of the Adjacent lenght over the Hypotenuse length. There is also 'tan', which represents ratio of the Opposite length over the Adjacent length, but you really only need to know sin and cos. Keep in mind were talking about RIGHT <-*edit* triangles here.

Example, the 'Sin' of 45 degrees is roughly 0.7. Meaning if started to draw the first line (hypotenuse) of a triangle at a 45 degree angle, the 'Opposite' side of the triangle (the side opposite the 45 degree angle) would always be 0.7 times as long as the hypotenuse. Knowing such ratios, you can figure out the distance of unknown sides of your triangles.

Check this site out

http://math.about.com/gi/dynamic/offsite.htm?site=http%3A%2F%2Fwww.physics.uoguelph.ca%2Ftutorials%2Ftrig%2Ftrigonom.html

All you need is zeal
Preston C
23
Years of Service
User Offline
Joined: 16th May 2003
Location: Penn State University Park
Posted: 25th Sep 2003 14:26
ok, I'll check it out, now if my head would stop hurting from the confusion...


Dark Basic Pro has arived! I can feel the power!
StOrM3
22
Years of Service
User Offline
Joined: 24th Sep 2003
Location: Cyberspace
Posted: 25th Sep 2003 19:45
I second that emotion, I am also confused, and what is the reason we would use the sin and cos for, for instance, like are these needed for changing direction, like if I have a ball bounce off a wall and want it to rebound correctly in the right direction or say for bouncy bullets how would I use these functions, can someone give me an example or sample code and an explanation of what the code is doing..

I would greatly appreciate this, thanks in advance for anyone whom can help with this.

Ken



[PKE] Pain Killa Entertainment(tm) [PKE]
Pain Brings Reality...
[PKE] Pain Killa Entertainment(tm) [PKE]
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 25th Sep 2003 21:15
Well, here's a basic use - rotation of a point around another.



You can also see a good example in Darths ripple 20-liner.

These are only the tip of the iceberg
Powersoft
22
Years of Service
User Offline
Joined: 1st Aug 2003
Location: United Kingdom
Posted: 27th Sep 2003 17:41 Edited at: 27th Sep 2003 17:44
we hve just done trig. so here goes
imagine you have a triangle (see code snippet) with a right angle _| in on corner


if you want to find what X equals you have to know what the two other bits are
eg.
x=__ degrees
o=5
a=10
so x= htan(o/a)
= htan(5/10)
you have then found out the angle

if you need to find the length you do
eg.
o=?
a=15
angle=60
so tan60 (o/15)
o=15*tan60

but if 0=15 anda=? then instead of * tan60 you would /

the way to know what to use is
if you know
h + o you use sin
h + a you use cos
o + a you use tan

htan means inverse tan




hope this was useful



Im not an ALIEN
Preston C
23
Years of Service
User Offline
Joined: 16th May 2003
Location: Penn State University Park
Posted: 27th Sep 2003 17:53


Man, I thought Algebra I was bad last year, I'm gonna hate trig.


Dark Basic Pro has arived! I can feel the power!
Powersoft
22
Years of Service
User Offline
Joined: 1st Aug 2003
Location: United Kingdom
Posted: 27th Sep 2003 18:00
its not that bad it will be useful for rotationg objects in a game like command and conquer so it faces the right way

Im not an ALIEN

Login to post a reply

Server time is: 2026-07-25 07:01:29
Your offset time is: 2026-07-25 07:01:29