All I need is an irregular polygon 0~;

Hi, I am looking at ways for calculating the area of any non-self-intersecting polygon in an x-y plane given its vertices:

One way that I have come up with is by splitting the polygon up into trapeziums, so moving from one point to the next calculating the trapeziums formed below each pair of consecutive points (where the last point = the first point). This adds the trapeziums going from the x-axis to the top of the polygon and subtracts the area of trapezoids going from the x-axis to the bottom of the polygon, leaving the area of the polygon. Adding up all these trapeziums gives an equation for area according to the top equation in the attached picture. https://9appsapk.vin https://vidmateapp.vin

Another method (given by Wikipedia) which I think is deducible from Green’s theorem, says the area of an irregular polygon equals the bottom equation in the picture. To my understanding these two equations give the same area but I cannot prove their equality. Can somebody please help me confirm whether or not they are equal, or what is wrong with the trapezium method? Its killing me!!!

Thank you for helping!kdvvjst546f21

the example in the Ruby API shows you can simply call face.area

depth = 100
width = 100
model = Sketchup.active_model
entities = model.active_entities
pts = []
pts[0] = [0, 0, 0]
pts[1] = [width, 0, 0]
pts[2] = [width, depth, 0]
pts[3] = [0, depth, 0]
# Add the face to the entities in the model
face = entities.add_face(pts)
area = face.area

john

@DaveR I read somewhere that you were helping your son with Algebra, it is not the same as teaching him SketchUp:)
It is been a while for me, but I suspect that it has to do with the fact that you could eliminate some arguments in the first equation:

1 Like

This is simply arithmetic calculation.

The idea is to sum up the area of consecutive triangles. The formula works for non-convex polygons too. It is much simpler and general than using trapezium.

3 Likes