Quote:
Originally Posted by Airblader
In case you need to be flexible with the orientation of the triangle, but also to just not have to hard-code it, a different approach would be – and I hope this doesn't cause any flashbacks – using math. Define a standard triangle and rotate the coordinates of each point around a certain point (ideally the origin).
The wikipedia article even opens with the rotation matrix for a point in two dimensions, so really all you'd have to do is set up an array of points defining a standard triangle (easy!) and then loop over it to apply the matrix to each point (that's a matrix multiplication). And et voila, your array now consists of points defining a rotated triangle.
|
I'm really not a programmer. I'm a mathematician so no negative flashbacks for me! Thanks!