Constructor
new PlanarSet()
Create new empty instance of PlanarSet
- Source:
Methods
add(shape) → {PlanarSet}
Add new shape to planar set and to its spatial index.
If shape already exist, it will not be added again. This happens with no error, it is possible to use size property to check if a shape was actually added.
Method returns planar set object updated and may be chained
If shape already exist, it will not be added again. This happens with no error, it is possible to use size property to check if a shape was actually added.
Method returns planar set object updated and may be chained
- Source:
Parameters:
Name | Type | Description |
---|---|---|
shape |
Shape
|
shape to be added, should have valid box property |
Returns:
- Type:
-
PlanarSet
delete(shape) → {boolean}
Delete shape from planar set. Returns true if shape was actually deleted, false otherwise
- Source:
Parameters:
Name | Type | Description |
---|---|---|
shape |
Shape
|
shape to be deleted |
Returns:
- Type:
-
boolean
hit(point) → {Array}
Point location test. Returns array of shapes which contains given point
- Source:
Parameters:
Name | Type | Description |
---|---|---|
point |
Point
|
query point |
Returns:
- Type:
-
Array
search(box) → {Array.<Shapes>}
2d range search in planar set.
Returns array of all shapes in planar set which bounding box is intersected with query box
Returns array of all shapes in planar set which bounding box is intersected with query box
- Source:
Parameters:
Name | Type | Description |
---|---|---|
box |
Box
|
query box |
Returns:
- Type:
-
Array.<Shapes>
svg() → {String}
Returns svg string to draw all shapes in planar set
- Source:
Returns:
- Type:
-
String