Constructor
new Box(xmin, ymin, xmax, ymax)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
xmin |
number
|
minimal x coordinate |
ymin |
number
|
minimal y coordinate |
xmax |
number
|
maximal x coordinate |
ymax |
number
|
maximal y coordinate |
Classes
Members
Methods
contains(shape) → {boolean}
Return true if box contains shape: no point of shape lies outside the box
- Source:
Parameters:
Name | Type | Description |
---|---|---|
shape |
AnyShape
|
test shape |
Returns:
- Type:
-
boolean
equal_to(other_box) → {boolean}
Returns true if this box is equal to other box, false otherwise
- Source:
Parameters:
Name | Type | Description |
---|---|---|
other_box |
Box
|
query box |
Returns:
- Type:
-
boolean
intersect(other_box) → {boolean}
Returns true if intersected with other box
- Source:
Parameters:
Name | Type | Description |
---|---|---|
other_box |
Box
|
Query box |
Returns:
- Type:
-
boolean
less_than(other_box) → {boolean}
Defines predicate "less than" between two boxes. Need for interval index
- Source:
Parameters:
Name | Type | Description |
---|---|---|
other_box |
Box
|
other box |
Returns:
- Type:
-
boolean
- true if this box less than other box, false otherwise
merge(other_box) → {Box}
Returns new box merged with other box
- Source:
Parameters:
Name | Type | Description |
---|---|---|
other_box |
Box
|
Other box to merge with |
Returns:
- Type:
-
Box
not_intersect(other_box) → {boolean}
Returns true if not intersected with other box
- Source:
Parameters:
Name | Type | Description |
---|---|---|
other_box |
Box
|
other box to test |
Returns:
- Type:
-
boolean
rotate(angle, centeropt)
Box rotation is not supported
Attempt to rotate box throws error
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
angle |
number
|
angle in radians | ||
center |
Point
|
<optional> |
(0,0) | center |
set(xmin, ymin, xmax, ymax)
Set new values to the box object
- Source:
Parameters:
Name | Type | Description |
---|---|---|
xmin |
number
|
mininal x coordinate |
ymin |
number
|
minimal y coordinate |
xmax |
number
|
maximal x coordinate |
ymax |
number
|
maximal y coordinate |
svg(attrs) → {string}
Return string to draw box in svg
- Source:
Parameters:
Name | Type | Description |
---|---|---|
attrs |
Object
|
an object with attributes of svg rectangle element |
Returns:
- Type:
-
string
toPoints() → {Array.<Point>}
Transform box into array of points from low left corner in counterclockwise
- Source:
Returns:
- Type:
-
Array.<Point>
toSegments() → {Array.<Segment>}
Transform box into array of segments from low left corner in counterclockwise
- Source:
Returns:
- Type:
-
Array.<Segment>