
-----------------------------------
sosno
Tue Mar 09, 2004 8:10 pm

drawing oval problem
-----------------------------------
im trying to draw an oval that moves across the screen on a parabola i just cant figure out how to do it because it wants int but my equation involves real 
var x1, y1 : int

x1 := -50
y1 := 0
colorback (199)
cls

loop
    y1 := -1x1**2 %im am trying for it to be -0.1x1**2 (** is instead of exponent)
    drawfilloval (x1, y1, 30, 30, 14)
    delay (50)
    cls
    x1 := x1 + 1
    exit when y1 = 479
end loop



-----------------------------------
Paul
Tue Mar 09, 2004 8:14 pm


-----------------------------------
though it still doesn't go parabola

y1 := (-1)*(1**2) %im am trying for it to be -0.1x1**2 (** is instead of exponent)

I put the brackets cause its my habit

-----------------------------------
sosno
Tue Mar 09, 2004 8:19 pm

differtn thing
-----------------------------------
look in comment i would like it to be

y := -0.1*x**2

-----------------------------------
AsianSensation
Tue Mar 09, 2004 8:20 pm


-----------------------------------
when you draw to the screen, use round.

x:= something
y:= something

drawfilloval (round (x), round (y), ...)

-----------------------------------
sosno
Tue Mar 09, 2004 8:24 pm


-----------------------------------
sorry can u elaborate on that.
when you draw to the screen, use round.

x:= something
y:= something

drawfilloval (round (x), round (y), ...)

-----------------------------------
jonos
Tue Mar 09, 2004 8:24 pm


-----------------------------------
well, in turing you can't use decimals as coordinates so for each coordinate you will have to do round().

just do what he said and it should work. like i said before, turing won't let you use decimal numbers for coordinates, so if you round them to the nearest whole number (which round() does), then it will plot them for you.

-----------------------------------
Paul
Tue Mar 09, 2004 8:24 pm


-----------------------------------
Oh, that was confusing, you cant put a decimal into a int variable, so when you multiplied by -0.1, you turned it into decimal.

-----------------------------------
AsianSensation
Tue Mar 09, 2004 8:27 pm


-----------------------------------
Oh, that was confusing, you cant put a decimal into a int variable, so when you multiplied by -0.1, you turned it into decimal.

turing would not let you draw something with real numbers as it's parameter. So doing this: 

drawfilloval (0.564, -3.56 ....) will not work.

so to solve this, you round off the value for your coordinates first, so the above becomes:

drawfilloval (round (0.564), round(-3.56) ....), which is the samething as doing: drawfilloval (1, -4 ....), and you can draw on to the screen like that.

-----------------------------------
sosno
Tue Mar 09, 2004 8:27 pm


-----------------------------------
i realise i cant use decimals so can someone tell me for a beginner how to get around this.

-----------------------------------
sosno
Tue Mar 09, 2004 8:29 pm


-----------------------------------
but u cant round .1 it will be 0 and it wont work, 
you can tround parabolas neways

-----------------------------------
jonos
Tue Mar 09, 2004 8:29 pm


-----------------------------------
thats as easy as we can make it.

round(0.1) will round 0.1 to 0
round(0.5) will round 0.5 to 1
round(1000.25) will round 1000.25 to 1000

thats really simplest it can be.

-----------------------------------
AsianSensation
Tue Mar 09, 2004 8:31 pm


-----------------------------------
but u cant round .1 it will be 0 and it wont work, 
you can tround parabolas neways

what do you mean you cant round? you mean your assignment specify that you can't use the round function? or that you feel by rounding it, you are making the oval following an inaccurate path?

Because, without rounding, you really can't draw to the screen, turing is limited like that.

-----------------------------------
sosno
Tue Mar 09, 2004 8:38 pm


-----------------------------------
no my asssingment doenst specify i just want that circle to move a nice path along the screen and it hought the parabola would be a nice way to do that ne alternatives

this is only the start of what im trying to achieve im working on a moon where one circle blcoks out the other

incase you were wonderig if i just recently psoested somethign about a moon that was not compatable with the version of turing i run @ school i use mac turing 4.x (not sure exactly which one)

-----------------------------------
jonos
Tue Mar 09, 2004 8:41 pm


-----------------------------------
well, thats the only way you can do it unless you use trig which only a few people really know very well. look in turing submissions for arcs, circles, or something like that and  youl can just take code from there and work with that.
