Help with Altivec

Posted:
in Genius Bar edited January 2014
I have a matrix for rotations. I want to multiply this matrix to say 2-100 other matricies. for now I am just trying to do it with one. In the header for a multiplication it says that the matrix is an array of 4 float vectors.



So I have: vector float rotationMatrix [4];



To get the values into each vector I dont know what to do. From what I saw, it should look like this:



rotationMatrix [0] = (vector float) (cos(theta), sin(theta), 0.0, 0.0);



but I get an error saying that is is not a constant. How do I assign the variables into a vector correctly?



The second part is weird to. I want to put 3 floats from a vector into a struct.



my code is:



newVector.x = answer [0] ;

newVector.x = answer [1] ;

newVector.x = answer [2] ;



where answer is the 4th vector from the answer of the multiplication matrix.



So, um what am I doing wrong because I have no clue, and the documentation isnt to helpful. Google is not too clear either.

Comments

Sign In or Register to comment.