• 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
DrEvil

Radius of curvature.

9 posts in this topic

Suppose I have a path that is simply made up of a series of points. I don't have a strong math background, but I would like to calculate the radius of curvature of each vertex of the path. Anyone have an idea on how I can do this? Thanks.
0

Share this post


Link to post
Share on other sites
The first thing to do is decide what kind of curve you want to fit through the points. That's a whole separate topic. But, a very quick, and very approximate way to compute some radii of curvature is to assume that at each vertex the curve approaches being a circle that happens to pass through the adjacent points. So, then the problem becomes a matter of computing the radius of a circle that passes through the point of interest and the adjacent point on either side. Its a pretty big assumption---highly unlikely---that the curve you are really interested in does behave in this manner (e.g., it is unlikely that the center-of-curvature actually happens to correspond to a circle that passes through both the point-of-interest and also the two adjacent points), but that is an easy way to get started with something.

The next possibility, is to actually use proper formulas to compute the radius of curvature. The following page shows the formulas, for the problem in 2D:

Radius of Curvature

If you have a spline or curve that has an analytic formulation, then you can possibly compute those derivatives analytically. Or, you can do it numerically. There is the issue of finding an appropriate projection plane, if you have a 3D curve...since the curvature then would be a function of some projection.
0

Share this post


Link to post
Share on other sites
To provide a bit more information, I'm experimenting with vehicles driving, and am looking for a way to estimate a speed that a vehicle can go around a corner without losing control. The information that I've seen related to this are based around a radius of curvature. If I have the friction coefficient of the vehicle I can get the lateral force that would push it into a slide. I'm not sure how to put that information to use in adjusting the vehicle speed so that it takes turns safely. My googling turned up some stuff that uses the radius of curvature so that's what I'm looking into now. I figured I could adjust the speed based on this radius. Is there a way to calculate this radius at a corner if I have 2 vectors that meet, sort of an L shape, essentially each vector is a tangent of the circle. Any other ideas are welcome as well.
0

Share this post


Link to post
Share on other sites
Well, to find the radius of curvature, you probably need to know width of the road (i.e. area where said car is allowed to drive, which is part of entire road).

There's simple illustration
If radius of such circle is what you need, i can derive the formula. It's quite simple, circle is tangent to outside of road and pass through the inner point.

If road is curved and car is supposed to stay on same line, then you can get radius of curvature from shape of that line. If line is polygonal somewhere, you can do it as grhodes suggested, or you can find curvature of your spline analytically.
0

Share this post


Link to post
Share on other sites
The illustration looks about what I need. I have the path width defined as well. Once I get the radius I will need to work backwords with the centrifugal force equation to solve for the speed the object can go through the turn, since I should know the force that the vehicle loses it. I think it will give me a decent enough value that the vehicle should slow down to. Just not sure how to get this radius. Appreciate the help.
0

Share this post


Link to post
Share on other sites
As a sidenote, remember that most roads are inclined to counteract the centripetal forces acting on the vehicle. This effectively reduces the "curvature" of the road.
0

Share this post


Link to post
Share on other sites
Yea, this is for a game where that probably won't be the case, and I just need it as a good estimate of speed for the turns. Consider this more a case of offroad driving than street driving. And even streets are only inclined to reduce force at some expected speed. Pretend there are no speed limits, and the car wants to drive a course as fast as possible.
0

Share this post


Link to post
Share on other sites
Let v1 is direction vector before turn, v2 is direction vector after turn (both normalized 2D vectors) , w is track width (note: it's assumed that track is like in my drawing(note that it may be incorrect if there's several such turns close to eachother), road sides is straight lines that just break), r is circle radius for largest turn that fits on road.

The formula is simply
r = w/(1-0.5*Length(v1 + v2))
[beware of infinite radius at zero angle]

That was not so simple to derive tho... Derivations:

let perp(a) = [ay, -ax] (perpendicular aka orthogonal line). For coordinates, let outer corner of that turn be origin.

n is normalized angular bisector direction:
n = (perp(v1) + perp(v2)) / |perp(v1) + perp(v2)|

The inner corner c must be at the bisector line, i.e.
c = d*n
and be on the distance w from side of the road
c . perp(v1) = w ; same for v2
d*n . perp(v1) = w
d = w / (n . perp(v1))

symmetry: the circle center o must be at bisector line; circle must intersect bisector in c , thus
o = n*(d + r)

the circle center must also be at distance r from either line
o . perp(v1) = r ; same for v2

(d + r) * n . perp(v1) = r

d * n . perp(v1) + r * n . perp(v1) = r
d * n . perp(v1) = r * (1 - n.perp(v1))

r = (d * n . perp(v1) ) / (1 - n . perp(v1))

replacing d by it's formula, simplifying:

r = w/(1-DotProd(n,perp(v1)))
note that dotproduct is cosine of half angle, simplifying even more:
r = w/(1-0.5*|v1+v2|)

little test app:
int main()
{
Vec2d v1(1.2,0.2);
Vec2d v2(0.75,1);
Normalize(v1);
Normalize(v2);
double w(2.3456789);

double r = w/(1-0.5*Length(v1+v2));// radius of largest turn circle

cout<<"r="<<r<<endl;

// test: find circle center , find it's distance to outer side of road and to c. Must be equal to r

Vec2d n=Normalized(perp(v1)+perp(v2));
double d=w/DotProd(n , perp(v1));
Vec2d c=d*n;
cout<<DotProd(c,perp(v1))-w<<endl;// must be very small
cout<<DotProd(c,perp(v2))-w<<endl;// must be very small


Vec2d o = n * (d + r);

cout<<"r (distance to v1 line) ="<<DotProd(o,perp(v1))<<endl;
cout<<"r (distance to v2 line) ="<<DotProd(o,perp(v2))<<endl;
cout<<"r (distance to c) ="<<Length(o-c)<<endl;

return 0;
}

0

Share this post


Link to post
Share on other sites
I have been working on a small tool to try to fit a path to a racetrack.

I found an article about it, that included some bits about radius of curvature

http://www.gamedev.net/community/forums/topic.asp?topic_id=391612
^ You may be able to use that formula to help you in some way.

Unfortunately I still havnt gotten my particular contraption to converge on a solution. Hope you have better luck.
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