You can take a look to the JSTS Topology Suite library (<a href="https://github.com/bjornharrtell/jsts">https://github.com/bjornharrtell/jsts</a>).<br>This library provides Openlayers a large set of spatial operations.<br>
Hope this can help you.<br>