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

Username:   Password: 
 RegisterRegister   
 Drawing Lines (on a cartesian plane-type-thing)?
Index -> Programming, Turing -> Turing Help
Goto page Previous  1, 2
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Paul




PostPosted: Tue May 04, 2004 3:20 pm   Post subject: (No subject)

um... just reduce the slope to lowest fractional form then draw a line of circles (o's) in between the 2 circles already drawn (I edited my code).
Sponsor
Sponsor
Sponsor
sponsor
Fazonica




PostPosted: Tue May 04, 2004 3:23 pm   Post subject: (No subject)

Exclamation got it! thanks again!
Cervantes




PostPosted: Tue May 04, 2004 3:27 pm   Post subject: (No subject)

Fazonica wrote:

and i don't think those are densely packed "o"s...!!

they aren't. pauls an idiot. Wink

i haven't added in that bit with minx and maxx, you can do that Wink

code:

setscreen ("graphics:600;600")
var MINx, MAXx, m, b : int
var x, y : int
const gridsize := 20

put "Enter value for M : " ..
get m
put "Enter value for B : " ..
get b
x := - (maxx div 2)
cls

/*for gx : 1 .. maxx by gridsize
 drawline (gx, 0, gx, maxy, black)
 end for
 for gy : 1 .. maxx by gridsize
 drawline (0, gy, maxx, gy, black)
 end for*/

var font := Font.New ("Times New Roman:12")

loop

    x += gridsize
    y := (m * x) + (b * gridsize)
    exit when x > maxx or y > maxy
    Draw.Text ("O", x + maxx div 2, y + maxy div 2 + gridsize div 3, font, black)

end loop

Draw.Text ("(0,0)", maxx div 2, maxy div 2, font, brightred)


EDIT: paul your code seems to be excessively long and it seems to only draw 3 circles.
they're at:
(0 - run, 0 - rise + b)
(0, 0 + b)
(0 + run, 0 + rise + b)
anywho....
Fazonica




PostPosted: Tue May 04, 2004 3:34 pm   Post subject: (No subject)

wow. and that works too!! Surprised i feel like such a beginner. and just when i think i know a lot. meh. Smile thanks!
Paul




PostPosted: Tue May 04, 2004 3:36 pm   Post subject: (No subject)

mine looks better and has more practical use. Stupid assignment. Im changing it back to draw.thickline. and keeping it for further use.
Fazonica




PostPosted: Tue May 04, 2004 3:38 pm   Post subject: (No subject)

LOL!! *thumbs up* good idea. you never know when you're going to have to draw graphs. i blame math.
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 2 of 2  [ 21 Posts ]
Goto page Previous  1, 2
Jump to:   


Style:  
Search: