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
Technique is to create one element - vector: Technique is to create one element with the values from one structure, and use repmat to replicate it to the preferred size. Then,

Evaluating a string: The function eval is used to compute a string as a function. For illustration, below is the string 'plot(x)'is interpreted to be a call to plot the functi

Example of Interpolation and extrapolation: The MATLAB has a function to do this, known as polyfit. The function polyfit finds the coefficients of the polynomial of the partic

deblank function: The deblank function eliminates only trailing blanks from the string, not leading the blanks. The strtrim function will eliminate both the leading and traili

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

Illustration of gauss-jordan: Here's an illustration of performing such substitutions by using MATLAB >> a = [1 3 0; 2 1 3; 4 2 3] a = 1 3 0 2 1 3 4 2

Example of Gauss-jordan: For a 2×2 system, this would results and for a 3 × 3 system, Note that the resulting diagonal form does not involve the right-most col

Replacement : Replace a row by adding it to (or subtract from it) a multiple of the other row. For a given row ri, this is written as   ri  - srj →  ri Note that when r

Indexing into Vectors of structures: Frequently, when the data structure is a vector of structures, it is essential to iterate through the vector in order by various fields. F

Use of Nested if-else statements: By using the nested if-else to select from among the three possibilities, not all the conditions should be tested. In this situation, if x is