10609 - Fractal

All about problems in Volume 106. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

angga888
Experienced poster
Posts: 143
Joined: Sat Dec 21, 2002 11:41 am
Location: Indonesia

Post by angga888 »

lobow wrote:the result x' and y' will be the valors of C.
is it right?
I don't really understand your algo.
I interpret your steps this way:
Assume we want to build an equilateral triangle ABC. Now, we only know two points (A and B) and going to find the third one (point C).
Let's take an example:
the coordinate of A (0,0) and B (6,0), so the midpoint of AB is (3,0). Using your step we will get C (3,-3), and I think it's not an equilateral triangle.

Maybe if I don't misunderstand yours, you should use it in another way.

lobow
New poster
Posts: 10
Joined: Tue Jun 08, 2004 7:27 pm
Location: Pelotas - RS - Brazil
Contact:

Post by lobow »

I used the same way you showed this last post. At least when I used my way in your values I found the same C point.

But when I use in my program I get (6.710351,-6.710351).

The only thing that may be wrong then its the midpoint. What formula did you use to find it? I used (A+B)/2, maybe it is wrong.

angga888
Experienced poster
Posts: 143
Joined: Sat Dec 21, 2002 11:41 am
Location: Indonesia

Post by angga888 »

lobow wrote:The only thing that may be wrong then its the midpoint. What formula did you use to find it? I used (A+B)/2, maybe it is wrong.
Yes, same with mine. :wink:

lobow
New poster
Posts: 10
Joined: Tue Jun 08, 2004 7:27 pm
Location: Pelotas - RS - Brazil
Contact:

Post by lobow »

I saw an error in my formula. I was using the midpoint to rotate, but ill never find the C point with this (i think). Then I changed the x,y coordinates of the rotation axis to the point B and the point that I want to rotate to A, rotating 60

angga888
Experienced poster
Posts: 143
Joined: Sat Dec 21, 2002 11:41 am
Location: Indonesia

Post by angga888 »

More questions post me via PM. 8)

..
A great helper
Posts: 454
Joined: Thu Oct 18, 2001 2:00 am
Location: Hong Kong

Post by .. »

angga888 wrote:Hi lobow,

I assume that the equilateral triangle always on the left side. I just try it and get the same result as the sample output. The problem description doesn't specify that. To get the points in an equilateral triangle, first I rotate the coordinates so that they become parallel to the x-axis or y-axis. After this, we can find all the points easilly. Next, I rotate them back again and get the real coordinates.

Hope it helps :wink:

Anggakusuma
I personally think that this method is not so "simple". I provided my method here. Given A, B, you can find C, D by ratio. And we know E are eqidistance from C, D. So I draw 2 circles using centers C, D and radius = distance(C, D). Then find the 2 intersection points of these 2 circles. Then you can use triangle-test to decided which intersection point is the required E. :wink:
My signature:
  • Please make discussion about the algorithm BRFORE posting source code.
    We can learn much more in discussion than reading source code.
  • I HATE testing account.
  • Don't send me source code for debug.

Post Reply

Return to “Volume 106 (10600-10699)”