Post Reply 
ppl plots multi-coloured point within a quarter circle
06-24-2021, 04:40 AM
Post: #1
ppl plots multi-coloured point within a quarter circle
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.

Code:

// qtrcrc02 plots a quarter circle
// with different coloured points
EXPORT qtrcrc02()
BEGIN
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
do
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))
end;

END;
freeze;
end;

Thanks.
Find all posts by this user
Quote this message in a reply
06-30-2021, 07:57 PM (This post was last modified: 07-01-2021 05:07 AM by C.Ret.)
Post: #2
RE: ppl plots multi-coloured point within a quarter circle
Hi,

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:


EXPORT MAURER(N,D)
BEGIN
LOCAL I,K,R,X,Y,U:=160,V:=120; LOCAL r,g,b,T;
// -------------------------- Black background
RECT_P(RGB(0,0,0));
// ++++++++++++++++++++++++++ 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
LINE_P(U,V,X,Y,RGB(r,g,b,92));
X▶U;Y▶V;
// ------------------------- Adjust speed for smooth animation
TICKS▶T;WHILE TICKS-T<60 DO END;
END;
// ++++++++++++++++++++++++++ FREEZE END
FREEZE;
END;


It is base on Maurer Rose drawings in varing colors as well as graphics by playing with periodic functions.
   
Find all posts by this user
Quote this message in a reply
06-30-2021, 09:21 PM
Post: #3
RE: ppl plots multi-coloured point within a quarter circle
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.

Thanks.
Find all posts by this user
Quote this message in a reply
06-30-2021, 11:32 PM (This post was last modified: 06-30-2021 11:33 PM by matalog.)
Post: #4
RE: ppl plots multi-coloured point within a quarter 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.
Find all posts by this user
Quote this message in a reply
07-01-2021, 04:33 AM (This post was last modified: 07-01-2021 04:49 AM by Liamtoh Resu.)
Post: #5
RE: ppl plots multi-coloured point within a quarter circle
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.

Thanks.

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.
Find all posts by this user
Quote this message in a reply
07-01-2021, 05:20 AM (This post was last modified: 07-01-2021 05:46 AM by C.Ret.)
Post: #6
RE: ppl plots multi-coloured point within a quarter circle
Héhé.

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.
Find all posts by this user
Quote this message in a reply
08-31-2024, 07:29 PM
Post: #7
RE: Maurer Rose
(06-30-2021 07:57 PM)C.Ret Wrote:  Hi,

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:


EXPORT MAURER(N,D)
BEGIN
LOCAL I,K,R,X,Y,U:=160,V:=120; LOCAL r,g,b,T;
// -------------------------- Black background
RECT_P(RGB(0,0,0));
// ++++++++++++++++++++++++++ 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
LINE_P(U,V,X,Y,RGB(r,g,b,92));
X▶U;Y▶V;
// ------------------------- Adjust speed for smooth animation
TICKS▶T;WHILE TICKS-T<60 DO END;
END;
// ++++++++++++++++++++++++++ FREEZE END
FREEZE;
END;


It is base on Maurer Rose drawings in varing colors as well as graphics by playing with periodic functions.
I am new to the Prime. Came across this old post. Thought I'd give it a try but it is not working for me. It will draw the "pedals" over and over again in multiple colors but the lines are really just the edge of the pedal. There are no crossing (in-fill) lines. I just copied and pasted the code. Calculator is in degrees. The code seems to be copied okay but maybe there is some hidden character code that is messing things up.
I would appreciate your thoughts.
Regards,
Jerry
Find all posts by this user
Quote this message in a reply
08-31-2024, 08:52 PM
Post: #8
RE: ppl plots multi-coloured point within a quarter circle
Please disregard my post. Setting the calculator to radians and the program works great. Thank you for such a nice demo!
Regards,
Jerry
Find all posts by this user
Quote this message in a reply
09-01-2024, 05:16 AM
Post: #9
RE: ppl plots multi-coloured point within a quarter circle
You're welcome, your remark is relevant.
I realize that my program does not contain any trigonometric settings. And indeed, it only works properly in radian mode.

So this is an important remark and it must be pointed out.

Sincere thanks.
Find all posts by this user
Quote this message in a reply
Post Reply 




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