Synopsis

PDX_MSGT mth_PointToLine2D(long option, MTH_2DPNT lspt, double lptv[2], MTH_2DPNT pproj, MTH_2DPNT pline, double *alf)

Purpose

Project a 2D point to a 2D line.

Description

This routine projects a 2D point onto the straight 2D 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