![]() Try playing around with this code by running it multiple times and so producing a new data set with rand, and by changing the number of data points affecting the number of triangles. This will assure that there are the required three data points to define a triangle. Put in simpler terms, each point is matched with its natural neighbors (as determined by the underlying algorithm) to produce a triangle, a circle about which will cover no other data points. The delaunay function creates a triangular grid for scattered data points by returning a set of triangles such that no data points are contained in any triangle’s circumcircle. Consider the following code that will generate the surface shown in Figure 4.29.įigure 4.29 Visualizing non-uniformly sampled data points using trisurf. Using the peaks function that we saw in the earlier surface plots, we can see that the trisurf function can also be used as a way to get a look at a surface from a set of non-uniformly sampled data points. ![]() Continuing with the x, y, and z data we’ve just created the following code will create this matrix and produce the plot shown in Figure 4.28.įigure 4.28 Triangular meshplot of the three data points.Įach row of the matrix tri specifies the points that constitute each face of the object. This is done by creating an mx3 matrix, where each of the m rows represents a triangle by identifying the three indices in the x, y, and z vectors that make up the three vertices of the triangle. We can then create a set of eight triangles: one face that connects data points 1, 2, and 5, another for data points 2, 3, and 5, another for data points 3, 4, and 5, another for 4, 1, and 5, another for 1, 2, and 6, another for 2, 3, and 6, another for 3, 4, and 6, and a final one for 4, 1, and 6. Let’s say we have the data points as described in the following code and shown in Figure 4.27.įigure 4.27 Data points for a triangular plot. To help you understand how these functions work, we will look at a simple example. ![]() The functions trimesh and trisurf can be used to generate a triangular mesh and surface plot respectively.īoth of these functions have the same synopsis and are therefore completely interchangeable. In some instances, you may have data that you want displayed by a set of triangles. Generating Surfaces with TrianglesĪs you may have noticed, the surf and mesh functions use quadrilaterals as defined by neighboring vertices in your X, Y, and Z matrices to generate the 3D mesh or surface plot. Figure 4.26 A 3-D stem plot with supporting line plots. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |