Hi my Mathematics are somewhat rusty and I am trying to solve a problem where I take a 3d line segment described by the vector r*(cos[t], h, sin[t]) where t is unknown and describes a constraint that will rotate its end points to exactly fit in-between two rays P0 + D0*u & P0 + D1*v
So something like:
P0 + D0*u + r*(cos[t], h, sin[t]) = P0 + D1*v (Where u, v, & t are unknowns)
Which is sort of like the intersection of two lines in 3 space I believe.
So my attempt so far is:
=> D0*u + r*(cos[t], h, sin[t]) = D1*v
[1] D0.x*u + r*cos[t] = D1.x*v
[2] D0.y*u + r*h = D1.y*v
[3] D0.z*u + r*sin[t] = D1.z*v
[2]=> u = (D1.y*v - r*h)/D0.y
[1]&[2]=> D0.x*(D1.y*v - r*h)/D0.y + r*cos[t] = D1.x*v
=> v = (D0.x*r*h - D0.y*r*cos[t])/(D0.x*D1.y - D0.y*D1.x)
[2]&[3]=> D0.z*(D1.y*v - r*h)/D0.y + r*sin[t] = D1.z*v
=> v = (D0.z*r*h - D0.y*r*sin[t])/(D0.z*D1.y - D0.y*D1.z)
=> (D0.x*r*h - D0.y*r*cos[t])/(D0.x*D1.y - D0.y*D1.x) = (D0.z*r*h - D0.y*r*sin[t])/(D0.z*D1.y - D0.y*D1.z)
=> (D0.x*h - D0.y*cos[t])*(D0.z*D1.y - D0.y*D1.z) = (D0.x*D1.y - D0.y*D1.x)*(D0.z*h - D0.y*sin[t])
=> (D0.x*h - D0.y*cos[t])*D0.z*D1.y - (D0.x*h - D0.y*cos[t])*D0.y*D1.z = (D0.x*D1.y - D0.y*D1.x)*D0.z*h - (D0.x*D1.y - D0.y*D1.x)*D0.y*sin[t]
=> D0.x*h*D0.z*D1.y - D0.y*cos[t]*D0.z*D1.y - D0.x*h*D0.y*D1.z + D0.y*cos[t]*D0.y*D1.z = D0.x*D1.y*D0.z*h - D0.y*D1.x*D0.z*h - D0.x*D1.y*D0.y*sin[t] + D0.y*D1.x*D0.y*sin[t]
=> (D0.x*D1.y - D1.x*D0.y)*sin[t] - (D0.z*D1.y - D0.y*D1.z)cos[t] = h(D0.x*D1.z - D1.x*D0.z)
Which gives me an equation of the form k1*sin[t] - k2*cos[t] = k3
Then I put that form of equation into Wolfram|Alpha:
http://www.wolframalpha.com/input/?i=k1+Sin%5Bt%5D+-+k2+Cos%5Bt%5D+%3D%3D+k3
http://www.wolframalpha.com/input/?i=solve+k1+Sin%5Bt%5D+-+k2+Cos%5Bt%5D+%3D%3D+k3+for+t
Now looking at the solutions for t I am a bit confused what to do next - especially how I should interpret the results of the second Wolfram|Alpha link?
(Although I do know once I have a valid solution for t how to get u & v and rest etc.)