Synopsis

PDX_MSGT mth_PointToLine(long option, MTH_3DPNT lspt, double lptv[3], MTH_3DPNT pproj, MTH_3DPNT pline, double *alf)

Purpose

Project point to line.

Description

This routine projects a point onto the straight line defined by lspt and lptv.

Input

option

MTH_PTVEC

Option giving form of line definition (lptv). If MTH_PTVEC is set, the line is in point/vector format, and lptv is a direction vector. Otherwise, lptv is a second point on the line.

lspt

A point on the line.

lptv

Either a second point on the line, or a direction vector.

pproj

The point to be projected.

Output

pline

The projected point (on the line).

alf

Parametric solution to the projection; ie., the parameter alf, where pline = (1-alf)*lspt + alf*lptv (MTH_PTVEC not set) pline = lspt + alf*lptv (MTH_PTVEC set)

Return

MTH_NOERR