Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
cube drawing and rotation

Subject: cube drawing and rotation

From: onur yasarlar

Date: 28 Feb, 2010 13:25:04

Message: 1 of 4

hi everyone;
i'm new at matlab so my question will be very easy to answer.
i want to draw a cube with some edge value and then rotate the cube about x and z axis (ex: for x:30degree, for z:40 degree).
i tried to write a transformation matrix to multiply but i could not figure it out.
in the forum i found a for loop with patch command to do create a cube but i couldn't understand the code.
please help;

best regards...

Subject: cube drawing and rotation

From: Rune Allnor

Date: 28 Feb, 2010 13:58:10

Message: 2 of 4

On 28 Feb, 14:25, "onur yasarlar" <yasarlar_o...@hotmail.com> wrote:

> i want to draw a cube with some edge value and then rotate the cube about x and z axis (ex: for x:30degree, for z:40 degree).
> i tried to write a transformation matrix to multiply but i could not figure it out.

doc patch
doc view

Rune

Subject: cube drawing and rotation

From: Jan Simon

Date: 28 Feb, 2010 14:32:05

Message: 3 of 4

Dear Onur!

> i want to draw a cube with some edge value and then rotate the cube about x and z axis (ex: for x:30degree, for z:40 degree).
> i tried to write a transformation matrix to multiply but i could not figure it out.

Please show us what you've tried. Then CSSMers can help you to improve the program.

> in the forum i found a for loop with patch command to do create a cube but i couldn't understand the code.
> please help;

We cannot help you to understand the code, if you do not show it!

Kind regards, Janh

Subject: cube drawing and rotation

From: Nguyen Long

Date: 6 Oct, 2010 09:16:05

Message: 4 of 4

"onur yasarlar" <yasarlar_onur@hotmail.com> wrote in message <hmdqrg$fvh$1@fred.mathworks.com>...
> hi everyone;
> i'm new at matlab so my question will be very easy to answer.
> i want to draw a cube with some edge value and then rotate the cube about x and z axis (ex: for x:30degree, for z:40 degree).
> i tried to write a transformation matrix to multiply but i could not figure it out.
> in the forum i found a for loop with patch command to do create a cube but i couldn't understand the code.
> please help;
>
> best regards...
Remember to use the rotation matrix for each dimension, for example:
suppose that v is the matrix for 8 vertices of the cube, rx, ry, rx is the rotation matrix responsible for Ox, Oy, Oz. Do this iteration:
v = v*rx;
v = v*ry;
v = v*rz;

Regards.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us