/// <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)); }
public static float EuclideanNorm(GridPoint3 point) { var squareMagnitude = point.X * point.X + point.Y * point.Y + point.Z * point.Z; return(Mathf.Sqrt(squareMagnitude)); }
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; } }
/// <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)); }
/// <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)); }
/// <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)); }
public override bool Contains(GridPoint3 point) { return(shape.Contains(point)); }
public static IEnumerable <GridPoint3> GetOrthogonalNeighbors(GridPoint3 point) { return(point.GetVectorNeighbors(Directions)); }
public static int ChebychevNorm(GridPoint3 point) { return(Mathf.Max(Mathf.Abs(point.X), Mathf.Abs(point.Y), Mathf.Abs(point.Z))); }
public static int ManhattanNorm(GridPoint3 point) { return(Mathf.Abs(point.X) + Mathf.Abs(point.Y) + Mathf.Abs(point.Z)); }
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); }