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.

Related Data and Programs:

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.

Source Code:

Examples and Tests:

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

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

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

Last modified on 06 July 2012.