## Friday, September 21, 2007

### HP-35s Euclid Implementation - III : Evaluating points on a line

A simple but important operation is to evaluate points on a line using it's parametric equation (item 3 in the specification); (1-t)p+tq (linear interpolation/extrapolation) where t is the scalar parameter and p is the position vector for first point defining the line and q the position vector for the second point.

The importance of this operation is:
1. More practical to produce points of the line than the implicit equation.
2. Works in any dimension.
3. It is more usefull to have programs that solves problems where the solution is a point on a line produce the parameter giving the point then the actual coordinates: The parameter tells if the point is on the line segment defining the line (0<=t<=1), on the ray starting at first point and traveling away from second point (t<0) or on other ray if t>1. Use this program if want coordinates after parameter inspection.
Stack Input/Output:
`3D case: [t, Y, Z, T | L]-> XEQ E ->[[x, y, z], Y, Z, T | t]2D case: [t, Y, Z, T | L]-> XEQ E ->[[x, y], Y, Z, T | t]`
Where t is the parameter and (x, y, z) is the evaluated point if a 3D line has been entered using the L program and (x, y) is the evaluated point if a 2D line has been entered using the L program.

Variables:

`A: First point defining the line, populated by the L program.B: Second point defining the line, populated by the L program.`
`E001 LBL EE002 ABSE003 RDNE004 eq (1-LASTX)xA+LASTXxBE005 RTN`