# HP Forums

Full Version: HP Prime - Drawing a circle from a program
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

Hello

I can draw a line from a program:

line({0,0},{5,5});

But I cannot find the correct syntax to draw a circle by giving coordinates of the center and the radius. I tried all kind of syntaxes I could imagine with no success. Manual did not help me more.

Help much appreciated.

Kind regards.

ARC(G,x,y,r,a1,a2,c)

or

ARC_P (G,x,y,r,a1,a2,c)

Page 538 in Edition 1, July 2013, User Guide.

TomC

Note: radius (r) is always in pixels, regardless of whether ARC or ARC_P is used. So if you are using the Cartesian version of ARC, convert the radius first.

I recommend just using ARC_P and work with pixels.
I believe the conversion formulas are:

X point to pixel: integer((x - Xmin)/(Xmax - Xmin)) * 318

Y point to pixel: integer((y - Ymax)/(Ymin -Ymax)) * 218

Also you can use the C>PX command in the catalog. C>PX(x,y) returns the list {x pixel, y pixel}.

Bonjour Thomas

Why does the command "circle()" not be used?

It was the command I was trying to use. I am confused.
Many thanks for you answer. Kind regards.

elle n'existe pas, tu dois utiliser ARC_P

Because "circle" implies that you are drawing a complete circle exclusively. ARC can draw curved arcs between 0<x<2pi angular values.

TW

Mic

in fact, I was using the line() command of the Geometry App in a program, which works fine as soon as you use the following syntax:

line({x1,y1},{x2,y2})

But for an unknown reason, trying to use a similar syntax on the circle() command of the Geometry App in a program does not work. For instance, here is a syntax I tried:

circle({x1,y1},{x2,y2})

I thought this would draw a circle where x1,y1 and x2,y2 would be the coordinates of two end points of a diameter.

Kind regards.