In a two dimentional integer space, you have two points, A and B. This function returns an enumeration of the points in the quadrilateral subset bounded by A and B.
A = {1,1} B = {2,3}
Fn(A,B) = {{1,1},{1,2},{1,3},{2,1},{2,2},{2,3}}
I can implement it in a few lines of LINQ.
private void UnknownFunction(Point to, Point from, List<Point> list)
{
var vectorX = Enumerable.Range(Math.Min(to.X, from.X), Math.Abs(to.X - from.Y) + 1);
var vectorY = Enumerable.Range(Math.Min(to.Y, from.Y), Math.Abs(to.Y - from.Y) + 1);
foreach (var x in vectorX)
foreach (var y in vectorY)
list.Add(new Point(x, y));
}
I'm fairly sure that this is a standard mathematical operation, but I can't think what it is. Feel free to tell me that it's one line of code in your language of choice. Or to give me a cunning implementation with lambdas or some such.
But mostly I just want to know what it's called. It's driving me nuts. It feels a little like a convolution, but it's been too long since I was at school for me to be sure.