private void CreateParticles(Box3f exclusion)
        {
            int numX = (int)(Bounds.Width / Diameter);
            int numY = (int)(Bounds.Height / Diameter);
            int numZ = (int)(Bounds.Depth / Diameter);

            Positions = new List <Vector3f>();

            for (int z = 0; z < numZ; z++)
            {
                for (int y = 0; y < numY; y++)
                {
                    for (int x = 0; x < numX; x++)
                    {
                        Vector3f pos = new Vector3f();
                        pos.x = Diameter * x + Bounds.Min.x + Spacing;
                        pos.y = Diameter * y + Bounds.Min.y + Spacing;
                        pos.z = Diameter * z + Bounds.Min.z + Spacing;

                        if (!exclusion.Contains(pos))
                        {
                            Positions.Add(pos);
                        }
                    }
                }
            }
        }
Esempio n. 2
0
 public void MarkAsStatic(Box3f bounds)
 {
     for (int i = 0; i < NumParticles; i++)
     {
         if (bounds.Contains(Positions[i]))
         {
             StaticConstraints.Add(new StaticConstraint3d(this, i));
         }
     }
 }