1 / 7

Adventure of The Cube: Constructing and Transforming a 3D Object in Matlab

Learn how to create a 3D cube in Matlab with homogeneous coordinates, apply translations, scaling, rotation, and display it using patch commands. Understand matrix operations for transformations and the concept of homogeneous equations for vertices.

clampman
Download Presentation

Adventure of The Cube: Constructing and Transforming a 3D Object in Matlab

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Adventures of The Cube Roland Miezianko CIS 581 Computer Graphics and Image Processing Prof. Longin Jan Latecki Roland Miezianko, CIS581

  2. Objective • Construct a 3D object in Matlab (Cube) • Create and use Homogenous Coordinates • Compute all transformations: • Translation • Scaling • Rotation x,y,z-axis • Flyby Roland Miezianko, CIS581

  3. Construct the Cube, matrix data • Define matrix of vertices • 8x3 matrix • Define matrix of faces • 6x4 matrix • Define matrix of vertex and face colors • 6x3 matrix Roland Miezianko, CIS581

  4. Construct the Cube, display • Construct cube using the patch command • patch('Vertices', v, 'Faces', f, 'FaceVertexCData', fvc, 'FaceColor', 'flat', 'EdgeColor', 'none') • Set colors to be transparent • alpha(.5); Roland Miezianko, CIS581

  5. Homogeneous Equations • Matlab vertices are defined as triplet • N x 3 matrix • Must add additional column to the vertex matrix (N x 4 matrix) • Vw = [v vw]'; Roland Miezianko, CIS581

  6. Matrix Operations • Matrix operation to translate, scale, and rotate • Rotate about x-axis example rx = [ 1 0 0 0; 0 cos(xang) -sin(xang) 0; 0 sin(xang) cos(xang) 0; 0 0 0 1]; Vw = [v vw]'; Vcomp = ( rx * Vw )'; Vnew = Vcomp(:,1:3); Roland Miezianko, CIS581

  7. The Movie "Adventures of The Cube" Roland Miezianko, CIS581

More Related