Author: Wesley Liu (wesliutw@gmail.com)

Demo 1

This section shows how JavaScript calculate the union area through WebAssembly.
Area calculation algorithm is based on Boost C++ graph library.
Observation: the speed of calculation is extremly faster than pure JS implementation.
Usage: drag the blue and the yellow blocks to get the union area of these two blocks, or input the specific coordinates of the green and red blocks.

area:0

Demo 2

Solution:
step 1.
use MULTIPOLYGON to group all blockages.
step 2.
use boost::geometry::envelope to get the enclosing rectangle.
step 3.
set the pins and display SVG.
Source code: https://github.com/wesleytw/course_projects/blob/master/proj1/formal_proj/proj1.cpp