Patch function - graphics objects, MATLAB in Engineering

Patch function - graphics objects:

The patch function is used to generate a patch graphics object, which is made from 2-dimensional polygons. The patch is defined by its vertices and faces. For illustration, consider a patch which has four vertices in 3-dimensional space, given by the coordinates:

(0, 0, 0)

(1, 0, 0)

(0, 1, 0)

(0.5, 0.5, 1)

 

Just to visualize these points first, the plot3 function is used, as shown in figure:

>> x = [0 1 0 0.5];

>> y = [0 0 1 0.5];

>> z = [0 0 0 1];

>> plot3(x,y,z,'ko')

837_Patch function.png

Rotating the figure shows all four points, as shown in figure.

2127_Patch function1.png

Generating and showing these points is not essential to generate a patch object; this was just complete to visualize at first the vertices . A patch object is defined by both the vertices and the faces of the polygon which connect these vertices. The one way of calling this function is patch(fv),here fv is a structure variable with fields known as vertices and faces.

polyhedron.vertices = [.  .  .

0 0 0

1 0 0

0 1 0

0.5 0.5 1];

polyhedron.faces = [.  .  .

1 2 3

1 2 4

1 3 4

2 3 4];

pobj = patch(polyhedron, .  .  .

'FaceColor',[0.8, 0.8, 0.8],.  .  .

'EdgeColor','black');

Posted Date: 10/22/2012 8:25:41 AM | Location : United States







Related Discussions:- Patch function - graphics objects, Assignment Help, Ask Question on Patch function - graphics objects, Get Answer, Expert's Help, Patch function - graphics objects Discussions

Write discussion on Patch function - graphics objects
Your posts are moderated
Related Questions
Execution steps: Whenever the program is executed, the steps below will take place: The script calcandprintarea starts executing. The calcandprintarea calls the readr

Illustration of anonymous functions: Dissimilar functions stored in the M-files, when no argument is passed to an anonymous function, the parentheses should still be in the fu

I dont know how to input different videos on matlab program

Example of image processing: The other illustration generates a 5 × 5 matrix of arbitrary integers in the range from 1 to the number of colors; the resultant image is as shown

Algorithm for subfunction: The algorithm for subfunction askforn is as shown:  Prompt the user for the positive integer n.  Loop to print an error message and reprom

Scaling:   change a row by multiplying it by a non-zero scalar sri →  ri For illustration, for the matrix:

Square Matrices: If a matrix has similar number of rows and columns, for illustration, if m == n, the matrix is square matrix. The definitions which follow in this part apply

function imread: The function imread can read an image file, for illustration a JPEG (.jpg) file. The function reads color images into a 3-dimensional matrix. >> myimage1

num2str function: The num2str function, that converts real numbers, can be called in many ways. If only the real number is passed to the num2str function, it will generate a s

Interchange rows : for illustration interchanging rows ri and rj is written as