• ### What is your GameDev Story?

#### Archived

This topic is now archived and is closed to further replies.

# Determining length of curve

This topic is 5428 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello, I was developing an application that read the input of curves from AutoCAD(.dwg) file and determine its total length AutoCAD stores the input as  typedef struct CDB_ARC_ENTITY_type{ CDB_ENT_HEADER Header; /* Header Information */ PNT_3D Center ;/* Center Point (10,20,30) */ double Radius ;/* Radius (40) */ double start_ang ;/* Start angle (50) */ double end_ang ;/* End Angle (51) */ }CDB_ARC_ENTITY;  The question is how to determine te length curve? I have searched the net and found to calculate it http://www.tpub.com/content/engineering/14070/css/14070_242.htm But it does not tell me the "delta" of angles Please can anyone tell me to determine it. waiting for some serious help mhadi [edited by - mhadi on March 7, 2004 10:44:56 AM]

##### Share on other sites
Think about it, if you''re only dealing with circles the solution is easy, especially considering that you are given the radius, start angle and end angle. The difference in angles is your ''delta'', or 1 degree. Then you know that the circumference of a circle is 2*PI*radius. Therefore you take the circumference times the percentage of the circle that the arc encompases:

##### Share on other sites
Okay, if you're attempting to determine the length of a complex curve this is a simple application of differential calculus. The general equation is of the form:

The curve length is equal to the definite integral from a to b of the squareroot of dx^2 + dy^2. Now, depending on how your curve function is defined f(x) or g(y) then you can isolate the appropriate differential to either:

square root of 1 + dy/dx dx
square root of dx/dy + 1 dy

Now, hopefully, your function is simple to integrate, but if not just enter it into Mathematica or some other mathematics program and you can get a good approximation, or if you want I could approximate it with Simpsons rule to a specific floating point precision accuracy.

Thanks,
Will

[edited by - bonedoctor on March 7, 2004 10:55:06 AM]

Duh! Function?!!

##### Share on other sites
I never thought I''d ever say this, but listen to the AP. Given the information AutoCAD gives you, it''s the best way to determine the length. Just add up the lengths of all the pieces of the circles.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 13
• 9
• 15
• 14
• 46
• ### Forum Statistics

• Total Topics
634056
• Total Posts
3015282
×