コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="iVx"></param>
        /// <param name="ptRelVx"></param>
        /// <returns></returns>
        public Point2i GetRelativeUV(int iVx, Point2i ptRelVx)
        {
            var pt = IndexUV(iVx) + ptRelVx;

            if (new Point2i(0, 0) > pt || pt >= SizeUV)
            {
                throw new Exception("Index does not exist");
            }

            return(pt);
        }
コード例 #2
0
ファイル: PixelGrid2D.cs プロジェクト: arendvw/voxeltools
        private void Initialize(Rectangle3d boundingBox, Point2d pixelDimensions)
        {
            _BBox      = boundingBox;
            _PixelSize = pixelDimensions;

            int iX = Convert.ToInt16(Math.Floor(boundingBox.X.Length / pixelDimensions.X));
            int iY = Convert.ToInt16(Math.Floor(boundingBox.Y.Length / pixelDimensions.Y));

            var size = new Point2i(iX, iY);

            SizeUV = size;
        }
コード例 #3
0
        /// <summary>
        /// Construct a pixelgrid
        /// </summary>
        /// <param name="boundingBox"></param>
        /// <param name="pxielDimensions"></param>
        /// <param name="grid"></param>
        public Grid2D(Rectangle3d boundingBox, Point2d pxielDimensions, T grid)
            : base()
        {
            _BBox      = boundingBox;
            _PixelSize = pxielDimensions;

            int iX = Convert.ToInt16(Math.Floor(boundingBox.X.Length / pxielDimensions.X));
            int iY = Convert.ToInt16(Math.Floor(boundingBox.Y.Length / pxielDimensions.Y));

            var gridsize = new Point2i(iX, iY);

            SizeUV = gridsize;
            Grid   = grid;
        }
コード例 #4
0
ファイル: Point2i.cs プロジェクト: arendvw/voxeltools
 /// <summary>
 /// Is the point2i equal to point p1. Zero tolerance for differences.
 /// </summary>
 /// <param name="p">Point2i to compare with</param>
 /// <returns></returns>
 public bool Equals(Point2i p)
 {
     return(X == p.X && Y == p.Y);
 }
コード例 #5
0
 /// <summary>
 /// Return a value at index
 /// </summary>
 /// <param name="index"></param>
 /// <returns></returns>
 public Y ValueAt(Point2i index)
 {
     return(ValueAt(UVIndex(index)));
 }
コード例 #6
0
 /// <summary>
 /// Convert a point2i location to the index of the point in the bitarray
 /// </summary>
 /// <param name="uv"></param>
 /// <returns></returns>
 public int UVIndex(Point2i uv)
 {
     return(uv ^ _SizeUV);
 }