Skip to content

Files

Latest commit

 

History

History
40 lines (22 loc) · 1.01 KB

collision-gjk.markdown

File metadata and controls

40 lines (22 loc) · 1.01 KB

Collision.GJK

Copyright (c) 2013 Jasper Palfree http://wellcaffeinated.net/PhysicsJS/

Adapted and optimized by Luis Lafuente llafuente@noboxout.com

todo: stress test

source: https://github.com/wellcaffeinated/PhysicsJS

reference: https://github.com/felipetavares/bomberman/blob/master/web/modules/collision.js

reference: http://www.codezealot.org/archives/88

reference: http://mollyrocket.com/849

  • getPolygonPolygon (a_points: Polygon, b_points: Polygon): Object

    Implementation of Gilbert–Johnson–Keerthi (GJK)

    Returned object

    {
    
      overlap: Boolean,
    
      simplex: Polygon,
    
      distance: Number,
    
      closest: Vec2
    
    }

    todo: distance seem to be not 100% right