12.07.2015 Views

Basics of MATLAB and Beyond

Basics of MATLAB and Beyond

Basics of MATLAB and Beyond

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

diagram. Such a triangular grid can be calculatedfor our seamount example <strong>of</strong> the last section. Thetriangles are defined using the delaunay function:3>> tri = delaunay(x,y);>> tri(563:end,:)ans =2 4 71 2 68 1125 245 59We have displayed the last few lines <strong>of</strong> the M × 3 matrix tri, whichdefines the triangles by a set <strong>of</strong> triplets that are indices into the x <strong>and</strong> yvectors. For example, the four triangles we have displayed in ans are〈( ) ( ) ( )〉1: x(2),y(2) x(4),y(4) x(7),y(7)〈( ) ( ) ( )〉2: x(1),y(1) x(2),y(2) x(6),y(6)〈( ) ( ) ( )〉3: x(8),y(8) x(3),y(3) x(11),y(11)〈( ) ( ) ( )〉4: x(25),y(25) x(245),y(245) x(59),y(59)We can use this triangulation matrix to plot a surface <strong>of</strong> the seamountdata; each face <strong>of</strong> the surface is one <strong>of</strong> the triangles:trisurf(tri,x,y,z)hold onplot3(x,y,z,’o’)axis tightThe functions trisurf <strong>and</strong> trimesh do not create surface objects;rather, they create patch objects.37 Three-dimensional Modelling37.1 PatchesIn this section we discuss the representation <strong>of</strong> real-world objects. Suchobjects are built up using their faces (the six faces <strong>of</strong> a cube, for example).In matlab “faces” are patches, <strong>and</strong> are defined using the patchcomm<strong>and</strong>. Patches are blobs <strong>of</strong> coloured light (or ink) that are defined byvertex points. The line between the vertices is the patch’s edge <strong>and</strong> theenclosed area is the patch’s face. Before talking about three-dimensionalobjects we discuss the simpler two-dimensional patch.c○ 2000 by CRC Press LLC

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!