Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Optimize Collision Detection with Octree
Search
yomotsu
October 08, 2014
Programming
780
0
Share
Optimize Collision Detection with Octree
yomotsu
October 08, 2014
More Decks by yomotsu
See All by yomotsu
three.jsとRapierでレースゲームが3日でできた話
yomotsu
0
800
PBR in three.js
yomotsu
1
1.1k
dialog要素でつくるモーダルダイアログ
yomotsu
0
1k
IE to Edge
yomotsu
1
380
A Camera Control Library for three.js
yomotsu
1
1.4k
Let’s try AR on mobile Web with <model-viewer>
yomotsu
0
590
WebXR: Beyond WebGL
yomotsu
2
1.9k
Non-DOM components with WebGL in Vue.js
yomotsu
5
13k
WebGL Libs for WebApp Frameworks
yomotsu
4
7.9k
Other Decks in Programming
See All in Programming
モダンOBSプラグイン開発
umireon
0
190
Nuxt Server Components
wattanx
0
220
Symfony + NelmioApiDocBundle を使った スキーマ駆動開発 / Schema Driven Development with NelmioApiDocBundle
okashoi
0
250
AI時代のシステム設計:ドメインモデルで変更しやすさを守る設計戦略
masuda220
PRO
6
1.1k
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
830
Java 21/25 Virtual Threads 소개
debop
0
310
Agentic AI: Evolution oder Revolution
mobilelarson
PRO
0
220
メッセージングを利用して時間的結合を分離しよう #phperkaigi
kajitack
3
520
Smarter Angular mit Transformers.js & Prompt API
christianliebel
PRO
1
110
KagglerがMixSeekを触ってみた
morim
0
360
Codex CLI でつくる、Issue から merge までの開発フロー
amata1219
0
260
Mastering Event Sourcing: Your Parents Holidayed in Yugoslavia
super_marek
0
130
Featured
See All Featured
Rails Girls Zürich Keynote
gr2m
96
14k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
500
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
990
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.4k
Building Applications with DynamoDB
mza
96
7k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.1k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
79
The Pragmatic Product Professional
lauravandoore
37
7.2k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
160
Art, The Web, and Tiny UX
lynnandtonic
304
21k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
190
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.8k
Transcript
1 Optimize Collision Detection with Octree Presented by Akihiro Oyamada
(@yomotsu) Frontend Engineer at PixelGrid, Inc. Oct 7, 2014
2
3
4
5
6
7 Collision Detection vs 524 Tris
8 vs only about 30 Tris by partitioning
ׂۭͨؒ͠ .PSUPOPSEFSʹैͬͯฒΔ 9
10
11
12
13
14
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個) ]
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> ! }
17 -FWFMͷͷࢠϊʔυΛٻΊΔʹʜ
18 var i; ! var parentMotonNum = 1; ! for
( i = 0; i < 8; i ++ ) { ! console.log( ( parentMotonNum << 3 ) + i ); ! } ! // 8, 9, 10, 11, 12, 14, 15
19 -FWFMͷͷϊʔυΛٻΊΔʹʜ
20 var childMotonNum = 10; console.log( childMotonNum >> 3 );
! // 1
ϏοτγϑτͰ ٻΊΒΕΔ 21
ϊʔυʹܗͷ τϥΠΞϯάϧΛొ͢Δ 22
""##WT5SJBOHMF ϊʔυ""## 23
24
25
NBY%FQUIΛʹͨ͠Β $ISPNF͕ࢭ·ͬͨ ? ? ? ʜ ? ݸͷϊʔυ͕Ͱ͖Δ 26
܁Γฦ͠ͷΛݮΒ͢͜ͱ͕Ͱ͖ ͨ 27
%Ͱ͋Δ͚ΕͲɺ ܗฏ໘ʹ͍ۙͷͰɺ 2VBEUSFF % Ͱ͍͍͔ .PSUPO/VNͱϏοτγϑτ 28
• THREE.RayΛΊͯɺಠࣗͷ Segment-Triangleަࠩςετʹஔ͖͑ • ίϝϯτΛେྔʹೖΕͨ(ຊޠ͚ͩͲ) 29 ଞʹͬͨ͜ͱ
30 gl.finish(); @yomotsu