Jump to content

Filling empty spaces in drawing math functions

2 replies to this topic

#1 Maccraft123

  • Members
  • 4 posts
  • LocationPoland ^^

Posted 29 July 2018 - 10:05 AM

I made small program which draws math fuctions
But I ran into problem:
Not displaying properly function when difference between old Y and new Y is higher than 1.
I tried
Code is in attachment
Screenshot also

I program on bigger screen becouse better view than 51x19

#2 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 29 July 2018 - 10:43 AM

View PostMaccraft123, on 29 July 2018 - 10:05 AM, said:

Code is in attachment
Screenshot also

Nope: you might've noticed the attachment system didn't let you upload anything.

Screenshots need to be hosted offsite, using a host such as imgur. You might also use pastebin for your code.

#3 Exerro

  • Members
  • 801 posts

Posted 03 August 2018 - 08:42 PM

Is your issue having something like this?
Posted Image

To get around this, you could draw a column of pixels up until the next Y coordinate. Something like this:
for y = currentY, nextY, currentY < nextY and 1 or -1 do
    drawPixel(currentX, y)

However what I'd do personally is generate a list of points (x, y coordinates) and then draw lines between those points using paintutils.drawLine or your own function.

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users