Computer Science Canada

Triangle Procedure

Author:  Token [ Tue Jun 21, 2005 6:06 pm ]
Post subject:  Triangle Procedure

okay well if u were following that post about the new improved turing then you may have read my issues about the triangle, i'm trying to get this to work but i'm having some problems... okay heres what i've got so far

code:

module Poly

    export Triangle
    procedure Triangle (a1, a2, a3, b, h, x, y, c : int)

        if a1 + a2 + a3 not= 180 then
            Error.Halt ("Not a true triangle: All angles do not add up to 180*")
        else



            drawline (x, y, x + b, y, c)
            drawline (x, y, x + round (((h * sind (a1)) * cosd (a1))), y + h, c)
            drawline (x + b, y, x + round (((h * sind (a1)) * cosd (a1))), y + h, c)

        end if
    end Triangle


end Poly

Poly.Triangle (90, 60, 30, 50, 50, maxx div 2-100, maxy div 2, black)
Poly.Triangle (60, 30, 90, 50, 50, maxx div 2, maxy div 2, black)
Poly.Triangle (30, 90, 60, 50, 50, maxx div 2+100, maxy div 2, black)


correct me if i'm wrong but these should be the same triangle, only rotated... i'll try and start from scratch, if ne one has ne ideas let me kno.

Author:  Bacchus [ Tue Jun 21, 2005 6:16 pm ]
Post subject: 

In your equiation, your only using the first angle for the calculations. So the base and height are being used in the perspective of that one angle. causing the different triangles.


: