- Add
getAABBAsBox
methods toPolygon
andCircle
that returns aBox
(getAABB
returns aPolygon
) - thanks getkey!
- Combine consecutive duplicate points in polygons to remove zero-length edges. (Fixes #55)
- Add the ability to set an offset for circles - thanks funnisimo!
- Check explicitly for
undefined
y
param when scaling vectors. (Fixes #52)
- Add
getCentroid
method toPolygon
that computes the centroid. (Fixes #50)- Useful for computing the center of a polygon if you want to rotate around it.
- Fix "Vornoi" -> "Voronoi" everywhere. Changes are all in private code, no functional changes. (Fixes #27)
- Exposed isSeparatingAxis() function - thanks hexus!
- Allow pointInPolygon to work with small polygons. (Fixes #41)
- (POTENTIALLY BREAKING CHANGE) Make
recalc
onPolygon
more memory efficient. It no longer does any allocations. ThecalcPoints
,edges
andnormals
vector arrays are reused and only created insetPoints
when the number of new points is different than the current ones. (Fixes #15)points
,angle
andoffset
can no longer be manually changed. ThesetPoints
,setAngle
, andsetOffset
methods must be used.- As a result of this, the
recalc
method is no longer part of the API.
- Add
getAABB
toPolygon
andCircle
that calculate Axis-Aligned Bounding Boxes - thanks TuurDutoit! (Fixes #17)
- Fix missing
T_VECTORS.push()
- thanks shakiba! (Fixes #8) - Add
package.json
- released asnpm
module (Fixes #11, Fixes #12)
- Add
clone
method toVector
that returns a new vector with the same coordinates. - Add
angle
andoffset
toPolygon
that are used to modify the computed collision polygon (Fixes #3, Fixes #4)- The
rotate
andtranslate
methods still exist onPolygon
but they modify the originalpoints
of the polygon, wherasangle
andoffset
do not modify the original points, and are instead applied as computed values.
- The
- Add
setPoints
,setAngle
, andsetOffset
methods toPolygon
- Add
pointInCircle
andpointInPolygon
functions for performing "hit tests" (Fixes #2)
- Reformat comments so that they can be run through
docco
to create an annotated source file. - Fix/optimize compilation with the Closure Compiler in advanced mode (previously it was mangling some important properties)
- Wrap the code in a UMD declaration so that it works:
- Just inserting it as a
<script>
- Using an AMD loader
- In Node.js
- Just inserting it as a
- Add
rotate
method toVector
andPolygon
. - Add
translate
method toPolygon
- Add some examples (using Raphael.js for display)
- Initial release