Glide Reflection
Time limit2sMemory limit512 MB
Given two equal-length segments, find a glide reflection (a reflection in a line plus a parallel translation) that maps one segment onto the other.
- Level
Medium7 of 10
- Topics
- Geometry, Math, Implementation, Brute force
- Solved
- No attempts yet
Problem
A motion is a transformation of the plane that preserves distances between points: if a motion sends points and to and , then .
One kind of motion is a glide reflection. A glide reflection is the composition of a reflection across some line and a translation by a vector parallel to (the vector may be zero). The figure shows a glide reflection applied to a segment.
A FIGURE GOES HERE
It is known that any segment can be mapped to any other segment of the same length by a glide reflection.
Given the coordinates of two distinct points and and of two points and that are the same distance apart, find a glide reflection that sends to and to .
Input
The first line contains four integers: the coordinates of two distinct points and . The second line also contains four integers: the coordinates of two distinct points and . It is guaranteed that . Every number in the input has absolute value at most 1000.
Output
Print a description of the glide reflection you found.
On the first line print the coordinates of two distinct points lying on the line of the reflection, and on the second line print the coordinates of the translation vector parallel to that line. Print real numbers with at least 6 digits after the decimal point.