HP Forums

Full Version: ppl plots multi-coloured point within a quarter circle
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This program demonstrates plotting different coloured point within a quarter circle.

It clears the screen, sets up local variables, uses a for loop, used the RANDINT
function to generate numbers for colours and points. It then plots the points
using the PIXon_P command for each cycle of the for loop.
The FREEZE commpands pauses the screen. Press Esc to exit the programs.

I thought some new users could benefit from seeing this program.


// qtrcrc02 plots a quarter circle
// with different coloured points
EXPORT qtrcrc02()
print; // clear the text screen
rect(); // clear the graphics screen
local i,m;
local x,y,z;
local a,b,c;
m := 65000;
z := 208*208;
for i from 1 to m
x := randint(0,208);
y := randint(0,208);
a := randint(0,255);
b := randint(0,255);
c := randint(0,255);
if x*x+y*y <= z then pixon_p(x,y,rgb(a,b,c))



You program not particularly spectacular miss a bit a dynamic and colorfull animation.
Here is a better example to demonstrate HP Prime capapilities to new users:

LOCAL I,K,R,X,Y,U:=160,V:=120; LOCAL r,g,b,T;
// -------------------------- Black background
// ++++++++++++++++++++++++++ MAIN LOOP
FOR I FROM 0 TO 360*30 DO
// -------------------------- Compute Coordinates
π*I*D/180▶K; 120*SIN(N*K)▶R; 160+R*COS(K)▶X; 120-R*SIN(K)▶Y;
// -------------------------- Color's Kaliodoscope schema
140+115*SIN(π*I/180)▶r; 140+115*SIN(π*I/120)▶g; 140+115*SIN(π*I/ 72)▶b;
// ------------------------- Draw full-colored roses
// ------------------------- Adjust speed for smooth animation
// ++++++++++++++++++++++++++ FREEZE END

It is base on Maurer Rose drawings in varing colors as well as graphics by playing with periodic functions.
Thanks for posting your spectacular program.

BTW what numbers did you input for N and D?

I used 1 and 1 and got a nicely multi-colored circle.

Those programs produce beautiful results guys, thanks for sharing them.

I have been interested in playing with graphics on various screens for years, and it's great when people share things like these.

The reason I ask so many questions in this group, is that I want to get a bit more than the obvious out of the HP Prime too :-).

I am lucky enough to need to use a calculator all day in my work, but I spend my free time, trying to understand each ability (inbuilt function of the calc) deeply, so that I can use it to it's fullest.

Great work. Please, keep sharing.
For the maurer program:

I put in (phi-1), i.e. (1+sqrt(5)/2))-1, which is approximatly 0.618 into both
boxes, (N and D).

It produced a different but impressive display for the prime.


edit: I may not have appropriate parenthesis for (phi-1). it is about ((1+(2.236/2)) -1 ) which is about 0.618.
Taking the ratio of two consecutive fibinacci numbers will converge to about 0.618 also.

There is an infinity of combinations for N and D producing tons of different styles for Maurer's Rose geometries.
Moreover, for each style or geometry, any multiplicity factor may induce different aspect or effect in color "sliding".

One of my favorite style are the one obtained by a "close miss" of integer or round value (see attached figure).

MAURER( 4 , 119.7 )

But, there is so much possibilities and different style of effect or geometry that you have to explore and prospect to found your own art.
That what make it attractive to new users or students. And the corrolated explanations may have to introduce notions in trigonometry, periodicity, theory of color , and so on...

A great tool to introduce a full set of notions and practices !

Don't hesitate to modify my code, adding, removing or emphasing any feature or gadget.
Reference URL's