-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
113 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
viewport: null | ||
title: Canvas 多边形碰撞检测 | ||
css: common.css,collision-detection.css | ||
js: polygon-collision-detection.js | ||
js: https://unpkg.com/[email protected]/dist/earcut.min.js,polygon-collision-detection.js | ||
--- | ||
|
||
<div class="wrap"> | ||
|
@@ -17,4 +17,14 @@ <h2>凸多边形碰撞检测 SAT算法</h2> | |
<canvas id="sat" width="800" height="400"></canvas> | ||
</section> | ||
|
||
<section> | ||
<h2>凹多边形碰撞检测 耳朵减法 + SAT</h2> | ||
<button class="btn" id="clear-sat2">清空画布</button> | ||
<button class="btn" id="create-polygon2">创建多边形</button> | ||
<button class="btn" id="check-polygon2">检测多边形是否有重合</button> | ||
<p>点击画布创建顶点,点击创建生成多边形</p> | ||
<p>是否碰撞:<span id="sat-result2"></span></p> | ||
<canvas id="sat2" width="800" height="400"></canvas> | ||
</section> | ||
|
||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,18 @@ <h2>凸多边形碰撞检测 SAT算法</h2> | |
<canvas id="sat" width="800" height="400"></canvas> | ||
</section> | ||
|
||
<section> | ||
<h2>凹多边形碰撞检测 耳朵减法 + SAT</h2> | ||
<button class="btn" id="clear-sat2">清空画布</button> | ||
<button class="btn" id="create-polygon2">创建多边形</button> | ||
<button class="btn" id="check-polygon2">检测多边形是否有重合</button> | ||
<p>点击画布创建顶点,点击创建生成多边形</p> | ||
<p>是否碰撞:<span id="sat-result2"></span></p> | ||
<canvas id="sat2" width="800" height="400"></canvas> | ||
</section> | ||
|
||
</div> | ||
<script src="https://unpkg.com/[email protected]/dist/earcut.min.js"></script> | ||
<script src="../js/polygon-collision-detection.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters