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.

Newcomers DBPro Corner / Vector-commands, what?

Author
Message
Bangla
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: Sweden
Posted: 2nd Oct 2002 11:25
Does anybody know how to correctly implement the vector-commands? They would be a great help when you are programming so you might think there would be more information, tutorial-code or examples to explain them further, but I have found none.

Does anybody know how or where I can find out more about the vector-commands and how they work in general?
Much appretiated!
Seph
21
Years of Service
User Offline
Joined: 3rd Oct 2002
Location:
Posted: 4th Oct 2002 02:33
If you don't mind my asking in the middle of your topic, what are vector commands, anyway?

Bangla
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: Sweden
Posted: 4th Oct 2002 11:38
The vector-commands are part of the 3DMath-commands in the DBPro-package. A vector is something that has both direction and force (like three steps south, 30 degrees by three units, 25 mph to the left and so on.) as opposed to a scalar that has just force. (2 kg, 3 meters and so on.)

Using vectors when moving stuff about is very handy. You can split up a vector in it's components so you could edit them and I thought the vector-commands was to help the user do just that. But I might have been wrong, I don't really know what they do at all! And I can't make the demos or examplefiles work so I'm kinda stuck.
I'm building a physics engine and fast vector-calculations are essential! That's why it would have been good with some good vector-commands.

400 Mhz, 120 Meg, TNT2 - and then some...
Bangla
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: Sweden
Posted: 7th Oct 2002 13:09
*hehe* I guess everyone is as lost on these commands as me. =)

400 Mhz, 120 Meg, TNT2 - and then some...
Zero
21
Years of Service
User Offline
Joined: 28th Aug 2002
Location: Finland
Posted: 7th Oct 2002 15:56
Yeah. DBS should make some improvement to the help-files

The evil plan is now even closer!
- - - - - - - - - - - - - - - - - - - -
Specs:- P3 550 Nvidia TNT2M64, 192Mb RAM
HippyGoth
21
Years of Service
User Offline
Joined: 4th Oct 2002
Location: United States
Posted: 7th Oct 2002 17:24
Bangledesh, instead of waffling on, why don't you tell everyone what commands you need help with.

HippyGoth.
Bangla
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: Sweden
Posted: 7th Oct 2002 20:46
HippyGoth: Gladly, gladly. As I stated in the beginning of the thread; I need someone to tell me "how to correctly implement the vector-commands".

In short: I need help with the vector-commands. They are part of the math3D-commands and are (not specific but it's a long list and I don't wanna type it all):

Add Vector
Copy Vector
Delete vector
Divide Vector
Dotproduct Vector
BCC Vector
CCW Vector
Squared Length Vector
Length Vector
X Vector (and Y and Z also)
Hermit Vector
Is Equal Vector
Linear Interpolate Vector
Make Vector
Minimize Vector
Multiply Vector
Normalize Vector
Project Vector
Scale Vector
Set vector
Subtract Vector
Transform Vector
Transform Coords Vector
Transform Normals Vector

... and I don't need to know them all. Just explain how to use one or two in general (with code, I allready know what a vector is so I don't need to know that) and I'm sure I'll figure the rest out for myself.

400 Mhz, 120 Meg, TNT2 - and then some...
tigakub
21
Years of Service
User Offline
Joined: 17th Oct 2002
Location:
Posted: 18th Oct 2002 00:56
REM - HOPE THIS HELPS

REM - ALLOCATE MEMORY FOR THREE VECTORS REFERENCED BY THE
REM - INDICES 1,2, AND 3.
r1 = make vector3(1)
r2 = make vector3(2)
r3 = make vector3(3)

REM - *** NOTE ***
REM - I'm not really sure what the return value means
REM - but I suspect it's 1 if the allocation succeeded
REM - and 0(zero) if DB couldn't allocate the vector
REM - because e.g. you ran out of memory, or you've
REM - already allocated a vector to a particular number. REM - Therefore I check here and exit if any of the
REM - results is 0.
REM - ************

if r1 = 0 goto error
if r2 = 0 goto error
if r3 = 0 goto error

REM - INITIALIZE VECTORS 1 AND 2 WITH SOME VALUES
set vector3 1, 100.0, 200.0, 300.0
set vector3 2, 110.0, 220.0, 330.0

REM - SUBTRACT VECTOR 2 FROM VECTOR 1 AND STORE
REM - THE RESULT IN VECTOR 3
subtract vector3 3, 1, 2

REM - PRINT THE RESULT
print "("+ str$(x vector3(3)) +","+ str$(y vector3(3)) +","+ str$(z vector3(3)) +")"

error:
REM - DEALLOCATE THE VECTORS SO THAT YOU CAN REUSE
REM - 1, 2, AND 3 AGAIN LATER(?)
if r1 = 1 then r1 = delete vector3(1)
if r2 = 1 then r2 = delete vector3(2)
if r3 = 1 then r3 = delete vector3(3)

tigakub
21
Years of Service
User Offline
Joined: 17th Oct 2002
Location:
Posted: 18th Oct 2002 00:59
Oops. The three if statements in the middle are missing thens ... sorry, bad C habit.

Milamber
21
Years of Service
User Offline
Joined: 27th Sep 2002
Location: Australia
Posted: 19th Oct 2002 16:25
With the vector4 commands, I've been told the 4th vector is for the scale of the object, eg if you scale the object dow to 50% of it's initial size.

System Specs: AMD Athlon 1700+ XP, GA-7VRX motherboard, 128MB DDR RAM, GeForce2 MX400 64MB VRAM
Bangla
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: Sweden
Posted: 21st Oct 2002 13:37
Thanks guys! Much appritiated! =)

400 Mhz, 120 Meg, TNT2 - and then some...

Login to post a reply

Server time is: 2024-04-20 08:55:23
Your offset time is: 2024-04-20 08:55:23