Advertisement

Vectors??!?!

Started by August 06, 2000 05:50 AM
1 comment, last by RiAL 24 years, 4 months ago
Is there a way of having a 3d vector?? All the examples are for 2D ones. Can anyone help?
quote: Original post by RiAL

Is there a way of having a 3d vector?? All the examples are for 2D ones. Can anyone help?


A 3D vector is just a 2D vector with an additionnal value.

A 2D Vector : (2,1)

A 3D Vector : (2,1,3)
Advertisement
There surely is a way !!

A 3D vector is basically a 2D vector, each element of which is a vector. Thinking like this will help you understand the problem from the programming point of view.

int aa[5][5]; is basically a table, with 5 rows and 5 columns, when each cell (5*5=25 of those...) is a number.

int aaa[5][5][5]; is ''almost'' the same, a table with 25 cells, each of which is a vector of lenght 5, it is really that simple !
So, the total number of integers you can store here is 5*5*5=125

This topic is closed to new replies.

Advertisement