ppl plots multi-coloured point within a quarter circle - 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: ppl plots multi-coloured point within a quarter circle (/thread-17158.html) ppl plots multi-coloured point within a quarter circle - Liamtoh Resu - 06-24-2021 04:40 AM 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. RE: ppl plots multi-coloured point within a quarter circle - C.Ret - 06-30-2021 07:57 PM 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. [attachment=9606] RE: ppl plots multi-coloured point within a quarter circle - Liamtoh Resu - 06-30-2021 09:21 PM 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. RE: ppl plots multi-coloured point within a quarter circle - matalog - 06-30-2021 11:32 PM 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. RE: ppl plots multi-coloured point within a quarter circle - Liamtoh Resu - 07-01-2021 04:33 AM 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. RE: ppl plots multi-coloured point within a quarter circle - C.Ret - 07-01-2021 05:20 AM 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). [attachment=9607] 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.