// Bounds implements the Spatial interface. The returned bounding box takes // into account all of the mesh's bounding boxes, transformed into world space. // // This method properly read-locks the object. func (o *Object) Bounds() math.Rect3 { var b math.Rect3 o.RLock() for i, m := range o.Meshes { if i == 0 { b = m.Bounds() } else { b = b.Union(m.Bounds()) } } if o.Transform != nil { b.Min = o.Transform.ConvertPos(b.Min, LocalToWorld) b.Max = o.Transform.ConvertPos(b.Max, LocalToWorld) b = b.Union(b) } o.RUnlock() return b }