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 / What's a 'vector' in dark basic?

Author
Message
MicroMan
22
Years of Service
User Offline
Joined: 19th Aug 2003
Location: Stockholm, Sweden
Posted: 7th Sep 2003 01:10
Is it a point or a line?

In other 3d systems a vector is a point with a position, length and a direction. I.e. it is a sort of one-dimensional object -- a one dimensional line, heading somewhere and ending somewhere. At each end there is a vertex.

But a vector in DB is only adressed with X, Y and Z if I understand it correctly... If the above definition was true it should be respresented by six numbers.

Like:

Vertex 1 : <Ax,Ax,AZ>
Vertex 2 : <Bx,By,Bz>

A line goes between Vertex 1 and Vertex 2, and that is the vector. But it seems in DBP the Vector is represented only by 3 numbers. If you add Vertex 1 with Vertex 2 like this...

<Cx,Cy,Cz> = <Ax+Bx,Ay+By,Az+Bz>

... you should only get another point in space...

Vectors confuse me... At least in DBP.

-----
They SAID that given enough time a million monkeys with typewriters could recreate the collected works of William Shakespeare... Internet sure proved them wrong.
-----
Dr OcCuLt
23
Years of Service
User Offline
Joined: 27th Nov 2002
Location: a Dark Deep Dark pit, it dark in here
Posted: 7th Sep 2003 02:16
a vector is a line from the orgin to a set point. so a Vector is represented 3 numbers.
the orgin to the set point in the x axis.
the orgin to the set point in the y axis.
the orgin to the set point in the z axis.

becos the orgin is 0,0,0 then we just call the 3 numbers x,y and z

yes all vector have a length and a direction you just have to work them out from x,y and z

--Dr 0--
Rye
23
Years of Service
User Offline
Joined: 30th May 2003
Location: United Kingdom, Blackrod
Posted: 8th Sep 2003 00:27
you are both wrong.
a vector is just something that has magnitude and direction and it doesnt have to pass through the origin.

There are different types of vectors:-
position vectors
unit vectors
displacement vectors

In A-Level maths we used i j and k as the x, y and z components.
For position vectors i+j+k would be the same as 1,1,1 and 2i+2j+2k would be 2,2,2.

for displacement vectors
a=i+j and b=j+k
the displacement vector from a to b would be -i+k

a unit vectors just have a magnitude of 1.

I didnt understand much of it theres loads more. As to vectors in DBP i dont have a clue how to use them or what they are. Im gonna wait until they update the help system.
Dr OcCuLt
23
Years of Service
User Offline
Joined: 27th Nov 2002
Location: a Dark Deep Dark pit, it dark in here
Posted: 8th Sep 2003 02:10
i`m not wrong. but this is a sicky subject and you can look in two diffrent texts book and see two diffrent ways to explane who vertex work

i,j and k are unit vertex just of the the axis ie i=1,0,0 j=0,1,0 and so on.

--Dr 0--
ChipOne
23
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Canada
Posted: 8th Sep 2003 21:13
don't look to math-based definitions for vectors in the dbp world. vectors are more-complex-than-normal data types in dbp. you can instanciate vector2, vector3 and vector4 vectors, which hold [x,y], [x,y,z] and [x,y,z,w] respectively. there isn't adequate use of vectors yet in the language, but it has been identified in many posts that it should be.

Catmull Rom Sample Code

the above code uses vectors, if you want to see them in action in dbp.

cheers

-= i only do what my rice krispies tell me to do =-
Plystire
23
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 9th Sep 2003 23:42
a vector is a vector no matter where it is.

Vector n. : A direction with a speed

which is just what it says. If an object has a vector then it will be moving in that direction at that speed

~PlystirE~
Hamish McHaggis
23
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 10th Sep 2003 00:16
A vector is a direction with a distance. It can be written in different ways. I'll use a 2d example to be simple.

A vector could be written like this...

100 along the x axis
100 along the y axis

This would have a direction of 100x,100y and a length of sqrt(100^2+100^2), because I can't be arsed to find the length.

You could also write a vector like this...

50 units at 40 degrees

This would have a length of 50 units and a bearing of 40 degrees.

I believe they are based around two different coordinate systems, cartisian and something else . The first example is the one used in darkbasic pro, the second I don't think is used as much but I suppose it has some use. Anyone with basic knowledge of triganometry can translate between the two.

Vectors have loads of uses, especially in 3D and 2D calculations, for example, the vector perpendicular to another (2D) vector can be found by...

vector = (x,y)
perp vector = (-y,x)

The dot product of 2 vectors can be used to tell what angle is between them...

angle = acos(dot product of 2 unit vectors)

Unit vectors being vectors with a total length of 1.

This is a simple program that uses perp vectors and dot products to check if the mouse is inside a triangle...



Brains are for idiots.

Athelon XP 1400 Plus - Nvidia Geforce MX400 - 256mb RAM
Drac X
22
Years of Service
User Offline
Joined: 6th Sep 2003
Location:
Posted: 10th Sep 2003 08:38
The way I think about it is like this...

A vector is a number that describes something more complex than a point on a number line.

A regular number can only go up or down along the number line that you learned about in grade school. But a 3d vector would describe a point on the number line if the number line extended infinitely in all directions (and I suppose it does).

I'm new to all this vector stuff. So I checked out the articles on them at flipcode. After some reading, I wrote some functions to handle vector arithmatic. The plan is to forget all the xyz vector mumbo jumbo, and let my functions take care of the fact that they are vectors. I'm going to treat them like numbers, because that's that's the way I think about them.

As for what they are, the article on flipcode says that they can describe 3 things: Location, Direction, or Quantity. I like that definition.

Drac - X
_________________
Excerpt from 'A Day in the Life of Some Guy' ©2003
Drac X
22
Years of Service
User Offline
Joined: 6th Sep 2003
Location:
Posted: 10th Sep 2003 08:39
But to answer the original question.... it can be a point or a ray. It can't be a line... at least... I don't think so.

Drac - X
_________________
Excerpt from 'A Day in the Life of Some Guy' ©2003
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 10th Sep 2003 16:12
I'm not going to explain what a vector is, but I can explain what DBPro allows you to use vectors for ...

a position in space
a set of angles (generally euler angles)
a direction (for normals)
a velocity

Basically anywhere you have 2/3/4 related numbers together in one entity.
Hamish McHaggis
23
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 10th Sep 2003 18:01
Of course, I don't know everything about vectors, there's obviously a lot more to them than I know.

Also when I said distance, I meant magnitude, as its not always distance it represents.

Brains are for idiots.

Athelon XP 1400 Plus - Nvidia Geforce MX400 - 256mb RAM

Login to post a reply

Server time is: 2026-07-25 08:12:39
Your offset time is: 2026-07-25 08:12:39