Example #1
0
        /// <summary> Clipping a fragment doesn't create a fragment of a fragment </summary>
        /// <param name="plane">The plane to clip the fragment with</param>
        /// <returns>Creates a smaller fragment of the original primitive</returns>
        public override PrimitiveFragment?Clip(AxisAlignedPlane plane)
        {
            PrimitiveFragment?newFragment = Original.Clip(plane);

            if (newFragment == null)
            {
                return(null);
            }
            else
            {
                Vector3[] newBounds = { Vector3.ComponentMin(Bounds[0], newFragment.Bounds[0]), Vector3.ComponentMin(Bounds[1], newFragment.Bounds[1]) };
                return(new PrimitiveFragment(Original, newBounds));
            }
        }
Example #2
0
 /// <summary> Create a spatial bin </summary>
 /// <param name="direction">The direction that the bins are ordered in</param>
 /// <param name="start">The starting point of this bin in the specified direction</param>
 /// <param name="end">The ending point of this bin in the specified directio</param>
 public SpatialBin(Vector3 direction, float start, float end)
 {
     SplitPlaneLeft  = new AxisAlignedPlane(direction, direction * start);
     SplitPlaneRight = new AxisAlignedPlane(-direction, direction * end);
 }