static BoundingBoxXYZ GetBoundingBox(
IList<IList<BoundarySegment>> boundary)
{
BoundingBoxXYZ bb = new BoundingBoxXYZ();
double infinity = double.MaxValue;
bb.Min = new XYZ( infinity, infinity, infinity );
bb.Max = -bb.Min;
foreach( IList<BoundarySegment> loop in boundary )
{
foreach( BoundarySegment seg in loop )
{
Curve c = seg.GetCurve();
IList<XYZ> pts = c.Tessellate();
foreach( XYZ p in pts )
{
bb.ExpandToContain( p );
}
}
}
return bb;
}