Monday, September 8, 2008

Inversion

Inversion Icon

I had to make an app that solves the problem of Apollonius about half a year ago, so I'm publishing it here in case someone needs it.

Now for those of you who don't know what the problem of Apollonius is: It's about geometry, or more precisely Euclidean plain geometry. The task is to construct all circles (or lines) that are tangent to ("touch") three circles (or a point / line).

Now this may sound easy, but try to do this with three points, which is the most easy one (as much as I remember). You'll soon find out it isn't that easy. But if you use something called "inversion" (not the app), it's very easy. Inversion is sometimes also called "mirroring in a circle" (at least in German), which explains the concept very well (google for it if you want).

This is my first app (other than web apps), so don't expect too much of it. But still it's fun to play around. It's free and I'll give you the source code if you want (I'm not good at choosing copyleft licenses, so I'd appreciate advise).

Download:

Inversion1.1.dmg

How to use:

Add shapes with the plus button on the bottom left of the window. You can change the properties of the shapes using the inspector. If you have 3 shapes, the solution of the problem of Apollonius will be drawn in red.

System requirements:

  • Mac OS 10.5 Leopard (Universal)
  • 1 MB of free disk space

Screenshot:

7 comments:

lone said...

Hello-- this is indeed the best tool I have seen on Apollonian. I was wondering that there is anyway I can export it as a webservice and see the x,y coordinates and solution circle ...You people simply rock

Lukas Berns said...

Hi
thanks for the response

I could implement what you said, I just need to know what exactly you mean by a ‘webservice’

because porting the whole project to javascript so it can be run in a browser is quite hard work

just printing out the data about the solution circles is quite easy.

One thing I might add is the ability to export as an image (png or tiff) – actually I don't know why I haven't done it :P

just let me know if I misunderstood you.
cheers

Lukas Berns said...

Ok I have published Inversion 1.3 which adds the ability to export as png, tiff and txt. I'm not sure if this enough for you, but this is a quite useful function. The text output is somehow bad to read and to parse, maybe I'll add some xml option.

http://rand1-365.blogspot.com/2009/04/inversion-13.html

Hope this helps.
Lukas

Anonymous said...

Hey Lukas you rock man. I have been working as a researcher at Stanford University USA. I was stuck with this problem for a long time as I wasnt able to implement Apollonius due to my weak math background. I am working on geolocation of internet host using RTT
http://www.slac.stanford.edu/comp/net/wan-mon/tulip/

An example can be found over here
(http://www-wanmon.slac.stanford.edu/cgi-wrap/tulip-viz.cgi?target=www.slac.stanford.edu)

As you might see we are using trilateration to find the host which isnt working out very well. I was thinking to implement Apollonius to locate the host. Implementing Apollonius seems to bit hard and requires great Mathematical background which you surely have. Before diving into implementation I thought I should first get a feasibility to solve the problem using Apollonius.

Your software is really helping me out there as i dont need to implement Apollonius it self.

I am extremley grateful to you as you have saved me alot of time. It would be great if you can reffer me some reading material which can help me implement it in Java as am not good at Objective C and rest of the project is in Java as well

Lukas Berns said...

@Anonymous
It's nice that you find my app helpful.
Yes I can help you port it to Java (although I'm not good at Java because I only have started (not completed) one or two tutorials on Java.
But as long as the goal is to get the data and not a UI with a graph, it's quite simple as the underlying mathematics are quite simple.

To keep the amount of work as little as possible, I want to know which functions you need. I guess you only need points or circles as starting objects. Implementing lines is (interestingly) more difficult (my app has still some bugs there).

And finally, just to let you know, because this is app is more-less just a proof of concept for using the inversion to solve Apollonius, it's not the ideal way because this app uses calculated geometrics, which can easily cause errors — that's why there's the slider to adjust the precision .
If I can find a better way, I'll implement that.

BTW your project sounds interesting.

Anonymous said...

Hi Lukas many thanks for the abrupt response and helping me solve this. Yes I only need the data as I am plotting it on the map. I have already figured out the way to convert latitude, longitude in the Cartesian coordinates and vice versa.
And you are right I need to start with the circles only and then can enhance it to points as it would help sort out more cases.
I have read some other ways as well like Mobius transforms and solving degree 2 equations but they seem to be awfully hard to implement.
Thanks for praising the project, it is quite an interesting problem and every year many researchers are coming up different methodologies to solve this problem.

Lukas Berns said...

@Anonymous
I finished the port of the circles.
There might be (no — are) bugs, but I will eliminate them as I stumble over them.

The points etc. will come soon.

Checkout the code here: http://github.com/lukasberns/Apollonius/tree/master

I guess it'll be licensed as GPL just as Inversion because it's a port. If that's inconvenient, I'll change to something different.

I hope it works well enough for use in your project.

Greetings, Lukas