void setupParticleSystem(Autodesk.Revit.DB.Face f, int uDiv, int vDiv, double springDampening, double springRestLength, double springConstant, double mass)
        {
            BoundingBoxUV bbox = f.GetBoundingBox();
            double uStep = (bbox.Max.U - bbox.Min.U)/uDiv;
            double vStep = (bbox.Max.V - bbox.Min.V)/vDiv;

            for (int j = 0; j <=uDiv; j++) // Y axis is outer loop
            {
                double u = bbox.Min.U + uStep * j;

                for (int i = 0; i <= vDiv; i++) // X axis is inner loop
                {
                    double v = bbox.Min.V + vStep * i;

                    Particle a = particleSystem.makeParticle(mass, f.Evaluate(new UV(u, v)), false);
                    if(i > 0)
                    {
                        particleSystem.makeSpring(particleSystem.getParticle((i - 1) + (j * (vDiv+1))), a, springRestLength, springConstant, springDampening);
                    }

                    if (j > 0)
                    {
                        Particle b = particleSystem.getParticle(i + ((j - 1) * (vDiv+1)));
                        particleSystem.makeSpring(a, b, springRestLength, springConstant, springDampening);
                    }

                    if (i == 0 || i == vDiv || j==0 || j==uDiv)
                    {
                        a.makeFixed();
                    }
                }
            }
        }
 /// <summary>
 /// Create a new curve with the same 
 /// geometry in the reverse direction.
 /// rom Jeremy Tammik
 /// </summary>
 /// <param name="orig">The original curve.</param>
 /// <returns>The reversed curve.</returns>
 /// <throws cref="NotImplementedException">If the 
 /// curve type is not supported by this utility.</throws>
 static Autodesk.Revit.DB.Curve CreateReversedCurve(Autodesk.Revit.DB.Curve orig)
 {
     if (orig is Autodesk.Revit.DB.Line)
     {
         return Autodesk.Revit.DB.Line.CreateBound(
           orig.GetEndPoint(1),
           orig.GetEndPoint(0));
     }
     else if (orig is Autodesk.Revit.DB.Arc)
     {
         return Autodesk.Revit.DB.Arc.Create(orig.GetEndPoint(1),
           orig.GetEndPoint(0),
           orig.Evaluate(0.5, true));
     }
     else
     {
         throw new Exception(
           "CreateReversedCurve - Unreachable");
     }
 }