Example #1
0
        public void Set(Point3l point, T value)
        {
            Contract.Requires(Box.Contains(Bounds, point));

            long xz = Morton.Encode(point.X - Bounds.X, point.Z - Bounds.Z);

            Volume[(point.Y - Bounds.Y) + xz * Bounds.Height] = value;
        }
Example #2
0
        // Volume is stored in columns (y is up/down), this makes traversals down columns fast.
        // After that x and z are in morton order.

        public T Get(Point3l point)
        {
            Contract.Requires(Box.Contains(Bounds, point));

            long xz = Morton.Encode(point.X - Bounds.X, point.Z - Bounds.Z);

            return(Volume[(point.Y - Bounds.Y) + xz * Bounds.Height]);
        }
        public void EncodeDecode()
        {
            Vector3 coords = new Vector3(1, 2, 3);

            Assert.AreEqual(Morton.Decode(Morton.Encode(coords)), coords);
        }