Sunday, October 14, 2007

HP-35s 3D to 2D projection utility subroutines - II

Subroutine to project a 3D vector to 2D by paralell projection to one of the cardinal planes; discards one coordinate.

Stack Input/Output
[n, [u,v,w], Z, T | L]-> X047 ->[[x,y], n, [u,v,w], Z | L]
Where n tells which coordinate to discard: [x=v, y=w] if n=1, [x=u, y=w] if n=2 and [x=u, y=v] if n=3.

Program:
X052 1
X053 X=Y?
X054 GTO X062
X055 RDN
X056 2
X057 X=Y?
X058 GTO X065
X059 RDN
X060 eq [[1,0,0]xREGY,[0,1,0]xREGY]
X061 RTN
X062 RDN
X063 eq [[0,1,0]xREGY,[0,0,1]xREGY]
X064 RTN
X065 RDN
X066 eq [[1,0,0]xREGY,[0,0,0]xREGY]
X067 RTN
Comments:

Terms of use.

The parameter n is typical found using the X025 subroutine.

Placed in the X 'library' since a vector utlity, from before have finding the component of a 3D vector with max absolute value, vector unpack routines, cross product and normalization.

Change history:

20071014:1723UTC : Because of change in the X025 subroutine line numbers changed here. Entry point used to be X047 but is now X052.

No comments: