Advertisement

Double array (Matrix) passing problem

Started by July 11, 2000 02:05 PM
9 comments, last by ByteMe95 24 years, 6 months ago
        //You can use two starsvoid Identity(float** matrix){matrix[0][0] = matrix[1][1] = matrix[2][2] = matrix[3][3] = matrix[4][4] = 1.0f;//zero the rest...}//or a referencetypedef float mymatrix[4][4];void Identiry(mymatrix& matrix){matrix[0][0] = matrix[1][1] = matrix[2][2] = matrix[3][3] = matrix[4][4] = 1.0f;//zero the rest...}float** Fiddle(float** matrix){float** matI;matI = (float**)new float[4];for(long j=0;j<4;j++)   matI[j] = new float[4];return matI;//delete like thisfor(j=0;j<4;++)   delete[] matI[j];delete[] matI;}/*though that uses 20bytes not 16 like if you used an array mapping function on a float[16] & returned a float* like some matrix stuff is done...  classes are nice because you can overload operators, like (int,int) so you can use 16bytes & still index the like D3DXMATRIX */matrix(1,1) = 1.0f;    


Edited by - Magmai Kai Holmlor on July 11, 2000 12:22:17 AM
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara

This topic is closed to new replies.

Advertisement