QUADRANT I PLANS
Purpose: Draw a right triangle with sides parallel to X and Y axis
Input  IV: Coordinates of the end points of the hyptenuse ( X1, Y1) ( X2, Y2)
Output  DV: Canvas with right triangle drawn
;;righttriangle: number number number number > true
;;draw a right triangle given coordinates of end points of hyptenuse
(define (righttriangle X1 Y1 X2 Y2) ...)
;;QUADRANT II PLANS  EXAMPLES first drawn on graph paper
;; Example 1 with negative slope
(line (makeposn 0 25) (makeposn 0 0) 'red) ;;parallel to Yaxis
(line (makeposn 10 0) (makeposn 0 0) 'red) ;;parallel to Xaxis
(line (makeposn 0 25) (makeposn 10 0) 'red) ;;hypotenue
;;Example 2 with positive slope
(line (makeposn 5 10) (makeposn 5 0) 'blue)
(line (makeposn 15 0) (makeposn 5 0) 'blue)
(line (makeposn 5 10) (makeposn 15 0)'blue)
;;Example 3 from Quadrant III to Quadrant IV
(line (makeposn 15 20) (makeposn 15 5) 'green)
(line (makeposn 20 5) (makeposn 15 5) 'green)
(line (makeposn 15 20) (makeposn 20 5) 'green)
;;righttriangle: n n n n > true
;;draw a right triangle given coordinates of end points
(define (righttriangle X1 Y1 X2 Y2)
(and
(line (makeposn X1 Y1) (makeposn X1 Y2) 'black)
(line (makeposn X2 Y2) (makeposn X1 Y2) 'black)
(line (makeposn X1 Y1) (makeposn X2 Y2) 'black)))
(righttriangle 25 20 5 15)
(righttriangle 25 20 5 15)
Planning is essential to learn the process. Please do NOT just guess and check.
PLAN ON GRAPH PAPER FIRST!!
