Hi Chilli,
I have used arrays quite extensivey over the years for different projects, but I just came across this page
http://www.mochima.com/tutorials/vectors.html
It said in C++ they talk about Vectors rather than arrays. Anyway it seems vectors can change size on the fly and have some of the funtionality you put into your score class.
I know they use vectors in 3D.
So what is the difference between a vector and an array?
Asimov
Vectors or Arrays?
Vectors or Arrays?
----> Asimov
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk
Re: Vectors or Arrays?
Okay, before I answer your question, we need to address this.Asimov wrote:I know they use vectors in 3D.
The term 'vector' has different meanings depending on what we're talking about, so we need to be careful about using it.
In mathematics, a vector is something that has magnitude and direction. It is generally represented by a [1 by n] matrix or an [n by 1] matrix (row vector or column vector). However, it need not be represented by a matrix (matrix is basically the mathematical equivalent of an array).
In C++, a vector is an array which can dynamically resize. When we talk about vectors, we usually mean std::vector, which can not only dynamically resize, but also provides facilities such as out of bounds testing.
When using mathematical vectors, we need not use std::vector. In fact, we often won't when we use hardware-accelerated 3D (because of the way direct3D works).
In general, we will be making more use of std::vector in the future because it is easier than managing arrays and it's safer. However, in situations where speed or memory usage are an issue, we will naked arrays (for example, surfaces will always be arrays, never vectors). Also, there are functions that only take naked arrays as parameters, so in those cases too we will be using naked arrays.
Chili
Re: Vectors or Arrays?
Hi Chill,
Cool I can't wait.
Asimov
Cool I can't wait.
Asimov
----> Asimov
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk
Re: Vectors or Arrays?
what branch are vectors apart of.. ? physics?
Re: Vectors or Arrays?
Vectors are a pure math concept. They see a lot of use in physics calculations.
Chili