Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Optimize Collision Detection with Octree

yomotsu
October 08, 2014

Optimize Collision Detection with Octree

yomotsu

October 08, 2014
Tweet

More Decks by yomotsu

Other Decks in Programming

Transcript

  1. 1 Optimize Collision Detection with Octree Presented by Akihiro Oyamada

    (@yomotsu) Frontend Engineer at PixelGrid, Inc. Oct 7, 2014
  2. 2

  3. 3

  4. 4

  5. 5

  6. 6

  7. 10

  8. 11

  9. 12

  10. 13

  11. 14

  12. 15 // maxDepth4のoctreeのツリー構成例 ! octree.nodes = [ [node], //level 1

    (node*1個) [node,node...] //level 2 (node*8個) [node,node...] //level 3 (node*64個) [node,node...] //level 4 (node*512個) ]
  13. 16 // node単体の構成例 ! OctreeNode = function ( params )

    { ! this.tree // <Octree> this.depth // <Number> this.mortonNumber // <Number> this.min // <THREE.Vector3> this.max // <THREE.Vector3> this.trianglePool // <Array> ! }
  14. 18 var i; ! var parentMotonNum = 1; ! for

    ( i = 0; i < 8; i ++ ) { ! console.log( ( parentMotonNum << 3 ) + i ); ! } ! // 8, 9, 10, 11, 12, 14, 15
  15. 24

  16. 25