# Board index » delphi » Math help!!

## Math help!!

I hope this isn't too far off subject, although I am trying to do this
in Delphi. Answer by e-mail (see .sig at bottom) if you don't want to
clutter the newsgroup.

My geometry/trigonometry is very, very rusty. I could use some help or
pointers on trying to figure the following out for a program I am
writing. Basically, I'm trying to convert CNC code to HPGL.

I'm trying to draw some arcs. I know the 'direction' (CW or CCW),
start point, end point, and either the radius or centerpoint. I need to
convert that to either centerpoint and angle, or three points on the
arc.

--
All junk mail senders will be prosecuted to the fullest extent of the
law!!
http://www.ntsource.com/~andyross

## Re:Math help!!

##### Quote
Andrew Rossmann wrote in message <360693E4.C637CDF3@no_junk.ntsource.com>...
>  I'm trying to draw some arcs. I know the 'direction' (CW or CCW),
>start point, end point, and either the radius or centerpoint. I need to
>convert that to either centerpoint and angle, or three points on the

I don't have time to work out the details for you, but perhaps this will
get you started.

If I understand you correctly you have two points A and B on the circle
and the center point, C.

You can use the arctan2 function to get the angle between a radius line
and the X-axis (if I remember correctly).  So something like
arctan2(Ay-Cy, Ax-Cx) should give you the angle from the X-axis to
point A and arctan2(By-Cy, Bx-Cx) should give you the angle from
the X-axis to the point B.  Draw your arc by creating intermediate
points.  These intermediate points will be something like
(Cx + R*COS(theta), Cy+R*SIN(theta)).

I you need an arctan2 function, look on the Delphi Math Functions
pages in my Computer Lab.

efg
_________________________________________
efg's Computer Lab:  http://infomaster.net/external/efg

Earl F. Glynn                 E-Mail:  EarlGl...@att.net
Overland Park, KS  USA