# gridtrimesh 1.0

OS : Windows / Linux / Mac OS / BSD / Solaris

Script Licensing : Freeware

Created : Aug 18, 2007

Downloads : 5

Thank you for voting...

## The function GRIDTRIMESH fits a surface of the form Z ...

The function gridtrimesh by Willie Brink fits a surface of the form Z = F(X, Y) to a given triangular mesh. Inputs X and Y are assumed to be produced by something similar to MESHGRID and the result could then be visualized by a simple SURF(X, Y, Z).

The triangular mesh on which this function operates should be defined in the usual way by two matrices F and V. MATLAB functions that use similar representations include TRIMESH, TRISURF and REDUCEPATCH. The included example file BEETHOVEN. MAT contains two such matrices.

A main advantage that this function has over the internal function griddata is that it operates not only on the set of vertices but also on the given triangulation. GRIDDATA first performs a Delaunay triangulation on the projected data points and subsequently always yields a surface that has a convex domain in the xy-plane. Another major drawback of GRIDDATA is that it handles surfaces that are not so-called 2. 5D poorly (a "2. 5D" surface has the property that for any xy-pair there exists at most one z-value on the surface, e. g. any function z = f(x, y)).

This is because GRIDDATA projects all points to the xy-plane and then triangulates them without considering their original positions in 3-space. gridtrimesh 1.0, on the other hand, considers all intersections that the ray through a particular gridpoint makes with the surface in 3D and then picks the maximum z-value. This emulates the idea of dropping a piece of cloth over the surface from above (i. e. from somewhere on the positive z-axis).

Another favourable trait of this function is its speed. I've tested it on the well-known Stanford bunny that consists of approximately 70, 000 triangles. For a 100-by-100 grid (which is 10, 000 points to be sampled) the function executes in about 2. 4 seconds.

For those requiring more speed a MEX version of the function, called MXgridtrimesh [gridtrimesh1.0.exe], is also supplied. This function may be used in exactly the same manner and produces exacly the same answer as gridtrimesh - 0MB. But since MXgridtrimesh 1.0 was written in C and then compiled with MEX it performs better. It required about 0. 2 seconds for the Stanford bunny on a 100-by-100 grid and only about 2 seconds for a 1, 000-by-1, 000 grid (a million points!!).

The attached zip-file also includes an example script called DEMONSTRATION which can be run directly (you may need to recompile MXGRIDTRIMESH first, however).

CAUTION: at this stage the inputs X and Y must be generated by meshgrid(x, y) where x and y are monotonically increasing vectors.

The triangular mesh on which this function operates should be defined in the usual way by two matrices F and V. MATLAB functions that use similar representations include TRIMESH, TRISURF and REDUCEPATCH. The included example file BEETHOVEN. MAT contains two such matrices.

A main advantage that this function has over the internal function griddata is that it operates not only on the set of vertices but also on the given triangulation. GRIDDATA first performs a Delaunay triangulation on the projected data points and subsequently always yields a surface that has a convex domain in the xy-plane. Another major drawback of GRIDDATA is that it handles surfaces that are not so-called 2. 5D poorly (a "2. 5D" surface has the property that for any xy-pair there exists at most one z-value on the surface, e. g. any function z = f(x, y)).

This is because GRIDDATA projects all points to the xy-plane and then triangulates them without considering their original positions in 3-space. gridtrimesh 1.0, on the other hand, considers all intersections that the ray through a particular gridpoint makes with the surface in 3D and then picks the maximum z-value. This emulates the idea of dropping a piece of cloth over the surface from above (i. e. from somewhere on the positive z-axis).

Another favourable trait of this function is its speed. I've tested it on the well-known Stanford bunny that consists of approximately 70, 000 triangles. For a 100-by-100 grid (which is 10, 000 points to be sampled) the function executes in about 2. 4 seconds.

For those requiring more speed a MEX version of the function, called MXgridtrimesh [gridtrimesh1.0.exe], is also supplied. This function may be used in exactly the same manner and produces exacly the same answer as gridtrimesh - 0MB. But since MXgridtrimesh 1.0 was written in C and then compiled with MEX it performs better. It required about 0. 2 seconds for the Stanford bunny on a 100-by-100 grid and only about 2 seconds for a 1, 000-by-1, 000 grid (a million points!!).

The attached zip-file also includes an example script called DEMONSTRATION which can be run directly (you may need to recompile MXGRIDTRIMESH first, however).

CAUTION: at this stage the inputs X and Y must be generated by meshgrid(x, y) where x and y are monotonically increasing vectors.

**gridtrimesh 1.0 scripting tags:**grid trimesh, griddata, gridtrimesh, function, matlab mathematics, surface, matlab gridtrimesh.

**What is new in gridtrimesh 1.0 software script?**- Unable to find gridtrimesh 1.0 news.

**What is improvements are expecting?**Newly-made gridtrimesh 1.1 will be downloaded from here. You may download directly. Please write the reviews of the gridtrimesh. License limitations are unspecified.