Beispiel #1
0
        static int SceneCompareFunction(VoxelGeometry elementA, VoxelGeometry elementB, int axis)
        {
            BoundingBox boundsA = elementA.GetBounds();//.Transform.TransformBounds(elementA.Mesh.GetBounds());

            Vector3 posA = (boundsA.Max + boundsA.Min) * 0.5f;// elementA.Transform.GetPosition();
            float valueA = (axis == 0) ? posA.X : (axis == 1) ? posA.Y : posA.Z;

            BoundingBox boundsB = elementB.GetBounds();//.Transform.TransformBounds(elementB.Mesh.GetBounds());

            Vector3 posB = (boundsB.Max + boundsB.Min) * 0.5f;//elementB.Transform.GetPosition();
            float valueB = (axis == 0) ? posB.X : (axis == 1) ? posB.Y : posB.Z;

            if (valueA < valueB)
                return -1;
            if (valueA > valueB)
                return 1;

            return 0;
        }
Beispiel #2
0
 static Vector2 SceneBoundsFunction(VoxelGeometry element, int axis)
 {
     BoundingBox bounds = element.GetBounds();//.Transform.TransformBounds(element.Mesh.GetBounds());
     return (axis == 0) ? new Vector2(bounds.Min.X, bounds.Max.X) : ((axis == 1) ? new Vector2(bounds.Min.Y, bounds.Max.Y) : new Vector2(bounds.Min.Z, bounds.Max.Z));
 }