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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
840
PBR in three.js
yomotsu
1
1.1k
dialog要素でつくるモーダルダイアログ
yomotsu
0
1.1k
IE to Edge
yomotsu
1
400
A Camera Control Library for three.js
yomotsu
1
1.5k
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
過去のレビュー知見をSkillsで資産化した話
pkshadeck
PRO
1
1.9k
AI時代だからこそ「Bloc」を採用する価値があるのかもしれない
takuroabe
0
170
My daily life on Ruby
a_matsuda
3
310
Skillは並べた。動かなかった。契約で繋いだ。— 65個のSkillから、自走する開発サイクルへ
junholee
0
130
【ディップ|26年新卒研修資料】TDD実装演習
dip_tech
PRO
0
180
Making the RBS Parser Faster
soutaro
0
710
Terraform言語の静的解析 / static analysis of Terraform language
wata727
1
140
JCON - Create Agentic AI Apps, The Easy Way!
kdubois
1
110
PicoRuby for IoT: Connecting to the Cloud with MQTT
yuuu
2
770
2026年のソフトウェア開発を考える(2026/05版) / Software Engineering Scrum Fest Niigata 2026 Edition
twada
PRO
23
12k
サークル参加から学ぶ、小さな事業の回し方
yuzneri
0
170
AlarmKitで明後日起きれるアラームアプリを作る
trickart
0
130
Featured
See All Featured
Ruling the World: When Life Gets Gamed
codingconduct
0
230
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.4k
RailsConf 2023
tenderlove
30
1.4k
Done Done
chrislema
186
16k
Abbi's Birthday
coloredviolet
2
7.6k
A Modern Web Designer's Workflow
chriscoyier
698
190k
A better future with KSS
kneath
240
18k
AI: The stuff that nobody shows you
jnunemaker
PRO
6
640
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
440
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
3k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
820
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