# Difference between revisions of "Geometry package:GSoC17"

## Boolean operations with polygons

Developer: Piyush Jain

Mentor: JuanPi Carbajal

### Objectives

```  1. Implement a set of boolean operations and supporting function for acting on polygons.
```
```  2. These include the standard set of potential operations such as union/OR, intersection/AND, difference/subtraction, and exclusiveor/XOR.
```
```  3. Other things to be implemented are the following functions: polybool, ispolycw, poly2ccw, poly2cw, poly2fv, polyjoin, and polysplit.
```

### Expectations

• Mentor:
• Developer:
``` 1. Incorporating Clipper native oct interface instead of mex.
2. Adding new algorithm as per the paper of F. Martínez, A.J. Rueda, F.R. Feito
```

## Workplan

``` Benchmark Piyush polygon union written as an .oct file against the current .mex interface to clipper in geometry 3.0
```

1. Clipper native oct interface instead of mex

if mex is ok

1. Add F. Martínez, A.J. Rueda, F.R. Feito algorithm

2. Salvage work from last GSoC

Maybe

• Add CGAL interface for poly clipping

### Details of proposed work

This section describes the overall idea of implementation and the workplan for the implementation of the new algorithmalgorithm which is based on the paper by F. Martínez, A.J. Rueda, F.R. Feito.

• Basic structure of the program for boolean operations :

1. Take the polygons in standard input form of Octave (NaN separated or Cell arrays) and convert it into the required input format of the algorithm (the way it is implemeted). This part will be handled by m script.

2. Implement .cc file which will return the resultant polygons. This will also contain input validation.

3. oct-interface will be created for this file.

4. The output of the cpp code will be passed onto the m script which will handle the necessary processings before returning it as final result.

### Discoveries

• On benchmarking the polyunion function in oct interface vs the mex interface, it is found that oct interface had twice as better performance as mex. As it doesn't ensure much advantage, it is not worthed to rewrite the package with oct.