Exemplo n.º 1
0
        protected void SampleProbe(Vector2D point, out Probe probe)
        {
            point = Constrain(point - Vector2D.Half * _spacing);
            Vector2D local = point - _region.TopLeft;
            Vector2D coord = CgMath.Floor(local / _spacing);
            int      iY    = (int)coord.Y * _stride;
            int      iX    = (int)coord.X;

            int iTopLeft  = iY + iX;
            int iTopRight = iY + Math.Min(iX + 1, _stride - 1);
            int toBottom  = (iTopLeft + _stride < _count) ? _stride : 0;

            Vector2D pTopLeft = CellTopLeft(point);
            Vector2D d        = (point - pTopLeft) / _spacing;

            probe.TopLeft     = _data[iTopLeft];
            probe.TopRight    = _data[iTopRight];
            probe.BottomLeft  = _data[iTopLeft + toBottom];
            probe.BottomRight = _data[iTopRight + toBottom];
            probe.U           = d.X;
            probe.V           = d.Y;
        }
Exemplo n.º 2
0
 public Vector2D CellTopLeft(Vector2D point)
 {
     return(_spacing * CgMath.Floor(point * _toGrid));
 }
Exemplo n.º 3
0
 public Vector2D CellCenter(Vector2D point)
 {
     return(_spacing * (CgMath.Floor(point * _toGrid) + Vector2D.Half));
 }