I see there’s a good question already for general polygons here. Are there any simpler or more efficient algorithms specific to quadrilaterals?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
For a (convex) quadrilateral, it’s often faster to just split the quad into two triangles, and compute the area of the two triangles.
If the quadralateral is not guaranteed convex, the closed polygon approach is still my preference, since it’s usually faster than the checks to figure out how to correctly split the quad.
Edit from Comments:
As Walt W points out, the two approaches are theoretically identical in terms of performance. The second is more flexible, due to not requiring convex quads, but the first (splitting triangles) is easier to implement as well as understand, so potentially more maintainable.