# How to calculate the length of a somewhat well defined curve?

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

## Recommended Posts

I'm trying to make my spaceship corner in a nice curve, but my math is a bit hazy in one area. The curve has two endpoints, I know the starting and ending angles for both and the coordinates for both. What equation should I use to find its length? I'm wondering as to how the "level of curvature" is handled. You can assume it's constant throughout the curve. Or am I going to need some more variables to define that as well? (I notice Photoshop has the normal pull-points for curve corners... that makes the issue harder, hmm?)

##### Share on other sites
Well, assuming the curvature is constant, I would think you can just calculate the circumfrence(C = 2πr) of the circle that it would form if it went 360o and divide by the difference between starting and ending angles. Hope that helps.

-AJ

##### Share on other sites
Step 1) Approximate the curve with 2 line segments.

Step 2) Subdivide the curve into two intervals corresponding to the two line segments

Step 3) Repeat step 1

If you have an analytic formula for the curve, this procedure will yield (a close but not exact) riemann sum as the number of line segments increases, that it will converge to the length of the curve. This should solve your problem.

##### Share on other sites
If you have a parametric curve, like
u(t) = {x(t),y(t),z(t)}
and you know which values of the parameter correspond to the initial and final point, let them be t0 and t1, then the length between those points is:
Integral[from t0 to t1, sqrt(x2(t)+y2(t)+z2(t)), dt]

As for the curvature...
Find the first and second derivative of the curve. (Notice that if 't' represents time, these will be the vectors of velocity and acceleration of the object)
The vectors {t, n, b), where:
t(t) = u'/|u'|
n(t) = b X t
b(t) = u' X u"/|u' X u"|

are a right-handed orthogonal base of unit vectors, where t(t) is the tangent vector at the point u(t), n is the vector of curvature at the point u(t), and b(t) is the vector of torsion.

If you apply the following world matrix to the object...
[ n.x   b.x   t.x    x(t) ][ n.y   b.y   t.y    y(t) ][ n.z   b.z   t.z    z(t) ][   0     0     0     1   ]

the spaceship will orientate perfectly with respect to the curve at any of its points.

edit:
fixed bug with "

[Edited by - someusername on February 28, 2006 4:51:06 PM]

1. 1
Rutin
29
2. 2
3. 3
4. 4
5. 5

• 13
• 13
• 11
• 10
• 13
• ### Forum Statistics

• Total Topics
632955
• Total Posts
3009451
• ### Who's Online (See full list)

There are no registered users currently online

×