Jump to content
  • Advertisement

Archived

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

mhadi

Determining length of curve

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
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:

(2*PI*radius) * (|startangle-endangle|/360)

Share this post


Link to post
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]

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!