Post Reply 
GRAPH 3D v2.425 (20-FEB-2017)
10-23-2014, 07:58 AM
Post: #81
RE: GRAPH 3D v2.32 (Updated 18-SEPT-2014)
Hello Han,

great app!

Maybe you could add a plot with color by value (eg. blue [low values] to red [high values]) for the drawed plane.

Wolfgang


Attached File(s) Thumbnail(s)
   
Find all posts by this user
Quote this message in a reply
10-24-2014, 06:32 PM (This post was last modified: 10-24-2014 06:35 PM by Han.)
Post: #82
RE: GRAPH 3D v2.32 (Updated 18-SEPT-2014)
You mean like this?

[Image: attachment.php?aid=1145]

Change the g3D_zcolor() function to this:
Code:

//----------------------------
// g3D_zcolor
//----------------------------
g3D_zcolor(x,y)
begin
  local r,c;
  local minz,maxz;
  minz:=max(minZ,zmin3D);
  maxz:=min(maxZ,zmax3D);

  case
    if cmode==0 then
      r:=RGB((x-1)/grid3D*255,1,(y-1)/grid3D*255);
    end;
    if cmode==1 then
      r:=Zvals(x,y);
      if r>maxz then r:=maxz; end;
      if r<minz then r:=minz; end;
      r:=(r-minz)/(maxz-minz+1);
      c:=IP(4*r);
      r:=IP(r*254)+1;
      case
        if c==0 then r:=RGB(255,r,0); end;
        if c==1 then r:=RGB(255-r,255,0); end;
        if c==2 then r:=RGB(0,255,r); end;
        if c==3 then r:=RGB(0,255-r,255); end; 
      end;
    end;
  end;

  if zColor(x,y) then
    return(r);
  else
    return(0);
  end;
end;


Attached File(s) Thumbnail(s)
   

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
10-25-2014, 05:16 PM
Post: #83
RE: GRAPH 3D v2.32 (Updated 18-SEPT-2014)
How I can graph a heart? like a mathematica

[Image: 3235953968_874df091a5_o_d.jpg]


I input the ecuation: [Image: latex.php?latex=%5Cleft+%28+x%5E2%2B%5Cc...mp;amp;s=0]
But don't do nothing XD
Visit this user's website Find all posts by this user
Quote this message in a reply
10-25-2014, 05:35 PM
Post: #84
RE: GRAPH 3D v2.32 (Updated 18-SEPT-2014)
(10-25-2014 05:16 PM)nakjaen Wrote:  I input the equation:
\[ \left( x^2 + \frac{9}{4} y^2 +z^2 -1 \right)^3 -x^2 z^3 -\frac{9}{80}y^2 z^3 = 0 \]
But don't do nothing XD

Graph3D only graphs functions. The equation you have there does not describe a function.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
10-27-2014, 07:44 AM
Post: #85
RE: GRAPH 3D v2.32 (Updated 18-SEPT-2014)
(10-24-2014 06:32 PM)Han Wrote:  You mean like this?

Yes, thank you
Find all posts by this user
Quote this message in a reply
11-29-2014, 08:16 PM
Post: #86
RE: GRAPH 3D v2.32 (Updated 18-SEPT-2014)
Hi Han, great app really, I tok a look at your code harder than i could imagine to understand, would it be possible to enable drawing 2 functions in the same graph?
Like. Drawing a sphere consisting of halfs.
Regards/T[/align]
Find all posts by this user
Quote this message in a reply
11-30-2014, 01:46 AM
Post: #87
RE: GRAPH 3D v2.32 (Updated 18-SEPT-2014)
(11-29-2014 08:16 PM)Torb Wrote:  Hi Han, great app really, I tok a look at your code harder than i could imagine to understand, would it be possible to enable drawing 2 functions in the same graph?
Like. Drawing a sphere consisting of halfs.
Regards/T[/align]

Yes, this will be one of the features of the next release within the next few weeks.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
12-01-2014, 09:47 AM
Post: #88
RE: GRAPH 3D v2.32 (Updated 18-SEPT-2014)
(11-30-2014 01:46 AM)Han Wrote:  
(11-29-2014 08:16 PM)Torb Wrote:  Hi Han, great app really, I tok a look at your code harder than i could imagine to understand, would it be possible to enable drawing 2 functions in the same graph?
Like. Drawing a sphere consisting of halfs.
Regards/T[/align]

Yes, this will be one of the features of the next release within the next few weeks.

Great, looking forward for it thanks.

other quest, the debug feature of prime doesn't work on your program, is there any other tool availible for debug/develop your app?

