How do I get all the points between two Point objects?

.net, c#

Solution

There are no build in functions for this, since there are no points between points. Mathematicaly there is a line between two points. In terms of Computer-Graphics, lines could be antialiased and so beeing not rounded to full Integer numbers.

If you are looking for a fast method of creating all integral numbers inbetween, I guess Bresenhams-Line-Algorithm would be your choice. But this is not build into .NET, you have to code it by yourself (or take Matthew Watson's implementation):

http://en.wikipedia.org/wiki/Bresenham's_line_algorithm

There are even fasther algorithms for doing it, but I would go for Bresenham.

Problem

Lets say I have my first Point struct: ``` Point start = new Point(1, 9); ``` and my second: ``` Point end = new Point(4, 9); ``` I want to get all the points between the start and end. So for example I would want 2,9 and 3,9 in an array. Does .NET have something built in for this?

Original source