Esempio n. 1
0
 public SF2(Box2D box, int nx, int ny) : base(box, nx, ny)
 {
     field = new List <float>(nx * ny);
     for (int i = 0; i < nx; i++)
     {
         for (int j = 0; j < ny; j++)
         {
             field.Add(0);
         }
     }
 }
Esempio n. 2
0
        public Grid2D(Box2D box, int nxmax, int nymax) : base(box)
        {
            this.nx = nxmax;
            this.ny = nymax;
            diag    = b - a;
            Vector2 scale = new Vector2(1 / (float)(nx - 1), 1 / (float)(ny - 1));

            cellDiag = diag;
            cellDiag.Scale(scale);

            invCellDiag = new Vector2(1.0f / cellDiag.x, 1.0f / cellDiag.y);
        }
Esempio n. 3
0
        //img box2d double double
        public HeightField(Texture2D img, Box2D b, float bdeepth, float wdeepth) : base(b, img.width, img.height)
        {
            this.img     = img;
            this.bdeepth = bdeepth;
            this.wdeepth = wdeepth;

            notifyChanges();


            CalculateKernel(3);
            Smooth();
            CalculateKernel(5);
            Smooth();

            needCalculateRoad = true;
        }
Esempio n. 4
0
 bool intersect(Box2D b2)
 {
     return(!(a.x >= b2.b.x) || (a.y >= b2.b.y) || (b.x <= b2.a.x) || (b.y <= b2.a.y));
 }
Esempio n. 5
0
 public Box2D(Box2D b)
 {
     this.a = b.a;
     this.b = b.b;
 }