Example #1
0
 private static bool IsInsideParallelogramXZ(FlatTriPoint point, int width, int height)
 {
     return
         (point.X >= 0 &&
          point.X < width &&
          point.Z >= 0 &&
          point.Z < height);
 }
Example #2
0
        public static bool DefaultContains(FlatTriPoint point, int width, int height)
        {
            ArrayPoint storagePoint = ArrayPointFromGridPoint(point.BasePoint);

            return
                (storagePoint.X >= 0 &&
                 storagePoint.X < width &&
                 storagePoint.Y >= 0 &&
                 storagePoint.Y < height);
        }
Example #3
0
        private static bool IsInsideDownTriangle(FlatTriPoint point, int side)
        {
            if (point.X >= side)
            {
                return(false);
            }
            if (point.Y >= 0)
            {
                return(false);
            }
            if (point.Z > 0)
            {
                return(false);
            }

            //if ()

            return(true);
        }
Example #4
0
 public InspectableSplicedVectorPoint(FlatTriPoint point)
 {
     x     = point.X;
     y     = point.Y;
     index = point.I;
 }
Example #5
0
 /**
  *      Construct a new grid whose cells are determined by the given test function.
  *
  *      The function should only return true for points within the bounds of the rectangle when
  *      the given transforms are applied to them.
  *
  *      Normally, the static factory methods or shape building methods should be used to create grids.
  *      These constructors are provided for advanced usage.
  *
  *      @link_constructing_grids
  */
 public FlatTriGrid(int width, int height, Func <FlatTriPoint, bool> isInside, FlatTriPoint offset) :
     this(width, height, isInside, x => x.MoveBy(offset), x => x.MoveBackBy(offset), FlatTriPoint.MainDirections)
 {
 }
Example #6
0
 public int DistanceFrom(FlatTriPoint other)
 {
     throw new NotImplementedException();
 }
Example #7
0
        /**
         *      A test function that returns true if the point for which the given
         *      vertexPoint is a vertex, is inside this grid.
         */
        private bool IsInsideVertexGrid(FlatTriPoint vertexPoint)
        {
            var faces = (vertexPoint as IVertex <PointyHexPoint>).GetVertexFaces();

            return(faces.Any(Contains));
        }
Example #8
0
        private static bool IsInsideUpTriangle(FlatTriPoint point, int side)
        {
            int x = 2 * (point.X + point.Y) + point.I;

            return(point.X >= 0 && x < 2 * side - 1 && point.Y >= 0);
        }