コード例 #1
0
ファイル: ImplicitShape.cs プロジェクト: yfdtc12345/Football
 /// <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
ファイル: ImplicitShape.cs プロジェクト: yfdtc12345/Football
 /// <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
ファイル: ImplicitShape.cs プロジェクト: yfdtc12345/Football
 /// <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
ファイル: ImplicitShape.cs プロジェクト: yfdtc12345/Football
 /// <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
ファイル: ExplicitShape.cs プロジェクト: Radeg/dots_all-modes
        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);
        }