Note, a reference image is attached illustrating the steps, below:
We are working with a single Editable_Poly object. We have two edges on this poly that are not parallel, do not currently intersect, and _are_ co-planar, but the plane on which they are co-planar is not necessarily parallel to X, Y, or Z planes in any coordinate system (i.e., just some random plane, so let's not make any assumptions here):
Given vertices #1 and #2, we have edge A: #1 -> #2
Given vertices #3 and #4, we have edge B: #3 -> #4
As previously stated, edges A and B do not intersect. Imagine, we want to create a new edge which would be a logical extension of edge A, starting from vertex #1, in the direction of vertex #2, until it comes into contact with edge B. It would split polygon P into P1 and P2 (see attached image).
Let's call this new point, (p5), at which point we would like to place a vertex going forward. So, we have so far:
Edge A: #1 -> #2
Edge B: #3 -> #4
Future Edge C: #2 -> (p5) (we're in the process of creating this edge at this point, but we don't have a vertex at p5 to be able to create it)
Future split of polygon P into P1 and P2
We want to place a new vertex on edge B, called vertex #5, at the point (p5) (i.e., splitting edge B into edges B1 and B2 that are co-linear and connect at p5), after we calculate point p5's coordinates, so that Edge B gets split into edges B1 and B2 and polygon P gets split into P1 and P2 (once again, please see attached image):
Edge B1: #3 -> #5
Edge B2: #5 -> #4
Cross-check time, we want to make sure that:
Vertices #1, #2, and the newly created vertex #5 are co-linear. In other words, if we were to extend edge A from vertex #2, in the direction of vertex #5, it would eventually touch vertex #5.
Once all of the above is done, it would not be too difficult to create a cut from vertex #2 to vertex #5, connecting edges A, B1, and B2, at vertex #5, via a newly cut edge, which we will call Edge C. We would then have:
Edge A: From vertex #1 to vertex #2
Edge B1: From vertex #3 to vertex #5
Edge B2: From vertex #5 to vertex #4
Edge C: From vertex #2 to vertex #5
Polygons P1 and P2
A summary of the process:
We started with two edges A and B. We wanted to create a new edge that connects them, C, which is co-linear with edge A. In creating edge C, we wound up splitting edge B into edges B1 and B2, which are co-linear with respect to each other. The newly created edge C is co-linear with edge A.
Thanks for any ideas on how to script this, especially the determination of the coordinates of point p5.