예제 #1
0
 /// <summary>
 /// Creates a shape that is the product of this shape with another shape.
 /// </summary>
 /// <remarks>
 /// Takes the first shape, and for each point, scale that point by
 /// the given amount, and create a copy of the second shape at that point.
 /// The combined shape is the product of the two shapes.
 /// </remarks>
 public static IImplicitShape <GridPoint3> Product(
     this IExplicitShape <GridPoint3> shape1,
     IImplicitShape <GridPoint3> shape2,
     GridPoint3 scale)
 {
     return(new ProductShape3(shape1, shape2, scale));
 }
예제 #2
0
        public static float EuclideanNorm(GridPoint3 point)
        {
            var squareMagnitude =
                point.X * point.X +
                point.Y * point.Y +
                point.Z * point.Z;

            return(Mathf.Sqrt(squareMagnitude));
        }
예제 #3
0
        public override TCell this[GridPoint3 point]
        {
            get
            {
                var accessPoint = point - shape.Bounds.Point;
                return(cells[accessPoint.X, accessPoint.Y, accessPoint.Z]);
            }

            set
            {
                var accessPoint = point - shape.Bounds.Point;
                cells[accessPoint.X, accessPoint.Y, accessPoint.Z] = value;
            }
        }
예제 #4
0
 /// <summary>
 /// Creates a 3D Translate Shape.
 /// </summary>
 /// <param name="shape">Base shape to translate.</param>
 /// <param name="offset">Offset of the movement of the shape.</param>
 public static IImplicitShape <GridPoint3> Translate(
     this IImplicitShape <GridPoint3> shape,
     GridPoint3 offset)
 {
     return(new TranslationShape3(shape, offset));
 }
예제 #5
0
 /// <summary>
 /// Creates a 3D Parallelepiped.
 /// </summary>
 /// <param name="dimensions">Dimensions of the shape.</param>
 public static IImplicitShape <GridPoint3> Parallelepiped(GridPoint3 dimensions)
 {
     return(new ParallelepipedShape(dimensions));
 }
예제 #6
0
 /// <summary>
 /// Creates a 3D Single Shape.
 /// </summary>
 /// <param name="point">Point value of the center.</param>
 public static IImplicitShape <GridPoint3> Single1(GridPoint3 point)
 {
     return(new SingleShape3(point));
 }
예제 #7
0
 public override bool Contains(GridPoint3 point)
 {
     return(shape.Contains(point));
 }
예제 #8
0
 public static IEnumerable <GridPoint3> GetOrthogonalNeighbors(GridPoint3 point)
 {
     return(point.GetVectorNeighbors(Directions));
 }
예제 #9
0
 public static int ChebychevNorm(GridPoint3 point)
 {
     return(Mathf.Max(Mathf.Abs(point.X), Mathf.Abs(point.Y), Mathf.Abs(point.Z)));
 }
예제 #10
0
 public static int ManhattanNorm(GridPoint3 point)
 {
     return(Mathf.Abs(point.X) + Mathf.Abs(point.Y) + Mathf.Abs(point.Z));
 }
예제 #11
0
        public static IExplicitShape <GridPoint3> Translate(this IExplicitShape <GridPoint3> shape, GridPoint3 n)
        {
            var newBounds = GridBounds.Translate(shape.Bounds, n);
            var newShape  = ImplicitShape.Translate(shape, n).ToExplicit(newBounds);

            return(newShape);
        }