Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

LWPOLYLINE bulge to ARC

Status
Not open for further replies.

Fahr

Computer
Sep 7, 2004
3
Hello people,

I'm struggling with the following; I built a DXF parser/drawer in C++ which works fine, except for the bulges (42) in LWPOLYLINEs. I tried to convert this bulge to an ARC, but I can't figure it out. All the samples online are in Lisp and I don't quite read Lisp...
Can someone please explain in normal mathematical terminology how to convert an LWPOLYLINE bulge into an ARC? I have the coordinates of the starting and ending point and the bulge value and I'd like to turn this into an ARC with a center point, radius, start angle and end angle.
Any help is most appreciated!

Thanks,
- Fahr
 
Replies continue below

Recommended for you

I always wondered that myself. I had tried to figure it out myself but was never sucessful. Thanks borgunit. (Resistance is futile)
 
I already found that site, borgunit, but it describes all the procedures in LISP using many default AutoCAD functions which I can't just implement in C.
The story may provide some mathematical geniuses with enough info on deriving the formula, but I am no such genius... I'm really looking for a formula or formulas taking the 3 known parameters and spitting out the needed info for a normal ARC...

- Fahr
 
Fahr - "The bulge is the tangent of 1/4 of the included angle for the arc between the selected vertex and the next vertex in the polyline's vertex list. A negative bulge value indicates that the arc goes clockwise from the selected vertex to the next vertex. A bulge of 0 indicates a straight segment, and a bulge of 1 is a semicircle." You should be able to implement that in C.
 
IFRs - I read it and I understand it. However, I need more than just that. For now I am just working on turning it into the full circle and then further. I have the following;

double chord = sqrt(pow(abs(P1.x - P2.x), 2) + pow(abs(P1.y - P2.y), 2));
double s = chord / 2 * bulge;
double radius = (pow(chord / 2, 2) + pow(s, 2)) / (2 * s);

So, I have the radius, yay me. I can't figure out the center point, however...

- Fahr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor