Alexander Shenkin
2014-May-19 14:42 UTC
[R] How to define and calculate volume of 3D polygon?
Hi Folks, I have a set of x,y,z points in 3D space that defines the outline of a tree crown (5 - 15 perimeter points + 1 top & bottom point). I would like to calculate the volume of the corresponding 3D polygon based on those points. I have been able to use geometry::convhulln, but I think this isn't the right algorithm, since the polygon needs to pass through each point in order, and not just snap a rubber-band around the outer points. Any suggestions for alternative algorithms and packages would be most welcome! Thanks, Allie seq x y z 1 1 -1.7310065 2.4502278 11.1 2 2 -1.9048260 -0.6096212 9.0 3 3 2.8652209 0.8891057 11.0 4 4 2.3929514 -3.4516349 11.2 5 5 -2.6436343 5.2745803 11.7 6 6 -4.3521504 4.6924180 11.7 7 7 6.1441732 -4.8051156 11.6 8 8 -6.2157823 -3.2193244 8.0 9 9 1.0024961 -2.8275434 9.0 10 10 -3.9656821 3.0452201 8.0 11 11 4.2070518 -1.5970958 11.0 12 12 -0.9461915 1.2902409 9.8 13 13 2.2792265 0.7517491 11.4
Duncan Murdoch
2014-May-19 15:42 UTC
[R] How to define and calculate volume of 3D polygon?
On 19/05/2014, 10:42 AM, Alexander Shenkin wrote:> Hi Folks, > > I have a set of x,y,z points in 3D space that defines the outline of a > tree crown (5 - 15 perimeter points + 1 top & bottom point). I would > like to calculate the volume of the corresponding 3D polygon based on > those points. I have been able to use geometry::convhulln, but I think > this isn't the right algorithm, since the polygon needs to pass through > each point in order, and not just snap a rubber-band around the outer > points. > > Any suggestions for alternative algorithms and packages would be most > welcome!If you aren't using the convex hull, you need to specify more information. The vertices of a polyhedron don't have a natural order, so passing through them "in order" doesn't make sense. One way to specify this information is to specify which triples of vertices form triangular faces, as convhulln does. I don't know of a package containing code to compute the volume, but a description of the algorithm is on this page: http://www.ecse.rpi.edu/~wrf/Research/Short_Notes/volume.html Duncan Murdoch> > Thanks, > Allie > > seq x y z > 1 1 -1.7310065 2.4502278 11.1 > 2 2 -1.9048260 -0.6096212 9.0 > 3 3 2.8652209 0.8891057 11.0 > 4 4 2.3929514 -3.4516349 11.2 > 5 5 -2.6436343 5.2745803 11.7 > 6 6 -4.3521504 4.6924180 11.7 > 7 7 6.1441732 -4.8051156 11.6 > 8 8 -6.2157823 -3.2193244 8.0 > 9 9 1.0024961 -2.8275434 9.0 > 10 10 -3.9656821 3.0452201 8.0 > 11 11 4.2070518 -1.5970958 11.0 > 12 12 -0.9461915 1.2902409 9.8 > 13 13 2.2792265 0.7517491 11.4 > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >