- #1
cavalieregi
- 41
- 0
I have been given various corners which are x and y coordinates for a shape. The coordinates are listed in a vector e.g. xpoints = [x1, x2, x3, …, xn, x1] and ypoints = [y1, y2, y3, …, yn, y1] so that corner 1 would be (x1,y2) and corner n would be (xn, yn). I have listed the first point last so that I can calculate the distance between each point in the shape when using the distance equation. These distances added up will give the perimeter. These points could be anything. The lines made between each point are straight. I was wondering is there a way where I could calculate the total area roughly. I don’t think I could integrate it as I don’t have a function for the shape. I was thinking maybe since all of the lines are straight maybe triangles could be used? Note this is for a programming assignment but is there a mathematical method anyone could think of which I could use to approach this. The picture shows examples of possible areas. Also note the points can be negative to. Also is there any way some could think of only calculating the shaded area. See picture for reference. It include possible shapes.
View attachment 2163
View attachment 2163