Monday, November 28, 2016

Cross Patty (cross pattée)


max( f(abs(x), abs(y)), f(abs(y), abs(x)) ) > 0



(1) f(x,y) = ax^2 - y + b  (parabola)


a = 0.035, b = 0.85


(2) f(x,y) = x^2 + (y - a)^2 - b^2  (circle)


a = 15.6, b = 14.75


(3) f(x,y) = abs(x)^p + abs(y - a)^p - b^p  (superellipse)


a = 15.6, b = 14.75
p = 2.5, 2.4, 2.3, ...,1.5

p = 4, a = 10, b = 8


(4) f(x,y) = a[exp(-abs(x+b)^p) + exp(-abs(x-b)^p)] - y + c


p = 1.5, a = 1, b = 7, c = 2

p = 3, a = 1, b = 7, c = 2


(5) f(x,y) = a cos(bx)^p - y + c


p = 1, a = -1, b = π/7, c = 2

p = 2, a = 1, b = π/7, c = 2

p = 3, a = -1, b = π/7, c = 2

p = 4, a = 1, b = π/7, c = 2


( Mathematical software used: Graph )

Friday, October 21, 2016

Rounded Cuboid with Superquadric Corners


The corners of the rounded cuboids on my previous post are spherical corners.

We can generalize the spherical corners (power = 2) to superquadric corners (power > 0).


Equation 1.


The equation for a rounded cuboid with superquadric corners can be given by:

       max(|x| - a, 0)p + max(|y| - b, 0)p + max(|z| - c, 0)p = dp,

where a, b, c, d > 0, and p ≧ 1.


p = 1

p = 1.5

p = 2

p = 4

p = 10


Equation 2.


Furthermore, the above equation can be generalized as follows:

       max(|x| - a, 0)p + max(|y| - b, 0)q + max(|z| - c, 0)r = d,

where a, b, c ≧ 0, d > 0, and p, q, r > 0.




Related posts:


Monday, October 17, 2016

Equation of a Rounded Rectangle



Equations:


The equation of a rounded rectangle centered at (0,0) with width 2(a+c), height 2(b+c)
and corner radius c can be expressed as

       max(|x| - a, 0)² + max(|y| - b, 0)² = c² ...... (I)

or

       (|x| - a + │|x| - a│)² + (|y| - b + │|y| - b│)² = (2c)² ...... (II)

, where a, b, and c are positive numbers.




Proof:


The rounded rectangle can be broken down into four parts (see the image below):
       ╭
       │ (|x| - a)² + (|y| - b)² = c²,  if |x|≧a and |y|≧b ...... (1)
       │ |x| = a + c                  ,  if |x|≧a and |y|<b ...... (2)
       │ |y| = b + c                  ,  if |x|<a and |y|≧b ...... (3)
       │ no graph                    ,  if |x|<a and |y|<b ...... (4)
       ╰

Since |x|≧a in part (2) and |y|≧b in part (3),
the above expression is equivalent to
       ╭
       │ (|x| - a)² + (|y| - b)² = c²,  if |x|≧a and |y|≧b;
       │ (|x| - a)² = c²               ,  if |x|≧a and |y|<b;
       │ (|y| - b)² = c²               ,  if |x|<a and |y|≧b;
       │ 0 = c²                        ,  if |x|<a and |y|<b.
       ╰

Now make the equations of the four parts look similar:
       ╭
       │ (|x| - a)² + (|y| - b)² = c²,  if |x|≧a and |y|≧b;
       │ (|x| - a)² +   (b - b)² = c²,  if |x|≧a and |y|<b;
       │   (a - a)² + (|y| - b)² = c²,  if |x|<a and |y|≧b;
       │   (a - a)² +   (b - b)² = c²,  if |x|<a and |y|<b.
       ╰

Since max(|x|, a) =
               ╭
               │ |x|,  if |x|≧a
               │  a,  if |x|<a
               ╰
and max(|y|, b) =
               ╭
               │ |y|,  if |y|≧b
               │  b,  if |y|<b,
               ╰
the four equations can be combined into a single one as follows:

       (max(|x|, a) - a)² + (max(|y|, b) - b)² = c²,

or equivalently,

       max(|x| - a, 0)² + max(|y| - b, 0)² = c² ...... (I)


Using the formula max(z, 0) = (z + |z|) / 2,
the above equation can be expanded to

       (|x| - a + │|x| - a│)² + (|y| - b + │|y| - b│)² = (2c)² ...... (II)




Note:


  • When a or b is zero (but not both), the equation (I) describes a stadium (curve).
  • When c is zero (a and b are positive), the equation (I) describes a rectangular region rather than a rectangle.
  • The equation  max(|x| - a, |y| - b) = 0  describes a rectangle.
  • The equation  max(|x| - a, 0)² + max(|y| - b, 0)² + max(|z| - c, 0)² = d²  describes a rounded cuboid.

max(|x|, 0)² + max(|y| - 1, 0)² = 2²
(a = 0)

max(|x| - 3, 0)² + max(|y|, 0)² = (1.5)²
(b = 0)

max(|x| - 3, 0)² + max(|y| - 2, 0)² = 0
(c = 0)

max(|x| - 4, 0)² + max(|y| - 3, 0)² + max(|z| - 1, 0)² = 1


Related posts:

Tuesday, October 11, 2016

Wednesday, October 5, 2016

Funny Boxing Champion (1)




Equations (方程式):


   (1) body (身体):
x² + y² - 72[exp(1/(sin(y+x) - 1)) ± exp(1/(sin(y-x) - 1))]² = 5/2


   (2) eye sockets (眼眶):
(abs(x) - π/4)² + (y - 3π/2)² = (π/8)²


   (3) eyes (眼睛):
arcsin²(k(abs(x) - π/4)) = arcsin²(k(y - 3π/2))


   (4) mouth (嘴巴):
arcsin²(kx) = arcsin²(k(y - 19π/16))


   (5) navel (肚臍):
arcsin²(kx) = arcsin²(k(y + π/3))



(8 ≦ k ≦ 10)



( Mathematical software used: gnuplot )

Wednesday, August 17, 2016

Rounded Cross - cross with rounded corners (圓角十字形)



gnuplot script:

a = 2
b = 1
c = 1
w = 8
max(x,y) = x < y ? y : x
min(x,y) = x < y ? x : y
fun(x,y) = \
  min(min(max(abs(x)-b,0)**2 + max(abs(y)-(a+b+2*c),0)**2 - c**2, \
  max(abs(x)-(a+b+2*c),0)**2 + max(abs(y)-b,0)**2 - c**2), \
  max((abs(x)-(b+c))**2 + (abs(y)-(b+c))**2 - c**2, \
  c**2 - (abs(x)-(b+2*c))**2 - (abs(y)-(b+2*c))**2))
set xrange [-w:w]
set yrange [-w:w]
set size ratio -1
set samples 512
set isosamples 512
set contour base
set cntrparam levels discrete 0.0
unset key
unset surface
set table 'fun.dat'
splot fun(x,y)
unset table
plot 'fun.dat' w l lw 1.5 lc rgb "red"

(a = 2, b = 1, c = 1)


(a = 4, b = 0.5, c = 0.5)


(a = 0, b = 0, c = 2)


(a = 0, b = 2, c = 4/3)


(a = 2, b = 0, c = 4/3)


( Mathematical softwares used: Graph, gnuplot )


Related posts: