Skip to content

Commit 5d52998

Browse files
committed
Bump version to 0.3
1 parent d3fb8d9 commit 5d52998

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 0.3 (Feb 11, 2014)
4+
5+
- Add `pointInCircle` and `pointInPolygon` functions for performing "hit tests" (Fixes #2)
6+
37
## 0.2 (Dec 8, 2013)
48

59
- Reformat comments so that they can be run through `docco` to create an annotated source file.

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ It's released under the [MIT](http://en.wikipedia.org/wiki/MIT_License) license.
1818

1919
Current version: `0.2`. [Annotated source code](http://jriecken.github.io/sat-js/docs/SAT.html) is available.
2020

21-
Nicely compresses with the [Google Closure Compiler](https://developers.google.com/closure/compiler/) in **Advanced** mode to about 5KB (1.8KB gzipped)
21+
Nicely compresses with the [Google Closure Compiler](https://developers.google.com/closure/compiler/) in **Advanced** mode to about 6KB (1.9KB gzipped)
2222

2323
<a name="classes"></a>
2424
Classes
@@ -221,10 +221,27 @@ Test two polygons
221221

222222
No collision between two Boxes
223223

224+
var V = SAT.Vector;
224225
var B = SAT.Box;
225226

226227
var box1 = new B(new V(0,0), 20, 20).toPolygon();
227228
var box2 = new B(new V(100,100), 20, 20).toPolygon();
228229
var collided = SAT.testPolygonPolygon(box1, box2);
229230

230231
// collided => false
232+
233+
Hit testing a circle and polygon
234+
235+
var V = SAT.Vector;
236+
var C = SAT.Circle;
237+
var P = SAT.Polygon;
238+
239+
var triangle = new P(new V(30,0), [
240+
new V(0,0), new V(30, 0), new V(0, 30)
241+
]);
242+
var circle = new C(new V(100,100), 20);
243+
244+
SAT.pointInPolygon(new V(0,0), triangle); // false
245+
SAT.pointInPolygon(new V(35, 5), triangle); // true
246+
SAT.pointInCircle(new V(0,0), circle); // false
247+
SAT.pointInCircle(new V(110,110), circle); // true

0 commit comments

Comments
 (0)