Given two lines in R3. Each line is defined by two vertices on a moving frame (linear *and* angular motion). Assume we have world space vertices A,B and C,D defining the current lines. At t0 = 0 I compute the distance d( 0 ) = dot ( AC, cross( AB, CD) / | cross( AB, CD) | ) such that d( 0 ) > 0. I can use this function to measure the distance over time. The only problem is that the orientation of cross( AB, CD ) can flip. E.g. if edge CD would rotate around the initial cross product axis( 0 ) = cross( AB( 0 ), CD( 0 ) ). The distance would be constant, be switches signs when CD crosses over AB. I guess I would need to add some concept of handiness to get the proper sign. Is this possible or are there other possibilities to define the distance?

Thanks,

-Dirk

**Edited by Dirk Gregorius, 12 February 2013 - 04:24 PM.**