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

Discussion around the Swiss Micros DM42 calculator.
Post Reply
Surveyguy
Posts: 1
Joined: Tue Aug 28, 2018 4:07 pm

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

Post by Surveyguy » Thu Aug 30, 2018 6:37 pm

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: 490
Joined: Tue May 02, 2017 3:48 pm
Location: New Jersey, USA
Contact:

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

Post by Thomas Okken » Fri Aug 31, 2018 9:56 pm

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