shoreline, a MATLAB code which tries to identify and triangulate the 2D domain over which some function F(X,Y) is nonnegative.

It does this by starting with a set of sample points, where the function is evaluated. Triangles are dropped from the triangulation if all 3 vertices have negative functions. Triangles with 3 positive vertices are assumed (to within the requested resolution) to be part of the region. Therefore, a more accurate answer can be sought by refining those triangles whose vertices include both positive and negative values.

This results in a refined "shoreline" around the positive triangles. The function is evaluated at the new nodes, and again the negative triangles are dropped, the positive ones kept, and the intermediate triangles can be further refined, if desired.

It is also possible to estimate the integral of some function g(x,y) over the region implicitly defined by 0 <= f(x,y).


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


shoreline is available in a MATLAB version.

Related Data and Programs:

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

edge, a MATLAB code which defines some test functions in 1d, 2d and 3d for the detection of edges.

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

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


surf_test, a MATLAB code which demonstrates the MATLAB surf() function for displaying a 3d surface of the form z=f(x,y).

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

Source Code:

Last modified on 24 March 2019.