Share:

" /> Visio Guy » Visio Squircles
Home » Shapes

Visio Squircles

Submitted by on April 2, 2009 – 5:00 am | | 15904 views 4 Comments

squircle-visio-shapeA couple weeks ago, I briefly glanced at my annoying Facebook page and noticed that people were commenting on the “new look”, which I was fortunate enough to not notice.

What did catch my eye was a comment from one friend, who noted; “Hey, the new Facebook has squircles!” Then another replied; “Yes, squircles are so Web 2.0!”

Naturally I was put off by how folks try to Out-clever-two-point-oh each other on Facebook, but I was nonetheless curious about squircles, because they sounded…well…visual!

Scandal! It’s Not a True Squircle

So I immdiately set out to find out what a squircle was, and create a Visio version of one, if possible.

It turns out that squircles are a sort of rounded square.You can read about the details on Wikipedia, but I’ll summarize a squircle as a a “circle to the fourth power”. Normally, you would describe a circle as being an x2+y2 kind of beast. A squircle would be what you get if you were to plot x4+y4.

The ShapeSheet behind each Visio shape is good at representing trigonometric curves, and you can use algebra to create expressions for each point in a shape. But it isn’t good at creating arbitrary curves and plotting innumerable points. So I had to come up with an approximation of r4, that could be expressed as circular arcs or elliptical arcs, or splines or nurbs.

Since my nurb- and spline-math is very rusty, I settled on creating a squircle from eight circular arcs, each arc tangent to the next. I think it looks pretty good, but see for yourself:

visio-squircle-tangents

While the shape is composed of eight circular arcs, there are only three unique radii for these arcs, since the corner curves are all the same, the left and right sides are the same, and the top and bottom are the same.

In the illustration above, I’ve highlighted one set of unique arc-segments and colored them red, green and blue. They are all circular arcs, but they all have (potentially) different radii. Where they meet, they are tangent. So the red arc is tangent to the green arc, and the blue arc is tangent to the other end of the green arc.

Also shown are the radii for each arc. When the shape is stretched to be rectangular, the red and blue radii no longer remain the same. But the corner radii always remain the same–as specified by the shape’s user.

Creating the Squircle

To calculate the geometry for the shape, I had to resort to some lengthy, but not complicated, algebra and trigonometry. For this squircle shape, we choose a width and height, and we specify the arc and radius of the corners. These knowns, along with the constraint of tangency at each arc intersection make this a solvable system. Here’s the design- and calculation scribblings for the masochistic:

homeworkclick to view larger image

The trick to translating complicated math like this into the ShapeSheet is to use User-defined cells. When you sketch out your geometry, give the important bits good-but-short names. As you do the algebra, notice any long-but-repeated expressions and turn them into variable- or constants to make your formulas shorter. Now all of the variables and constants become User-defined cells.

In my squircle shape, I’ve got 13 User-defined cells. They have names like this:

User.alpha
User.r
User.w
User.h
User.bx
User.by
User.br
User.rx
User.ry
User.k
User.cosb
User.sinb

If you ignore the “User” bits, it starts to look a lot like eighth-grade algebra class, doesn’t it? The end-result of all this substitution and simplification is a very compact and clean Geometry section. This is what the actual arc-definitions look like for our squircle’s geometry-section:

squircle-shapesheet-geometry

click to view larger image

Using the Squircle Shape

When using this shape, we specify both the angle and the radius of the corner arcs (the green ones!) You do this via the Shape Data Window which you can access under the View menu.

We can see what happens as we vary the angle at the corner. Below, I’ve shown the shape as both a “squircle” (a square) and a “circtangle” (a rectangle). When the angle goes beyond 90°, things start to get interesting!

angle-comparisons

click to view larger image

Similarly, we can experiment with the radius at the corner. In the image below, I’ve expressed the radius as a function of the width of the shape, since absolute values wouldn’t tell you anything useful:

radii-comparisons

click to view larger image

Get the squircle!

Visio Squircle Shape (57.87 kB) - 219

And be sure to let us know what you are doing with the Squircle by leaving a comment below. We’d love to know what uses you put him to!

We whipped up a few flowcharts with him, just to see if we could. Here are some samples using Visio 2007’s themes feature, including the custom Battlezone Theme.

squircle-flowcharts

click to view larger image

4 Comments »

Leave a comment!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.

*