I am trying to draw a affine rectangle (with rotation and skew) on top of an image but don't know how to calculate the vertices. I don't have a background in maths or matrix operations.
My affine class is defined as follows:
public class AffineRectangle
{
public double X { get; set; }
public double Y { get; set; }
public double Width { get; set; }
public double Height { get; set; }
public double Rotation { get; set; }
public double Skew { get; set; }
}
I plan on using the ImageSharp library to draw a polygon using code similar to this:
using (Image<Rgba32> image = new Image<Rgba32>(800, 800))
{
image.Mutate(x => x.DrawPolygon(
Rgba32.Red,
10,
new SixLabors.Primitives.PointF[] {
new Vector2(10, 10),
new Vector2(550, 50),
etc...
}));
image.Save("test.bmp");
}
Edit: it's a dotnet core Web service that I'm writing.