15.11.2014 Views

MATLAB Mathematics - SERC - Index of

MATLAB Mathematics - SERC - Index of

MATLAB Mathematics - SERC - Index of

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

2 Polynomials and Interpolation<br />

T =<br />

4 9 3 1<br />

4 9 2 1<br />

7 9 3 1<br />

7 9 5 1<br />

7 4 9 3<br />

7 4 8 9<br />

6 9 2 1<br />

6 9 5 1<br />

6 4 9 2<br />

6 4 8 9<br />

6 7 9 5<br />

6 7 8 9<br />

The 12 rows <strong>of</strong> T represent the 12 simplices, in this case irregular tetrahedrons,<br />

that partition the cube. Each row represents one tetrahedron, and the row<br />

elements are indices <strong>of</strong> points in X.<br />

For three-dimensional tessellations, you can use tetramesh to plot the output.<br />

However, using patch to plot the output gives you more control over the color<br />

<strong>of</strong> the facets. Note that you cannot plot delaunayn output for n > 3.<br />

This code plots the tessellation T by drawing the tetrahedrons using<br />

three-dimensional patches:<br />

figure, hold on<br />

d = [1 1 1 2; 2 2 3 3; 3 4 4 4]; % <strong>Index</strong> into T<br />

for i = 1:size(T,1) % Draw each tetrahedron.<br />

y = T(i,d);<br />

% Get the ith T to make a patch.<br />

x1 = reshape(X(y,1),3,4);<br />

x2 = reshape(X(y,2),3,4);<br />

x3 = reshape(X(y,3),3,4);<br />

h(i)=patch(x1,x2,x3,(1:4)*i,'FaceAlpha',0.9);<br />

end<br />

hold <strong>of</strong>f<br />

view(3), axis equal<br />

axis <strong>of</strong>f<br />

camorbit(65,120)<br />

% To view it from another angle<br />

title('Delaunay tessellation <strong>of</strong> a cube with a center point')<br />

2-30

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

Saved successfully!

Ooh no, something went wrong!