ColtraineGF
Member
Well, I'm not sure about the matrix part, but you could try this:C#. I need to flip the parallelogram vertically when 'R' is pressed. I'm told to use matrices but I have no idea how to do that. I don't know if I should expect anything from here because most of the questions I've seen are pretty basic, but who knows.
If you were to flip a 2D shape on the plane over some vertical line that goes through it, you could find the center line between the leftmost and rightmost points of the shape, and then for each point add twice the difference between the center line's X coordinate and the point's X coordinate.
For example, using a shape with points (3, 4)(leftmost), (6, 3) and (7, 5)(rightmost):
-Center line -> x = 3 + ( (7 - 3) / 2) -> x = 5
-X coord of (3, 4) flipped over center -> 3 + ( (5 - 3) * 2) -> 7
-X coord of (6, 3) flipped over center -> 6 + ( (5 - 6) * 2) -> 4
-X coord of (7, 5) flipped over center -> 7 + ( (5 - 7) * 2) -> 3
And the new flipped points end up being (7, 4), (4, 3), and (3, 5).