The picture is strange, but the red circles are vertices, the blue lines are lines or linesegments, the gray is empty space, and the green is the filled space to be calculated.
How do I calculate this if the vertex information is contained in an array that contains only lines or linesegments?
I think you do not want self-intersecting polygons. If you have such, you’d better split them, otherwise you will run in a lot of problems, like 90% of the algorithms will fail.
As for the shoelace algorithm, it is already implemented in Three.js – get the coordinates as 2D vectors, push them in an array and use ShapeUtils.area. Because the shooelace algorithm calculates signed area, you must take the absolute value of the result. Do the same with the holes and subtract their area from the overall area.