<p>Instead of having a binary on/off per pixel you can instead make a heat map. The more points fall within the pixel the brighter the pixel is. Essentially create a 2D histogram which you then renormalize to get the grayscale for the output.</p>

<p>If you want to blur the points then you can move a portion of the brightness to the next pixel based on the remaining fraction after multiplying to the resolution. If it the coordinate is <code>(0.55313, 0.236831)</code> and your resolution is 1000x1000 then <code>0.87*0.17</code> goes to <code>553, 236</code>, <code>0.87*0.83</code> goes to <code>553, 237</code>, <code>0.13*0.17</code> goes to <code>554, 236</code> and <code>0.13*0.83</code> goes to <code>554, 237</code>. This is distributed linearly but there are other options.</p>

CC BY-SA 3.0
2017-02-16T14:18:26.937Z
Thanks, this kind of method for fractionally distributing brightness among pixels is what I was looking for. Has this technique a name? I  thought to add brightness to pixels based on the distance between their center and the point coordinates (up to a certain threshold) but this is simpler.
Giovanni Resta
CC BY-SA 3.0
2017-02-16T11:10:17.193Z
2017-02-16T11:10:17.193Z
ratchet freak
<p>I've difficulties in looking for an answer by myself because I don't know the jargon. I need somebody who'll points me in the right direction.</p>

<p>Assume I have 100000 points with coordinates in the unit square, so points like (0.55313, 0.236831).</p>

<p>I want to create a B/W picture with a given side in pixels (say 1000 x 1000) which shows these points.</p>

<p>The naive approach is to multiply by the side the coordinates and round, so point (0.55313, 0.236831) becomes pixel (553, 237) and to turn pixel (553,237) on.</p>

<p>This is rather unsatisfactory. If the points are many, say millions, I could easily fill all the area with a black blob that gives me 0 information.</p>

<p>So, what I thought was to have an array 1000x1000 of floating point numbers that I can update somehow when I add a point, and at the end I can normalize the values and obtain a grayscale image, which will be "blacker" where more points are.</p>

<p><strong>Now the question</strong>: which algorithms are used to add a "blurred" point? I.e., I would like to take into account the real coordinates, so that, if a point is near the border of a "pixel" I would like its addition to my array to "smudge" a little the nearby pixels. Like when you draw a point in a drawing program and it actually adds a little disk with decreasing (linear? Gaussian?) intensity.</p>

<p>Surely it is a problem that has been already been studied and solved, just I don't know how it is called...</p>

<p>thanks</p>

<algorithm><antialiasing>
Main techniques to draw a point at non integer coordinates?
Giovanni Resta
# Main techniques to draw a point at non integer coordinates?

(Asked by: username_0 on 2017-02-16)

I've difficulties in looking for an answer by myself because I don't know the jargon. I need somebody who'll points me in the right direction.

Assume I have 100000 points with coordinates in the unit square, so points like (0.55313, 0.236831).

I want to create a B/W picture with a given side in pixels (say 1000 x 1000) which shows these points.

The naive approach is to multiply by the side the coordinates and round, so point (0.55313, 0.236831) becomes pixel (553, 237) and to turn pixel (553,237) on.

This is rather unsatisfactory. If the points are many, say millions, I could easily fill all the area with a black blob that gives me 0 information.

So, what I thought was to have an array 1000x1000 of floating point numbers that I can update somehow when I add a point, and at the end I can normalize the values and obtain a grayscale image, which will be "blacker" where more points are.

**Now the question**: which algorithms are used to add a "blurred" point? I.e., I would like to take into account the real coordinates, so that, if a point is near the border of a "pixel" I would like its addition to my array to "smudge" a little the nearby pixels. Like when you draw a point in a drawing program and it actually adds a little disk with decreasing (linear? Gaussian?) intensity.

Surely it is a problem that has been already been studied and solved, just I don't know how it is called...

thanks

**Tags:** algorithm, antialiasing


---

## 1 answers

### Answer by username_1 on 2017-02-16. Score: 4 | Accepted answer

Instead of having a binary on/off per pixel you can instead make a heat map. The more points fall within the pixel the brighter the pixel is. Essentially create a 2D histogram which you then renormalize to get the grayscale for the output.

If you want to blur the points then you can move a portion of the brightness to the next pixel based on the remaining fraction after multiplying to the resolution. If it the coordinate is `(0.55313, 0.236831)` and your resolution is 1000x1000 then `0.87*0.17` goes to `553, 236`, `0.87*0.83` goes to `553, 237`, `0.13*0.17` goes to `554, 236` and `0.13*0.83` goes to `554, 237`. This is distributed linearly but there are other options.

> **Comments:**
> **username_0**: Thanks, this kind of method for fractionally distributing brightness among pixels is what I was looking for. Has this technique a name? I  thought to add brightness to pixels based on the distance between their center and the point coordinates (up to a certain threshold) but this is simpler.  

---

