# [vtkusers] Centroid of a surface

JGraves at stratasys.com JGraves at stratasys.com
Fri Dec 3 15:20:45 EST 2004

```Check here for Brian Mirtich's paper and sample code.

http://www.cs.berkeley.edu/~jfc/mirtich/massProps.html

Jeff Graves
Stratasys Inc.

-----Original Message-----
From: Andrew J. Dolgert [mailto:ajd27 at cornell.edu]
Sent: Wednesday, November 17, 2004 12:16 PM
To: Huntsinger, Reid; Dr Zeto
Cc: vtkusers at vtk.org
Subject: RE: [vtkusers] Centroid of a surface

I said earlier that I didn't think this would work.  Well, now I get
Reid's point. The (something) in d(something) he describes is a
differential form.  If you write the equations in terms of multivariate
calculus, the steps require the use of the divergence theorem, Green's,
and Stokes', and they seem to work.  It's clever.

To summarize, we have a few options for finding a useful point inside a
surface.

1. For closed, convex polygonal regions, maybe the average positions of
the surface points will suffice as a center around which to do things
like shrinking the region.

2. Reid's algorithm can give both bounded volume and center of mass,
even for objects with holes, as long as your surface is closed.

3. Tetrahedralize the whole region.  Would only try this if the
resulting tets were of some use.

4. Monte carlo could give a quick estimate of object size.  Find the
bounding box.  Pick random points in the box and ask whether they are in
or out.  Only quick if the question of in or out is quickly done.  A
fine method for low-order accuracy.  If your polygonal object has
pathological pointy bits, where the surface normal varies greatly from
polygon to polygon, monte carlo might actually do the best job of
avoiding numerical inaccuracy.

- Drew
_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at:
&lt;http://www.vtk.org/Wiki/VTK_FAQ&gt;