Synopsis

PDX_MSGT mth_DistanceBetween3DLines(long option, double para_tol, double *pt1, double *tan1, double *pt2, double *tan2, double *alf1, double *alf2, double *dist)

Purpose

Solves for two straight lines in 3D space (least squares).

Description

This routine solves the equations of two straight lines in 3D spaces. The lines must be in point/vector form. The lines may or may not intersect. If they do not intersect, the solution represents the minimum distance between the two lines.

Input

option

Output options (Not used)

para_tol

The parallel lines test tolerance.

pt1

The initial point on the first line.

tan1

The tangent vector of the first line.

pt2

The initial point on the second line.

tan2

The tangent vector of the second line.

Output

alf1

Parametric solution to equation 1

alf2

Parametric solution to equation 2

dist

The distance between the two lines.

Return

      MTH_NOERR
      MTH_PARALLELLINES (alf1 = 0.0 and alf2 = proj. of alf1 point to line 2)
      .fi