Game Development Reference
In-Depth Information
To fill mvEquationResults from 0 to 40, we simply call:
FillVector( 41 );
Below is what that data would look like:
x
y
0
100
1
98
2
96
3
94
38
24
39
22
40
20
Again, this seems ridiculously easy. In fact, it seems like a lot of wasted effort
when we could have simply used the equation itself for any value of x . However,
this does allow us to manipulate the results of that equation. For instance, if we
want y to be the result of the equation except when x = 27, in which case we want
y = 1.0, we can change that single entry in the vector.
mvEquationResults[27] = 1.0;
This may seem like an inconsequential benefit at the moment. However, we
will soon see that this ability lies at the heart of the power behind response curves.
Just for the sake of completeness, we can recover a value by simply retrieving
the contents of the vector element.
y = mvEquationResults[x]
Not a lot to it, eh?
A DVANCED 1- TO -1 M APPINGS
The above example is simplified somewhat by the fact that the x range that we are
working with is between 0 and 40. We have the luxury of using the vector indices
that, for a group of 41 elements, start at 0 and end at 40. We are not able to do this if
the range with which we want to deal starts at, for example, 125 and extends to 165.
Search WWH ::




Custom Search