コード例 #1
0
ファイル: WaterSimulator.cs プロジェクト: KommuSoft/Zertz
        public Vector3[] GetVectors(IShape2D shape)
        {
            RectangleF r  = shape.Bounds;
            float      x0 = -0.5f * dxy;
            float      y0 = x0 * (n - 0x01);

            x0 *= (m - 0x01);
            double          dxyinv = 1.0d / this.dxy;
            int             xi1 = Math.Max(0x00, Math.Min(n - 0x01, (int)Math.Floor((r.X - x0) * dxyinv)));
            int             xi2 = Math.Max(0x00, Math.Min(n - 0x01, (int)Math.Ceiling((r.Right - x0) * dxyinv)));
            int             yi1 = Math.Max(0x00, Math.Min(m - 0x01, (int)Math.Floor((r.Y - y0) * dxyinv)));
            int             yi2 = Math.Max(0x00, Math.Min(m - 0x01, (int)Math.Ceiling((r.Bottom - y0) * dxyinv)));
            int             dx = xi2 - xi1;
            int             dxa = n - dx - 0x01;
            int             k = yi1 * n + xi1, K;
            Vector3         v;
            Stack <Vector3> vs = new Stack <Vector3>();

            for (int y = yi1; y <= yi2; y++)
            {
                for (K = k + dx; k <= K; k++)
                {
                    v = PosNor[k];
                    if (shape.Contains(v.X, v.Z))
                    {
                        vs.Push(v);
                    }
                }
                k += dxa;
            }
            return(vs.ToArray());
        }
コード例 #2
0
 public override bool IsContained(IShape2D shape)
 {
     return(shape.Contains(WorldCircle));
 }
コード例 #3
0
ファイル: RectZone.cs プロジェクト: Magicolo/PseudoFramework
 public override bool IsContained(IShape2D shape)
 {
     return shape.Contains(WorldRect);
 }
コード例 #4
0
 public bool ShapeContains(Point2D p)
 {
     return(shape.Contains(p));
 }
コード例 #5
0
ファイル: WaterSimulator.cs プロジェクト: KommuSoft/Zertz
 public Vector3[] GetVectors(IShape2D shape)
 {
     RectangleF r = shape.Bounds;
     float x0 = -0.5f*dxy;
     float y0 = x0*(n-0x01);
     x0 *= (m-0x01);
     double dxyinv = 1.0d/this.dxy;
     int xi1 = Math.Max(0x00,Math.Min(n-0x01,(int) Math.Floor((r.X-x0)*dxyinv)));
     int xi2 = Math.Max(0x00,Math.Min(n-0x01,(int) Math.Ceiling((r.Right-x0)*dxyinv)));
     int yi1 = Math.Max(0x00,Math.Min(m-0x01,(int) Math.Floor((r.Y-y0)*dxyinv)));
     int yi2 = Math.Max(0x00,Math.Min(m-0x01,(int) Math.Ceiling((r.Bottom-y0)*dxyinv)));
     int dx = xi2-xi1;
     int dxa = n-dx-0x01;
     int k = yi1*n+xi1, K;
     Vector3 v;
     Stack<Vector3> vs = new Stack<Vector3>();
     for(int y = yi1; y <= yi2; y++) {
         for(K = k+dx; k <= K; k++) {
             v = PosNor[k];
             if(shape.Contains(v.X,v.Z)) {
                 vs.Push(v);
             }
         }
         k += dxa;
     }
     return vs.ToArray();
 }