Showing posts with label aldraw. Show all posts
Showing posts with label aldraw. Show all posts

Saturday, June 22, 2013

Membranes

As you may be aware, I like making geometrical constructions. Ever since I made an AlDraw app for Android, I've been using it to post constructions on Facebook. The other day I posted this construction, titled "Membranes".
This wasn't the first time I constructed this image, but when I reuse a construction, I still reconstruct it, rather than simply copying the original. But when I did that this time I discovered that I made the original one incorrectly. It wasn't exactly a mistake. I made it the way I had intended to, but I found out when I made a small change, it made the whole thing more elegant.

To explain how, I'll need to explain how I constructed it in the first place. I started with these two circles. The radius of the outer circle is R. The radius of the inner circle is R/2. They are both centered at (0, 0).
Next I drew circular arcs between the inner and outer circles. All three have radius R and are centered on the edge of the outer circle. The red at 0°, the blue at 30° and the green at 60°. I've shown the centers of the circles in the same color as the circles.
Then I added those same circles again, reflected around the x and y axes.
Then I wanted to connect the different arcs, and I want it to look smooth, so I want to make circular arcs that are tangent to the arcs they're connecting. How do I do that?

Well, if two circles are tangent, then a line drawn through the centers of both will pass through the point of tangency. So if you have a circle, and you know what point you want to be tangent, then you can draw a line through the center of that circle and through that point. Then any circle that is centered on that line and that goes through that point will be tangent to the first circle. And if you have two circles like that, and you want to find one circle that is tangent to both, then you can draw two lines. Where they intersect will be the center of the third circle.

So I'll start with the red circles. I drew lines through the centers of the red circles and the points where the red circles intersect the inner circle. Where they intersect is the center of the circular arc that connect the two arcs. Note that each red line comes close to where the other red circle intersects the outer circle, but not quite. Also, each red line comes close to where the blue circles intersect the inner circle, but again, not quite.
The I did the same thing with the blue circles. I drew a line through the center of each blue circle and the point where that circle intersects the inner circle. Note the intersection of the blue lines is close to the outer circle, but not quite on it. Also, each blue line comes close to where the green circles intersect the inner circle, but again, not quite.
The next and final step is where I noticed the mistake. Because the next step I simply drew straight line segments to connect the green arcs. The straight lines are nearly tangent to the green arcs. But not quite.
Now at this point, I could have simply found the circular arcs that would be tangent to the green arcs the same way I did for the blue and red. That would be one way of fixing it. But I wanted those green arcs to be connected by straight lines and for those line to actually be tangent to the arcs. And the only way to do that is the change the radius of the inner circle, which changes where the red and blue circles intersect it, which changes where the connecting arcs need to be. In other words, changing nearly the whole image.

So this time, I started not with the outer circle and inner circle, but rather the outer circle and one of the green circles.
Now I need to find the point on the green circle where a horizontal line will be tangent to it. A line drawn through the center of a circle will always be perpendicular to the circle and hence perpendicular to the tangent line where it intersect the circle. So what I need to do is draw a vertical line through the center of the green circle, and where it intersects the green circle is where a horizontal line will be tangent to it.
Then I can draw the inner circle with the same center as the outer circle and that goes through that point. A little bit of trigonometry shows that the radius of the new inner circle is R, which is approximately .5176R.
Then I drew the other circles the same as before, between the outer circle and the new inner circle.
Again, I drew lines between the centers of the red circles and the points where they intersect the inner circle. But notice, this time they don't pass close to where the other red circle intersect the outer circle, they pass right through it. Also, although the difference is too small to notice at this scale, the red lines also pass directly through where the point where the blue circles intersect the inner circle.
And again, I drew the lines between the centers of the blue circles and the points where they intersect the inner circle. And again, notice that they don't intersect near the outer circle, they intersect directly on top of it. Also, they pass directly through the points where the green circles intersect the inner circle.
And finally, I drew the lines connecting the green arcs, and this time, they're actually tangent.
It's interesting how that one little almost imperceptible change made the whole thing more elegant.






Monday, December 31, 2012

AlDraw on Android

I've mentioned my program AlDraw before. It's the one that lets you make cool geometrical constructions like you can see here.

Well, now I've released it as an Android app. If you have a device with Android 3.0 or higher, check it out! https://play.google.com/store/apps/details?id=strinka.aldrawandroid

Tuesday, December 13, 2011

AlDraw Wiki

Ever wish there were a wiki focused on AlDraw for you to learn from and contribute to? No, I didn't really think so. Nonetheless, it now exists - behold, AlDraw Wiki!

Right now there's not a lot of stuff specific to AlDraw. I've been focusing on the Construction techniques category. I have instructions on simple techniques, such as how to construct a midpoint, intermediate, such as how to inscribe a circle in a triangle and advanced, such as how to construct a circle that passes through two given points and is tangent to a given line. And I'm adding more every day.

Is something confusing or unclear? Ask and I'll write it better. Do you see a mistake I made? Edit it!

Edit: I've just added the pentagon. This page describes both how to construct a pentagon inscribed in a circle (which is easy to find elsewhere online) and also how to construct a pentagon from a given side length (which is harder to find elsewhere).

Monday, August 22, 2011

AlDraw, Version 2.1

Well, it's been more than a year since I announced I was working on AlDraw 2.0. Now, 2.1 is out. The coolest thing: now it does colors. Look!















There are also a few other new features. It does copy and paste, too, although that's a bit complicated since it handles scaling and rotation in addition to translation. So now, a year later, I've hit all the big things on the to-do list. There are still plenty of little things to work on. More pictures can be found here.

Wednesday, December 8, 2010

AlDraw on SourceForge

Back in August, I said I was working on improving AlDraw. And I have been. Slowly, but surely.

And now, it's on SourceForge. https://sourceforge.net/projects/aldraw/

AlDraw-src.jar is, as your  might have guessed, all the source files. AlDraw.zip is contains an executable jar, among other things. All you need to try it out is java installed on your computer.

I'm still calling it a beta version. I've made significant progress, but there's still a ways to go. Particularly on the new features front. I've added hardly any of the features I've been wanting to. Most of my efforts have gone to the code design and usability goals. And fixing the things I broke while refactoring.

But it's in a workable, usable state now. Go try it out! And if you know Java, take a look at the code and tell me if it still looks like a total mess. It's released under GNU GPLv3 so you can copy, modify and redistribute it nearly however you like.

Tuesday, August 17, 2010

AlDraw, Version 2.0

AlDraw is the program I use to make things like this:
(By the way, I just uploaded a bunch onto my picasa album)

I've been working on improving it. I've decided I want to do a major overhaul, and make it version 2.0.

There are three big things I want to focus on:

  • Improving code design. -- When I first wrote it, I didn't really give any thought or attention to making it good code and easily maintainable and extensible. As I gradually expanded it, I rewrote the worst parts to make it more flexible. But for the scale of changes I want, I don't think that's going to be enough. Also, I want to be able to show the code to another programmer and not have them think "What the hell were you doing?"
  • Improving usability. -- This is probably the worst thing about the program right now, because I'm the only one who uses it. There are a lot of things about the program that make perfect sense to me, but wouldn't to anyone who just started using it, because they didn't write it, or get used to its shortcomings as they worked to fix them. If anyone is willing to help test it, let me know.
  • Add features. -- Copy and paste to make repeated designs like tiling easier. Make zooming and panning more fluid. Add colors. Pretty straightforward.
Also, as I want this to be a big step forward, now would be a good time to rename it. I would welcome any suggestions. Possible ideas: keep AlDraw, GeomeDraw, Constructomatic, Euclidomizer...