setting statically sized multi-dimensional arrays
Bill Baxter
dnewsgroup at billbaxter.com
Tue Jan 22 04:33:09 PST 2008
Hoenir wrote:
> Spacen Jasset schrieb:
>> void MakeRotationAboutX(float[4][4] m, float angle)
>> {
>> m[] = [[1f, 0, 0, 0],
>> [0, cos(angle * PI / 180), sin(angle * PI / 180), 0],
>> [0, -sin(angle * PI / 180), cos(angle * PI / 180), 0],
>> [0, 0, 0, 1]];
>> }
> why don't you use an extra function for the conversion of deg to rad? it
> will get inlined by the compiler so there's no efficiency loss.
>
> btw you rotate clockwise, is this intented?
Unless he's using row vectors and v' = v * R
Or storing the matrix in column major format for use with Fortran and/or
OpenGL (most likely).
--bb
More information about the Digitalmars-d-learn
mailing list