Ejemplo n.º 1
0
        /// <summary>
        /// Get the value of a relativePosition voxel, defined by a Point3i size.
        /// </summary>
        /// <param name="voxelIndex"></param>
        /// <param name="relativePosition"></param>
        /// <returns>
        /// returns 0 if empty
        /// returns -1 if non existant
        /// returns 1 if true
        /// </returns>
        ///
        public sbyte GetRelativePointValue(int voxelIndex, Point3i relativePosition)
        {
            var pt = (Point3i.IndexToPointUvw(SizeUVW, voxelIndex)) + relativePosition;

            if (new Point3i(0, 0, 0) > pt || pt >= SizeUVW)
            {
                return(-1);
            }
            return(GetValue(pt) ? (sbyte)1 : (sbyte)0);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get the value of of a voxel relative to voxel with number i
        /// </summary>
        /// <param name="voxelIndex">The voxel number to get a relative position for</param>
        /// <param name="relativeVoxel">Relative coordinates to the voxel, e.g. (1,0,0) for a voxel to the right</param>
        /// <returns>The value of the relative voxel</returns>
        public float GetRelativePointValue(int voxelIndex, Point3i relativeVoxel)
        {
            var pt = Point3i.IndexToPointUvw(SizeUVW, voxelIndex) + relativeVoxel;

            if (new Point3i(0, 0, 0) > pt || pt >= SizeUVW)
            {
                return(float.NaN);
            }
            return(GetValue(pt));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Set a relativePosition point value to value X
        /// </summary>
        /// <param name="voxelIndex"></param>
        /// <param name="relativePosition"></param>
        /// <param name="value"></param>
        public void SetRelativePointValue(int voxelIndex, Point3i relativePosition, bool value)
        {
            var pt = Point3i.IndexToPointUvw(SizeUVW, voxelIndex) + relativePosition;

            if (new Point3i(0, 0, 0) > pt || pt >= SizeUVW)
            {
                return;
            }

            this[pt] = value;
        }