diff --git a/reference.html b/reference.html index c5cebbd..b4b6118 100644 --- a/reference.html +++ b/reference.html @@ -59,6 +59,8 @@
Construct a shape using a non-intersecting ploygon.
You can either specify the coordinates as with hardoncollider.addPolygon()
or use an instance of the Polygon
class.
shape = shapes.PolygonShape(100,100, 200,200, 300,100)
+ shape = shapes.newPolygonShape(100,100, 200,200, 300,100)
Construct a circular shape.
shape = shapes.CircleShape(400,300, 100)
+ shape = shapes.newCircleShape(400,300, 100)
Construct a point shape.
shape = shapes.PointShape(400,300)
+ shape = shapes.newPointShape(400,300)
Syntax depends on used class system. Shown syntax works for bundled hump.class and slither.
Construct a polygon.
At least three points that are not collinear (being on a straight line) are needed to construct the polygon. If there are collinear points, these points will be removed so that the overall shape of the polygon is not changed.
@@ -890,10 +901,8 @@ endpoly = polygon.Polygon(10,10, 40,50, 70,10, 40,30)
- polygon.Polygon
looks rather verbose - that is why you can actually
- call the module like a function to create an instance of the Polygon
class:
poly = polygon(10,10, 40,50, 70,10, 40,30)
+ Polygon = require 'hardoncollider.polygon'
+poly = Polygon(10,10, 40,50, 70,10, 40,30)
Create a merged polygon of two polygons if, and only if the two polygons share one edge. If the polygons share more than one edge, the result may be erroneous.
+Create a merged polygon of two polygons if, and only if the two polygons share one complete edge. If the polygons share more than one edge, the result may be erroneous.
This function does not change either polygon, but rather create a new one.
Syntax depends on used class system. Shown syntax works for bundled hump.class and slither.
Create a new spatial hash given a cell size.
Choosing a good cell size depends on your application. To get a decent speedup, the average cell should not contain too many objects, nor should a single object @@ -1221,10 +1231,8 @@ end
hash = spatialhash.Spatialhash(150)
- As with Polygon()
, you can call the module as
- a shortcut to the above:
hash = spatialhash(150)
+ Spatialhash = require 'hardoncollider.spatialhash'
+hash = Spatialhash(150)
Draw hash cells on the screen, mostly for debug purposes
+draw_mode
show_empty
(true)print_key
(false)love.graphics.setColor(160,140,100,100)
+hash:draw('line', true, true)
+hash:draw('fill', false)
+