private Matrix4X4 GetCenteringTransformVisualCenter(IEnumerable <IObject3D> items, double goalRadius)
        {
            IEnumerable <(Vector2, Vector2, Vector2)> GetPolygons()
            {
                foreach (var item in items)
                {
                    foreach (var meshItem in item.VisibleMeshes())
                    {
                        var worldMatrix = meshItem.WorldMatrix(this);
                        var faces       = meshItem.Mesh.Faces;
                        var vertices    = meshItem.Mesh.Vertices;
                        foreach (var face in faces)
                        {
                            if (face.normal.TransformNormal(worldMatrix).Z > 0)
                            {
                                yield return(
                                    new Vector2(vertices[face.v0].Transform(worldMatrix)),
                                    new Vector2(vertices[face.v1].Transform(worldMatrix)),
                                    new Vector2(vertices[face.v2].Transform(worldMatrix))
                                    );
                            }
                        }
                    }
                }
            }

            var outsidePolygons = new List <List <IntPoint> >();

            var projection = new Polygons();

            // remove all holes from the polygons so we only center the major outlines
            var polygons = OrthographicZProjection.GetClipperPolygons(GetPolygons());

            foreach (var polygon in polygons)
            {
                if (polygon.GetWindingDirection() == 1)
                {
                    outsidePolygons.Add(polygon);
                }
            }

            IVertexSource outsideSource = outsidePolygons.CreateVertexStorage();

            Vector2 center = outsideSource.GetWeightedCenter();

            outsideSource = new VertexSourceApplyTransform(outsideSource, Affine.NewTranslation(-center));

            double radius = MaxXyDistFromCenter(outsideSource);

            double scale    = goalRadius / radius;
            var    scalling = Matrix4X4.CreateScale(scale, scale, 1);

            var centering = Matrix4X4.CreateTranslation(-center.X, -center.Y, 0);

            return(centering * scalling);
        }