예제 #1
0
 public StratifiedRenderer(IBoundedShape <T> Source, Surfacize <T, Material> SurfacizeFunc, T Default)
 {
     this._Default           = Default;
     this._Source            = Source;
     this._SurfacizeFunc     = SurfacizeFunc;
     this._OrientedRenderers = new _OrientedRenderer[3];
 }
예제 #2
0
            public _OrientedRenderer(StratifiedRenderer <T> StratifiedRenderer, Axis Axis)
            {
                this._StratifiedRenderer = StratifiedRenderer;
                this._Axis = Axis;
                IBoundedShape <T> source = this._StratifiedRenderer._Source;
                Vector <int>      bounds = source.Bound;

                this._DirBounds = bounds[Axis];
                this._Interior  = new OrientedPartRenderer(Shape.EnumerateInterior(source, this._StratifiedRenderer._SurfacizeFunc, Material.Default), Axis, this._DirBounds);
                this._Levels    = new VBO <ColorNormalVertex> [this._DirBounds - 1, 2];
            }
예제 #3
0
        /// <summary>
        /// Enumerates the interior surfaces in a bounded shape.
        /// </summary>
        public static IEnumerableSurface <F> EnumerateInterior <T, F>(IBoundedShape <T> Source, Surfacize <T, F> SurfacizeFunc, F Excluded)
            where F : IEquatable <F>
        {
            IEnumerableInteriorSurfaceShape <T> eiss = Source.Extend <IEnumerableInteriorSurfaceShape <T> >();

            if (eiss != null)
            {
                return(eiss.EnumerateInteriorBorders(SurfacizeFunc, Excluded));
            }

            return(new EnumerableInteriorSurface <T, F>(Source, SurfacizeFunc, Excluded));
        }
예제 #4
0
        /// <summary>
        /// "Slices" the specified shape, returning a plane of the borders on the specified axis
        /// and level.
        /// </summary>
        public static IBoundedPlaneSurface <F> Slice <T, F>(IBoundedShape <T> Source, Axis Axis, int Level, Surfacize <T, F> SurfacizeFunc, F Excluded)
            where F : IEquatable <F>
        {
            IBoundedSliceableSurfaceShape <T> bsss = Source.Extend <IBoundedSliceableSurfaceShape <T> >();

            if (bsss != null)
            {
                return(bsss.Slice(SurfacizeFunc, Excluded, Axis, Level));
            }

            // Too sleepy to do this right now...
            throw new NotImplementedException();
        }
예제 #5
0
        /// <summary>
        /// Creates a filled infinite shape with the specified parameters.
        /// </summary>
        public static IFilledInfiniteShape <T> Fill <T>(IBoundedShape <T> Source, T Default)
        {
            IFillableBoundedShape <T> fbs = Source.Extend <IFillableBoundedShape <T> >();

            if (fbs != null)
            {
                return(fbs.Fill(Default));
            }

            return(new FilledInfiniteShape <T>()
            {
                Source = Source, Default = Default
            });
        }
예제 #6
0
        /// <summary>
        /// Creates an octree representation of the data specified in "Shape". Since the size
        /// of an octree must be a power of 2, all extra space is filled with the specified
        /// default value.
        /// </summary>
        public static Octree <T> Create(IBoundedShape <T> Shape, T Default)
        {
            Vector <int> bound  = Shape.Bound;
            int          mbound = bound.X;

            mbound  = mbound < bound.Y ? bound.Y : mbound;
            mbound  = mbound < bound.Z ? bound.Z : mbound;
            mbound -= 1;

            int d = 0;

            while (mbound > 0)
            {
                mbound /= 2;
                d++;
            }

            return(Octree <T> .Create(Cubia.Shape.Fill(Shape, Default), d));
        }
예제 #7
0
 public EnumerableInteriorSurface(IBoundedShape <T> Source, Surfacize <T, F> SurfacizeFunc, F Excluded)
 {
     this._Source        = Source;
     this._SurfacizeFunc = SurfacizeFunc;
     this._Excluded      = Excluded;
 }