I'm reading through "Mathematics for 3D Game Programming, and Computer Graphics" as a refresher, and leading in to some more complex real world problems down the line. However, one of the early chapters has a bit of math that seems overly complicated. This question deals with a problem from the textbook, that I believe the solution is far simpler than their recommended one.
The problem is to find the distance between two lines (in 2 or 3 dimensions).
Some set up:
1) Lines are set up parametrically as opposed to two points.
Where P = S + tV -- S is the starting point (say, A) and equals (1-t) * A
Now the book states to use this solution :
Expanded looks like:
Then the books next step is to reduce this, and take the derivatives with respect to time for both
Once the derivatives have been calculated. We move to a matrix form, and solve using some linear algebra.
My question is this, why would I use that series of steps when I already know the [ x, y, z ] for both points using the parametric. With those values wouldn't the simpler solution be just to do:
Is there some direct application of the former equations that I am missing (the book does not elaborate currently on its applications here)? I've had some discussion with other game developers, and we haven't found much a use case for the linear algebra set up.
Edit: (The linear algebra solution)
First both derivatives with respect to time:
Then in matrix form, solve for both t variables: