Pardon me if this sounds primitive. I have created a bezier curve with control points A, B, C, D, which are known (see image below). How can I find control points B1, C1, D1 for a new bezier curve reflected in AR1 and A2, B2 and C2 for a new bezier curve reflected in DR2?
Take the line going through AR1, the equation of this lines is
(x-A.x)(R1.y-A.y)=(y-A.y)(R1.x-A.x) (R1.y-A.y)x - (R1.x-A.x)y = A.x(R1.y-A.y)-A.y(R1.x-A.x)
So the normal vector of this line is
(R1.y-A.y, R1.x-A.x). This is the direction vector of the line perpendicular to it and since that goes through D, we can get the equation of that as well:
From this we isolate x for later use:
x = ((R1.x-A.x)D.x-((R1.y-A.y)(D.y+y))/(R1.x-A.x) x = D.x - (R1.y-A.y)(D.y+y)/(R1.x-A.x)
Then we replace x in the other line's equation using this
(D.y+y)(R1.y-A.y)^2/(R1.x-A.x) - (R1.x-A.x)y = A.x(R1.y-A.y)-A.y(R1.x-A.x)
We then isolate y
y = (A.x(R1.y-A.y)-A.y(R1.x-A.x)-D.y*(R1.y-A.y)^2/(R1.x-A.x))/(R1.x-A.x+(R1.y-A.y)^2/(R1.x-A.x))
This is the only equation you actually need to implement.The right side should be given. After you find y, use it to calculate x using the
x = D.x - (R1.y-A.y)(D.y+y)/(R1.x-A.x)
You should now have the coordinates of the closest point on the AR1 line to the D point (I suggest abstracting it and implementing a function, that given a line and a point does this, since you need to use it a couple of times). Now you just get the vector pointing from D to this new point, multiply it by 2 and add it to D to get D'. Repeat this process with C and B and you should have every control point.