1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How to determine Normal Vector of two colliding edges?

  1. Sep 27, 2007 #1
    I am writing a physics simulation about the collision and reaction of the Rigid Body.
    And now i have problem in determining the normal vector of two colliding edges.

    For example,
    I have 2 rectangulars ( whether or not it's of same size, anything can happens ),
    and under some situations, they rotate and translate.
    And finally, they come to contact each other with their edges.
    How do i determine their refraction vector / normal vector correspondingly?

    Just as shown as below :

    Thanks in advance.
  2. jcsd
  3. Sep 27, 2007 #2
    just attach a coordinate system to one of the "rectangulars", the line perpendicular to each face is the normal. of course you can do that for each "rectangular" but to talk about them both at the same time is pointless.

    if you don't understand what im saying then just imagine that one of them is stationary, that it has a normal perpendicular to each face, and that the other block is approaching it.

    hopefully you know how to code that because i don't but i would be interested in seeing your program+source
  4. Sep 27, 2007 #3
    mmm.. thanks for ur reply.
    but sry, i'm having problem in edge normal not face normal.
    or rather it would be vertices versus vertices normal.
    hope it's clear =)
  5. Sep 27, 2007 #4


    User Avatar
    Gold Member

    For an edge edge collision you find two points, one on the first edge and one on the second one so that the distance between them is minimal (it's easier than it sounds). The vector between those points is the collision normal.
    But by the way, how do you check to see if you have an edge-edge collision? When I implemented something like this a while ago I used the SAT (google it) to tell if boxes where colliding. The cool thing is that after checking for collision you can use the collision axis (you'll read about that when you google for SAT) to get the collision normal for free.
  6. Sep 27, 2007 #5
    that is just the line orthogonal to both vertices. i actually just solve this problem recently. but it doesn't make sense to me as far as using it to apply some snell's law of relfection analogue or something
  7. Sep 27, 2007 #6
    Yes, u guys are so right, it reminds me of the basic principle of normal vector.
    It's the matter of vector of colliding points.
    I got a proof from here:

    Btw, i found a new interesting & difficulty of implementing this,
    that's how to actually find the difference of two colliding points seem they are actually the same exact point.
    Well, umm my guess for my own way would be detecting them in a small increment of timer and when they come close enough, for a measurement of about < 0.1 distance, then i assume it's colliding.
    Well that's the computing way =/
    I'm not dealing with 3D simulation anyway, just my first implementation on rigid,
    and i'm writing it on flash as it's just for my trial.
    Will post it after i got it implemented and try for a 3d version with c++.
  8. Oct 9, 2007 #7
    As promised, i've done my research and had applied it.
    It's just my first trial and i didn't do a proper accurate collision detection,
    so if the simulation get stucked, just simply click reset button to restore it.
    Last edited: Oct 9, 2007
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook