@sean.swiatek
The primary goal, as I understood from your original post, is to move the "vertical" line to a position where it starts on one of the two boundaries and ends on the other while maintaining its angle (forward or backward) and its length.
So...
1. Intersect the target (Line) with either of the boundaries, say Line1, because we will slide it along that line to the desired position.
2. Determine a point relative to the intersection at the same angle and distance as the original Line.
3. Make an imaginary line through that last point parallel to Line1.
4. Intersect the imaginary line with the other boundary, Line2. This will be one endpoint of the Line's new position.
5. Make another imaginary line from that new end at the angle of the original but at any length.
6. Intersect the 2nd imaginary line with Line1 to find the other endpoint of the Line's new position.
7. Modify the Line's entity data to change its geometry to the two new endpoints.
8. Done.
I wrote it hoping that it wouldn't matter which boundary line you picked first. The reason it works is that if you conclude the (inters) function with nil, it will compute the intersection as though one or both of the lines (imaginary or not) overlap one another, even if they don't.
Note #1: It will work with lines at any angle (except in the case of note #3). And the line to be moved need not be within the boundary limits.
Note #2: The line may be moved beyond the limits of either or both boundaries.
Note #3: It will certainly not work if the Line is parallel to either of the boundaries, or if the two boundaries are parallel to each other.
Note #4: Technically, the angle of the Line's new position might be 180° opposite the original. If that is an issue, I can add a test for that and swap the two endpoints.
Note #5 {for @Kent1Cooper} As written it will work with lines only, that have one code 10 and one code 11. Yes, I know that a ray has those, but the code 11 is not a point but a vector, so no deal. Anyway, that was @sean.swiatek 's request... lines.