Square area of irregular polygon

Hello everyone!
I’d like to make in my application area selection. Something like this https://youtu.be/Ei-6oiPfudg?t=55 but in 3d.
I was thinking about creating some points on the mesh or in the space and then create polygon out of it, it would be best if it was making dynamically like in the video. so I make 2 points and then the 3rd one is always connected to the mouse pointer, when I put 3rd on the mesh 4rd is connected to mouse pointer etc…
I’ve done some research and found that I could calculate square area e.q. like this: Area of any polygon (Coordinate Geometry) - Math Open Reference

I made this playground to start with something https://playground.babylonjs.com/#QNJLCY#2 (first activate dblclick listener, then double click on ground / box to take points).

I’ve used non regular polygon to make it done. But I think I’ll need to make it done not only on XoZ plane but also take into account Y-axis. I didn’t implemented square area calculations, maybe Babylon has a method to calculate it?

Any help/guidance will be very appreciated, thanks!