This repository contains tools to generate random shapes using Bezier curves (images and meshes), controlling the number of points and the local curvature and sharpness. It is also possible to generate shapes by joining specified points using an in-house csv format, and to generate full sets of random shapes with variable parameters. It was elaborated on the basis of this StackOverflow answer: https://stackoverflow.com/a/50751932/3237302, although there are now significant differences in behavior and features. It was used, directly or indirectly, in the following references:
A supervised neural network for drag prediction of arbitrary 2D shapes in laminar flows at low Reynolds number
J. Viquerat, E. Hachem
Computers & Fluids, vol. 210, num. 104645, 2020
A twin-decoder structure for incompressible laminar flow reconstruction with uncertainty estimation around 2D obstacles
J. Chen, J. Viquerat, F. Heymes, E. Hachem
Neural Computing and Applications, vol. 34, iss. 8, 2022
Direct shape optimization through deep reinforcement learning
J. Viquerat, J. Rabault, A. Kuhnle, H. Ghraieb, A. Larcher, E. Hachem
Journal of Computational Physics, vol. 34, iss. 8, 2022
Graph neural networks for laminar flow prediction around random two-dimensional shapes
J. Chen, E. Hachem, J. Viquerat
Physics of Fluids, vol. 33, iss. 12, 2021
If you make use of this repo for your research, please consider citing one of these.
n_pts n_splg_pts
x1 y1 r1 e1
x2 y2 r2 e2
...
xn yn rn en
n_ctrl_pts
is the actual number of points you control on the shape. Each such point is joined with the next one using a cubic Bezier curven_splg_pts
is the number of sampling points per unit of distance between two control pointsxi yi
are the coordinates of the control pointsri
is the local radius around control pointi
. It measures how far the local control points are from the point you providedei
is a local measure of sharpness
Give a look at the examples below for a better understanding of the effects of radius and sharpness parameters. Maximum smoothness is usually obtained for r = 0.5
and e = 0.0
on all points.
csv | shape |
|
|
|
|
|
|
|
|
|
Generate a dataset of random shapes using python3 dataset.py
(parameters of the dataset can be modified inside the python file). It will generate images and meshes in separated folders.