Use the inner-product (dot product) of the vectors describing the lines to get the inner angle and subtract from 360 degrees?
Works best if you already have the lines in point-vector form, but you can get vectors from point-to-point form pretty easily (i.e. by subtraction).
Taking .
to be the dot product we have
v . w = |v| * |w| * cos(theta)
where v
and w
are vectors and theta
is the angle between the lines. And the dot product can be computed from the components of the vectors by
v . w = SUM(v_i * w_i : i=0..3) // 3 for three dimensions. Use more or fewer as needed
here the subscripts indicate components.
Having actually read the question:
- The angle returned from inverting the dot-product will always be less than 180 degrees, so it is always the inner angle.