Constructor
new PlanarSet(shapes)
Create new instance of PlanarSet
- Source:
Parameters:
Name | Type | Description |
---|---|---|
shapes |
array or set of geometric objects to store in planar set Each object should have a box property |
Classes
Methods
add(entry) → {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 |
---|---|---|
entry |
AnyShape
|
Object
|
shape to be added, should have valid box property Another option to transfer as an object {key: Box, value: AnyShape} |
Returns:
- Type:
-
PlanarSet
delete(entry) → {boolean}
Delete shape from planar set. Returns true if shape was actually deleted, false otherwise
- Source:
Parameters:
Name | Type | Description |
---|---|---|
entry |
AnyShape
|
Object
|
shape to be deleted |
Returns:
- Type:
-
boolean
hit(point) → {Array.<AnyShape>}
Point location test. Returns array of shapes which contains given point
- Source:
Parameters:
Name | Type | Description |
---|---|---|
point |
Point
|
query point |
Returns:
- Type:
-
Array.<AnyShape>
search(box) → {Array.<AnyShape>}
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.<AnyShape>
svg() → {String}
Returns svg string to draw all shapes in planar set
- Source:
Returns:
- Type:
-
String