diff --git a/meshmode/mesh/generation.py b/meshmode/mesh/generation.py index f08d5a7614abbe3c17c5f46781ee1575ffe81cb7..38479a885fb1abf71358722ed11e0e5303287ab3 100644 --- a/meshmode/mesh/generation.py +++ b/meshmode/mesh/generation.py @@ -45,6 +45,7 @@ Curve parametrizations .. autofunction:: drop .. autofunction:: n_gon .. autofunction:: qbx_peanut +.. autofunction:: apple .. autoclass:: WobblyCircle Surfaces @@ -155,6 +156,24 @@ def qbx_peanut(t): ]) +def apple(a, t): + """ + :arg a: 0 <= a <= 1/2; roundedness: 0 returns a circle, 1/2 returns a cardioid + :arg t: the parametrization, runs from [0,1) + :return: an array of shape *(2, npoints)* + """ + ilength = 2*np.pi + t = t*ilength + + sin = np.sin + cos = np.cos + + return np.vstack([ + cos(t) + a*cos(2*t), + sin(t) + a*sin(2*t) + ]) + + class WobblyCircle(object): """ .. automethod:: random