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

Username:   Password: 
 RegisterRegister   
 Draw.FillStar Rotation
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
molly22




PostPosted: Tue Jun 13, 2006 4:57 pm   Post subject: Draw.FillStar Rotation

Hi,

Is there a way to make a Draw.FillStar rotate?

Thanks in advance,
Molly

P.S. I'm a beginner at Turing.
Sponsor
Sponsor
Sponsor
sponsor
HellblazerX




PostPosted: Tue Jun 13, 2006 5:02 pm   Post subject: (No subject)

Well, the only way to do this I guess is to draw a star using Draw.FillStar, take a picture of that using Pic.New, and then using Pic.Rotate to rotate it. I don't see how you could trig in this, because Turing draws stars like rectangles. Also, if you try using Pic.Rotate, don't forget to use Pic.Free to free up memory.
TheOneTrueGod




PostPosted: Tue Jun 13, 2006 5:35 pm   Post subject: (No subject)

Well, one way is to make your own DrawFillStar procedure. Have it accept some parameters, and you could even customize it to have different amount of points (Like a 6 pointed star, as opposed to a 5 pointed one). Another is to use Draw.FillPolygon. However, as hellblazer said, there is no built-into-turing method of rotating it.
zylum




PostPosted: Tue Jun 13, 2006 10:47 pm   Post subject: (No subject)

with your own procedure you could do stuff like this:

Turing:
proc drawStar (cx, cy, iRad, oRad, p, r, c : int)
    var x, y : array 1 .. p * 2 of int
    var angle : real := r - 90
    for i : 1 .. p
        x (i * 2 - 1) := round (cosd (angle) * oRad) + cx
        y (i * 2 - 1) := round (sind (angle) * oRad) + cy
        angle += 360 / (p * 2)
        x (i * 2) := round (cosd (angle) * iRad) + cx
        y (i * 2) := round (sind (angle) * iRad) + cy
        angle += 360 / (p * 2)
    end for
    Draw.FillPolygon (x, y, p * 2, c)
end drawStar

const TRAILS := 5

View.Set ("offscreenonly")

var mx, my, md : int

for i : 1 .. maxint
    locate (1, 1)
    put "click!"
    mousewhere (mx, my, md)
    for j : 1 .. TRAILS
        drawStar (mx, my, 50, 25, 5, j * md * 15 + i, RGB.AddColor (1 - j / TRAILS, 1 - j / TRAILS, 1 - j / TRAILS))
    end for
    View.Update
    delay (10)
    cls
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  [ 4 Posts ]
Jump to:   


Style:  
Search: