[Papervision3D] Quaternions vs matrix
Philippe Ajoux
philippe.ajoux at gmail.com
Tue Jan 16 14:16:16 EST 2007
Tim Knip wrote:
> Got a MatrixMath as3 class (4x4 OpenGL column-order) which I could
> contribute....
>
> A matrix in this class is an array and looks like this:
> [
> [1, 0, 0, 0],
> [0, 1, 0, 0],
> [0, 0, 1, 0],
> [0, 0, 0, 1]
> ];
>
> So its array instead of object (m.a0, m.a1 etc)...
> Would object-access be faster the array-access?
>
> Class methods:
> 1. makeScale
> 2. makeRotation
> 3. makeTranslation
> 4. mult
> 5. invert
> also some methods for creating texture Matrix.
>
> Tim
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D at osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
>
I just did a quick test with 3 object variables, and one 3 element array.
I then timed the milliseconds it takes to have each variable incremented
by 1..
so,
x0++; x1++; x2++;
and
x[0]++; x[1]++; x[2]++;
To do this 90,000 times it took on average:
30 ms for the object access and 47 ms for array access. So object access
is still faster in AS3.0.
Also, for kicks I wanted to know how long it would take to loop through
the array using
a for loop instead of direct access. Takes about 81 ms.
More information about the Papervision3D
mailing list