a isosceles triangle
Author |
Message |
appling

|
Posted: Sat Nov 08, 2003 4:15 pm Post subject: a isosceles triangle |
|
|
how to make a calling instruction to create a isosceles triangle,
with x1,y1,x2,y2,x3,y3
i don't know how to do that.  |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
Tony

|
Posted: Sat Nov 08, 2003 4:20 pm Post subject: (No subject) |
|
|
well think about it. You've got your 3 points, so just draw lines between them.
Draw.Line(x1,y1,x2,y2)
(x2,y2,x3,y3)
3,3 1,1 |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
 |
appling

|
Posted: Sat Nov 08, 2003 4:28 pm Post subject: (No subject) |
|
|
i don't mean that,
i have a Draw_Triangle procedure
code: |
procedure Draw_Triangle (C1, R1, C2, R2, C3, R3 : int)
drawline (C1, R1, C2, R2, 7)
drawline (C1, R1, C3, R3, 7)
drawline (C2, R2, C3, R3, 7)
end Draw_Triangle |
and this is for every triangle
now , i need to write a calling instruction to create an isosceles triangle using this procedure
and the randint must be used.
how could i do |
|
|
|
|
 |
Tony

|
Posted: Sat Nov 08, 2003 4:37 pm Post subject: (No subject) |
|
|
ohh... so isosceles triangle has same length for all 3 sides and 60 degree angles. You just randomly pick the length, and calculate other two points using trig
so you pick any X1/Y1
then X2 will be X1+ cosd(30)*length
Y2 will be Y1+ sind(30)*length
X3/Y3 will be same, but with -30 angle |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
 |
AsianSensation
|
Posted: Sat Nov 08, 2003 4:38 pm Post subject: (No subject) |
|
|
you have to calculate the distance between each points then. A circle would be the easiest if every single one of your points are random
generate one random point, then generate a random radius. Do the equation of a circle with origin your first point, and the radius with the one you just generated, then generate two more points that satisfy the equation, voila, you have your 3 points, then draw lines between them to make a triangle.
One thing you have to watch out for is when you generate those points with the equation of a circle, you don't want all your points to be on the same line. |
|
|
|
|
 |
AsianSensation
|
Posted: Sat Nov 08, 2003 4:39 pm Post subject: (No subject) |
|
|
tony wrote: ohh... so isosceles triangle has same length for all 3 sides and 60 degree angles.
lol, tony forgot the definition of isosceles triangle. what you were talking about is an equilateral triangle, all three sides the same. But technically, an equilateral triangle is a isosceles triangle. |
|
|
|
|
 |
appling

|
Posted: Sat Nov 08, 2003 4:45 pm Post subject: (No subject) |
|
|
thanks i see |
|
|
|
|
 |
|
|