Use a hash table to find all intersections along a reference line. Beginning with a reference intersection, find the distance of the line segment between each subsequent intersection along the reference line. Only search along the line in one direction, determined by the value of the 'rotation' variable, either clockwise or counter-clockwise.
Case 1:Intersections may be found beyond the endpoint of the line segment, in such cases the length should be taken as the distance from the reference intersection to the endpoint of the line segment in the rotation direction.
Case 2: Rotation direction may change, the rotation should be read from the variable value
Case 3: A reference intersection will not always be provided. If no reference intersection is input the object should return the length of the reference line segment.
We are running a Linux environment, when possible, please do not rely on any windows libraries.
- Line equations
- Line intersections
- reference line
- reference intersection (optional, value may be null)
You should provide as OUTPUT:
- Intersections along the reference line
- For each intersection, output the length of the line segment contained between the current intersection and the reference intersection. EXCEPT when no reference intersection has been provided, in which case only the length of the complete line segment should be output.