Converting 3D vector to Cartesian triplet x,y,z

Discussion around the SwissMicros DM42 calculator
Post Reply
Surveyguy
Posts: 1
Joined: Tue Aug 28, 2018 6:07 pm

Converting 3D vector to Cartesian triplet x,y,z

Post by Surveyguy »

I just received my DM42 and I'm stuck trying to convert a 3D vector to a Cartesian triplet x,y,z. If someone could give me a hand it would be greatly appreciated.
Thomas Okken
Posts: 1098
Joined: Tue May 02, 2017 5:48 pm
Location: Netherlands
Contact:

Re: Converting 3D vector to Cartesian triplet x,y,z

Post by Thomas Okken »

Here are two approaches:

Assuming the vector is in the X register, this code will put the first three elements in T, Z, and Y, while leaving the vector in X:

Code: Select all

EDIT
ENTER
↓
ENTER
↓
ENTER
EXITALL
N.B. ↓ is not a short-hand for R↓; it is the matrix editor's "down one element" function, found near the end of the FCN catalog.

Another approach, more flexible, assuming the vector is stored in the variable "VEC":

Code: Select all

INDEX "VEC"
RCLEL
J+
RCLEL
J+
RCLEL
N.B. Since vectors are, by definition, Nx1 or 1xN, it doesn't matter whether you use ↓ or →, or J+ or I+.
Post Reply