Alright I have sets of arrays, created from the vertices of points of a triangle, named matrixVertice1 matrixVertice 2 and matrixVertice 3. I am translating the points by multiplication.
Moving dX points on the X, and dY points on the Y axii.
In theory, the matrice for this formula should look like this:
float matrixTrans[3][3]= {{1, 0, 0},{0, 1, 0},{dX, dY, 1}};
which is multiplied by each set of points. The user is asked to define dX and dY.
First, can I do it like that? (define the matrixTrans as such). If so, I am trying to output the translation matrix to the user:
//displays the translation matrix
cout %26lt;%26lt; "We are multiplying each vertice by: " %26lt;%26lt; endl;
for (i = 0; i %26lt; 3; i++){
for (j = 0; j %26lt; 3; j++ ){
cout%26lt;%26lt; matrixTrans[3][3] %26lt;%26lt; endl;
}
}
However the output is incorrect.
I suppose the real question is how to output a pre-defined matrix.. when 2 elements of the matrix are defined by the user. I know how to make a matrice the user inputs entirely, but not this
C++ outputting a stored matrix array?
Are you sure this line is right?
cout%26lt;%26lt; matrixTrans[3][3] %26lt;%26lt; endl;
Shouldn't it be.
for (int a = 0; a %26lt; 3; a++) {
for (int b = 0; b %26lt; 3; b++) {
cout%26lt;%26lt; matrixTrans[a][b] %26lt;%26lt; endl;
}
}
Or something similar to that.
Reply:you need a cin
Reply:Wow, I don't know a thing about Comp. Sci.
Well, I do know that the guys that take it are hot!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment