• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
VladimirM

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

9 posts in this topic

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? :)
0

Share this post


Link to post
Share on other sites
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
0

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.
0

Share this post


Link to post
Share on other sites
[quote name='VladimirM' timestamp='1345761559' post='4972792']
L = 0.5?16h²+w² + [w²/(8h)][Ln(4h + ?16h²+w²) - Ln(w)]
[/quote]
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.
1

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?
0

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?
0

Share this post


Link to post
Share on other sites
[quote]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
0

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):

[CODE]
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
[/CODE]

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
0

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.
0

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 :)

[quote] 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.
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0