I also want to have the following API:
Code: Select all
void drawLine(Vector2 p1, Vector2 p2, ColourValue cv, unsigned int thickness);
My question is, how do I go about determining the positions of the vertices of the triangle? We have p1 and p2, and a slope, but I basically need to create 2 points at each end of the line, offset by the thickness amount (which is in pixels), and perpendicular to the line.
For example lets say I want to draw a line with a 5 pixel thickness, using the following points:
1. p1(0,0) <-> p2(0,5)
2. p1(0,0) <-> p2(5,0)
3. p1(0,0) <-> p2(5,5)
In 1 above, I would need the points:
(-5,0)(5,0) <-> (-5,5)(5,5)
Is there a programatic way I can derive the 4 points representing the thick line, that works for any p1 and p2?