Attempt at a 3D parametric grapher
03-05-2019, 02:12 AM
Post: #1
 TheLastMillennial Member Posts: 75 Joined: Feb 2019
Attempt at a 3D parametric grapher
For some reason the absence of this app has really bugged me, in fact so much I've decided to try to make one. However, I've never really dealt with making anything in 3D, I don't understand how the equations actually work, and I certainly have never made a grapher before. Sounds like a typical ambitious project a newbie would attempt doesn't it? Yeah, that's kinda my shtick.

Anyways, I've done some research (wikipedia) and I think I understand the concept of 2D rotation. However, 3D rotation still breaks my brain, especially when I try of how this could work with more than just a simple cube example. I also looked around here and found this topic that contains this code:

(11-20-2014 07:59 AM)Han Wrote:  Here's some code you can modify:
Code:
#cas PPLOT(a,c,t0,tn,dt):= BEGIN   local n:=1,l;   r(t):=[a*cos(t),a*sin(t),c*t];   ptdef:=MAKELIST(r(X),X,t0,tn,dt);   n:=size(ptdef)-1;   ldef:=MAKELIST({X,X+1},X,1,n);   l:=LINE_P(ptdef,ldef,     {       [[1,0,0,0],[0,1,0,0],[0,0,1,15]],        "N",       {-160,-120,16*15},       {-a,a,-a,a,c*t0,c*tn}      });   freeze;   return 0; END; #end

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).
Unfortunately, there are no comments within the code and I can't figure out how this all works. Definitely the part I'm most confused on is what do the variables represent? (The a,c,t0,tn,dt)

I'd really appreciate it if someone could clarify the code I've posted, or provide a resource that I can learn how to program (or just graph) 3D parametric equations.
Thanks!
 « Next Oldest | Next Newest »

 Messages In This Thread Attempt at a 3D parametric grapher - TheLastMillennial - 03-05-2019 02:12 AM RE: Attempt at a 3D parametric grapher - cyrille de brébisson - 03-05-2019, 06:20 AM RE: Attempt at a 3D parametric grapher - TheLastMillennial - 03-05-2019, 11:44 PM RE: Attempt at a 3D parametric grapher - Han - 03-06-2019, 04:36 AM RE: Attempt at a 3D parametric grapher - cyrille de brébisson - 03-06-2019, 07:02 AM RE: Attempt at a 3D parametric grapher - TheLastMillennial - 03-07-2019, 04:28 AM

User(s) browsing this thread: 1 Guest(s)