Computer Science Canada making an equilateral triangle using draw.line and pythagorean theorem |
Author: | Hendo [ Mon Feb 19, 2007 8:05 pm ] |
Post subject: | making an equilateral triangle using draw.line and pythagorean theorem |
Hi, I'm new to Turing and I have been trying to find a way to make an equilateral triangle using three draw.line commands and pythagorean theorem, but to no avail... It's in a module file so it will have to be able to be made any size that the user species. TIA! ![]() |
Author: | Clayton [ Mon Feb 19, 2007 8:44 pm ] |
Post subject: | Re: making an equilateral triangle using draw.line and pythagorean theorem |
I already helped you out in the IRC channel, but for the benefit of others: ![]() |
Author: | Hendo [ Mon Feb 19, 2007 9:51 pm ] | ||
Post subject: | Re: making an equilateral triangle using draw.line and pythagorean theorem | ||
ok, i know this isn't turing code but since i'm on my mac and im using TNT Basic, this is what I tried (you'll notice that TNT Basic and Turing are similar)
Unfortunately this created a scalene triangle...i must be doing something wrong.... |
Author: | zylum [ Tue Feb 20, 2007 2:11 am ] |
Post subject: | Re: making an equilateral triangle using draw.line and pythagorean theorem |
you could try this thread for a nice solution: http://compsci.ca/v3/viewtopic.php?t=14543&highlight=triangle&sid=65c9d8edf28bf760b924a23f861c9663 if you *need* to use pythagorean then heres a method you can use: your initial point is (x, y) your side length is L so the next point on the base is (x + L, y) the x coord for the last point is x + L/2 the y coord for the last point is (using pythagorean theorem) sqrt(L^2 - (L/2)^2) sorry i was too lazy to draw up pictures ![]() |