Superformula

From testwiki
Jump to navigation Jump to search

Template:Short description Template:About The superformula is a generalization of the superellipse and was proposed by Johan Gielis in 2003.[1] Gielis suggested that the formula can be used to describe many complex shapes and curves that are found in nature. Gielis has filed a patent application related to the synthesis of patterns generated by the superformula, which expired effective 2020-05-10.[2]

In polar coordinates, with r the radius and φ the angle, the superformula is:

r(φ)=(|cos(mφ4)a|n2+|sin(mφ4)b|n3)1n1. By choosing different values for the parameters a,b,m,n1,n2, and n3, different shapes can be generated.

The formula was obtained by generalizing the superellipse, named and popularized by Piet Hein, a Danish mathematician.

2D plots

In the following examples the values shown above each figure should be m, n1, n2 and n3.

A GNU Octave program for generating these figures

function sf2d(n, a)
  u = [0:.001:2 * pi];
  raux = abs(1 / a(1) .* abs(cos(n(1) * u / 4))) .^ n(3) + abs(1 / a(2) .* abs(sin(n(1) * u / 4))) .^ n(4);
  r = abs(raux) .^ (- 1 / n(2));
  x = r .* cos(u);
  y = r .* sin(u);
  plot(x, y);
end

Extension to higher dimensions

It is possible to extend the formula to 3, 4, or n dimensions, by means of the spherical product of superformulas. For example, the 3D parametric surface is obtained by multiplying two superformulas r1 and r2. The coordinates are defined by the relations:

x=r1(θ)cosθr2(ϕ)cosϕ, y=r1(θ)sinθr2(ϕ)cosϕ, z=r2(ϕ)sinϕ,

where ϕ (latitude) varies between −π/2 and π/2 and θ (longitude) between −π and π.

3D plots

3D superformula: a = b = 1; m, n1, n2 and n3 are shown in the pictures.

A GNU Octave program for generating these figures:

function sf3d(n, a)
  u = [- pi:.05:pi];
  v = [- pi / 2:.05:pi / 2];
  nu = length(u);
  nv = length(v);
  for i = 1:nu
    for j = 1:nv
      raux1 = abs(1 / a(1) * abs(cos(n(1) .* u(i) / 4))) .^ n(3) + abs(1 / a(2) * abs(sin(n(1) * u(i) / 4))) .^ n(4);
      r1 = abs(raux1) .^ (- 1 / n(2));
      raux2 = abs(1 / a(1) * abs(cos(n(1) * v(j) / 4))) .^ n(3) + abs(1 / a(2) * abs(sin(n(1) * v(j) / 4))) .^ n(4);
      r2 = abs(raux2) .^ (- 1 / n(2));
      x(i, j) = r1 * cos(u(i)) * r2 * cos(v(j));
      y(i, j) = r1 * sin(u(i)) * r2 * cos(v(j));
      z(i, j) = r2 * sin(v(j));
    endfor;
  endfor;
  mesh(x, y, z);
endfunction;

Generalization

The superformula can be generalized by allowing distinct m parameters in the two terms of the superformula. By replacing the first parameter m with y and second parameter m with z:[3] r(φ)=(|cos(yφ4)a|n2+|sin(zφ4)b|n3)1n1

This allows the creation of rotationally asymmetric and nested structures. In the following examples a, b, n2 and n3 are 1:

References

Template:Reflist

Template:Commons category