Commit Graph

115 Commits

Author SHA1 Message Date
/Fox --develop
2750a5db62 fixed typo in docs/Shapes.rst 2016-09-30 17:51:27 -07:00
vrld
410cf048e2 Merge pull request #43 from ratkingsminion/patch-1
Fixing local variable
2016-08-28 18:10:39 +02:00
vrld
2408a37e1b Merge pull request #45 from sixFingers/intersectionsWithSegment
Intersections with segment
2016-07-06 14:53:57 +02:00
vrld
92fb6a607f Update MainModule.rst 2016-07-06 14:51:11 +02:00
Ignazio Setti
6080839feb Fix indenting 2016-06-01 13:17:57 +02:00
Ignazio Setti
d34709c426 Allows traversing the spatialhash with a ray 2016-06-01 13:13:23 +02:00
F.H
73a9456bb5 Fixing local variable 2016-01-25 21:06:38 +01:00
Matthias Richter
eac8874ef9 Fix documentation 2015-10-09 23:29:40 +02:00
vrld
16a4387ce9 Update README 2015-10-09 23:20:46 +02:00
Matthias Richter
0b2167d7b5 Add Sphix documentation 2015-10-09 23:10:15 +02:00
Matthias Richter
01e8e17b92 Simplify interface. HC is now immediate mode. 2015-10-09 23:09:35 +02:00
Matthias Richter
de2367ea26 Update rockspec 2015-10-09 23:09:22 +02:00
Matthias Richter
0471d71e95 rename rockspec 2015-10-07 23:12:40 +02:00
vrld
90a6e39091 Update README 2015-10-07 22:58:30 +02:00
vrld
d2d69c2620 Merge pull request #39 from clofresh/rockspec
add .rockspec
2015-05-30 16:16:24 +02:00
Carlo Cabanilla
c81ea210eb add .rockspec 2015-05-04 20:35:25 -04:00
Matthias Richter
79c3d0abf8 Finally fix #28 - shapes not removed properly on
A shape added with HC:add*() would be reintroduced to the spatial hash
after HC:remove() when any of shape:move(), shape:rotate() or
shape:scale() was called after the removal.
2014-04-27 11:16:36 +02:00
vrld
fb8c0511cf Merge pull request #34 from MGinshe/patch-1
Fix typo in shapes.lua (ipairs vs ipaits)
2014-03-18 12:13:33 +01:00
Ryan Cole
f46176716d small typo fix 2014-03-17 20:53:46 +13:00
Matthias Richter
6bb4ba0e24 Rename intersectionsRay. Less redundancy.
* intersectionsRay() -> intersectionsWithRay()
* intersectsRay() uses results from intersectionsWithRay()
  (Exception: PointShape does it the other way around)
2014-01-24 09:47:13 +01:00
vrld
afc917253c Merge pull request #31 from Ragzouken/intersectionsRay
method to return all intersections, not just the first
2014-01-24 00:33:16 -08:00
Matthias Richter
b362ae8c5f Undo bf35186904: use own triangulation again.
Replaced call to love.math.triangulate() with pure Lua implementation of
Kong's algofirthm.
2014-01-24 09:31:06 +01:00
Mark Wonnacott
b101121d51 new method for shapes :intersectionsRay returns an unordered table of ray intersection t values 2014-01-14 10:33:12 +00:00
Matthias Richter
2d169413dd Assert that Polygon is not intersecting itself 2014-01-13 22:49:45 +01:00
Matthias Richter
bf35186904 Use love.math.triangulate instead of own implementation 2014-01-13 22:49:38 +01:00
vrld
cabee18c81 Merge pull request #29 from italomaia/patch-1
Merge #29: remove redundant variable in shapes.lua
2013-12-30 10:50:31 -08:00
Italo Maia
db1b1bdb38 Update shapes.lua
mode in ConvexPolygonShape is already defined in the method signature
2013-12-29 02:09:27 -02:00
Matthias Richter
9d432517b7 Hackish fix for 97ae2d89 and parent.
A clean solution needs more investigation, but this will work for now.
2013-09-04 10:20:19 +02:00
Matthias Richter
97ae2d8928 Fix commit adfe9a9a breaking EPA. 2013-09-03 17:13:27 +02:00
Matthias Richter
adfe9a9a5d Issue #25 (2): Collision detection sometimes hangs.
Sometimes the expanding polytype algorithm takes a long time to
terminate, e.g. in situations like this:

 .-.