Regards/T
Find all posts by this user
Quote this message in a reply
12-01-2014, 04:36 PM
Post: #89
RE: GRAPH 3D v2.32 (Updated 18-SEPT-2014)
(12-01-2014 09:47 AM)Torb Wrote:  
(11-30-2014 01:46 AM)Han Wrote:  Yes, this will be one of the features of the next release within the next few weeks.

Great, looking forward for it thanks.

other quest, the debug feature of prime doesn't work on your program, is there any other tool availible for debug/develop your app?

Regards/T

You can debug each individual routine by exporting it and using DEBUG() on that command. You need to initialize the app variables, though. This can be done by simply creating a plot once you've exported the routine you want to debug. For example, export the Plot() routine, press the [Plot] key and then exit the plot, and then use:

DEBUG(Plot())

Hope that helps.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
12-03-2014, 04:57 PM
Post: #90
RE: GRAPH 3D v2.4 (Updated 03-DEC-2014)
(11-30-2014 01:46 AM)Han Wrote:  
(11-29-2014 08:16 PM)Torb Wrote:  Hi Han, great app really, I tok a look at your code harder than i could imagine to understand, would it be possible to enable drawing 2 functions in the same graph?
Like. Drawing a sphere consisting of halfs.
Regards/T[/align]

Yes, this will be one of the features of the next release within the next few weeks.

New beta 2.4 is up (see first post of thread).

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
12-04-2014, 09:21 AM
Post: #91
RE: GRAPH 3D v2.4 (Updated 03-DEC-2014)
Hello Han,

another great improvement so far. I've just reversed the color by value because I prefer red for the larger values:

Code:
r:=(r-minz)/(maxz-minz+1);

to

Code:
r:=(maxz-r)/(maxz-minz+1);

regards Wolfgang
Find all posts by this user
Quote this message in a reply
12-04-2014, 06:41 PM
Post: #92
RE: GRAPH 3D v2.4 (Updated 03-DEC-2014)
(12-03-2014 04:57 PM)Han Wrote:  New beta 2.4 is up (see first post of thread).

Have "resisted" trying Graph3D until now.
It works great! Thank you!

A.
Find all posts by this user
Quote this message in a reply
12-04-2014, 10:04 PM (This post was last modified: 12-04-2014 10:14 PM by Han.)
Post: #93
RE: GRAPH 3D v2.4 (Updated 03-DEC-2014)
(12-04-2014 09:21 AM)ww63 Wrote:  Hello Han,

another great improvement so far. I've just reversed the color by value because I prefer red for the larger values:

Code:
r:=(r-minz)/(maxz-minz+1);

to

Code:
r:=(maxz-r)/(maxz-minz+1);

regards Wolfgang

Feel free to make modifications as you see fit.

(12-04-2014 06:41 PM)Alberto Candel Wrote:  
(12-03-2014 04:57 PM)Han Wrote:  New beta 2.4 is up (see first post of thread).

Have "resisted" trying Graph3D until now.
It works great! Thank you!

A.

Glad to hear it works well. Since this is a beta release, do check back every now and then (first post) to see if there are updates. I'm slowly finding little bugs here and there, but it's a very slow process by myself. I'm hoping people will help find bugs in this beta.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
12-10-2014, 03:35 AM (This post was last modified: 02-21-2017 07:09 PM by Han.)
Post: #94
RE: GRAPH 3D v2.411 (Updated 05-DEC-2014)
I found a few more bugs relating to z-clipping. Also, I had toyed around with the trace mode with multiple plots. I find it rather hard to really see the surface being traced, and thought about "highlighting" the selected function being trace. Here are some screenshots of what I mean:

               

The left-most is the plot of several functions (transparent mode on). The next two screens show the highlighting of only the function being traced; the others are "greyed" out. The last screen shows the same effect, except transparency mode is off (i.e. hidden surface removal mode)

I'm curious if users would prefer this over the current implementation (in which all surfaces are graphed even in trace mode).

Edit: Also, here's a manual for the app.
.zip  graph3dmanual.zip (Size: 159.59 KB / Downloads: 438)

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
12-13-2014, 06:12 PM
Post: #95
RE: GRAPH 3D v2.411 (Updated 05-DEC-2014)
Mmmm. Tha last two pictures shows better the traces. It´s fine, because you see it better, and you can see the other surfaces on a shadow background. I like it better.

Thank you for the instructions. I´ll download it now.

PS: as I consider you the best programmer for the hp Prime nowadays. Are you specialized in structural analysis? I mean if you have ever thought of translating/ creating programs for beam analysis, frames or moments of inertia of different shapes. I miss A LOT Vigag, Sections, or FEM49, from Edwin Cordoba and Caspar Lugtmeier. Impossible to get something similar for HP Prime.
Find all posts by this user
Quote this message in a reply
12-14-2014, 08:08 PM (This post was last modified: 12-14-2014 08:09 PM by Trickfisch.)
Post: #96
RE: GRAPH 3D v2.412 (Updated 13-DEC-2014)
A cool application. But there was one thing that disturb me.
No Touch Control like zoom or move.

