Box

Box

Class Box represent bounding box of the shape

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

Box

Members

box

Return property box like all other shapes
Source:

center

Return center of the box
Source:

high

Property high need for interval tree interface
Source:

low

Property low need for interval tree interface
Source:

max

Property max returns the box itself !
Source:

xmax :number

Maximal x coordinate
Source:
Type:
  • number

xmin :number

Minimal x coordinate
Source:
Type:
  • number

ymax :number

Maximal y coordinate
Source:
Type:
  • number

ymin :number

Minimal y coordinate
Source:
Type:
  • number

Methods

clone() → {Box}

Clones and returns new instance of box
Source:
Returns:
Type:
Box

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

set(xmin, ymin, xmax, ymax)

Set new values to the box object
Source:
Parameters:
Name Type Description
xmin number miminal x coordinate
ymin number minimal y coordinate
xmax number maximal x coordinate
ymax number maximal y coordinate

svg(attrs) → {string}

Return string to draw circle in svg
Source:
Parameters:
Name Type Description
attrs Object an object with attributes of svg rectangle element, like "stroke", "strokeWidth", "fill"
Defaults are stroke:"black", strokeWidth:"1", fill:"none"
Returns:
Type:
string

toPoints() → {Array.<Point>}

Transform box into array of points from low left corner in counter clockwise
Source:
Returns:
Type:
Array.<Point>

toSegments() → {Array.<Segment>}

Transform box into array of segments from low left corner in counter clockwise
Source:
Returns:
Type:
Array.<Segment>