It then becomes easy to produce coordinates of a given distance from the defining segments first point (in register A) using program E since the distance then is the given parameter.
Stack Input/Output:
This program does not take any stack register input, stack register and LASTX register is left unchanged by this program.
Variables:
Reads:
A: First point defining the line, populated by the L program.Writes:
B: Second point defining the line, populated by the L program.
B: Adjust so line segment becomes of unit length.Program:
N001 LBL NComments:
N002 XEQ U001
N003 RCL A
N004 eq 1/ABS(B-A)
N005 STOx A
N006 STOx B
N007 RDN
N008 RCL A
N009 -
N010 STO+ A
N011 STO+ B
N012 XEQ U029
N013 RTN
Terms of use.
Mnemonic: N for Normal since normalize the vector B-A.
Since this program does not take any input from the stack registers but messes up the stack and LASTX registers it uses the U program to hide this from the end user; line 2 saves stack and LASTX registers and line 14 restores the working registers.
Change history:
20070929:2035UTC : Change because of fix in U program.
20071001:2040UTC : Do no longer recompute implicit equation of 2D line (used to check flag 2) since program L now stores the normalized implicit equation.
No comments:
Post a Comment