# BooleanOp

### Methods

#### (static) unify(polygon1, polygon2) → {Polygon}

Unify two polygons polygons and returns new polygon.
Point belongs to the resulted polygon if it belongs to the first OR to the second polygon

Source:
  - algorithms/boolean_op.js, line 30

##### Parameters:

Name | Type | Description
--- | --- | ---
`polygon1` | `Polygon` | first operand
`polygon2` | `Polygon` | second operand

##### Returns:

Type:
  `Polygon`

#### (static) subtract(polygon1, polygon2) → {Polygon}

Subtract second polygon from the first and returns new polygon Point belongs to the resulted polygon if it belongs to the first polygon AND NOT to the second polygon

Source:
  - algorithms/boolean_op.js, line 42

##### Parameters:

Name | Type | Description
--- | --- | ---
`polygon1` | `Polygon` | first operand
`polygon2` | `Polygon` | second operand

##### Returns:

Type:
  `Polygon`

#### (static) intersect(polygon1, polygon2) → {Polygon}

Intersect two polygons and returns new polygon Point belongs to the resultes polygon is it belongs to the first AND to the second polygon

Source:
  - algorithms/boolean_op.js, line 56

##### Parameters:

Name | Type | Description
--- | --- | ---
`polygon1` | `Polygon` | first operand
`polygon2` | `Polygon` | second operand

##### Returns:

Type:
  `Polygon`

#### (static) innerClip(polygon1, polygon2) → {Array.<Array.<Shape>>}

Returns boundary of intersection between two polygons as two arrays of shapes (Segments/Arcs)
The first array are shapes from the first polygon, the second array are shapes from the second

Source:
  - algorithms/boolean_op.js, line 68

##### Parameters:

Name | Type | Description
--- | --- | ---
`polygon1` | `Polygon` | first operand
`polygon2` | `Polygon` | second operand

##### Returns:

Type:
  `Array.<Array.<Shape>>`

#### (static) outerClip(polygon1, polygon2) → {Array.<Shape>}

Returns boundary of subtraction of the second polygon from first polygon as array of shapes

Source:
  - algorithms/boolean_op.js, line 88

##### Parameters:

Name | Type | Description
--- | --- | ---
`polygon1` | `Polygon` | first operand
`polygon2` | `Polygon` | second operand

##### Returns:

Type:
  `Array.<Shape>`

#### (static) calculateIntersections(polygon1, polygon2) → {Array.<Array.<Point>>}

Returns intersection points between boundaries of two polygons as two array of points
Points in the first array belong to first polygon, points from the second - to the second. Points in each array are ordered according to the direction of the correspondent polygon

Source:
  - algorithms/boolean_op.js, line 107

##### Parameters:

Name | Type | Description
--- | --- | ---
`polygon1` | `Polygon` | first operand
`polygon2` | `Polygon` | second operand

##### Returns:

Type:
  `Array.<Array.<Point>>`