Reputation: 6979
I'm trying to the find the area of a shape for which I've only been given the length of the sides.
Considering the shape to be a quadrilateral (having only four sides) for now, what is the method(or algo) to find its area in C++? (Given that the lengths of the sides of a quadrilateral are fixed, the resultant area of any quad shape obtained will be always equal.)
Note that I do not have the vertices of the shape and have only the sides. If at all, I'd have had the vertices, I could have used the this summation formula to directly get the area of a n-sided polygon. But what's the best way to deal with this constraint?
Upvotes: 1
Views: 994
Reputation: 442
You can't. You don't have enough information to make the calculation without knowing at least 2 of angles in addition to your lengths or more detail about the type of object that is more specific then a quadrilateral.
Reason: A quadrilateral has 4 sides. No other limits. In fact, the lines can intersect creating even more difficulty in calculation of the area.
Upvotes: 5