Identify and Triangulate the Domain where F(X,Y) = C

**SHORELINE2**
is a MATLAB library which
tries to identify and triangulate the approximate 2D domain over which
F(X,Y) = C for some user specified function F.

The program begins with a given rectangular domain, within which all the investigation is confined. A set of points is generated within the domain and triangulated. Then the function is evaluated at the points. Triangles are dropped from the triangulation if all 3 vertices have the same sign for F(X,Y)-C. Triangles whose vertices have conflicting sign are saved for further study.

Each triangle is now divided into four subtriangles, using the natural splitting involving the midpoints. The function is evalluated at these midpoints, and all subtriangles with vertices of matching sign are again discarded.

This process may be repeated several times. In general, each step of the process is expected to produce a refined estimate of the region where f(x,y)=0, using about twice as many triangles, each of 1/4 the area of the previous triangulation.

The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.

**SHORELINE2** is available in
a MATLAB version.

CONTOUR_GRADIENT, a MATLAB program which displays contours and gradient vectors for a function f(x,y).

EDGE, a MATLAB library which defines some test functions in 1D, 2D and 3D for the detection of edges.

HYPERSPHERE_SURFACE, a MATLAB library which illustrates a procedure for estimating the location of a hypersurface defined by a characteristic function or a signed function.

LEVELS, a MATLAB library which makes a contour plot, choosing the contour levels using random sampling.

MATLAB_SURF, a MATLAB library which demonstrates the MATLAB surf() function for displaying a 3D surface of the form Z=F(X,Y).

SHORELINE, a MATLAB program which tries to identify and triangulate the 2D domain over which some function f(x,y) is nonnegative.

TOMS626, a FORTRAN77 library which creates a contour plot of data associated with a triangulated set of points; this is ACM TOMS algorithm 626.

TRIANGULATION_ORDER3_CONTOUR, a MATLAB program which makes contour plot of scattered data, or of data defined on an order 3 triangulation.

TWOD_PLOTC, a MATLAB program which makes a color contour plot of scalar data defined on a 2D finite element mesh, by Jeff Borggaard.

- cull_pure_triangles.m, removes from the triangulation those triangles for which all vertices have the same sign.
- i4col_compare.m, compares two columns of an I4COL;
- i4col_sort_a.m, ascending sorts the columns of an I4COL;
- i4col_swap.m, swaps two columns of an I4COL;
- product_grid.m, samples a rectangle with a product grid.
- refine_size.m, determines the "size" of the refinement of a triangulation.
- refine_triangles.m, computes the refinement of a triangulation.
- shoreline2.m, identifies and triangulates a region for which F(X,Y) is approximately zero.
- sort_heap_external.m, external sorts a list of values into ascending order;
- timestamp.m, prints the current YMDHMS date as a time stamp.
- triangulation_area.m, returns the area of a triangulation.

**MYLINE_TEST** applies the program to a case in which the function
is a straight line.

- myline.m, defines the function f(x,y) = x-3y-2.1.
- myline_test.m, the test code.
- myline_test_output.txt, the output file.
- myline.png, a PNG image.

**CAMEL_TEST** applies the program to a case in which the function
defines a blobby closed curve.

- camel.m, defines the "camel" function.
- camel_test.m, the test code.
- camel_test_output.txt, the output file.
- camel.png, a PNG image.

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