Showing posts with label Polygon. Show all posts
Showing posts with label Polygon. Show all 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:

Wednesday, June 22, 2016

Folding Star Polygons using Equations (用方程式摺星形多邊形)

Regular star polygon {8/3}


Regular star polygon {12/4}


Regular star polygon {12/5}


Regular star polygon {10/4}


Regular star polygon {15/6}


( Mathematical softwares used: Graph, gnuplot )


Related posts:

Saturday, July 5, 2014

Flower of Golden Triangle Spirals (黃金三角螺旋花)





The Graph file used for this post can be found here.


( Mathematical software used: Graph )

Tuesday, September 17, 2013

Tiling by Nested Polygons (2)

(A) Tiling by Nested Hexagons, Squares and Equilateral Triangles










(B) Tiling using Nested Dodecagons (and Hexagons)






(C) Tiling by Nested Octagons and Squares






(D) Tiling using Nested Hexagons











(E) Tiling by Nested Hexagons and Equilateral Triangles








(F) Tiling by Nested Dodecagons, Hexagons and Squares










(G) Tiling by Nested Hexagons and Equilateral Triangles







( Mathematical software used: GeoGebra )


Related posts: