Flutter canvas. Obtain the reflection direction vector through the incident vector and the line

Viewed 61

I am trying to calculate the reflection in the canvas. For example, here is a canvas:

enter image description here

Now the positions of point A and the reflecting edge are known, I want to get the position of C

enter image description here

Another example: enter image description here

I need to complete this void (maybe include mistakes, you can change this):

/// [enterPoint] The point A
/// [intersection] The point B
/// [surfacePoint1] The first point of the reflecting surface
/// [surfacePoint2] The second point of the reflecting surface
/// @return the position/direction of point C
Offset calculateReflection(Offset enterPoint, Offset intersection, Offset surfacePoint1, Offset surfacePoint2){
  // TODO
}
0 Answers
Related