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

*Signed* distance between two moving lines

6 posts in this topic

Given two lines in R3. Each line is defined by two vertices on a moving frame (linear *and* angular motion). Assume we have world space vertices A,B and C,D defining the current lines. At t0 = 0 I compute the distance d( 0 ) = dot ( AC, cross( AB, CD) / | cross( AB, CD) | ) such that d( 0 ) > 0. I can use this function to measure the distance over time. The only problem is that the orientation of cross( AB, CD ) can flip. E.g. if edge CD would rotate around the initial cross product axis( 0 ) = cross( AB( 0 ), CD( 0 ) ). The distance would be constant, be switches signs when CD crosses over AB. I guess I would need to add some concept of handiness to get the proper sign. Is this possible or are there other possibilities to define the distance? 

 

Thanks,

-Dirk

Edited by Dirk Gregorius
0

Share this post


Link to post
Share on other sites

What is the signed distance between 2 lines? Lines are in a sense infinitely skinny. They are either touching, d = 0, or not touching d > 0. 

Edited by rayp
0

Share this post


Link to post
Share on other sites

I agree! Well, I think I need a sign relative to the initial configuration. If the lines are not touching the closest points define a plane. I want to drive this plane based on the cross product without have the cross product flip the plane. Does this make more sense?

Edited by Dirk Gregorius
0

Share this post


Link to post
Share on other sites

If your lines only move by translation, you might be able to define something like this (just project to a plane that is perpendicular to one of the lines and describe the other line as A*x+B*y+C*z+D=0, with A^2+B^2+C^2=1, and D is your distance). If your lines can move more freely, you can reach the same configuration with and without intersection, which makes it hard to have a meaningful sign assigned to the distance.

0

Share this post


Link to post
Share on other sites

I am implementing the Box2D TOI which is conceptually a root finding algorithm. You essentially find the closest features and based on this you try to find the root for d(t) = ( SupportB( -n ) - SupportA( n ) ) * n. Here n is a function of time and depends on the initial features. For the edge case I tried a fixed axis like Box2D does for vertex/vertex and I also attached a plane to one of the bodies. Both work i, but are highly inefficient. You can easily run 80 - 100 iterations which makes the algorithm unusable in practice. If you use n = e1(t) x e2(t) everything works great, but it can fail if the cross product flips. You can clearly see this if you plot the function that the root finder sees. The function has a step. 

0

Share this post


Link to post
Share on other sites

If the edges can move freely, you could get a distance value of zero if the edges happened to become parallel, despite a possibly large |AC|.

 

I don't think your distance function properly captures the concept of distance. (This is probably already clear in the discontinuity that you observe.)

See: http://en.wikipedia.org/wiki/Metric_(mathematics)

 

I think there are too many things going on at once with your formula. First, you have the magnitude of the separation |AC|. Second, you have the relative orientation of this separation with respect to the normal (ABxCD)^. Third, you have a time evolution behavior that dynamically changes the "semantics" of the formula (at least for me, as I try to interpret this as something distance-like). It might be a little too untamed for what you are trying to use it for.

 

I understand now a little more clearly what you were trying to do in your other post. I think you wanted to try to piece-wise apply this function correctly. If you are seeing positive benefits from using this function and wanted to pursue making it work, I would give that a second look. On a cursory look, you have maybe three things to consider. (a) The cross-product vanishes. (b+c) The two different signs of the cross-product.

0

Share this post


Link to post
Share on other sites

Hi Deekr,

 

I give you some more context. In my initial post I used d(t) = AC * ( AB  x CD ). This would be only partially correct since this doesn't take the other features into account. Essentially I solve d(t) = ( SupportB( -n ) - SupportA( n ) ) * n. Here n is some direction based on the closest features I start with at t = 0. E.g. for vertex / vertex Box2D uses a fixed axis computed from the closest points. For face/vertex n is the face normal moving with the rigid body. If you want to extent this to 3D we have to deal with edge/edge. Of course you can use a global axis as for vertex ( e.g. n = e1( 0 ) x e2( 0 ) ). Or I can use a fixed axis attached to body A or B. There is nothing wrong with this and this works perfect;y, but the performance sucks so bad that the algorithm becomes unusable in practice with these definitions for the separation function because the iteration count goes up to 50 - 100. If you investigate this you also notice that restart the algorithm but the features haven't changed. This strongly indicates that these are poor choices for a separation function.

 

Using n = e1( t ) x e2( t ) works great on the other hand. The algorithm uses 1-5 iterations and is lighting fast. The problem is to define a consistent normal. This only fails if the cross products flips and I need to come up with a condition to detect this. So far I a have failed miserable on this. One idea I had was to use the initial axis n( 0 ) = e1( 0 ) x e2( 0 ) as a reference direction and then detect when dot( n( 0 ), n( t ) ) < 0 and flip the axis. This is wrong since the normals can get into valid configuration violating this condition.  Intuively I guess I need some notion of handness which I should define from the initial configuration at t = 0. If I could create e.g. a consistent RH coordinate frame at each instance in time I might be able to detect the switch the normal properly. Just the normal seems not enough.

 

So yes I am seeing positive benefits from this. If we can solve this we have a really nice CCD which solves a lot of problems people might notice with conservative advancement. It is a really fast algorithm.

 

I am not so much concerned with case (a). I this case we could always create a normal from the closest points. Given we can make sure we have the correct direction to get the proper sign. I think the two different signs of the cross product are the problem and we need more information (possibly from the initial configuration) and track this through time.

 

Thanks! I appreciate your help!

-Dirk

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