Computer Science Canada Rotating Objects |
Author: | Sivann.. [ Thu Nov 06, 2008 5:31 pm ] |
Post subject: | Rotating Objects |
I'm working on a project for school, and I need to rotate an oval for it. I dont need it to spin, it just needs to be on a different angle. The problem is I don't understand how the variables work for rotating an object. When I try to rotate my oval, it creates a random box that is on that angle? This doesn't make sense. The code I placed is here, as well as the oval im trying to rotate 45 degrees. var f : int drawoval (420,70,40,15,11) var pic : int := Pic.New (50,50,120,45) var pic45 : int := Pic.Rotate (pic, 45, -1, -1) Pic.Draw (pic45, 5, 50, picCopy) The oval i want rotated is: drawoval (420,70,40,15,11) and yes, i have included: setscreen ("graphics:640,480,nobuttonbar") at the top of my screen. Help would be very appreciated. Thank You. |
Author: | The_Bean [ Thu Nov 06, 2008 7:12 pm ] |
Post subject: | Re: Rotating Objects |
The problem is that the Pic.New that your creating is not of the oval your trying to rotate. Draw.Oval (x, y, xRadius, yRadius, Color : int) where x,y are the center of the circle Pic.New (x1, y1, x2, y2 : int) : int where x1,y1 is the bottom left of the pic and x2,y2 is the top right of the pic In your program: Your making an oval at (420,70) with a x radius of 40 and y radius of 15. That oval will go from (380,55) to (460,85) if you were to make a box around it. So your Pic.New shouldn't be Pic.New(50,50,120,45) But Pic.New (380,55,460,85) other than that your Pic.Rotate is working properly |
Author: | The_Bean [ Fri Nov 07, 2008 1:50 pm ] | ||
Post subject: | Re: Rotating Objects | ||
There is also this method of actually drawing a rotated oval. Beware
|
Author: | Sivann.. [ Sun Nov 09, 2008 8:46 pm ] |
Post subject: | RE:Rotating Objects |
Thank you soo much. You saved my project ![]() |