Nerd Puzzle
October 18th, 2005 by Ivo
Ok, this post has no use whatsoever, but I need to get this out of my system. I was in an incredibly dull meeting the other day, and at one point, I had on my sheet of notes 3 randomly placed dots:
.
.
.
For some reason, I don't know why, I started to wonder if there would be one or more circles that have an outline that touches these 3 dots. Yes I am a nerd (just imagine how boring the meeting was).
To put this puzzle in other words: is there, for any given set of 3 points, a 4th point that has an equal distance to the first 3 points?
My preliminary conclusion is that for each three points, there is exactly 1 circle that has a matching outline, unless the 3 points are positioned exactly in one line. I lack the mathematical background however to prove/disprove this in theory. I discussed this with a fellow nerd and he also concluded that there should be exactly 1 circle for each set of 3 points (as long as they are not in a straight line).
Now I'm curious. Am I right in the 'exactly 1 circle' assumption? If so, what would be the optimal way of determining the center of the circle? In other words, how would you implement:
/** * Determine the center point of a circle whose outline strikes 3 given points. * @param Point $a * @param Point $b * @param Point $c * @return Point The center point of the circle outlining point $a, $b and $c */ function centerpoint($a, $b, $c) { .... return new Point($x, $y); }
On to something else. The rumours of the Zend Framework are spreading quickly. I haven't been contacted by Zend so it's not going to be Zend ATK.
I'm wondering what it is though. Whether it's anything like a business framework, or more of an IDE kind of thing, or just a set of classes providing some API.
Finally an update on ATK: we're wrapping up RC1 of ATK 5.3. It should be out real soon now.
October 18, 2005 at 10:00 pm, Derick said:
You can’t put a circle through all three points, but an elipse always works.
October 19, 2005 at 12:04 am, Chris Padfield said:
http://mathforum.org/library/drmath/view/55166.html
October 19, 2005 at 9:22 am, Patrick said:
There is always a circle, except when the points are on a straight line.
On paper, you can find the center by drawing 2 ‘perpendicular bisectors’ (in dutch: ‘middelloodlijnen’) between A and B and between B and C. Wherever these lines intersect, there’s the center point of the circle.
October 19, 2005 at 9:38 am, Harrie Verveer said:
The distance from one point to another point whould be:
((x[x] – a[x])^2 + (x[y] – a[y]) ^ 2)^0.5
(pythagoras)
so we are looking for something where this is true:
((x[x] – a[x])^2 + (x[y] – a[y]) ^ 2)^0.5 = ((x[x] – b[x])^2 + (x[y] – b[y]) ^ 2)^0.5 = ((x[x] – c[x])^2 + (x[y] – c[y]) ^ 2)^0.5
this is confusing, because we are using arrays in a mathematical function – so I replace some variables in the original part:
((X – A)^2 + (Y – B) ^ 2)^0.5
can be rewritten to:
(X^2 * -2XA * A^2 + Y^2 * -2BY * B^2) ^ 0.5
in our equals thingy we can simply forget about the sqrt – because X^0.5=Y^0.5 will equal just as well when we say X=Y. Right? It doesn’t matter – so get rid of it
Ok, let me get this equalisation again:
x[x]^2 * -2x[x]a[x] * a[x]^2 + x[y]^2 * -2a[y]x[y] * a[y]^2
=
x[x]^2 * -2x[x]b[x] * b[x]^2 + x[y]^2 * -2b[y]x[y] * b[y]^2
=
x[x]^2 * -2x[x]c[x] * c[x]^2 + x[y]^2 * -2c[y]x[y] * c[y]^2
Let’s get rid of some unwanted stuff, to make life easier:
x[x] * a[x]^3 – x[y] * a[y]^3 = x[x] * b[x]^3 – x[y] * b[y]^3
= x[x] * c[x]^3 – x[y] * c[y]^3
Hmmm I don’t get further than this for the moment – maybe this helps somebody else? If I didn’t make a mistake (pretty likely
)
October 19, 2005 at 9:42 am, Patrick said:
I forgot to mention that this also shows that there is at most 1 circle.