# TRIANGULATE_RECTANGLE Triangulate a Rectangular Region

TRIANGULATE_RECTANGLE is a MATLAB library which computes a simple triangulation of a rectangular region.

The triangulation will be represented by two sets of data:

• node coordinates, a set of NN pairs (X(I),Y(I)) that are the coordinates of points used to define the triangulation, stored as a 2xNN real array.
• elements, a set of NE triples (I1(J),I2(J),I3(J)) that are the indices of the nodes forming the vertex of triangle J, stored as a 3xNE integer array. For each triangle, the nodes are listed in counterclockwise order.

### Usage:

triangulate_rectangle ( xl, xr, xn, yb, yt, yn, base )
• xl, xr are the left and rightmost X coordinates.
• xn is the number of elements along the X direction.
• yb, yt are the bottom and topmost Y coordinates.
• yn is the number of elements along the Y direction.
• base is an optional input that is 1 for 1-based element indexing (default), or 0 for 0-based indexing.

### Languages:

TRIANGULATE_RECTANGLE is available in a MATLAB version.

### Related Data and Programs:

FEM2D_POISSON_RECTANGLE_LINEAR, a MATLAB program which solves the 2D Poisson equation on a rectangle, using the finite element method (FEM), and piecewise linear triangular elements.

TRIANGULATION, a MATLAB library which performs various operations on order 3 (linear) or order 6 (quadratic) triangulations, including searching a Delaunay triangulation to find which triangle contains a given point.

TRIANGULATION_DISPLAY, a MATLAB program which displays the nodes and elements of a triangulation on the MATLAB graphics screen;

### Examples and Tests:

You can go up one level to the MATLAB source codes.