# Matrix rotation of unit cube

kathrynp shared this question 4 years ago

I have managed to get the cube to rotate about the z and x axes, by applying the appropriate matrix to a single point, then using the 'cube' tool from the drop-down menus. (CubeRz and CubeRx) but trying the same process about the y axis (b=1) the cube suddenly jumps to the wrong position for theta>180.

I could rotate 4 vertices and construct the cube, but it's a lot of commands!

I hoped I could use Applymatrix(Matrix,cube) but cube is not accepted as an object, as far as I can see.

I have also tried to use cube(...) in the input line, but keep getting an error message.

I know there is an inbuilt command, Rotate(), but my students have to know the matrix operations.

What am I doing wrong? Thx!

PS I notice my GGb 5 dates from March (although I did start this on-line) so I will try updating it!

1

I think you have a problem with continuity of transformation of sphere. rotate the cube is not suddenly continue

I am afraid that you must do with two points, at least because hairy ball theorem

perhaps other user can give a solution

2

Hello kathrynp!

I think that you can avoid this "jumping" by changing the definition of your cube.

Try

`c=cube(O,A,vector(C))`
And than

```c_x=(O,Rx*A,vector(Rx*C))
c_y=(O,Ry*A,vector(Ry*C))
c_x=(O,Rz*A,vector(Rz*C))```
I presume, that this "jumping" is caused by the "internal way of GeoGebra" to create the cube by three given points, especially your point D.

Take a short look at the attached file and I hope, that this will solve your problem.

Greetings

mire2

1

Thanks! That's so tidy - especially embedding the rotation in the cube command. I've still got a problem inputting the Cube() command though - It says "Please check your input - number expected O" so I think I'll have to try another re-install.

1

I'll try it when the bug I found in applymatrix are solved

1

I have done the work using the matrix product instead applymatrix over the basic points of a cube

it is not hard

Files: foro.ggb
1

Thanks for your help, everyone! I still don't know why I was getting the error above. I abandoned that file and started fresh, and all worked well. Matrix transformations in 3D are not as straightforward as in 2D! Particularly working out how to generate the transformed cube!

1