8

I am trying to figure out a way of generating a 5 lobed shaped like the flower sin the sky of spongebob:

enter image description here

I.e. a parametric curve that is at least twice differentiable, closed and that transitions from convex to concave in regular lobes.

Makogan
  • 3,735

3 Answers3

12

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:

An approximate Sponge Bob flower curve

  • 1
    Since when are visual and qualitative criteria not part of math? Are you claiming that the entirety of math used for CAD, graphic design, computer graphics, etc are not math? – Makogan Oct 12 '23 at 06:58
  • 4
    Not at all, and no offense intended, just noting that in the sense many active/vocal users appear to understand MSE, this question does not have a "right" or "wrong" answer. Personally, I think it's a good question, worthy of a response. – Andrew D. Hwang Oct 12 '23 at 14:19
  • @Andrew D. Hwang Please have a look at the alternative way I propose. – Jean Marie Oct 13 '23 at 08:16
  • @AndrewD.Hwang Is there a specific way you approached this problem? Just curious since I honestly had no idea where to even start. – Bryce Oct 19 '23 at 01:32
  • 2
    @Bryce Yes. :) Although polar coordinates leap to mind, the curve isn't a polar graph because some rays cross the curve three times. We can still write $x(t)=r(t)\cos\theta(t)$ and $y(t)=r(t)\sin\theta(t)$, however. Taking $r(t) = C + c\cos(5t)$ ensures five petals if $\theta(t)$ doesn't differ too dramatically from $t$. To arrange the "back and forth" as the curves circles, it suffices to have $\theta(t)$ advance non-monotonically; choosing $\theta(t) = t + K\sin(10t)$ ensures two full oscillations per petal (one per "petal side") "with the right phase" relative to $r(t)$. – Andrew D. Hwang Oct 19 '23 at 02:29
5

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...

enter image description here

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')
Jean Marie
  • 88,997
  • 1
    This is nice! <> Both our curves are "too wide" at the tops of the lobes; I couldn't find a "simple" way to make them narrower without making them unpleasantly "pointy." With your method, maybe some gentle pressure from additional points near the tips of the petals...? – Andrew D. Hwang Oct 13 '23 at 13:01
4

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.

enter image description here

Fig. 1.

One can construct as well less regular shapes on the same model :

enter image description here

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;  

enter image description here

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}$ :

enter image description here

Fig. 4 : Transformation of Fig. 1 by the given complex transforms.

Jean Marie
  • 88,997