HP Forums
Plotting curve f(x,y,z) with HP Prime - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Plotting curve f(x,y,z) with HP Prime (/thread-2432.html)

Plotting curve f(x,y,z) with HP Prime - kilkenny - 11-15-2014 06:46 PM

Does anyone know is there a way to plot a curve in 3-space with the HP Prime? For example, plot the circular helix defined by the parameterized vector r(t)=[a*sin(t), a*cos(t), c*t].

RE: Plotting curve f(x,y,z) with HP Prime - mbeddo - 11-20-2014 07:14 AM

You can use the parametric app, but you'll have to transform the 3 dimensions down to 2. You do this through the use of rotation matrices - rotate about x, rotate about y, rotate about z (see wiki discussing 3D rotations for instance).

For example, if you rotate about x by -45 degrees, then rotate about z by 30 degrees, your rotation matrix is [[0.7071068, 0.3535534, -0.6123724], [0, 0.8660254, 0.5], [0.7071068, -0.3535534, 0.6123724]]. Your input vector is [a*sin(T), a*cos(T), c*T]. So you'd left multiply your rotation matrix with your input vector, then decide which two components to view.

Suppose you wanted to plot the new x and y projection. Then in the Parametric Symbolic View you'd enter X1(T) = 0.7071*A*SIN(T)+0.3536*A*COS(T)-0.6124*C*T and for Y1(T) = 0.8660*A*COS(T)+0.5*C*T. See screen shots.
Probably you're going to want a program where you enter the yaw, pitch, and roll angles and the function you want to plot, and the program does the rotation and configures X1(T) and Y1(T) for you.

RE: Plotting curve f(x,y,z) with HP Prime - Han - 11-20-2014 07:59 AM

Here's some code you can modify:

  local n:=1,l;
  return 0;

The matrix in the code is a 3x4 matrix used for perspective projection. The first three columns correspond to the 3x3 matrix resulting form the product of the three rotation matrices (about each axis). The last column is simply the eyepoint vector <0,0,d>. You'll need to adjust the 15 so that the distance d is larger than the distance from the center of the viewing box to the corner farthest from the center of the viewing box (similarly for the 16*15 value).

Edit: If you need help writing your own program, just post on the forums here and I'm sure someone will help. I've been thinking about creating a 3D parametric plot app but am already buried deep in other projects (also 3D related).

RE: Plotting curve f(x,y,z) with HP Prime - MagicMachine2 - 05-25-2018 11:51 PM

Hi Han,

Copied your program on my Prime but it won't work. There's no error but when I tried to run PPLOT, it won't run but there's a exclamation point (!) displayed on the screen.

Hope you can help me.

Thank you.