The program here computes two points that defines the intersection line between the plane defined by the P program and a second plane given as input to this program.

Stack Input/Output:

[[nx, ny, nz], [px, py, pz], Z, T | L]-> XEQ V ->[[x1, y1, z1], [x0, y0, z0], [nx, ny, nz], [px, py, pz] | L]The input of the second plane is similar to defining the first plane using the P program: [nx, ny, nz] in X stack register is a vector normal to the second plane and (px, py, pz) in Y stack register is a point in the second plane. The result in the case the planes are not paralell is two points defining the line: (x0, y0, z0) and (x1, y1, z1).

In the case the planes are paralell the message "PARALELL" is displayed shortly, stack and LASTX registers are then left unchanged.

Variables:

Writes:

R : Normalized normal vector.Program:

S : Distance from origo (0,0,0) to plane.

T : Defining point in the plane.

Z : Scratch data.

V001 LBL VComments:

V002 XEQ U001

V003 XEQ X004

V004 STO R

V005 X<>Y

V006 STO T

V007 X<>Y

V008 x

V009 +/-

V010 STO S

V011 RCL N

V012 LASTX

V013 XEQ X001

V014 STO Z

V015 ABS

V016 1E-6

V017 X>Y?

V018 GTO M041

V019 LASTX

V020 XEQ X025

V021 1

V022 X=Y?

V023 GTO V032

V024 RDN

V025 2

V026 X=Y?

V027 GTO V036

V028 eq (Sx([0,1,0]xN)-Ox([0,1,0]xR))/([0,0,1]xZ)

V029 eq (Ox([1,0,0]xR)-Sx([1,0,0]xN))/([0,0,1]xZ)

V030 0

V031 GTO VO39

V032 0

V033 eq (Sx([0,0,1]xN)-Ox([0,0,1]xR))/([1,0,0]xZ)

V034 eq (Ox([0,1,0]xR)-Sx([0,1,0]xN))/([1,0,0]xZ)

V035 GTO V039

V036 eq (Ox([0,0,1]xR)-Sx([0,0,1]xN))/([0,1,0]xZ)

V037 0

V038 eq (Sx([1,0,0]xN)-Ox([1,0,0]xR))/([0,1,0]xZ)

V039 eq [REGZ,REGY,REGX]

V040 ENTER

V041 ENTER

V042 RCL+ Z

V043 XEQ U079

V044 RTN

Terms of use.

Mnemonic: None.

The program stores the normalized implicit equation for the second plane and it's defining point in the calculator the same way as the P program does for the first plane: The normalized normal vector is stored in variable R, distance to origo in variable S and defining point in variable T. Mnemonics for these are that the keys associated with these variables are below and to the left of the keys assigned to the variables N, O and P where the same values are stored for the plane defined using the program P. This makes the relation between the P program and V program similar to the relation between the L program and the M program.

This program needs to compute and store the cross product of the two plane's normal vector: If this vector is of zero length the planes are paralell else it is a directional vector for the intersection line. This vector is stored in the Z variable.

This shares the show "PARALELL" message and stack restore code with the M program in the no solution case.

Change history:

20071013:1415UTC : This program was implemented before the X025 routine that finds the component of a 3D vector with largest absolute value. This program did that inline, now gone back and modified this program to use X025.

## No comments:

Post a Comment