%Name: Jessie Aaron Finley
%Date: February 16, 2007
%Purpose: To create a module that can draw the outline of a Square, Triangle (Right; grid A, B, C, and D, Issoceless, Equalateral, Scalene), and Circle
%Extra Creations: Rectangle, Parralellogram, Canadian Flag
%Create JShape module
unit
module JShape
%Declare shapes to be exported
export circle, square, RTriangle1, RTriangle2, RTriangle3, RTriangle4, ETriangle1, ETriangle2, ETriangle3, ETriangle4, ITriangle1, ITriangle2, ITriangle3, ITriangle4, Hexagon
%Declare variables
var half : int %Variable to make ETriangle's equal
var hieght2 :int
%Start and create the circle procedure
%Details: x= X-corodiante of the circles vertex
% y= Y-corodinate of the circles vertex
% r= Radius of the circle
% colour1= Colour of the circle
procedure circle (x, y, r, colour1 : int)
%Create the base of the circle procedure
Draw.Oval (x, y, r, r, colour1)
%Close the circle procedure
end circle
%Start and create the "square" module
%Details: x= starting X-corodinate
% y= Starting Y-corodinate
% thick= Length and width (Note: make the thickness 1 less then what you would want)
% colour2= Colour of the square
procedure square (x, y, thick, colour2 : int)
%Create the base of the square procedure
Draw.Box (x, y, thick + x, thick + y, colour2)
%Close the square procedure
end square
%Start and create RTriangle1
%Details: x= Bottom left X-Corodinate
% y= Bottom left Y-Corodinate
% base= Lenghth of base
% hieght= Lenghth of hieght
procedure RTriangle1 (x, y, hieght, base, colour4 : int)
%Draw side a of triangle
Draw.Line (x, y, x, hieght + x, colour4)
%Draw side b of triangle
Draw.Line (x, y, base + y, y, colour4)
%Draw side c of triangle
Draw.Line (x, hieght + x, base + y, y, colour4)
%Close the RTriangle1 procedure
end RTriangle1
%Start and create RTriangle2
%Details: x= Bottom left X-Corodinate
% y= Bottom left Y-Corodinate
% base= Lenghth of base
% hieght= Lenghth of hieght
procedure RTriangle2 (x, y, hieght, base, colour5 : int)
%Draw side b of triangle
Draw.Line (x, y, base + x, y, colour5)
%Draw side a of triangle
Draw.Line (base + x, y, base + x, hieght + y, colour5)
%Draw side c of triangle
Draw.Line (x, y, base + x, hieght + y, colour5)
%Close RTriangle2 procedure
end RTriangle2
%Start and create RTriangle3
%Details: x= Bottom left X-Corodinate
% y= Bottom left Y-Corodinate
% base= Lenghth of base
% hieght= Lenghth of hieght
procedure RTriangle3 (x, y, base, hieght, colour6 : int)
%Draw side b of triangle
Draw.Line (x, y, x, hieght + y, colour6)
%Draw side a of triangle
Draw.Line (x, hieght + y, base + x, hieght + y, colour6)
%Draw side c of triangle
Draw.Line (x, y, base + x, hieght + y, colour6)
%Close RTriangle3
end RTriangle3
%Start and create RTriangle4
%Details: x= Bottom left X-Corodinate
% y= Bottom left Y-Corodinate
% base= Lenghth of base
% hieght= Lenghth of hieght
procedure RTriangle4 (x, y, base, hieght, colour7 : int)
%Draw side b of triangle
Draw.Line (base + x, y, base + x, hieght + y, colour7)
%Draw side a of triangle
Draw.Line (base + x, hieght + y, x, hieght + y, colour7)
%Draw side c of triangle
Draw.Line (base + x, y, x, hieght + y, colour7)
%Close RTriangle4
end RTriangle4
%Start and create ETriangle1 procedure
%Details: Top vertex points up
% x= Bottom X-Corodinate
% y= Bottom Y-Corodinate
% hieght= Distance from each vertex to each median of the opposite line
% colour11= Colour of the triangle
procedure ETriangle1 (x, y, hieght, colour11 : int)
%Variable to make all sides of the triangle equal
half := hieght div 4
%Draw bottom line of triangle
Draw.Line (x, y, hieght + x, y, colour11)
%Draw left line of triangle
Draw.Line (x, y, hieght div 2 + x, hieght div 2 + half + y, colour11)
%Draw right line of triangle
Draw.Line (hieght + x, y, hieght div 2 + x, hieght div 2 + half + y, colour11)
%Stop ETriangle1 procedure
end ETriangle1
%Start and create ETriangle1 procedure
%Details: Top vertex points right
% x= Bottom X-Corodinate
% y= Bottom Y-Corodinate
% hieght= Distance from each vertex to each median of the opposite line
% colour12= Colour of the triangle
procedure ETriangle2 (x, y, hieght, colour12 : int)
%Variable to make all sides of the triangle equal
half := hieght div 4
%Left line of triangle
Draw.Line (x, y, x, hieght + y, colour12)
%Bottom line of triangle
Draw.Line (x, y, hieght div 2 + half + x, hieght div 2 + y, colour12)
%Top line of triangle
Draw.Line (x, hieght + y, hieght div 2 + half + x, hieght div 2 + y, colour12)
%Stop and end ETriangle2 procedure
end ETriangle2
%Start and create ETriangle1 procedure
%Details: Top vertex points down
% x= Bottom X-Corodinate
% y= Bottom Y-Corodinate
% hieght= Distance from each vertex to each median of the opposite line
% colour13= Colour of the triangle
procedure ETriangle3 (x, y, hieght, colour13 : int)
%Variable to make all sides equal
half := hieght div 4
%Draw top line of triangle
Draw.Line (x, hieght div 2 + half + y, hieght + x, hieght div 2 + half + y, colour13)
%Draw left line of triangle
Draw.Line (x, hieght div 2 + half + y, hieght div 2 + x, y, colour13)
%Draw right line of triangle
Draw.Line (hieght div 2 + x, y, hieght + x, hieght div 2 + half + y, colour13)
%Stop ETriangle3 procedure
end ETriangle3
%Start and create ETriangle1 procedure
%Details: Top vertex points left
% x= Bottom X-Corodinate
% y= Bottom Y-Corodinate
% hieght= Distance from each vertex to each median of the opposite line
% colour14= Colour of the triangle
procedure ETriangle4 (x, y, hieght, colour14 : int)
%Variable to make all sides equal
half := hieght div 4
%Draw right line of triangle
Draw.Line (hieght div 2 + half + x, y, hieght div 2 + half + x, hieght + y, colour14)
%Draw bottom line of triangle
Draw.Line (hieght div 2 + half + x, y, x, hieght div 2 + y, colour14)
%Draw top line of triangle
Draw.Line (x, hieght div 2 + y, hieght div 2 + half + x, hieght + y, colour14)
%Stop ETriangle4 procedure
end ETriangle4
%Start and create ITriangle1
%Details: Top tip points up
% x= bottom left x-corodinate
% y= bottom left y-corodinate
% base= The base of the triangle
% hieght= The hieght of the triangle
procedure ITriangle1 (x, y, base, hieght, colour14 : int)
%Draw bottom line of triangle
Draw.Line (x, y, base + x, y, colour14)
%Draw left line of triangle
Draw.Line (x, y, base div 2 + x, hieght + y, colour14)
%Draw right line of triangle
Draw.Line (base + x, y, base div 2 + x, hieght + y, colour14)
%Stop and end ITriangle1 procedure
end ITriangle1
%Start and create ITriangle2
%Details: Top tip points down
% x= bottom left x-corodinate
% y= bottom left y-corodinate
% base= The base of the triangle
% hieght= The hieght of the triangle
procedure ITriangle2 (x, y, base, hieght, colour15 : int)
%Draw top line of triangle
Draw.Line (x, y + hieght, x + base, y + hieght, colour15)
%Draw left line of triangle
Draw.Line (x, y + hieght, base div 2 + x, y, colour15)
%Draw right line of triangle
Draw.Line (base div 2 + x, y, x + base, y + hieght, colour15)
%Stop and end ITriangle2 procedure
end ITriangle2
%Start and create ITriangle3
%Details: Top tip points right
% x= bottom left x-corodinate
% y= bottom left y-corodinate
% base= The base of the triangle
% hieght= The hieght of the triangle
procedure ITriangle3 (x, y, base, hieght, colour16 : int)
%Draw left line of triangle
Draw.Line (x, y, x, x + base, colour16)
%Draw bottom line of triangle
Draw.Line (x, y, x + hieght, base div 2 + y, colour16)
%Draw top line of triangle
Draw.Line (x, y + base, x + hieght, base div 2 + y, colour16)
%Stop and end ITriangle3 procedure
end ITriangle3
%Start and create ITriangle4
%Details: Top tip points left
% x= bottom left x-corodinate
% y= bottom left y-corodinate
% base= The base of the triangle
% hieght= The hieght of the triangle
procedure ITriangle4 (x, y, base, hieght, colour17 : int)
%Draw left line of triangle
Draw.Line (x + hieght, y, x + hieght, y + base, colour17)
%Draw bottom line of triangle
Draw.Line (x + hieght, y, x, base div 2 + y, colour17)
%Draw top line of triangle
Draw.Line (x + hieght, y + base, x, base div 2 + y, colour17)
%Stop and end ITriangle4 procedure
end ITriangle4
procedure Hexagon (x, y, hieght, colour15 : int)
hieght2 := hieght div 3
Draw.Line (hieght2 + x, y, x, hieght2 + y, colour15)
Draw.Line (x, hieght2 + y, x, hieght2 * 2 + y, colour15)
Draw.Line (x, hieght2 * 2 + y, hieght2 + x, hieght2 * 3 + y, colour15)
Draw.Line (hieght2 + x, hieght2 * 3 + y, hieght2 * 2 + x, hieght2 * 3 + y, colour15)
Draw.Line (hieght2 * 2 + x, hieght2 * 3 + y, hieght2 * 3 + x, hieght2 * 2 + y, colour15)
Draw.Line (hieght2 * 3 + x, hieght2 * 2 + y, hieght2 * 3 + x, hieght2 + y, colour15)
Draw.Line (hieght2 * 3 + x, hieght2 + y, hieght2 * 2 + x, y, colour15)
Draw.Line (hieght2 * 2 + x, y, hieght2 + x, y, colour15)
end Hexagon
%Close the JShape module
end JShape |