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

Username:   Password: 
 RegisterRegister   
 Thicker lines in draw statement?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
x-ecutioner




PostPosted: Mon Nov 10, 2008 9:10 pm   Post subject: Thicker lines in draw statement?

this could either be really simple or really complicated, i think ...

any idea how to make the line thicker in a draw statement for like a circle or a square or a star?
code:

drawbox (Shapes.x - Shapes.add, Shapes.x - Shapes.add, Shapes.x2 + Shapes.add, Shapes.x2 + Shapes.add, Shapes.colorz)
drawoval (Shapes.x - Shapes.add, Shapes.x - Shapes.add, Shapes.ovalxr, Shapes.ovalyr, Shapes.colorz)
drawstar (Shapes.x - Shapes.add, Shapes.x - Shapes.add, Shapes.x2 + Shapes.add, Shapes.x2 + Shapes.add, Shapes.colorz)

thanks
Sponsor
Sponsor
Sponsor
sponsor
corriep




PostPosted: Mon Nov 10, 2008 9:17 pm   Post subject: Re: Thicker lines in draw statement?

Easiest way to do it :

Turing:

var thickness : int := 5 % Replace with anything you want

% Circle
for i : 1 .. thickness
drawoval (100, 100, 30 - i, 30 - i, black)
end for
% Square
for i : 1 .. thickness
drawbox (10 + i, 10 + i, 50 - i, 50 - i, black)
end for
% Star
for i : 1 .. thickness
drawstar (150 + i, 150 + i, 250 - i, 250 - i, black)
end for
The_Bean




PostPosted: Mon Nov 10, 2008 9:21 pm   Post subject: Re: Thicker lines in draw statement?

a) Use a for loop to increase/decrease the size by 1 each time for the thickness you want.
Turing:

%A)
for i : 1 .. 5
    Draw.Box (50 - i, 50 - i, 100 + i, 100 + i, 7)
    %
    Draw.Star (150 - i, 50 - i, 200 + i, 100 + i, 7)
    %
    Draw.Oval (275, 75, 25 + i, 25 + i, 7)
end for

b) Use the 'Fill' version of what your using, and make a smaller version of the same shape inside with the background colour.
Turing:

%B)
Draw.FillBox (50, 50, 100, 100, 7)
Draw.FillBox (55, 55, 95, 95, 0)
%
Draw.FillStar (150, 50, 200, 100, 7)
Draw.FillStar (160, 60, 190, 90, 0)
%
Draw.FillOval (275, 75, 30, 30, 7)
Draw.FillOval (275, 75, 25, 25, 0)

c) Use Draw.ThickLine, and recreate the image by ureself.
Turing:

%C)
Draw.ThickLine (50, 50, 100, 50, 5, 7)
Draw.ThickLine (50, 50, 50, 100, 5, 7)
Draw.ThickLine (100, 100, 50, 100, 5, 7)
Draw.ThickLine (100, 100, 100, 50, 5, 7)
%
for i : 0 .. 359 by 72
    Draw.ThickLine (round (cosd (i) * 30) + 175, round (sind (i) * 30) + 75, round (cosd (i + 36) * 15) + 175, round (sind (i + 36) * 15) + 75, 5, 7)
    Draw.ThickLine (round (cosd (i) * 30) + 175, round (sind (i) * 30) + 75, round (cosd (i - 36) * 15) + 175, round (sind (i - 36) * 15) + 75, 5, 7)
end for
%
for i : 0 .. 359
    Draw.ThickLine (round (cosd (i) * 30) + 275, round (sind (i) * 30) + 75, round (cosd (i + 1) * 30) + 275, round (sind (i + 1) * 30) + 75, 5, 7)
end for
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  [ 3 Posts ]
Jump to:   


Style:  
Search: