Jump to content
  • Advertisement
Sign in to follow this  
VladimirM

Calculating height of parabola, based on base width and arc length

This topic is 2121 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

this is the formula for the arc length of a parabola 0.5?16h²+w² + [w²/(8h)][Ln(4h + ?16h²+w²) - Ln(w)], from http://www.had2know.com/academics/parabola-segment-arc-length-area.html ., if i know the arc length and the base width, how can i find the height?

I've tried solving for h, using wolfram alpha and mathematica, both failed... said it cant be solved, But there must be a way? It's mathematics, everything is possible, right? :)

Share this post


Link to post
Share on other sites
Advertisement
Why don't you take the original equation for your parabola and calculate the height from there?

You can do this with good ol' calculus by finding the extrema for the equation by calculating all zero-values for the first derivative of your equation within your given range. You can then use the second derivative to determine whether each extremum is a local maximum, a local minimum or an inflection point.

Since you're working with a parabola you'll only find one extremum which will be the x-value for your highest point. Evaluate this x in your original function and you'll get your height.

EDIT:

Easier yet, if your parabola is of the form y = a*x^2 + b, where a < 0 (otherwise you can't find a maximum) then your height is simply the value of b Edited by Radikalizm

Share this post


Link to post
Share on other sites
the base width of my parabola varies (the distance between x1 and x2), between some value q and 0, the thing is that i need the arc length to always be equal to q, I am modeling a spring that when compressed bends like a parabola, so when the spring compresses to a smaller length than its rest length q, i must maintain the length by bending it. and in order to bend it to a certain arc length (q), i must calculate the height every time the base width changes.

Share this post


Link to post
Share on other sites

L = 0.5?16h²+w² + [w²/(8h)][Ln(4h + ?16h²+w²) - Ln(w)]

This equation cannot be rearranged in terms of height with elementary algebra, because it has the [eqn]h[/eqn] both inside and outside a transcendental function (here [eqn]\ln[/eqn]). You can write it out as a closed-form recursive process or a recurrence and then approximate it numerically (or directly approximate it via Newton-Raphson with two variables) - wouldn't know how to do it right then though, sorry.

Share this post


Link to post
Share on other sites
I have no idea how to do any of those things you mentioned, i just finished high school my knowledge of math is limited.. Is there some software that does these approximations or do i have to try and do it myself?

Share this post


Link to post
Share on other sites
So if I understand you correctly, you need to keep the length of the parabolic arc constant, while modifying its base width, so you need to obtain the correct height for it to have the same length?

Share this post


Link to post
Share on other sites
So if I understand you correctly, you need to keep the length of the parabolic arc constant, while modifying its base width, so you need to obtain the correct height for it to have the same length?[/quote]

exactly

Share this post


Link to post
Share on other sites
OK, I think I got it. I would expect the length of the parabola to increase monotonically as the height increases, for a same base width. In this case, you can use good old bisection. This will allow you to converge on the correct height required to obtain a given arc length, knowing the base width. I would expect the algorithm to converge pretty quickly on the solution, which means it should be fast if you only need, say, 5 digits of precision, but I can't say anything about performance. I believe it would be correct though.

The code would look something like this (may have some edge cases but it's the idea):


input: base length W, required length L.
output: approximate correct H such that Length(W, H) = L

1. Let lo = 0, hi = 4h + c (twice the limit form plus some constant, try various c)
2. Compute H_mid = (lo + hi) / 2
3. Compute L' = Length(W, H_mid)
4. If L' < L, let lo = H_mid and goto 2
5. If L' > L, let hi = H_mid and goto 2
6. If L' is close to L, return H_mid


Though note that if arc length doesn't strictly increase with height with constant base width as I think it does, this might not work.

EDIT:

If w is a constant, then:

O(0.5?16h²+w² + [w²/(8h)][ln(4h + ?16h²+w²) - ln(w)]) = O(0.5?16h² + [1/(8h)][ln(4h + ?16h²)]) = O(2h + ln(8h)/(8h)) = O(2h + ln(8h)/(8h))

Which tends to 2h in the limit, so the arc length does increase monotonically with h, this should work.

You can also use Newton-Raphson instead by differentiating (have you seen this method at high school?), it would converge faster but each iteration takes more work, and the differentiated expression may not be so nice to compute. Edited by Bacterius

Share this post


Link to post
Share on other sites
Just out of interest, how is the parabola being used? If you're talking about the motion of a projectile under the force of gravity, there are other equations you can use that are more suited to the task.

Share this post


Link to post
Share on other sites
Thanks bacterius, i aproximated it using taylor series but it only worked for a small arc length to base width ratio, so the good old bisection is what i will settle for :)

Just out of interest, how is the parabola being used? If you're talking about the motion of a projectile under the force of gravity, there are other equations you can use that are more suited to the task.[/quote]

I have springs that compress, and i want to keep their length constant so i bend them accordingly when they compress.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!