I am looking for an algorithm in C# that will take a polyline (i.e. a line with nodes/corners) and, given a width/buffer, generate a polygon. In other words, if you picture a polyline with a certain width, I'd like to get the bounding polygon that fits around that polyline.
The polyline is simply a list of (x,y) coordinates which I'd like to input into the algorith, together with a certain width, and have it spit out a list of (x,y) coordinates describing the nodes/corners of the polygon.
So something like:
point[] PolylineToPolygon(Point[] points, double width)
{
// algorithm
}
void Convert()
{
Point[] linePoints = new Point[] { new Point { X = -25.125675, Y = 28.434342 }, new Point { X = -26.232687, Y = 29.958363 }, new Point { X = -24.554377, Y = 26.445767 } };
point[] polygonPoints = PolylineToPolygon(linePoints, 0.003);
}
From what I've read, I need to use the Minkowski algorithm but I cannot find an implementation in C#, nor am I sure exactly which Minkowski algorithm to use...
Any help or pointers would be greatly appreciated!