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 Discussion / Listen Up Again Everyone!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Author
Message
Clarks
21
Years of Service
User Offline
Joined: 30th Oct 2003
Location: BALTIMORE,MARYLAND
Posted: 8th Dec 2003 04:23
I recently read a post were i posted something about DB math functions and some one wrote to me that raw math functions are better and faster that DB math functions.

So you should already know what the question is.

Are raw math functions much better than DB built in math functions and are they much faster?Also what are the benefits of using raw math functions over DB math functions if there are any?


(Example)
Using sin, cos, and tan, for making objects orbit one-another or using DB newxvalue, newyvalue, and newzvalue.
John H
Retired Moderator
22
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 8th Dec 2003 14:06
Why not do a test and record how fast each one does an entire loop...


Dont forget to Join the Forums!
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 8th Dec 2003 14:49
I personally like the SIN and COS equivalents to NEWVALUE, simply because I'm more used to them. They do exactly the same thing except it might be easier to use NEWYVALUE than trying to make the SIN/COS equivalent.

OBJANG#=230
DIST#=10.0
NX#=NEWXVALUE(NX#,OBJANG#,DIST#)
NZ#=NEWZVALUE(NZ#,OBJANG#,DIST#)

Or

OBJANG#=230
DIST#=10.0
NX#=NX#+(SIN(OBJANG#)*DIST#)
NZ#=NZ#+(COS(OBJANG#)*DIST#)

6 and half a dozen IMO.


Van-B


I laugh in the face of fate!
Monty87
21
Years of Service
User Offline
Joined: 8th Dec 2003
Location: not very deep in the west country, eng
Posted: 8th Dec 2003 22:42
cut back on the exclaimation marks mate.

Monty
Clarks
21
Years of Service
User Offline
Joined: 30th Oct 2003
Location: BALTIMORE,MARYLAND
Posted: 9th Dec 2003 00:24
THANKS FOR THE RESPONSES
ANYMORE
I WILL DO A TEST TO SEE WHICH IS FASTER
Doucan
21
Years of Service
User Offline
Joined: 26th Nov 2003
Location: Vermont USA
Posted: 9th Dec 2003 02:35
Ok, This may make you think I am a complete and total idiot, but what do sin() and cos() actually do? If it takes to long to explain don't bother.

If you come to a fork in the road, take it!

-Yogi Berra
Hell IVIonkey
22
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 9th Dec 2003 06:31 Edited at: 9th Dec 2003 06:32
In terms of game programming, it helps you find out how far to move in the various directions (x,y,z) when your angle is not a multiple of 90 degrees.

Check out these two articles for help:
http://mathworld.wolfram.com/Sine.html
http://mathworld.wolfram.com/Trigonometry.html

Doucan
21
Years of Service
User Offline
Joined: 26th Nov 2003
Location: Vermont USA
Posted: 10th Dec 2003 01:55
Well... I still don't get it. Those are the same as newxvalue, etc., right? If they are I'll just look up those because I'm wasting everybody's time!!

If you come to a fork in the road, take it!

-Yogi Berra
Hell IVIonkey
22
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 10th Dec 2003 08:33
It's very important to understand trig in game programming because you will need to use them for things other than moving and camera positions. If you want to find the angle between objects/points, you'll need trig, specifically ATAN().

Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 10th Dec 2003 10:16
Yeah, learn as much trig as you can stand - when it comes to doing things like flattening a model onto a matrix and collision detection, you'll be glad of the extra knowledge.


Van-B


I laugh in the face of fate!
Clarks
21
Years of Service
User Offline
Joined: 30th Oct 2003
Location: BALTIMORE,MARYLAND
Posted: 11th Dec 2003 07:43
thanks for the info

Login to post a reply

Server time is: 2025-05-22 03:53:18
Your offset time is: 2025-05-22 03:53:18