So I've looked in the source code and modified it a little.

Ad the top add this:
Code:
z;

after
Code:
fcolor,clist,reclist;


Now first the g3D_keys().
Code:
g3D_keys()
begin
  local key, run=1,  m;
  local m1, mx1=0, mxa=0, mz1=0, mza=0;
  local m2, mx2=0, mz2=0;
  LOCAL leng2=100, leng1;
  LOCAL x, y, siz=zoom3D, res, sizz;

  g3D_draw();
  
  while run do
    leng1:=leng2;

    key:=wait(-1);

    case

    if TYPE(key)==6 then // Touch
         
       case  
           
          if tmode then g3D_draw(); g3D_trace(); end;

          m:=MOUSE;
          if SIZE(m(1))>0 then 
             mxa:=m(1,2);
             mza:=m(1,1);
          end;

          repeat
             m:=MOUSE;
              
             if Size(m(2))>0 AND Size(m(1))>0 then
                mx1:=m(1,1);
                mx2:=m(2,1);
             end;
   
             //Touch and Zoom
             While (mx1>0) AND (mx2>0) Do
                mz1:=m(1,2);
                mz2:=m(2,2); 
                leng2:=approx(sqrt((mx2-mx1)^2+(mz2-mz1)^2));
 
                if z=0 then
                   // Save Settings and Screen G0 in G2
                   leng1:=leng2;
                   z:=1;  
                   dimgrob_p(G2,360,240);
                   blit_p(G2,G0);
                end;

                // Calculate Zoom and redraw Screen from G2 to G1 (no flicker) to G0 (main Screen) 
                sizz:=leng2/leng1*160;
                RECT(G1);
                blit_p(G1,160-sizz,120-sizz*0.75, 160+sizz, 120+(sizz*0.75),G2,0,0,320,240);
                blit_p(G0, G1);

                m:=MOUSE;
                mx1:=-1;        
                mx2:=-1;
                if Size(m(2))>0 AND Size(m(1))>0 then
                   mx1:=m(1,1);
                   mx2:=m(2,1);         
                end;
             end; 
           

             //Touch and Move
             if SIZE(m(1))>0 then
                m1:=m(1);
             end;
             if m1(5)==#2d then
                mx1:=m1(2)-mxa;
                mz1:=m1(1)-mza;
                mxa:=m1(2);
                mza:=m1(1);
                rotx:=(rotx+mx1) MOD 360;
                rotz:=(rotz+mz1) MOD 360;
                g3D_rotmatrix();
                g3D_draw();
             end;

          UNTIL NOT SIZE(m(1))>0;
          siz:=leng2/leng1*siz;
       end; 
    end;
    
    if key==-1 then run:=0; end;
    if key==9 then g3D_getangles(); g3D_rotmatrix(); g3D_draw(); end;
    if key==27 then g3D_recolor(1); g3D_draw(); end;
    if (key==48 AND contour==0) then tmode:=1; fsel:=flist(tracefunc); g3D_draw(); g3D_trace(); end;

    // default
    repeat
      case
        if key==2 then rotx:=(rotx-5) MOD 360; end;
        if key==12 then rotx:=(rotx+5) MOD 360; end;
        if key==4 then run:=0; end;
        if key==7 then rotz:=(rotz-5) MOD 360; end;
        if key==8 then rotz:=(rotz+5) MOD 360; end;
        if key==1 then roty:=(roty+5) MOD 360; end;
        if key==3 then roty:=(roty-5) MOD 360; end;
        if key==37 then winx:=winx+5; end;
        if key==39 then winx:=winx-5; end;
        if key==33 then winy:=winy+5; end;
        if key==43 then winy:=winy-5; end;
        if key==38 then winx:=-160; winy:=-120; end;
        if key==45 then zoom3D:=max(zoom3D/1.05,.01); end;
        if key==50 then zoom3D:=zoom3D*1.05; end;
      end;
      g3D_rotmatrix();
      g3D_draw();
    until NOT iskeydown(key);
    
    end;

    if z=1 then
         // redraw screen with right zoom
         zoom3D:=siz;
         g3D_rotmatrix();
         g3D_draw();
         z:=0;
    end;
  end; // end while
  freeze;

end;



!Not a must have!
And for a better trace mode. Even the trace mode control. It have some problems, like that in the movement the trace is not rendered. But somebody could solve it.

Code:
g3D_trace()
begin
  local key, run=1, m;
  local m1, mx1=0, mxa=0, mz1=0, mza=0;

  g3D_drawtrace();

  while run do

    key:=wait(-1);

    case
    if TYPE(key)==6 then
        if TYPE(key)==6 then // Touch
           
          m:=MOUSE;
          if SIZE(m(1))>0 then 
            mxa:=m(1,2);
            mza:=m(1,1);
          end;

          repeat
            m:=MOUSE;

            
            //Touch and Move
            if SIZE(m(1))>0 then
              m1:=m(1);
            end;
            if m1(5)==#2d then
              mx1:=m1(2)-mxa;
              mz1:=m1(1)-mza;
              mxa:=m1(2);
              mza:=m1(1);
              rotx:=(rotx+mx1) MOD 360;
              rotz:=(rotz+mz1) MOD 360;
              g3D_rotmatrix();
              g3D_draw();
            end;

          UNTIL NOT SIZE(m(1))>0;
        end; 
        g3D_drawtrace();
      end;
    if key==-1 then tmode:=0; run:=0; end;
    if key==9 then g3D_getangles(); g3D_rotmatrix(); g3D_draw(); g3D_drawtrace(); end;
    if key==27 then g3D_recolor(1); g3D_draw(); g3D_drawtrace(); end;
    if key==45 then 
      tracefunc:=tracefunc-1;
      if tracefunc<1 then tracefunc:=size(flist); end;
      fsel:=flist(tracefunc);
      g3D_draw(); g3D_drawtrace(); 
    end;
    if key==50 then
      tracefunc:=tracefunc+1;
      if tracefunc>size(flist) then tracefunc:=1; end;
      fsel:=flist(tracefunc);
      g3D_draw(); g3D_drawtrace(); 
    end;

    repeat
      case
        if key==4 then tmode:=0; run:=0; end;
        if key==48 then tmode:=0; run:=0; end;
        if key==2 then ytrace:=ytrace+1; wait(.1); end;
        if key==12 then ytrace:=ytrace-1; wait(.1);  end;
        if key==7 then xtrace:=xtrace-1; wait(.1);  end;
        if key==8 then xtrace:=xtrace+1; wait(.1);  end;
        if key==37 then winx:=winx+5; g3D_draw(); end;
        if key==39 then winx:=winx-5; g3D_draw(); end;
        if key==33 then winy:=winy+5; g3D_draw(); end;
        if key==43 then winy:=winy-5; g3D_draw(); end;
        if key==38 then winx:=-160; winy:=-120; g3D_draw(); end;
      end;
      g3D_drawtrace();
    until NOT iskeydown(key);
 
    end;

  end; // end while

  g3D_draw();

end;



Interesting are only the variable definitions at the top of a function, all the code in
Code:
 if TYPE(key)==6 then
and the variable
Code:
z
at the top.


In this code the style icons can't be displayed.
I've tried to implement this, but the actual version can't handle a single click. So every time you touch the screen, this popup would be displayed. Sorry :'(.
In a old version I have created a full dialog for all settings (even the secrets), but I didn't added this in the new one. Because there is a dialog on the view button in the main screen.


So here is the full code.

.txt  HPPrime_touch_v2.412.txt (Size: 53.85 KB / Downloads: 108)

Have fun with it ;-)
I wait for replies and critic.
Find all posts by this user
Quote this message in a reply
12-15-2014, 10:08 AM
Post: #97
RE: GRAPH 3D v2.412 (Updated 13-DEC-2014)
Hi Han, the new features looks great, will try them out asap. Though the http://ftp.hp.com seems to be empty on Prime stuff, can't get any updates from it any more? Do you know some other source for the latest firmware?
/Torb
Find all posts by this user
Quote this message in a reply
12-15-2014, 11:59 AM
Post: #98
RE: GRAPH 3D v2.412 (Updated 13-DEC-2014)
(12-15-2014 10:08 AM)Torb Wrote:  Hi Han, the new features looks great, will try them out asap. Though the http://ftp.hp.com seems to be empty on Prime stuff, can't get any updates from it any more? Do you know some other source for the latest firmware?
/Torb

It run even with version 6039.
I've tryed it
Find all posts by this user
Quote this message in a reply
12-15-2014, 05:11 PM
Post: #99
RE: GRAPH 3D v2.412 (Updated 13-DEC-2014)
ok thanks, but i only have 6031, wonder what hp is doing with their update site for prime though...
[/quote]

It run even with version 6039.
I've tryed it
[/quote]
Find all posts by this user
Quote this message in a reply
12-15-2014, 06:11 PM (This post was last modified: 12-15-2014 06:13 PM by Trickfisch.)
Post: #100
RE: GRAPH 3D v2.412 (Updated 13-DEC-2014)
Try it. It could run or not. My Version is 5 month old.

And you can try the code from my first post one day ago. I think it is a must have add-on. ;D
Find all posts by this user
Quote this message in a reply
Post Reply 




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