1

I want to compute the area of a random polygon and the volume of a random polyhedron. Google searches led me to tessellation and the Monte Carlo method. However I am only interested in an exact calculation and not an approximation through convergence. Might someone know the exact formulae by heart or have a link to a page where such formulae are described?

The formulae are not needed to apply to exotic polygons or polyhedrons. I am already satisfied if they apply to simple (non-intersecting edges) convex shapes. I would like to use nothing else besides a list of vertex coordinates [(x1, y1), ..., (xn, yn)] or [(x1, y1, z1), ..., (xn, yn, zn)], possible arranged in a specific order.

I am able to read Fortran, C/C++, Python and MATLAB. Hence an algorithm written in any of these languages or written in pseudo-code is well received.

Aeronaelius
  • 1,291
  • 3
  • 12
  • 31
  • 1
    I don't have code for you, but given that the shape is 'simple and convex', you could choose one vertex then find the area of all the triangles formed as you loop through the other vertices... – abiessu Aug 14 '13 at 15:30
  • For simple polyedras, you have to tesselate and compute the volume of the tetrahedrons with the determinant formula. Ditto for polygons (tesselate and use the norm of the cross product to compute the areas of the triangles) – Alexandre C. Aug 14 '13 at 15:30

1 Answers1

2

For simple polygons, you can use Green-Riemann formula, as explained there: http://www.math.unl.edu/~mbrittenham2/classwk/208s04/inclass/areas_of_polygons.pdf

This amounts to summing the (algebraic) areas of triangles M_iOM_j, with O the origin (or any point), and where the algebraic area of the triangle BOA is positive iff the angle BOA is positive.

For polyedras, you can use Ostrogradski's formula to generalize the above. See eg. there: http://en.wikipedia.org/wiki/Polyhedron#Volume

You can find a review of the above method for computing volumes there: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.144.3873&rep=rep1&type=pdf

Alexandre C.
  • 55,948
  • 11
  • 128
  • 197
  • I read through your first link for polygons. It's excellent, that is exactly what I wanted. I am now going to read your second link for polyhedrons. – Aeronaelius Aug 14 '13 at 15:40
  • I read your second link for polyhedrons. I understand the method, however I need to do some follow-up reading: determining the centroid of a face and the normal vector of a face. Going to dust of my old calculus book ;) – Aeronaelius Aug 14 '13 at 15:50
  • 1
    @Aeronaelius: For triangular faces, finding the centroid is easy: just average the vertices. A normal vector is given by the cross product of two edges. – Alexandre C. Aug 14 '13 at 15:54
  • Yes finding a normal vector is quite easy. But in 3D space a normal vector can point two ways. While considering a convex polyhedron how do you explicitly determine the outward pointing normal vector of a face? – Aeronaelius Aug 14 '13 at 16:30
  • @Aeronaelius: You have to list the vertices in the right order, so that the cross product of edges has the right orientation. See http://en.wikipedia.org/wiki/Cross_product – Alexandre C. Aug 14 '13 at 16:52