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 / Advantages of Vector2 over custom UDT & Functions

Author
Message
Burning Feet Man
18
Years of Service
User Offline
Joined: 4th Jan 2008
Location: Sydney, Australia
Posted: 11th Apr 2013 06:42
A question for those who are experienced with Vector2 commands; is there any real advantage through their use? Or is it really just as easy, (if not easier?), to manage all my data in my own structured UDT's complimented by custom written functions to perform the same calculations as the Vector2 commands.

Any thoughts on this subject would be most appreciated.

Help build an online DarkBASIC Professional help archive.
DarkBasic Help Wikia
Mage
Valued Member
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location:
Posted: 11th Apr 2013 08:14
If you are able to do either, then write both functions. Loop them 100000 times and get both versions total completion times. Then just use the faster method.

There's an argument to be made about code complexity, but I usually side with performance.

Burning Feet Man
18
Years of Service
User Offline
Joined: 4th Jan 2008
Location: Sydney, Australia
Posted: 17th Apr 2013 01:47
Oh how interesting! I'm reading now that you can call a Vector3 return to replace X,Y,Z variables when using a camera commands, etc! I think I'm starting to see why Vector commands could be useful, as that looks like a pretty clear advantage.

Mage, good thinking with the test as well. Always the obvious things isn't it (well, with me it is... )!

Help build an online DarkBASIC Professional help archive.
DarkBasic Help Wikia
Dar13
18
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 17th Apr 2013 04:37
I usually used my own functions/types because I had to call a function every time I wanted to access a single component of the variable instead of accessing a simple data structure. All those little function calls can eventually add up, especially if they have to be sprinkled throughout a 20,000 line project.

Login to post a reply

Server time is: 2026-07-07 12:28:33
Your offset time is: 2026-07-07 12:28:33