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

Username:   Password: 
 RegisterRegister   
 Drawing a Curved line
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
shodai




PostPosted: Tue Oct 04, 2016 3:10 pm   Post subject: Drawing a Curved line

I am trying to create a curved line that looks like what you would see in a graph showing exponential growth. I have tried a couple of approaches but the results are not what I am looking for. I think the issue is simply the formula. Does anyone know what formula I would use for x and y coordinates to make such a line? This is my best result so far.

var x : int
var y : int
x := 200
y := 200

for i : 1 .. 200
Draw.Dot (x, y, green)
if i < 100 then
x := x + 1
if y mod 2 = 0 then
y := y + 1
end if
else
y := y + 1
if x mod 2 = 0 then
x := x + 1
end if
end if
end for
Sponsor
Sponsor
Sponsor
sponsor
DemonWasp




PostPosted: Thu Oct 06, 2016 9:28 am   Post subject: RE:Drawing a Curved line

If you want to show exponential growth, you should compute exponential growth. See http://compsci.ca/holtsoft/doc/exp.html , and remember that exponential functions grow very quickly.

Consider using Draw.Line from the previous point to the current point, so that you can see it when the function goes off the screen.
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  [ 2 Posts ]
Jump to:   


Style:  
Search: