# CLOUD Define a Region Using Boundary Points Read From a File

CLOUD, a FreeFem++ script which defines a region using boundary points read from a file.

In this particular example, the computation begins with a PNG image of a cloud, which consists of a white region surrounded by a black region, and nothing else. (This simplicity is important, in order for MATLAB to detect just one continuous boundary. If this is not the case, then you can still do this, but it takes some human intervention.)

A MATLAB function from the image toolbox is able to report a list of pixel locations corresponding to the black/white border. These pairs of coordinates can be written to a file, preceded by a single line listing the number of such coordinates. (In fact, we have to thin the data, and we have to reverse its order, and we have to make sure that the first point is repeated at the end so that FreeFem++ can tell that the border closes up.)

FreeFem++ can read the file, and can be instructed to regard the data as defining the border of a region. To show that this is true, we go ahead and mesh the region and solve some hokey PDE on it.

### Licensing:

• cloud.png, a very simple drawing of a cloud, white surrounded by black;
• cloud.m, a MATLAB script which processes the cloud image and writes the data file.
• image_boundary.m, a MATLAB script called by cloud.m, which takes care of talking to the image toolbox.
• cloud_points.txt, the list of pixels forming the border. Because of the difference in conventions between (X,Y) Cartesian coordinates and the (I,J) numbering of pixels, the region will essentially be rotated by 90 or -90 degrees, who cares which one it is?
• cloud.edp, the FreeFem++ script;
• cloud.sh, a BASH script to run the example;
• cloud_output.txt, the output file;
• cloud_border.png, a plot by FreeFem++ of the border of the region. I didn't know you could do this!
• cloud_mesh.png, a PNG image of the mesh;
• cloud_uh.png, a PNG image of the solution;

You can go up one level to the FreeFem++ web page.

Last revised on 02 August 2015.