FILLCIRCLE_P()
|
02-22-2020, 10:57 PM
Post: #1
|
|||
|
|||
FILLCIRCLE_P()
HP Prime does not have a function which draws a filled circle. I have seen many attempts to implement a substitute by drawing concentric circles with one pixel increment radii, but it does not work well, and the area of such a circle is usually not uniform.
Recently I was working on an application that really could use such a filled circle... it was not absolutely necessary, but it definitely look nice... I decided to spend an hour or two on writing such a procedure. Maybe somebody will find it useful, and will save time he would otherwise have to spend on writing it. A program below consists of a procedure drawing a filled circle (FILLCIRCLE_P), and a few small demo/test additions. FILLCIRCLE_P() can be included in the program, or in a library. It draws a filled polygon (a function supported by HP Prime) which vertices are placed on the perimeter of the circle. (One of many methods to draw a filled circle; I am not saying the best one or the fastest one.) Code: EXPORT FILLCIRCLE_P (nG, nX, nY, nRadius, nSmoothness, nColor) One comment I would like to make is that the first, initial version of the code was not taking advantage of the symmetry of circle quadrants. I optimized the code later counting on increase of the speed of drawing. To my surprise, the increase of speed was smaller than 20%! This means that either calculation of trigonometric functions is fast, or that calculations related to list indexing and/or drawing filled polygon is slow. I did not have time to explore this subject deeper. Darius |
|||
02-22-2020, 11:22 PM
Post: #2
|
|||
|
|||
RE: FILLCIRCLE_P()
Some firmwares ago that feature was added.
Syntax: ARC(G, x, y, r or {rx, ry}, [∠1, ∠2], [border_color, [fill_color]]) Also: Program catalog/New/Example/Demo_ARC Viga C | TD | FB |
|||
02-23-2020, 01:10 AM
Post: #3
|
|||
|
|||
RE: FILLCIRCLE_P()
(02-22-2020 11:22 PM)Carlos295pz Wrote: Some firmwares ago that feature was added. Well, yeah. You are absolutely correct, Carlos. The description of this feature can be found in the Prime help. But if you look at the user's manual, it says: ARC_P(G, x, y, r [ , a1, a2, c]) Not a word about filling. Lesson to learn: every time you use a function, look it up in the calculator's help. (I am being facetious. I don't have time to go through every help item in the calculator every time the f/w update is released. On the other hand, I would not mind getting an updated user's manual with it. Or, at least, errata/what's new file.) A serious conclusion is that the user's manual is outdated and, as such, cannot be trusted. Okay, let's end this rant here, and look for the bright side: at least I had some fun with solving a trivial math problem. Thanks, Carlos, for letting me know about this addition. Darius |
|||
03-01-2020, 01:25 AM
Post: #4
|
|||
|
|||
RE: FILLCIRCLE_P()
Thanks for pointing this out Carlos. I had no idea they expanded ARC to fill in circles. I just modified all my games that I wrote that used the old method (drawing concentric circles with one pixel increment radii)
|
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)