This program is Copyright © 2004 by Jean-Marc Baillard and is used here by permission.
This program is supplied without representation or warranty of any kind. Jean-Marc Baillard and The Museum of HP Calculators therefore assume no responsibility and shall have no liability, consequential or otherwise, of any kind arising from the use of this program material or any part thereof.
-These programs deal with the most usual geometric transformations Tf,
essentially projections, symmetries, rotations ( and a few similarities
).
-In the first 4 paragraphs, we compute the coordinates of M' = Tf(M)
assuming the coordinates of M ( and Tf itself ) are known:
1°) Orthogonal Projection and Symmetry ( Reflexion )
a) 2-dimensional spaces: Orthogonal
Projection and Symmetry / Line
b) 3-dimensional spaces
1- Orthogonal Projection and
Symmetry / Plane
2- Orthogonal Projection /
Line
c) n-dimensional spaces
1- Orthogonal Projection and
Symmetry / Hyperplane
2- Orthogonal Projection and
Symmetry / Line
2°) Projection and Symmetry
a) 2-dimensional spaces: Projection
and Symmetry / Line // Vector
b) 3-dimensional spaces
1- Projection and Symmetry
/ Plane // Vector
2- Projection / Line // Vectorial
Plane
c) n-dimensional spaces
1- Projection and Symmetry
/ Hyperplane // Vector
2- Projection and Symmetry
/ Line // Vectorial Hyperplane
3°) Rotations
a) 2-dimensional spaces
b) 3-dimensional spaces
c) n-dimensional spaces
4°) Similarity ( Only 3 examples )
a) 2-dimensional spaces
b) 3-dimensional spaces
c) n-dimensional spaces
-The other programs deal with the link between Matrices and Transformations.
5°) Transformation >>>> Matrix
a) 2-dimensional spaces
b) 3-dimensional spaces
c) n-dimensional spaces
6°) Product ( Composition ) of 2 Transformations
7°) Reciprocal of a Transformation
8°) A Few Tests ( up to 17x18 Matrices )
a) Projection ? Symmetry ?
b) Isometry ?
c) Similarity ?
9°) Matrix >>>> Transformation
a) 2-dimensional spaces
b) 3-dimensional spaces
c) n-dimensional spaces ( One example
only )
Remarks: -Some of these programs use
synthetic registers M N O P Q a
( do not confuse O and Q in the listings )
-Don't stop a running program if registers P and Q are used ( it could
alter their contents - without any "crash" however )
-When register "a" is used, the program must not be called as more than
a first level subroutine ( however, an alternative is suggested in this
case )
-If you're not familiar to synthetic programming, these 6 registers may
be replaced by any unused standard registers,
( for example: R39
R40 R41 R42 R43 R44 which are unused in all the
following examples )
-The basis is assumed to be orthonormal.
-In the "rotation" programs, the basis must be direct orthonormal,
and the sign of the rotation angle is determined by the right-hand
rule.
1°) Orthogonal Projection and Symmetry
a-1) 2-Dimensional Space ( Program#1 )
M(x;y)
|
|
------------|M'(x';y')-----------------
( L ) : y = mx + p
|
|
M"(x";y")
-Given m , p and M(x,y) , the following program computes
M'(x',y') and M"(x",y") where ( MM' ) is perpendicular
to ( L ) and M' is the midpoint of [MM"]
Data Registers: /
Flags: /
Subroutines: /
01 LBL "OPS2A"
02 STO M
03 RDN
04 STO N
05 RDN
06 ST- T
07 RDN
08 ST* Z
09 RDN
10 +
11 R^
12 X^2
13 SIGN
14 ST+ L
15 X<> L
16 /
17 STO Z
18 R^
19 *
20 +
21 ENTER^
22 ST+ Y
23 X<> N
24 -
25 R^
26 ST+ X
27 RCL M
28 -
29 RCL N
30 R^
31 CLA
32 END
( 54 bytes / SIZE 000 )
| STACK | INPUTS | OUTPUTS |
| T | m | y" |
| Z | p | x" |
| Y | y | y' |
| X | x | x' |
| L | / | x |
Example: Line (L) is defined by
y = 3x - 7 and M(1;2) ; find M' and M"
3 ENTER^
-7 ENTER^
2 ENTER^
1 XEQ "OPS2A" >>>> RDN 2.8
RDN 1.4 RDN 4.6 RDN 0.8
whence M'(2.8;1.4) and M"(4.6;0.8)
Note: If (L) // (Oy) , the program
doesn't work but you can use "OPS2" below
In this case however, the formulas are trivial.
a-2) 2-Dimensional
Space ( Program#2 )
M(x;y)
|
|
------------|M'(x';y')-----------------
( L ) : ax + by = c
|
|
M"(x";y")
Data Registers: • R00 =
c • R01 = a
• R02 = b ( these 3 registers are to be initialized before executing
"PS2" )
Flags: F01 CF01 = projection
SF01 = reflexion
Subroutines: /
01 LBL "OPS2"
02 STO Z
03 RCL 01
04 *
05 X<>Y
06 RCL 02
07 X<>Y
08 ST* Y
09 RDN
10 +
11 RCL 00
12 X<>Y
13 -
14 FS? 01
15 ST+ X
16 RCL 01
17 X^2
18 SIGN
19 CLX
20 RCL 02
21 ST* X
22 ST+ L
23 X<> L
24 /
25 RCL 02
26 X<>Y
27 *
28 ST+ Z
29 X<> L
30 RCL 01
31 *
32 X<>Y
33 +
34 END
( 52 bytes / SIZE 003 )
| STACK | INPUTS | OUTPUTS |
| Y | y | y' or y" |
| X | x | x' or x" |
| L | / | x |
(x';y') if Flag F01 is clear
(x";y") if Flag F01 is set
Example: (L): 3x + 4y = 9 M(1;2) Find M' and M"
9 STO 00 3 STO 01 4 STO 02
CF 01 2 ENTER^ 1 XEQ
"OPS2" >>>> 0.76 X<>Y
1.68 whence M'(0.76;1.68)
SF 01 2 ENTER^ 1
R/S >>>> 0.52 X<>Y
1.36 whence M"(0.52;1.36)
b) 3-Dimensional Space
b-1) Orthogonal Projection ( and Symmetry ) onto ( with respect to ) a Plane.
M(x;y;z)
|
|
/ ----------|----------------------------- /
/
| M'(x';y';z')
/
/
/
/-P----------------------------------------/
The plane (P) is defined by its equation ax + by + cz = d
|
( MM' ) is perpendicular to ( P ) and M' is the midpoint of [MM"]
( M' belongs to (P) )
|
M"(x";y";z")
Data Registers: • R00 =
d • R01 = a
• R02 = b • R03 = c ( these registers are
to be initialized before executing "OPS3" )
Flags: F01 CF01 for the projection
SF01 for the reflexion
Subroutines: /
01 LBL "OPS3"
02 STO M
03 RCL 01
04 *
05 X<>Y
06 STO N
07 RCL 02
08 *
09 +
10 X<>Y
11 STO O
12 RCL 03
13 *
14 +
15 RCL 00
16 X<>Y
17 -
18 FS? 01
19 ST+ X
20 RCL 01
21 X^2
22 RCL 02
23 X^2
24 RCL 03
25 X^2
26 +
27 +
28 /
29 RCL 03
30 RCL 02
31 RCL 01
32 R^
33 ST* Z
34 ST* T
35 *
36 RCL O
37 ST+ T
38 X<> N
39 ST+ Z
40 X<> M
41 +
42 CLA
43 END
( 64 bytes / SIZE 004 )
| STACK | INPUTS | OUTPUTS |
| Z | z | z' or z" |
| Y | y | y' or y" |
| X | x | x' or x" |
| L | / | x |
(x';y';z') if Flag F01 is clear
(x";y";z") if Flag F01 is set
Example: (P): 3x + 4y + 5z = 1 M(2;6;7) Find M' and M"
1 STO 00 3 STO 01 4 STO 02 5 STO 03
CF 01
7 ENTER^
6 ENTER^
2 XEQ "OPS3" >>>> -1.84
RDN 0.88 RDN 0.6
whence M'(-1.84;0.88;0.6)
SF 01
7 ENTER^
6 ENTER^
2 R/S
>>>> -5.68 RDN -4.24
RDN -5.8 whence M"(-5.68;-4.24;-5.8)
b-2)
Orthogonal Projection onto a Line.
-Line (L) is now defined by one of its points, say A(xA;yA;zA) and one vector U(a;b:c)
M(x;y;z)
|
A
|
----|------->U -------|------------
(L)
(MM') perpendicular to (L)
M'(x';y';z')
Data Registers: R00
unused
( registers R01 to R06 are to be initialized before executing "OPL3" )
• R01 = xA • R04 = a
• R02 = yA • R05 = b
• R03 = zA • R06 = c
Flags: /
Subroutines: /
01 LBL "OPL3"
02 RCL 01
03 -
04 RCL 04
05 *
06 X<>Y
07 RCL 02
08 -
09 RCL 05
10 *
11 +
12 X<>Y
13 RCL 03
14 -
15 RCL 06
16 *
17 +
18 RCL 04
19 X^2
20 RCL 05
21 X^2
22 RCL 06
23 X^2
24 +
25 +
26 /
27 RCL 03
28 RCL 06
29 RCL Z
30 *
31 +
32 RCL 05
33 R^
34 *
35 RCL 02
36 +
37 RCL 04
38 R^
39 *
40 RCL 01
41 +
42 END
( 52 bytes / SIZE 007 )
| STACK | INPUTS | OUTPUTS |
| Z | z | z' |
| Y | y | y' |
| X | x | x' |
Example: A(2;3;7) U(3;4;5) Find M' if M(9;4;1)
2 STO 01 3 STO
04
3 STO 02 4 STO
05
7 STO 03 5 STO
06
1 ENTER^
4 ENTER^
9 XEQ "OPL3" >>>> 1.7
RDN 2.6 RDN 6.5
Thus, M'(1.7;2.6;6.5)
Note: The axial symmetry is equivalent to
a rotation by 180° around the (L) axis ( cf 3°) b) below
)
c) n-Dimensional Space
c-1) Orthogonal Projection ( and Symmetry ) onto ( with respect to ) an Hyperplane.
M(x1;...;xn)
|
|
/ ----------|------------------------------/
/
| M'(x'1;...;x'n)
/
/
/
/-H ---------------------------------------/
The hyperplane (H) is defined by its equation a1x1
+ ......... + anxn = b
|
( MM' ) is perpendicular to ( P ) and M' is the midpoint of [MM"]
( M' belongs to (P) )
|
M"(x"1;...;x"n)
Data Registers: • R00 = b
( Registers R00 thru Rnn and Rdd thru Rff are to be initialized before
executing "OPSN" )
• R01 = a1 • R02 = a2
.................. • Rnn = an
• Rbb = x1 • Rbb+1 = x2
............ • Ree = xn
( ee - bb = ee' - bb' = n-1 )
and when the program stops: Rbb' = x'1
; Rbb'+1 = x'2 ;............;
Ree' = x'n ( These 2 blocks
of registers can't overlap )
Flags: F01
CF 01 means projection
SF 01 means reflexion.
Subroutines: /
01 LBL "OPSN"
02 STO N
03 X<>Y
04 STO M
05 INT
06 CHS
07 LASTX
08 FRC
09 E3
10 *
11 +
12 1
13 +
14 STO O
15 CLX
16 STO P
17 LASTX
18 RCL 00
19 LBL 01
20 RCL IND Y
21 X^2
22 ST+ P
23 X<> L
24 RCL IND M
25 *
26 -
27 ISG Y
28 CLX
29 ISG M
30 GTO 01
31 FS? 01
32 ST+ X
33 RCL P
34 /
35 RCL O
36 ST- M
37 SIGN
38 LBL 02
39 RCL IND X
40 RCL Z
41 *
42 RCL IND M
43 +
44 STO IND N
45 CLX
46 SIGN
47 ST+ N
48 +
49 ISG M
50 GTO 02
51 RCL M
52 RCL N
53 ENTER^
54 DSE X
55 E3
56 /
57 +
58 RCL O
59 ST- Z
60 -
61 CLA
62 END
( 101 bytes )
| STACK | INPUTS | OUTPUTS |
| Y | bbb.eee(M) | bbb.eee(M) |
| X | bbb' | bbb.eee(M') |
| L | / | n |
Example: (H): x + 2y + 3z + 6t = 10 Find the coordinates of M' and M" if M(4;7;1;9)
10 STO 00
1 STO 01 2 STO 02
3 STO 03 6 STO 04
and if we choose registers R05 thru R08 for M ,
4 STO 05 7 STO 06 1 STO 07 9
STO 08 ( control number = 5.008 )
-If we want to get M' in registers R09 thru R12 and M" in R13 thru
R16
CF 01
5.008 ENTER^
9 XEQ
"OPSN" yields ( in 5 seconds ) 9.012
RCL 09 >>>> 2.7
RCL 10 >>>> 4.4
RCL 11 >>>> -2.9
RCL 12 >>>> 1.2 whence
M'(2.7;4.4;-2.9;1.2)
-Likewise, SF 01 5.008 ENTER^
13 R/S
gives 13.016 and we recall registers
R13 thru R16 to get M"(1.4;1.8;-6.8;-6.6)
c-2)
Orthogonal Projection ( and Symmetry ) onto ( with respect to ) a Line.
-Line (L) is determined by one of its points A(a1;a2;.....;an) and one vector U(u1;u2;....;un)
M(x1;...;xn)
|
|
A
|
----|------->U -------|-M'(x'1;...;x'n)-----------------------------
(L)
(MM") perpendicular to (L) ; MM' = M'M"
|
|
|
M"(x"1;...;x"n)
Data Registers: R00
unused
( Registers R01 thru R2n and Rbb thru Ree are to be initialized before
executing "OPSLN" )
• R01 = a1 • R02 = a2
.................. • Rnn = an
• Rn+1 = u1 • Rn+2 = u2 ................
• R2n = un
• Rbb = x1 • Rbb+1 = x2
............ • Ree = xn
and when the program stops: Rbb' = x'1
; Rbb'+1 = x'2 ;............;
Ree' = x'n ( These last
2 blocks of registers can't overlap )
Flags: F01
CF 01 = projection
SF 01 = reflexion.
Subroutines: /
01 LBL "OPSLN"
02 STO N
03 X<>Y
04 STO M
05 INT
06 CHS
07 LASTX
08 FRC
09 E3
10 *
11 +
12 1
13 +
14 STO O
15 LASTX
16 +
17 STO P
18 LASTX
19 ENTER^
20 CLX
21 STO Q
22 LBL 01
23 RCL IND M
24 RCL IND Z
25 -
26 RCL IND P
27 X^2
28 ST+ Q
29 X<> L
30 *
31 +
32 ISG Y
33 CLX
34 ISG P
35 CLX
36 ISG M
37 GTO 01
38 RCL Q
39 /
40 RCL O
41 ST- P
42 PI
43 INT
44 10^X
45 /
46 ISG X
47 LBL 02
48 RCL IND P
49 RCL Z
50 *
51 RCL IND Y
52 +
53 STO IND N
54 CLX
55 SIGN
56 ST+ N
57 ST+ P
58 RDN
59 ISG X
60 GTO 02
61 FC? 01
62 GTO 04
63 RCL O
64 ST- M
65 ST- N
66 LBL 03
67 RCL IND N
68 ST+ X
69 RCL IND M
70 -
71 STO IND N
72 ISG N
73 CLX
74 ISG M
75 GTO 03
76 LBL 04
77 RCL M
78 RCL N
79 ENTER^
80 DSE X
81 E3
82 /
83 +
84 RCL O
85 ST- Z
86 -
87 CLA
88 END
( 143 bytes )
| STACK | INPUTS | OUTPUTS |
| Y | bbb.eee(M) | bbb.eee(M) |
| X | bbb' | bbb.eee(M') |
| L | / | n |
Example: A(2;4;7;8) U(1;2;3;6) M(4;7;1;9) Find M' and M"
2 STO 01 1 STO 05
and, for instance, 4 STO 09
4 STO 02 2 STO 06
7 STO 10
7 STO 03 3 STO 07
1 STO 11
8 STO 04 6 STO 08
9 STO 12 ( control number
= 9.012 )
CF 01 9.012 ENTER^
13 XEQ "OPSLN" >>>> 13.016
( in 5 seconds ) and recalling registers R13 to R16, we get:
M'(1.92;3.84;6.76;7.52)
SF 01 9.012 ENTER^
13 R/S
>>>> 13.016 ( in 7 seconds ) -------------------------------------------
M"(-0.16;0.68;12.52;6.04)
2°) Projection and Symmetry
a) 2-Dimensional
Space
-The direction of projection and symmetry is now determined by a vector V(a';b')
M(x;y) V
\
\
\
\
------------\ M'(x';y')-----------------
( L ) : ax + by = c
(MM') // V and MM' = M'M"
\
\
M"(x";y")
Data Registers: • R00 =
c • R01 = a
• R02 = b
• R03 = a' • R04 = b' ( these 5 registers
are to be initialized before executing "PS2" )
Flags: F01 CF01 = projection
SF01 = symmetry
Subroutines: /
01 LBL "PS2"
02 STO M
03 RCL 01
04 *
05 X<>Y
06 STO N
07 RCL 02
08 *
09 +
10 RCL 00
11 X<>Y
12 -
13 FS? 01
14 ST+ X
15 RCL 01
16 RCL 03
17 *
18 RCL 02
19 RCL 04
20 *
21 +
22 /
23 RCL 04
24 RCL 03
25 RCL Z
26 ST* Z
27 *
28 RCL N
29 ST+ Z
30 X<> M
31 +
32 CLA
33 END
( 50 bytes / SIZE 005 )
| STACK | INPUTS | OUTPUTS |
| Y | y | y' or y" |
| X | x | x' or x" |
| L | / | x |
(x';y') if Flag F01 is clear
(x";y") if Flag F01 is set
Example: (L): 2x + 3y = 7 ; V(4;-3) ; M(1;2) Find M' and M"
7 STO 00 2 STO 01
3 STO 02
4 STO 03 -3 STO 04
CF 01
2 ENTER^
1 XEQ "PS2" >>>> 5 X<>Y
-1 whence M'(5;-1)
SF 01
2 ENTER^
1 R/S
>>>> 9 X<>Y -4 whence M"(9;-4)
b) 3-Dimensional Space
b-1) Projection ( and Symmetry ) onto ( with respect to ) a Plane.
-The direction of the projection is determined by a vector V(a';b';c')
M(x;y;z) V
\
\
\
\
/ --------\------------------------------- /
/
\ M'(x';y';z')
/
/
/
/-P----------------------------------------/
The plane (P) is defined by its equation ax + by + cz = d
\
( MM' ) // V and MM' = M'M"
( M' belongs to (P) )
\
M"(x";y";z")
Data Registers: • R00 =
d • R01 = a
• R02 = b • R03 = c
• R04 = a' • R05 = b' • R06 = c'
( these 7 registers are to be initialized before executing "PS3" )
Flags: F01 CF01 for the projection
SF01 for the symmetry
Subroutines: /
01 LBL "PS3"
02 STO M
03 RCL 01
04 *
05 X<>Y
06 STO N
07 RCL 02
08 *
09 +
10 X<>Y
11 STO O
12 RCL 03
13 *
14 +
15 RCL 00
16 X<>Y
17 -
18 FS? 01
19 ST+ X
20 RCL 01
21 RCL 04
22 *
23 RCL 02
24 RCL 05
25 *
26 +
27 RCL 03
28 RCL 06
29 *
30 +
31 /
32 RCL 06
33 RCL 05
34 RCL 04
35 R^
36 ST* T
37 ST* Z
38 *
39 RCL O
40 ST+ T
41 X<> N
42 ST+ Z
43 X<> M
44 +
45 CLA
46 END
( 66 bytes / SIZE 007 )
| STACK | INPUTS | OUTPUTS |
| Z | z | z' or z" |
| Y | y | y' or y" |
| X | x | x' or x" |
| L | / | x |
(x';y';z') if Flag F01 is clear
(x";y";z") if Flag F01 is set
Example: (P): 2x + 3y + 7z = 4 ; V(6;1;-2) M(1;4;5) Find M' and M"
4 STO 00 2 STO 01
3 STO 02 7 STO 03
6 STO 04 1 STO 05 -2 STO 06
CF 01
5 ENTER^
4 ENTER^
1 XEQ "PS3" >>>> -269
RDN -41 RDN 95 whence M'(-269;-41;95)
SF 01
5 ENTER^
4 ENTER^
1 R/S
>>>> -539 RDN -86 RDN
185 whence M"(-539;-86;185)
b-2) Projection ( and Symmetry
) onto ( with respect to ) a Line.
-Line (L) is defined by one of its points A(xA;yA;zA)
and a vector U(a;b;c)
-The direction of projection is determined by a ( vectorial ) plane
(P): a'x + b'y + c'z = 0
A(xA;yA;zA)
\
\ U
\
M(x;y;z)-----------M'(x';y';z')---------M"(x";y";z")
\
/---------------------\--------------------/
/
\
/
/
/
/-P----------------------------------------/
( MM' ) // (P) and MM' = M'M"
\
\ (L)
Data Registers: R00 unused
• R01 = xA • R02 = yA • R03 = zA
• R04 = a • R05 = b • R06 = c
• R07 = a' • R08 = b' • R09 = c'
( these 9 registers are to be initialized before executing "PS3" )
Flags: F01 CF01 = projection
SF01 = symmetry
Subroutines: /
01 LBL "PS3L"
02 STO M
03 RCL 01
04 -
05 RCL 07
06 *
07 X<>Y
08 STO N
09 RCL 02
10 -
11 RCL 08
12 *
13 +
14 X<>Y
15 STO O
16 RCL 03
17 -
18 RCL 09
19 *
20 +
21 RCL 04
22 RCL 07
23 *
24 RCL 05
25 RCL 08
26 *
27 +
28 RCL 06
29 RCL 09
30 *
31 +
32 /
33 RCL 03
34 RCL 06
35 RCL Z
36 *
37 +
38 RCL 05
39 R^
40 *
41 RCL 02
42 +
43 RCL 04
44 R^
45 *
46 RCL 01
47 +
48 FC? 01
49 GTO 01
50 2
51 ST* T
52 ST* Z
53 *
54 RCL O
55 ST- T
56 X<> N
57 ST- Z
58 X<> M
59 -
60 LBL 01
61 CLA
62 END
( 84 bytes / SIZE 010 )
| STACK | INPUTS | OUTPUTS |
| Z | z | z' or z" |
| Y | y | y' or y" |
| X | x | x' or x" |
(x';y';z') if Flag F01 is clear
(x";y";z") if Flag F01 is set
Example: A(4;6;-1) U(2;3;7) (P): 6x + y - 2z = 0 ; M(1;4;2) Find M' and M"
4 STO 01 6 STO 02
-1 STO 03
2 STO 04 3 STO 05
7 STO 06
6 STO 07 1 STO 08
-2 STO 09
CF 01
2 ENTER^
4 ENTER^
1 XEQ "PS3L" >>>> -48
RDN -72 RDN -183 whence
M'(-48;-72;-183)
SF 01
2 ENTER^
4 ENTER^
1 R/S
>>>> -97 RDN -148 RDN
-368 whence M"(-97;-148;-368)
c) n-Dimensional Space
c-1) Projection ( and Symmetry ) onto ( with respect to ) an Hyperplane.
-The direction of projection is defined by a vector V(v1;v2;....;vn)
M(x1;...;xn) V
\ \
\ \
/ ---------\-------------------------------/
/
\ M'(x'1;...;x'n)
/
/
/
/-H ---------------------------------------/
The hyperplane (H) is defined by its equation a1x1
+ ......... + anxn = b
\
( MM' ) // V and M' is the midpoint of [MM"]
( M' belongs to (P) )
\
M"(x"1;...;x"n)
Data Registers: • R00 = b
( Registers R00 thru R2n and Rdd thru Rff are to be initialized before
executing "PSN" )
• R01 = a1 • R02 = a2
.................. • Rnn = an
• Rn+1 = v1 • Rn+2 = v2 ................
• R2n = vn
• Rbb = x1 • Rbb+1 = x2
............ • Ree = xn
( ee - bb = ee' - bb' = n-1 )
and when the program stops: Rbb' = x'1
; Rbb'+1 = x'2 ;............;
Ree' = x'n ( These 2 blocks
of registers can't overlap )
Flags: F01
CF 01 = projection
SF 01 = symmetry.
Subroutines: /
01 LBL "PSN"
02 STO N
03 X<>Y
04 STO M
05 INT
06 CHS
07 LASTX
08 FRC
09 E3
10 *
11 +
12 1
13 +
14 STO O
15 ST+ O
16 0
17 LBL 01
18 RCL IND Y
19 RCL IND O
20 *
21 +
22 DSE O
23 DSE Y
24 GTO 01
25 STO P
( synthetic )
26 CLX
27 SIGN
28 RCL 00
29 LBL 02
30 RCL IND Y
31 RCL IND M
32 *
33 -
34 ISG Y
35 CLX
36 ISG M
37 GTO 02
38 FS? 01
39 ST+ X
40 RCL P
41 /
42 RCL O
43 ST- M
44 ISG X
45 LBL 03
46 RCL IND X
47 RCL Z
48 *
49 RCL IND M
50 +
51 STO IND N
52 CLX
53 SIGN
54 ST+ N
55 +
56 ISG M
57 GTO 03
58 RCL M
59 RCL N
60 ENTER^
61 DSE X
62 E3
63 /
64 +
65 RCL O
66 ST- Z
67 -
68 CLA
69 END
( 112 bytes )
| STACK | INPUTS | OUTPUTS |
| Y | bbb.eee(M) | bbb.eee(M) |
| X | bbb' | bbb.eee(M') |
| L | / | n |
Example: (H): x + 2y + 3z + 6t = 10 and V(2;4;7;-5) Find the coordinates of M' and M" if M(4;7;1;9)
10 STO 00 1 STO 01
2 STO 05 and, for
instance: 4 STO 09
2 STO 02
4 STO 06
7 STO 10
3 STO 03
7 STO 07
1 STO 11
6 STO 04
-5 STO 08
9 STO 12 ( control number
= 9.012 )
CF 01 9.012 ENTER^
14 XEQ "PSN" >>>> 14.017
and we recall registers R14 thru R17 to get M'(-126;-253;-454;334)
SF 01 9.012 ENTER^
14 R/S
>>>> 14.017 --------------------------------------------
M"(-256;-513;-909;659)
c-2)
Projection ( and Symmetry ) onto ( with respect to ) a Line.
-Line (L) passes through A(a1;a2;.....;an)
and is parallel to a vector U(u1;u2;....;un)
-The direction of projection is given by a ( vectorial ) hyperplane
(H): a'1x1 + ......... + a'nxn
= 0
A(a1;a2;.....;an)
\
\
\
M(x1;...;xn)-----------M'(x'1;...;x'n)---------M"(x"1;...;x"n)
\
/---------------------\--------------------/
/
\
/
/
/
/-H----------------------------------------/
( MM' ) // (H) and MM' = M'M"
\
\ (L)
Data Registers: R00
unused
( Registers R01 thru R3n and Rbb thru Ree are to be initialized before
executing "PSLN" )
• R01 = a1 • R02 = a2
.................. • Rnn = an
• Rn+1 = u1 • Rn+2 = u2 ................
• R2n = un
• R2n+1 = a'1 • R2n+2 = a'2 .............
• R3n = a'n
• Rbb = x1 • Rbb+1 = x2
............ • Ree = xn
and when the program stops: Rbb' = x'1
; Rbb'+1 = x'2 ;............;
Ree' = x'n ( These last
2 blocks of registers can't overlap )
Flags: F01
CF 01 = projection
SF 01 = symmetry.
Subroutines: /
01 LBL "PSLN"
02 STO N
03 X<>Y
04 STO M
05 INT
06 CHS
07 LASTX
08 FRC
09 E3
10 *
11 +
12 1
13 +
14 ENTER^
15 STO O
16 ST+ X
17 ST+ Y
18 .1
19 %
20 ST+ Z
21 CLX
22 STO Q
23 RDN
24 LBL 01
25 RCL IND Y
26 RCL IND Y
27 *
28 ST+ Q
29 CLX
30 SIGN
31 -
32 DSE Y
33 GTO 01
34 ST+ X
35 STO P
36 SIGN
37 ST+ P
38 ENTER^
39 CLX
40 LBL 02
41 RCL IND M
42 RCL IND Z
43 -
44 RCL IND P
45 *
46 +
47 ISG Y
48 CLX
49 ISG P
50 CLX
51 ISG M
52 GTO 02
53 RCL Q
54 /
55 RCL O
56 ST- P
57 ST- P
58 PI
59 INT
60 10^X
61 /
62 ISG X
63 LBL 03
64 RCL IND P
65 RCL Z
66 *
67 RCL IND Y
68 +
69 STO IND N
70 CLX
71 SIGN
72 ST+ N
73 ST+ P
74 RDN
75 ISG X
76 GTO 03
77 FC? 01
78 GTO 05
79 RCL O
80 ST- M
81 ST- N
82 LBL 04
83 RCL IND N
84 ST+ X
85 RCL IND M
86 -
87 STO IND N
88 ISG N
89 CLX
90 ISG M
91 GTO 04
92 LBL 05
93 RCL M
94 RCL N
95 ENTER^
96 DSE X
97 E3
98 /
99 +
100 RCL O
101 ST- Z
102 -
103 CLA
104 END
( 168 bytes )
| STACK | INPUTS | OUTPUTS |
| Y | bbb.eee(M) | bbb.eee(M) |
| X | bbb' | bbb.eee(M') |
| L | / | n |
Example: A(2;8;1;3) ; U(2;4;7;-5) and (H): x + 2y + 3z + 6t = 0 Find the coordinates of M' and M" if M(4;7;1;9)
2 STO 01
2 STO 05 1
STO 09 and, for instance:
4 STO 13
8 STO
02 4
STO 06 2 STO 10
7 STO 14
1 STO
03 7
STO 07 3 STO 11
1 STO 15
3 STO
04 -5
STO 08 6 STO 12
9 STO 16 ( control number
= 13.016 )
CF 01 13.016 ENTER^
17 XEQ "PSLN" >>>> 17.020
and we recall registers R17 thru R20 to get M'(74;152;253;-177)
SF 01 13.016 ENTER^
17 R/S
>>>> 17.020 --------------------------------------------
M"(144;297;505;-363)
3°) Rotation
a) 2-Dimensional Space
-Given a point A(xA;yA) and
an angle µ , "ROT2" calculates M'(x';y') if we know M(x;y)
-This program works in all angular modes.
M'(x';y')
/
/
/
/ µ
A /-------------- M(x;y)
AM = AM' and ( AM;AM' ) = µ
Data Registers: • R00 =
µ • R01 = xA
• R02 = yA ( these registers are to
be initialized before executing "ROT2" )
Flags: /
Subroutines: /
01 LBL "ROT2"
02 RCL 01
03 -
04 RCL 00
05 RCL 02
06 R^
07 -
08 P-R
09 RCL 00
10 R^
11 P-R
12 X<> Z
13 -
14 RCL 02
15 +
16 X<> Z
17 +
18 RCL 01
19 +
20 END
( 31 bytes / SIZE 003 )
| STACK | INPUTS | OUTPUTS |
| Y | y | y' |
| X | x | x' |
Example: A(6;7) µ = 21° Find M' if M(4;3)
21 STO 00 6 STO 01 7 STO 02 Set the HP-41 in DEG mode
3 ENTER^
4 XEQ "ROT2" >>>> 5.566310945
X<>Y 2.548942395 whence
M'( 5.566310945 ; 2.548942395 )
b) 3-Dimensional Space
-Given M(x;y;z) this program computes M'(x';y';z') = r(M)
where r is the rotation by an angle µ around an
axis (L) passing through a point A(xA;yA;zA)
and parallel to a vector U(a;b;c)
U
|
| A
|
|
| M'(x';y';z')
The vectors NM and NM' are both orthogonal to
U
and lengths NM and NM' are equal.
| /
The angle ( NM ; NM' ) = µ
| / µ
|/-------------- M(x;y;z)
N
Data Registers: • R00 = µ
( registers R00 to R06 are to be initialized before executing "ROT3" )
• R01 = xA • R04 = a
• R02 = yA • R05 = b
R07 to R12: temp
• R03 = zA • R06 = c
Flags: /
Subroutine: "OPL3" ( cf 1°) b-2)
Orthogonal projection onto a line )
01 LBL "ROT3"
02 STO 07
03 RDN
04 STO 08
05 X<>Y
06 STO 09
07 X<>Y
08 R^
09 XEQ "OPL3"
10 STO 10
11 ST- 07
12 RDN
13 STO 11
14 ST- 08
15 X<>Y
16 STO 12
17 ST- 09
18 RCL 07
19 RCL 00
20 COS
21 *
22 ST+ 10
23 RCL 08
24 LASTX
25 *
26 ST+ 11
27 RCL 09
28 LASTX
29 *
30 ST+ 12
31 RCL 00
32 SIN
33 RCL 04
34 X^2
35 RCL 05
36 X^2
37 RCL 06
38 X^2
39 +
40 +
41 SQRT
42 /
43 RCL 05
44 RCL 09
45 *
46 RCL 06
47 RCL 08
48 *
49 -
50 *
51 ST+ 10
52 CLX
53 RCL 06
54 RCL 07
55 *
56 RCL 04
57 RCL 09
58 *
59 -
60 *
61 ST+ 11
62 CLX
63 RCL 04
64 RCL 08
65 *
66 RCL 05
67 RCL 07
68 *
69 -
70 *
71 RCL 12
72 +
73 RCL 11
74 RCL 10
75 END
( 97 bytes / SIZE 013 )
| STACK | INPUTS | OUTPUTS |
| Z | z | z' |
| Y | y | y' |
| X | x | x' |
Example: µ = 24° A(2;3;7) U(4;6;9) Find M' = r(M) if M(1;4;8)
24 STO 00 2 STO 01
4 STO 04
3 STO 02 6 STO 05
7 STO 03 9 STO 06
Set the HP-41 in DEG mode
8 ENTER^
4 ENTER^
1 XEQ "ROT3" >>>> 1.009250426
RDN 3.497956694 RDN 8.330584237
whence M'( 1.009250426 ; 3.497956694
; 8.330584237 )
c) n-Dimensional Space
-Though the word "rotation" has a more general meaning in n-dimensional
spaces, "ROTN" computes M' = r(M)
where r is the rotation by an angle µ in the plane
(P) defined by a point A(a1;...;an) and 2 non-colinear
vectors U(u1;...;un) , V(v1;...;vn)
|
|
| M'(x'1;...;x'n)
The vectors NM and NM' are both parallel to the
plane (A;U;V) and lengths NM and NM' are equal.
| /
The angle ( NM ; NM' ) = µ
| / µ
|/-------------- M(x1;...;xn)
N
|
|
| M'1
| /
| / µ
M1 , M'1 are the orthogonal projections of
M , M' onto (P).
A |/-------------- M1
The vectors U , V , AM1 , AM'1
are in the plane (P)
/ \
The angle ( AM1 ; AM'1 ) = µ
/ \ V
/ U
-The vertical dotted line actually symbolizes the (n-2) dimensional
subspace (S) passing through A and orthogonal to (P).
-r may also be called a rotation by an angle µ "around" the subspace
(S).
Data Registers: • R00 = µ
( Registers R00 thru R3n and Rbb thru Ree are to be initialized before
executing "ROTN" )
• R01 = a1 • R02 = a2
.................. • Rnn = an
• Rn+1 = u1 • Rn+2 = u2 ................
• R2n = un
• R2n+1 = v1 • R2n+2 = v2 ..............
• R3n = vn
• Rbb = x1 • Rbb+1 = x2
............ • Ree = xn
and when the program stops: Rbb' = x'1
; Rbb'+1 = x'2 ;............;
Ree' = x'n ( These last
2 blocks of registers can't overlap )
Flags: /
Subroutines: /
01 LBL "ROTN"
02 X<>Y
03 STO M
04 INT
05 CHS
06 LASTX
07 FRC
08 E3
09 *
10 +
11 STO T
12 +
13 E3
14 /
15 +
16 STO N
17 SIGN
18 +
19 ENTER^
20 ST+ X
21 STO O
22 .1
23 %
24 +
25 +
26 0
27 STO P
( synthetic )
28 LBL 01
29 RCL IND O
30 X^2
31 ST+ P
32 X<> L
33 RCL IND Z
34 *
35 -
36 DSE O
37 DSE Y
38 GTO 01
39 RCL P
40 ST/ Y
41 CLX
42 STO Q
43 SIGN
44 RCL O
45 +
46 STO O
47 LASTX
48 +
49 LBL 02
50 RCL IND O
51 RCL Z
52 *
53 RCL IND Y
54 +
55 STO IND N
56 X^2
57 ST+ Q
58 SIGN
59 ST+ O
60 +
61 ISG N
62 GTO 02
63 DSE X
64 PI
65 INT
66 /
67 ST- N
68 ST- O
69 RCL N
70 LASTX
71 SIGN
72 X<> Q
73 SQRT
74 LBL 03
75 ST/ IND Y
76 ISG Y
77 GTO 03
78 CLST
79 LBL 04
80 RCL IND M
81 RCL IND Q
82 -
83 RCL IND O
84 X<>Y
85 *
86 ST+ Y
87 X<> L
88 RCL IND N
89 *
90 ST+ Z
91 CLX
92 SIGN
93 ST+ M
94 ST+ O
95 ST+ Q
96 RDN
97 ISG N
98 GTO 04
99 RCL P
100 SQRT
101 /
102 RCL Q
103 DSE X
104 ST- M
105 ST- N
106 ST- O
107 CLX
108 RCL 00
109 X<>Y
110 P-R
111 LASTX
112 -
113 RCL 00
114 R^
115 P-R
116 ST- L
117 X<> L
118 ST- T
119 RDN
120 -
121 RCL P
122 SQRT
123 /
124 LBL 05
125 RCL IND O
126 RCL Y
127 *
128 RCL IND N
129 R^
130 ST* Y
131 RDN
132 +
133 RCL IND M
134 +
135 STO IND N
136 CLX
137 SIGN
138 ST+ M
139 ST+ O
140 RDN
141 ISG N
142 GTO 05
143 RCL M
144 RCL N
145 RCL O
146 DSE X
147 2
148 /
149 ST- Z
150 -
151 CLA
152 END
( 235 bytes )
| STACK | INPUTS | OUTPUTS |
| Y | bbb.eee(M) | bbb.eee(M) |
| X | bbb' | bbb.eee(M') |
| L | / | n |
Example: µ = 24° A(1;2;4;7;6) U(3;1;4;2;5) V(2;7;3;1;4) Find M' = r(M) if M(4;6;1;2;3)
24 STO 00 1 STO 01
3 STO 06 2
STO 11 and, for instance:
4 STO 16
2 STO 02
1 STO 07 7
STO 12
6 STO 17
4 STO 03
4 STO 08 3
STO 13
1 STO 18
7 STO 04
2 STO 09 1
STO 14
2 STO 19
6 STO 05
5 STO 10 4
STO 15
3 STO 20 ( control
number = 16.020 )
16.020 ENTER^
21 XEQ "ROTN"
>>>> ( in 15 seconds ) 21.025 and we recall
registers R21 to R25 to get:
M'( 3.515304126 ; 4.098798832 ; 0.262179052
; 1.768429201 ; 2.009053978 )
4°) Examples of a more complex Transformation:
Similarity
-A similarity preserves the ratios of distances:
Tf is a similarity iff , for all points M , N
M'N' = k.MN where M' = Tf(M) ; N' = Tf(N) and k is a constant
= ratio of magnification.
-In the 3 following examples, Tf is the product of an homothecy h (
homothetic center = the origin O ; M1 = h(M)
iff OM1 = k.OM ( vectorial identity
) )
and an isometry Is: Tf = hoIs
a) 2-Dimensional
Space
-Here, k = 3 ( line 09 )
Is = Rot
where R is the reflexion with respect to line (L): ax + by = c
and t is the translation defined by vector U(a';b')
( a translation consists of a constant offset )
Data Registers: • R00 =
c • R01 = a
• R02 = b
• R03 = a' • R04 = b' ( these 5 registers
are to be initialized before executing "PS2" )
Flag: F01
Subroutine: "OPS2"
01 LBL "SIM2"
02 SF 01
03 XEQ "OPS2"
04 RCL 04
05 ST+ Z
06 CLX
07 RCL 03
08 +
09 3
the ratio of magnification may of course be stored into any unused data
register.
10 ST* Z
11 *
12 END
( 29 bytes / SIZE 005 )
| STACK | INPUTS | OUTPUTS |
| Y | y | y' |
| X | x | x' |
Example: (L): 3x + 4y = 9 U(4;-3) Calculate M' if M(6;1)
9 STO 00 3 STO 01 4 STO 02 4 STO 03 -3 STO 04
1 ENTER^
6 XEQ "SIM2" >>>> 20.64
RDN -18.48 whence M'(20.64;-18.48)
b) 3-Dimensional Space
-Now, Tf = hoIs with k = 2 ( line 11 ) , Is = rot
where r is the rotation by an angle µ around an axis
(L) passing through a point A(xA;yA;zA)
and parallel to a vector U(a;b;c)
and t is the translation defined by the same vector U
Data Registers: • R00 = µ
( registers R00 to R06 are to be initialized before executing "ROT3" )
• R01 = xA • R04 = a
• R02 = yA • R05 = b
R07 to R12: temp
• R03 = zA • R06 = c
Flags: /
Subroutine: "ROT3"
01 LBL "SIM3"
02 XEQ "ROT3"
03 RCL 06
04 ST+ T
05 CLX
06 RCL 05
07 ST+ Z
08 CLX
09 RCL 04
10 +
11 2
the ratio of magnification may be stored into any unused data register.
12 ST* T
13 ST* Z
14 *
15 END
( 33 bytes / SIZE 013 )
| STACK | INPUTS | OUTPUTS |
| Z | z | z' |
| Y | y | y' |
| X | x | x' |
Example: µ = 49° A(2,3,4) U(2,4,8) Compute M' if M(1,4,7)
49 STO 00 2 STO 01
2 STO 04
3 STO 02 4 STO 05
4 STO 03 8 STO 06
7 ENTER^
4 ENTER^
1 XEQ "SIM3" >>>> 7.772478150
RDN 13.85810556 RDN 30.62782768
whence M'( 7.772478150 ; 13.85810556 ; 30.62782768
)
c) n-Dimensional Space
-The following program calculates M'(x'1;...;x'n) = Tf ( M(x1;...;xn) ) where Tf = hotoR is the product ( composition ) of 3 transformations:
h is an homothecy ( ratio = k ; homothetic
center = the origin O )
t is a translation defined by a vector V(v1;v2;....;vn)
R is the reflection with respect to an hyperplane
(H): a1x1 + ......... + anxn
= b
Data Registers: • R00 = b
( Registers R00 thru R2n+1 and Rbb thru Ree are to be
initialized before executing "SIMN" )
• R01 = a1 • R02 = a2
.................. • Rnn = an
• Rn+1 = v1 • Rn+2 = v2 ................
• R2n = vn • R2n+1 = k
• Rbb = x1 • Rbb+1 = x2
............ • Ree = xn
and when the program stops: Rbb' = x'1
; Rbb'+1 = x'2 ;............;
Ree' = x'n ( These last
2 blocks of registers can't overlap )
Flag: F01
Subroutine: "OPSN"
01 LBL "SIMN"
02 SF 01
03 XEQ "OPSN"
04 LASTX
05 ISG X
06 CLX
07 STO M
08 LASTX
09 +
10 RDN
11 RCL IND T
12 STO T
13 LBL 01
14 CLX
15 RCL IND M
16 ST+ IND Y
17 R^
18 ST* IND Z
19 RDN
20 ISG M
21 CLX
22 ISG Y
23 GTO 01
24 X<> L
25 -
26 CLA
27 END
( 53 bytes )
| STACK | INPUTS | OUTPUTS |
| Y | bbb.eee(M) | bbb.eee(M) |
| X | bbb' | bbb.eee(M') |
| L | / | n |
Example: (H): x + 2y + 3z + 6t = 10 V(2;5;2;-3) k = 4 Find the coordinates of M' if M(4;7;1;9)
10 STO 00
1 STO 01 2 STO 02
3 STO 03 6 STO 04
2 STO 05 5 STO 06
2 STO 07 -3 STO 08 4 STO 09
For instance, 4 STO 10 7 STO
11 1 STO 12 9 STO 13
( control number = 10.013 )
and if we want to get M' in registers R14 to R17:
10.013 ENTER^
14 XEQ
"SIMN" >>>> 14.017 ( in 6 seconds
) and recalling registers R14 to R17 we find:
M'( 13.6 ; 27.2 ; -19.2 ; -38.4 )
Note: If registers R2n+1 to R3n are already
used by one of the transformations ( for instance: "ROTN" or "PSN" )
you may wish
to store k into register R3n+1 instead of R2n+1.
In this case, simply add
LASTX + after line 09
-The last 3 programs are only 3 examples among numerous other geometric
transformations ...
5°) Transformation >>>> Matrix
a) 2-Dimensional Space
M'(x';y') may be calculated from M(x;y) by means of linear formulas:
x' = ax + by + c
y' = a'x + b'y + c'
-The following program computes and stores these 6 coefficients in registers R05 thru R10
Data Registers: Those used by the transformation itself which are to be initialized before executing "TM2"
and when the program stops: R05 = a ; R07 = b ; R09 =
c
R06 = a' ; R08 = b' ; R10 = c' ( R11: temp
)
Flags: ? ( for example: CF 01 for a projection
, SF 01 for a reflexion ... )
Subroutines: The transformation itself
01 LBL "TM2"
02 ASTO 11
03 CLST
04 SIGN
05 XEQ IND 11
06