
27 Dec
2009
27 Dec
'09
6:04 a.m.
OvermindDL1 pravi:
On Sat, Dec 26, 2009 at 8:33 PM, anony
wrote: I have this variable definition:
float vertices[][3] = { {-1, -1, 1}, {1, -1, 1}, {1, 1, 1}, {-1, 1, 1}, {-1, -1, -1}, {1, -1, -1}, {1, 1, -1}, {-1, 1, -1} };
I want to scale all elements of vertices, by some constant, for now I do it like this:
BOOST_FOREACH(float& f, boost::make_iterator_range( boost::begin(vertices[0]), boost::end(vertices[7]))) { f *= scale; }
Are you sure that is correct, you are only multiplying the first 7 floats (out of 8*3=24)...
Nope, I am multiplying all the 24 of them (I've checked!). boost::begin() and boost::end() only return pointers (i.e., vertices[0] is an array in itself, not a single float).