## 10609 - Fractal

Moderator: Board moderators

angga888
Experienced poster
Posts: 143
Joined: Sat Dec 21, 2002 11:41 am
Location: Indonesia
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:
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
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. lobow
New poster
Posts: 10
Joined: Tue Jun 08, 2004 7:27 pm
Location: Pelotas - RS - Brazil
Contact:
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
More questions post me via PM. ..
A great helper
Posts: 454
Joined: Thu Oct 18, 2001 2:00 am
Location: Hong Kong
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 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. My signature: