Consider the MATLAB file Animationm Create a 2D nonsymmetric

Consider the MATLAB file Animation.m                                                                                                                                       

Create a 2D non-symmetrical shape specifying its vertices and using the fill command. Place the points in a data matrix. Use a sequence of at least 5 transformation matrices multiplications with different step sizes to create an animation video. Use Tables 1 through 4 to get the motion that you want.

Please use Matlab! Also can you make it so I could just copy the code directly into Matlab. Comments would be appreciated. Thank you!

Solution

Using Transformation Matrices

The first step in using matrices to transform a shape is to load the matrix with the appropriate values. What values you use and where you place them in the matrix depend on the type of transformations you\'re doing. A matrix that\'s set up to translate a shape looks like this:

Just like when you were using a formula to translate the vertices of a shape, in the preceding matrix the xTrans and yTrans variables are the number of vertical and horizontal units, respectively, that you want to translate the shape. In a program, you\'d initialize this matrix like this:

A matrix for scaling a shape looks like this:

Here, the variable xScaleFactor is how much you want to scale the shape horizontally, whereas yScaleFactor is how much to scale vertically. In a program, you\'d initialize the scaling matrix like this:

Finally, a matrix for rotating a shape looks as follows:

Here, the variable radians is the angle of rotation in radians. In a program, you\'d initialize the rotation matrix like this:

Consider the MATLAB file Animation.m Create a 2D non-symmetrical shape specifying its vertices and using the fill command. Place the points in a data matrix. Us

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site