(sorry for my english)
The task:
A triangle is specified. To realize its motion on the basis of mirror reflection with respect to an arbitrary line ax + by + c = 0, the coefficients of which are entered by the user.
Already done:
I read from the fields on the form the coordinates of the three points of the triangle.
Putting them into objects of class Point
(left (x, y)
, top (x, y)
, right (x, y)
).
Make an array of points
from the points of a triangle:
Point[] points = new Point[3] { left, top, right };
Draw a coordinate system:
DrawField();
DrawCoordinateSystem();
Draw a triangle:
graph.FillPolygon(Brushes.ForestGreen, points);
Make a mirror reflection of the triangle:
Point[] pointsCopy = (Point[]) points.Clone();
for (int i = 0; i pointsCopy.Length; i++)
pointsCopy[i].Y = -pointsCopy[i].Y;
graph.FillPolygon(Brushes.RoyalBlue, pointsCopy);
Read the coefficients (a
, b
, c
) from the fields on the form for the equation ax + by + c = 0
.
Question:
Tell me how to move it further relative to the line ax + by + c = 0
?