CLOUD
Define a Region Using Boundary Points Read From a File


cloud, a FreeFem++ code which starts with a black and white drawing of a cloud, uses MATLAB to extract the boundary, reads the boundary into FreeFem++ and solves a Poisson problem over the region.

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:

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

Reference:

Source Code:


Last revised on 24 May 2020.