How to calculate the area of a merged plane?

area of planeA is 4 (2 * 2)
area of planeB is 4 (2 * 2)
area of overlapped area is 1
after planeA merged planeB, the area of planeA should be 7 (4 + 4 - 1)

  1. the result is 8 == 4 + 4
	var geom = planeA.geometry;
	var area = 0;
	for (var i = 0; i < geom.faces.length; i++) {
		var face = geom.faces[i];
		var tri = new THREE.Triangle(geom.vertices[face.a], geom.vertices[face.b], geom.vertices[face.c]);
		var area = area + tri.getArea();
	}
	console.log(area);
  1. the result is -8,
	planeA.geometry.mergeVertices();
	var area = THREE.ShapeUtils.area(planeA.geometry.vertices);
	console.log(area);

Is there a utility method to calculate the area of a complex plane with three.js?
Thanks in advance.

Hi!
Maybe makes sense to use polybooljs.
An example of using: [Closed] How to split/separate a single ShapeGeometry into individual Geometries base on faces?

You know positions and sizes of planes, thus you know coordinates of corners, so you can pass them to the library, find intersection and then calculate its area.