I made some progress!
One option is to create a point at the center of mass. For what I call regular polygons, i.e. where the vertices are evenly distributed (e.g. triangle or rectangle), the coordinates for the center of mass are
x_com = average(vertices.x)
y_com = average(vertices.y)
z_com = average(vertices.z)
See here for more details: http://www.mathworks.com/matlabcentral/newsreader/view_thread/22176
This would allow to create a construction point at the center of mass, like this:
# Find the centre of mass of a polygon based on the average of the x, y, z values.
# A construction point is added to the centre of mass
def centreofmass(aface)
mod = Sketchup.active_model # Open model
ent = mod.entities # All entities in model
vert = aface.vertices
n = 0
x = 0
y = 0
z = 0
vert.each{|i|
n += 1
x += i.position[0]
y += i.position[1]
z += i.position[2]
}
pt = Geom::Point3d.new(x/n,y/n,z/n)
c = ent.add_cpoint pt
end
From there I probably could create triangles by drawing lines from the center of mass to the original vertices. Then repeating the process for the new triangles.
This could work for most somewhat regular shaped surfaces. I believe that there might be issues with polygons that have more vertices one side than the other, and also irregular shaped polygons, e.g. slim L shaped surfaces.
Anyway, it looks like I got a starting point.