On 07/11/2022 10:29 PM, Joel wrote:
Ok, this is working:
I'm glad to hear it!
Pathing algorithms can be quite fun to mess around with.
On Sunday, 6 November 2022 at 17:15:03 UTC, rikki cattermole
wrote:
On 07/11/2022 5:48 AM, Joel wrote:
The algorithm is too hard for me to work out and dg2d doesn't
help either. I want my code fixed up so that works from any
two points.
Its not as complex as that page initially looks.
```
pl
On Sunday, 6 November 2022 at 20:07:47 UTC, z wrote:
whenever the counter is above `1`
I meant above or equal(`>=`), woops
On Sunday, 6 November 2022 at 16:48:24 UTC, Joel wrote:
I want my code fixed up so that works from any two points.
You can add a condition to prevent writing out of the
image/framebuffer/whatever memory so it won't do any out of
bounds write.
Another valid algorithm could be testing all pix
On 07/11/2022 5:48 AM, Joel wrote:
The algorithm is too hard for me to work out and dg2d doesn't help
either. I want my code fixed up so that works from any two points.
Its not as complex as that page initially looks.
```
plotLine(x0, y0, x1, y1)
dx = abs(x1 - x0)
sx = x0 < x1 ? 1 : -1
On Sunday, 6 November 2022 at 11:40:40 UTC, claptrap wrote:
On Sunday, 6 November 2022 at 11:22:26 UTC, Joel wrote:
I found some code on the net but haven't been able to get it
working properly. I trying to draw with mouse (any direction).
this is the classic integer line drawing algorithm...
On Sunday, 6 November 2022 at 11:22:26 UTC, Joel wrote:
I found some code on the net but haven't been able to get it
working properly. I trying to draw with mouse (any direction).
this is the classic integer line drawing algorithm...
https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm#A
I found some code on the net but haven't been able to get it
working properly. I trying to draw with mouse (any direction).
```d
void drawLine(Dot s, Dot e) {
auto d=s;
/+
// import std.algorithm : swap;
if (s.pos.X>e.pos.X) {