
-----------------------------------
molly22
Tue Jun 13, 2006 4:57 pm

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.

-----------------------------------
HellblazerX
Tue Jun 13, 2006 5:02 pm


-----------------------------------
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
Tue Jun 13, 2006 5:35 pm


-----------------------------------
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
Tue Jun 13, 2006 10:47 pm


-----------------------------------
with your own procedure you could do stuff like this:

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
