Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
Drawing Lines (on a cartesian plane-type-thing)?
Author Message
Paul

Posted: 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).

Fazonica

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

got it! thanks again!
Cervantes

Posted: 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.

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

 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

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

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

Posted: 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

Posted: 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: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 2 of 2  [ 21 Posts ]
Goto page Previous  1, 2
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: