Computer Science Canada

How do you make an irregular oval rotate across the screen?

Author:  Yahoo999 [ Tue Mar 03, 2009 9:42 pm ]
Post subject:  How do you make an irregular oval rotate across the screen?

I used drawfillarc, because I thought if I could make the angles rotate (didnt seem to work). Is there something Im missing, because I just need to know the logic on how the oval can rotate across the screen. If Im wrong with drawfillarc please tell me what to do.

P.S Thank You for helping or trying the best to help
If you couldn't thank you for trying

code:

setscreen ("offscreenonly")
procedure downhill
    for x : 0 .. 339
        drawfillarc (30 + x, 350 - x, 20, 50, 0, 360, 255)
        delay (10)
        View.Update
    end for
end downhill
downhill

Author:  zero-impact [ Tue Mar 03, 2009 10:13 pm ]
Post subject:  Re: How do you make an irregular oval rotate across the screen?

What you could do is draw the oval once then using the turing PIC commands make a picture out of it and use Pic.Rotate to rotate it. Looking up PIC in the turing reference should give you all the commands you need.

Author:  Yahoo999 [ Tue Mar 03, 2009 10:17 pm ]
Post subject:  Re: How do you make an irregular oval rotate across the screen?

Is that the only way and no other, because if there are other ways I might need to use them for reference. BTW Im very new at Turing and I need lots of reference.

Author:  SNIPERDUDE [ Tue Mar 03, 2009 10:27 pm ]
Post subject:  RE:How do you make an irregular oval rotate across the screen?

Saving the oval as an object would be your best bet. So first you would draw the image, then use Pic.New (x1, y1, x2, y2) to save it as an image. Then to create it rolling down a hill, you would put in your loop (where you are determining the x and y value) a Pic.Rotate to rotate the image accordingly and Pic.Draw to draw it at the x and y locations set by your for loop.

That should help you out.

EDIT:

Is this out of interest or a school assignment?

Author:  Tony [ Tue Mar 03, 2009 10:47 pm ]
Post subject:  RE:How do you make an irregular oval rotate across the screen?

I'm not sure what the point of this exercise is, but it's likely that using the Pic module defeats the purpose.

You rotate an oval the same way you rotate _anything_ -- one pixel at a time.

Author:  The_Bean [ Tue Mar 03, 2009 11:29 pm ]
Post subject:  Re: How do you make an irregular oval rotate across the screen?

I'm thinking you should be using the Pic.Rotate(), because if you just started learning Turing then you probably won't know the math involved with making an oval and rotating it pixel by pixel across the screen.

Author:  SNIPERDUDE [ Wed Mar 04, 2009 9:12 am ]
Post subject:  RE:How do you make an irregular oval rotate across the screen?

That's what I was thinking. Or even the math to make an irregular oval roll down a hill properly.

Author:  Yahoo999 [ Wed Mar 04, 2009 4:24 pm ]
Post subject:  Re: RE:How do you make an irregular oval rotate across the screen?

SNIPERDUDE @ Wed Mar 04, 2009 9:12 am wrote:
That's what I was thinking. Or even the math to make an irregular oval roll down a hill properly.

I need the math to make it roll properly, because apparently PIC rotate cannot be used in my project. So if you can give me the math it would be much appreciated.

Author:  Tony [ Wed Mar 04, 2009 5:05 pm ]
Post subject:  RE:How do you make an irregular oval rotate across the screen?

you start with the base formula of

x^2 / a^2 + y^2 / b^2 = 1

and derive the rest from there.

Wikipedia might have other useful formulas:
http://en.wikipedia.org/wiki/Ellipse

Although I will warn you that generalizing this into a single math function will get complicated really fast.

Author:  Yahoo999 [ Wed Mar 04, 2009 5:38 pm ]
Post subject:  Re: RE:How do you make an irregular oval rotate across the screen?

Tony @ Wed Mar 04, 2009 5:05 pm wrote:
you start with the base formula of

x^2 / a^2 + y^2 / b^2 = 1

and derive the rest from there.

Wikipedia might have other useful formulas:
http://en.wikipedia.org/wiki/Ellipse

Although I will warn you that generalizing this into a single math function will get complicated really fast.


Im learning about graphics (basically draw and erase graphics) and can't I make a circle sliding down and across, while having blank arcs turn around and erasing the oval as it goes along therefore making it seemingly rolling and rotating along its own. That's what I found out today, but its confusing in most parts can someone give me an example. Thank you...hope I wasn't asking a lot since I was updating this help thread many times.


: