HP Forums
[Programming] Cartesian draw functions - 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: [Programming] Cartesian draw functions (/thread-2565.html)



[Programming] Cartesian draw functions - gabrieljcs - 12-05-2014 08:56 PM

What are the differences between the "Cartesian" vs "Pixel" drawing functions? Is there any way to create an app which draws to a cartesian plane, like the Graphing and Geometry apps?

Sorry if I haven't made myself clear and thanks in advance.


RE: [Programming] Cartesian draw functions - Tim Wessman - 12-06-2014 04:04 PM

The non _P version reads the current x/y bounds from the application and graphs using the definied window. Thus LINE(-1,-1,1,1) will draw using your window setting from the active application between catesian coordinates (-1,-1) and (1,1) passing through 0,0. If you are not in an application that has a plot view with definiable x/y window position, the system application default will be used.

If you are trying to draw things on a plot/graph or to create your own - these are exactly the commands you should be using.


RE: [Programming] Cartesian draw functions - gabrieljcs - 12-06-2014 04:31 PM

Exactly what I needed, thanks a lot!


RE: [Programming] Cartesian draw functions - gabrieljcs - 12-06-2014 08:12 PM

Still need some help, though... couldn't manage to draw a single line on a plot.
Tried calling from "Program", didn't work -- just drew the line on the screen, on top of everything. Then tried editing inside the app, e.g.:
Code:
EXPORT Geometry()
BEGIN
  IF GETKEY == 30 THEN
     LINE(-1,-1,1,1);
   END;
END;
Didn't work either...
Would you mind clarifying a little bit?


RE: [Programming] Cartesian draw functions - toml_12953 - 12-06-2014 09:28 PM

(12-06-2014 08:12 PM)gabrieljcs Wrote:  Still need some help, though... couldn't manage to draw a single line on a plot.
Tried calling from "Program", didn't work -- just drew the line on the screen, on top of everything. Then tried editing inside the app, e.g.:
Code:
EXPORT Geometry()
BEGIN
  IF GETKEY == 30 THEN
     LINE(-1,-1,1,1);
   END;
END;
Didn't work either...
Would you mind clarifying a little bit?

You have to clear the screen first with RECT();

Tom L


RE: [Programming] Cartesian draw functions - gabrieljcs - 12-06-2014 09:37 PM

I get it, but what I want to do is to draw into a "cartesian plane" (I don't really know how to call it), like the Graphing and Geometry apps do:
[attachment=1269]


RE: [Programming] Cartesian draw functions - Giancarlo - 12-06-2014 10:36 PM

Hello,
something like this?

Code:

EXPORT Cartesian_line()
BEGIN
RECT();
LINE(G0,0,10,0,-10); //axis
LINE(G0,-15,0,15,0); //axis
LINE(G0,-1,-1,1,1); // your line
WAIT(0);
END;

[Image: 67abd2fe-2ac1-45b9-bade-4ec3fda7bd7d_zps6a3f58a5.png]

bye

Giancarlo


RE: [Programming] Cartesian draw functions - gabrieljcs - 12-06-2014 11:10 PM

Thanks a lot for the answer, Giancarlo.

The issue is not the axis, but the ability to move around and zoom in and out. I thought there was a way of doing it systematically and not by painfully programming a pan and zoom function (I wouldn't even know where to begin).


RE: [Programming] Cartesian draw functions - Giancarlo - 12-06-2014 11:19 PM

Hello,
as far as i know the current firmware (6940) allow to "programatic access to geometry constructions."
The quoted part was extracted from the new firmware log.

hope it helps,

bye Giancarlo


RE: [Programming] Cartesian draw functions - gabrieljcs - 12-06-2014 11:24 PM

Very interesting, I'll take a look into it. Thanks a lot, again!

If anyone would be able to give an alternative to panning the screen, that'd be great!

TIA, Gabriel