: +-:-+
 '-'  |
  |   |
  +---+

The issue here is that the EPA adds vertices very close to each other,
which makes the separation distance change very slowly. If this is the
case, consider the current separation distance as approximately correct
and continue.
2013-08-13 15:34:58 +02:00
Matthias Richter
0dc1e6c719 Issue #25: Division by 0 in CircleShape:support().
support(A,B, 1,0) returns 0,0 when A and B are touching in a vertex of
both A and B AND this vertex is on the right of A's center (in direction
(1,0)), e.g. this situation:

    .---.
 .-.| B |
: A x---'
 '-'

Then: support(A,B, 1,0) = A:support(1,0) - B:support(-1,0) = x - x = 0

Since CircleShape:support(dx,dy) normalizes dx,dy this will result in a
division by 0 error in the subsequent execution of the GJK algorithm.

An early out with result 'not colliding' (in accordance to the other
edge cases) prevents this error.
2013-08-13 15:13:25 +02:00
Matthias Richter
5d100c703f Adhere to new class commons specs. 2013-07-21 12:51:35 +02:00
Matthias Richter
6c7c17ed9e [Fix #23] polygon:getBBox should be polygon:bbox 2013-02-09 22:07:31 +01:00
Matthias Richter
df3e163f9a [Fix] HC:remove(shape) does not remove from groups 2013-02-09 22:04:28 +01:00
Matthias Richter
ec2cc20a6b Better check if cell is empty in Hash:draw() 2013-02-09 22:04:18 +01:00
Matthias Richter
8283c13cfb Add shape:inGroup() 2012-12-15 16:01:21 +01:00
Matthias Richter
788c735ef7 Merge branch 'master' of github.com:vrld/HardonCollider 2012-10-12 18:53:01 +02:00
Matthias Richter
6931ca823a More robust way of handling collisons with concave shapes 2012-10-12 18:52:41 +02:00
Matthias Richter
28e80aeb6f Fix #21: CircleShape:collidesWith() incorrect. 2012-10-12 18:17:34 +02:00
Matthias Richter
8b30af1385 Refactor: Remove shape ids in main module. 2012-10-09 00:50:46 +02:00
Matthias Richter
ed495d3306 Report collisions immediately instead of collecting first.
Collecting collisions and then reporting leads to confusing behavior
when a previous collision callback resolved the collision, e.g.
platforms in jump in runs pushing the player upwards when standing on
two platforms at the same time.
2012-10-08 13:48:30 +02:00
Matthias Richter
68de65f22e Fix #19: outcircle not changed when scaling polygon. 2012-07-30 19:27:55 +02:00
Matthias Richter
1d5196cd70 Fix #18: Invalid check for class-commons. 2012-07-22 12:13:10 +02:00
Matthias Richter
de82e88ddf Add HC:shapesInRange(x1,y1, x2,y2)
Returns a set of shapes that are enclosed in the rectangle
(x1,y1)-(x2,y2).
2012-07-10 16:35:27 +02:00
Matthias Richter
317cce31c6 Add HC:addShape(shape).
Shape must have at least two functions:
- shape:bbox()
  must return an axis aligned bounding box of the shape

- shape:collidesWith(other)
  must return false, ... if the two shapes do not collide
  must return true, sx, sy if the two shapes collide, where sx,sy is the
                           separation vector from from shape to other.

Convex shapes can use the supplied GJK algorithm. In that case the shape
must implement shape:support(dx,dy) which returns the point of the shape
that lies furthest in the direction of dx,dy.
2012-07-10 16:29:59 +02:00
Matthias Richter
ebaabd22b7 Code refactoring 2012-07-10 16:29:34 +02:00
Matthias Richter
f1ad856da9 Remove Spatialhash:getNeighbors() in favor of :inRange() 2012-07-10 16:21:33 +02:00
Matthias Richter
1280b0a2d4 Use hash:rangeIter() in HC:update() 2012-07-10 16:19:27 +02:00
Matthias Richter
9badb23125 Add Spatialhash:inRange() and Spatialhash:rangeIter() 2012-07-10 16:18:53 +02:00
Matthias Richter
5125f35e71 Quick exit on shape:collidesWith(shape) 2012-07-10 16:18:20 +02:00