I am trying to figure out a way of generating a 5 lobed shaped like the flower sin the sky of spongebob:
I.e. a parametric curve that is at least twice differentiable, closed and that transitions from convex to concave in regular lobes.
I am trying to figure out a way of generating a 5 lobed shaped like the flower sin the sky of spongebob:
I.e. a parametric curve that is at least twice differentiable, closed and that transitions from convex to concave in regular lobes.
Strictly this isn't a mathematical question (because the criteria are visual and qualitative), but the parametric equations \begin{align*} x(t) &= \bigl(1.75 + \cos(5t))\cos\bigl(t + \tfrac{\pi}{20}\sin(10t)\bigr), \\ y(t) &= \bigl(1.75 + \cos(5t))\sin\bigl(t + \tfrac{\pi}{20}\sin(10t)\bigr), \end{align*} whose parameters you can tweak, give:
There are different ways to obtain such curves ; here is another one, using a description by level curve(s) based on a principle of attraction/repulsion of points situated in the external and internal concavities of the curve. These points are materialized as red and blue stars on the figure below featuring the "star-blob" as one among three level curves of a certain function.
Different parameters have to be tuned ; the tuning I have used here is not perfect, but is enough to convince that it is an alternative way...
This function is based on weighted inverses of squares of distances to the "starred" points (as one can see in the instruction inside the loop and the definition of function $f$ in the Matlab program). It would be a little akward to describe all the details : I leave the reader retrieve the other features from the program given below.
w=9;axis([-w,w,-w,w,-1,1]) L=-w:0.1:w; f=@(z)(min(1./abs(z).^(2),1)); [X,Y]=meshgrid(L); Z=X+i*Y; U=zeros(length(L)); r1=3.4;w1=1.8; r2=4.5;w2=-0.88; z1=r1*exp(i*2*a*(0:4)); z2=r2*exp(i*a*(1:2:9)); plot(z1,'*r');plot(z2,'*b'); for k=1:5 U=U+w1*f(Z-z1(k))+w2*f(Z-z2(k)); end; contour(X,Y,U,3, 'k')
Here is a third method where the curve is obtained as a "necklace" of circular arcs as described on the figure below. It is based on a star-shaped polygon. One takes alternatively external arcs (blue) in the convex parts and internal arcs in the concave parts (dark blue). The centers of these ars are the vertices $C_1, \cdots C_{10}$ of the star ; their radii are "propagated" in a way that each arc is connected to the previous one.
In this way, the smoothness requirement is achieved. Indeed, circular arcs with centers $C_k, C_{k+1}$ connected at point $P_k$ have a common tangent iff $C_k, C_{k+1}, P_k$ are aligned, which is true by construction.
Fig. 1.
One can construct as well less regular shapes on the same model :
Fig. 2.
The smoothness of these curves is of a special kind ; it is eye-satisfying, but
it isn't $C^2$ because there is a sudden change of curvature at connection points.
it isn't even $C^1$ : it is sometimes called a $G^1$ type of continuity ("G" for Geometric) : a common tangent, that's all. This is the kind of issues one encounters also with spline functions.
Matlab program used for fig. 1 and fig. 3 (please note that we use a complex numbers representation) :
clear all;close all;hold on;axis equal function cir(c,r,t1,t2) R=linspace(t1,t2,100); plot(c+r*exp(i*R)) end; n=6; R=1:(2*n+3); c=(11+3*(-1).^R).*exp(i*R*pi/n) ; % vertices plot(c(1:2*n+1)); d=diff(c); % sides described as vectors m=abs(d); % sidelengths r=5; % initial external radius for k=1:2*n a=angle(d(k)); dec=angle(d(k+1)/d(k)); % "declination" angle cir(c(k+1),r,a-pi*(-1)^(k+1),a+dec); r=m(k+1)-r; end;
Fig. 3 : Case $n=6$ (notation in the program for the number of extreme points of the star).
Edit : I have realized that the previous method should be combined with a second transformation in order to deform the circular forms composing the shape. This can be achieved by applying a well-fitted complex transformation to the shape.
Here is what I have obtained with transformation $F_1(z)=z+1+i$ followed by $F_2(z)=(z \sqrt{|z|})^{1.06}$ :
Fig. 4 : Transformation of Fig. 1 by the given complex transforms.