Content

Interesting Math Problem

Monday 6 November 2006 - Filed under Maths&Physics

There are n dots, p red ones and q blue ones. The target is to link up the red ones without having cross overs, e.g.
crossovers
To produces this,
nocrossovers

To solve this problem. I consider all the red dots lie originally on a perfect circle and this irregular pattern is produced by moving the dots further or closer to the center of the circle. So, I first calculated the center point of all dots, centerX=(x1+x2+…+xn)/n, centerY=(y1+y2+…+yn)/n. Using a center point, I calculate the angle of a dot as angle1=Math.atan2(y1-centerY, x1-centerX). All the dots are sorted by their angles and linked clockwise or counterclockwise.
Not something difficult but quite interesting :) .

2006-11-06  »  5566

Talkback x 2

  1. Maciek
    6 November 2006 @ 5:34 pm

    What do you need blue dots for?

  2. 5566
    6 November 2006 @ 8:39 pm

    lol, true, the problem remains the same without the blue dots .

Share your thoughts

Re: Interesting Math Problem







Tags you can use (optional):
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

For spam filtering purposes, please copy the number 3169 to the field below: