Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 a isosceles triangle
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
appling




PostPosted: Sat Nov 08, 2003 4:15 pm   Post subject: a isosceles triangle

Question how to make a calling instruction to create a isosceles triangle,
with x1,y1,x2,y2,x3,y3
Question

i don't know how to do that. Crying or Very sad
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: 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
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
appling




PostPosted: 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 Wink

and the randint must be used.

how could i do
Tony




PostPosted: 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 Rolling Eyes

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
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
AsianSensation




PostPosted: 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




PostPosted: 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




PostPosted: Sat Nov 08, 2003 4:45 pm   Post subject: (No subject)

thanks i see
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 7 Posts ]
Jump to:   


Style:  
Search: