The curves are not arcs as they are lines from angular equations{involute,trochoidal}. (I haven’t been able to solve the two equations to find and intersection)

First problem is that intersect_line_plane is that the plane and line are coplanar .

Second intersect_line_line() intersects lines not line segments. So all my lines actually intersect as they are in the same plane.

So then you have to check bounding conditions for each point. But that just finds the point. Then I have to split the two curves on that point and discard the remaining parts.

Ended up being easier to iterate over the raw array using linear algebra equation for line intersection and removing remaing values, then creating the curves for the data.

Was hoping for built in method to do this simple type of function but so far, no luck.

```
def intersect(p, p2, q, q2)
a = p2.y - p.y
b = p.x - p2.x
c = a*p.x + b*p.y
a1 = q2.y - q.y
b1 = q.x - q2.x
c1 = a1*q.x + b1*q.y
det = a*b1 -a1*b
if det == 0
return
else
x = (b1*c - b*c1)/det
y = (a*c1 - a1*c)/det
if [p.x,p2.x].min <= x && [p.x,p2.x].max >= x && [p.y,p2.y].min <= y && [p.y,p2.y].max >= y &&
[q.x,q2.x].min <= x && [q.x,q2.x].max >= x && [q.y,q2.y].min <= y && [q.y,q2.y].max >= y
return [x,y,0]
end
end
end
def intersectLines(l1, l2)
cnt = 0
## intersection will be at the end
(l1.size-1).downto 1 do |i|
p = l1[i]
p2 = l1[i-1]
#intersection will be at the front
1.upto l2.size-2 do |j|
q = l2[j]
q2 = l2[j+1]
int = intersect(p,p2,q,q2)
if !int.nil?
l2.shift(j+1)
l1.pop(cnt+1)
l1.push int
nl = l1+l2
return nl
end
end
cnt = cnt +1
end
end
```