How To Draw Polygon In Matlab
3D Polygon - describe planes with Matlab In this example we're going to explain how to describe a 3D polygon using Matlab. More specifically, we are going to describe several apartment surfaces (planes) to build or model a box. The sentence fill3(x, y, z, c) would make full the 3D polygon defined by vectors ten, y and z with the colour specified past c. The vertices of the polygon are specified by coordinates of components of 10, y and z, and the polygon is airtight by connecting the final vertex to the first one. Let'south say that we want to draw this arbitrary rectangular box P1(0, 0, 0) We could draw our first flat surface past filling the area divers past the first iv points, similar this: ten = [p1(1) p2(1) p3(1) p4(1)]; fill3(x, y, z, i); The code produces this figure: Nosotros can expand our axes, add a grid and concur the epitome in order to add together more planes... axis([-1 3 -1 5 -1 4]) produces... We tin draw a second surface or aeroplane defined past the concluding 4 vertices: And the result now is: We can add together more than surfaces by connecting the appropriate vertices, in the right social club. If nosotros go on our code in a higher place with ten = [p2(1) p6(1) p7(1) p3(ane)]; x = [p2(ane) p6(1) p5(1) p1(1)]; The resulting 3D-prototype is the following effigy: view(120, 50) function poly_rectangle(p1, p2, p3, p4) We can call that function from whatsoever other script or from the control window. Let's try it: poly_rectangle(p3, p4, p8, p7) What did yous get? From '3D Polygon' to Matlab homeFrom '3D Polygon' to 3D figures |
Source: https://www.matrixlab-examples.com/3d-polygon.html
Posted by: jenkinswassely.blogspot.com

0 Response to "How To Draw Polygon In Matlab"
Post a Comment