Access the raw webgl data to measure polygon area?


I have a function that allows one to draw a polyline on the map and it gets filled with a polygon, I would like to measure that polygon's area. I noticed the polygon gets mapped onto the terrainprovider and I was wondering if there is mesh data to extract so I can calculate the area.