Friday, October 12, 2007

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

Utility 3D vector subroutine to tell which component that has the largest absolute value.

This is of use when projecting points in an arbitary plane to one of the three cardinal planes in order to reduce a 3D problem to a 2D problem (when possible). Use this subroutine on the arbitary plane's normal vector in order to decide which 3D coordinate to discard in order to avoid all points to be projected on a line if arbitary plane is perpendicular to the choosen cardinal plane or to avoid floating precision problems in case they are nearly perpendicular:

Examine the arbitary plane's normal vector (using this subroutine) and discard the coordinate that has the maximum absolute value.

Stack Input/Output:
[[u, v, w], Y, Z, T | L]-> XEQ X025 ->[n, -, -, - | [u, v, w]]
Where [u, v, w] is the vector in question and n is 1 if u has largest absolute value, 2 if v has and 3 if w has.

Program:
X025 XEQ X008
X026 LASTX
X027 RDN
X028 ABS
X029 RDN
X030 ABS
X031 RDN
X032 ABS
X033 X<>Y
X034 ABS
X035 X<>Y
X036 R^
X037 X>=Y?
X038 GTO X047
X039 X<>Y
X040 R^
X041 X<Y?
X042 GTO X045
X043 3
X044 RTN
X045 1
X046 RTN
X047 R^
X048 X>=Y?
X049 GTO X043
X050 2
X051 RTN
Comments:

Terms of use.

Placed in the X 'library' since a vector utlity, from before have vector unpack routines, cross product and normalization.

Change history:

20071014:1723UTC : Problem that vector lost, changed so vector now can be found in LASTX register. This also effects the X047 subroutine now X052 subroutine and those using that: Entry point address changed to X052.

1 comment:

michelle said...

I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.


Elaina

http://www.freearticletrove.com/