how did you calculate the area of the room ? can you share with us
Closed this issue · 1 comments
VivekanandKumar commented
how did you calculate the area of the room ? can you share with us
ekymoz commented
areaRoom: function (vertex, coords, digit = 2) {
var vertexArray = coords;
var roughArea = 0;
var j = (vertexArray.length)-2;
for (var i = 0; i < vertexArray.length-1; i++) {
roughArea = roughArea + ((vertex[vertexArray[j]].x + vertex[vertexArray[i]].x) * (vertex[vertexArray[j]].y - vertex[vertexArray[i]].y));
j = i;
}
roughArea = roughArea / 2;
return Math.abs(roughArea.toFixed(digit));
}