Home Technical Talk

Converting Line to Points - Help

Hi.

Haven't done anything constructive in a while. Been busy on some stuff.

Anyway ~ I'm suffering a problem with one of my projects.

It's a drawing application that uses OpenGL for rendering.

Basically, when drawing, data is recorded from the mouse/tablet.

A series of X Y locations enters the drawing buffer. Depending on the datarate of the mouse and the FPS of the application, these X Y locations aren't directly adjacent.

eg. in the X direction, instead of recording a straight path of 1 2 3 4 5, it will record 1 3 5. With a faster mouse speed it records 1 5.

I have OpenGL rendering a line between all points in the buffer and the program simultaneously converts these lines into the individual points they are made up. These points are saved into the image data.

The drawing is done in realtime whilst conversion is done when the program is idle or when the screen must update (when other windows disturb the drawing environment), thus allowing uninterrupted drawing time.


Anyway, what I need help with is the algorithm that converts the lines to points. The one I'm using right now doesn't do the job properly so I was wondering if anyone could lend me a hand?

What we have is a line and what we need are the coordinates of every pixel nearest this line. From that I can calculate some kind-of 'anti-aliasing' based on the distance of each point from the surrounding pixels.

The language I'm using is C++.

Replies

Sign In or Register to comment.