## 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 X008X026 LASTXX027 RDNX028 ABSX029 RDNX030 ABSX031 RDNX032 ABSX033 X<>YX034 ABSX035 X<>YX036 R^X037 X>=Y?X038 GTO X047X039 X<>YX040 R^X041 X<Y?X042 GTO X045X043 3X044 RTNX045 1X046 RTNX047 R^X048 X>=Y?X049 GTO X043X050 2X051 RTN`

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/