public static SpaceBounds Merge(SpaceBounds a, SpaceBounds b) { if (a == null) { return(b); } if (b == null) { return(a); } Bounds?bounds = null; if (a.boundingBox != null && b.boundingBox != null) { bounds = Bounds.Merge(a.boundingBox.Value, b.boundingBox.Value); } else if (a.boundingBox != null) { bounds = a.boundingBox.Value; } else if (b.boundingBox != null) { bounds = b.boundingBox.Value; } Sphere?sphere = null; if (a.boundingSphere != null && b.boundingSphere != null) { sphere = Sphere.Merge(a.boundingSphere.Value, b.boundingSphere.Value); } else if (a.boundingSphere != null) { sphere = a.boundingSphere.Value; } else if (b.boundingSphere != null) { sphere = b.boundingSphere.Value; } return(new SpaceBounds(bounds, sphere)); }