I have a feature which allows marking point on a surface and usnig raycast and mouse click position. You can click as many points as you want, then the last point connects with the first point to complete the shape. All the things are working fine. But now I am looking for a way to calculate the area. I make a little study and found that there are different formulas for different shapes. Like for
- Area of Rectangle Area = l × w where l = length w = width
- Area of Square Area = a2 where a = sides of the square
- Area of a Triangle Area = 1/2 b×h where b = baseh = height and so on
My question is how should I calculate the area. The user has flexibility to create any kind of shape but how should i know which user has created and use the exact formula to show the area? Or is there any general way to show the area?