public override smallestParticle[] Collapse(Particle oMass, gProps gProps) { return null; }
public static readonly int[] squares = { 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196 };//, 225, 256, 289, 324, 361, 400 }; public double CalcConsant( Particle oPart, gProps gProps) { return (gProps.G * mass * oPart.mass) / ( gProps.pixelPerDist * gProps.pixelPerDist); }
public virtual smallestParticle[] Collapse(Particle oPart, gProps gProps) { int noOfParticles = 1; for (int i = 0; i < squares.Length; i++) { noOfParticles = squares[i]; if (gProps.smallestMass > mass / (double)noOfParticles) { break; } } int squaredNumber = (int)Math.Sqrt(noOfParticles); // DETERMINE IF IT SHOULD FRACTURE double percentMass = mass / (mass + oPart.mass); if (percentMass > 0.95d || percentMass < 0.05d) { return null; } // THE REST OF IT smallestParticle[][] newParticles = new smallestParticle[squaredNumber][]; smallestParticle[] result = new smallestParticle[noOfParticles]; double widthPerPart = shape.Width / squaredNumber; double massPerPart = mass / (double)noOfParticles; for (int i = 0; i < squaredNumber; i++) { newParticles[i] = new smallestParticle[squaredNumber]; for (int o = 0; o < squaredNumber; o++) { //newParticles = new Particle(mass / (double)noOfParticles); newParticles[i][o] = new smallestParticle(massPerPart, vel, new Vector(pos.X + widthPerPart * i - (shape.Width / 2.0d), pos.Y + widthPerPart * o - (shape.Width / 2.0d)), gProps.currentID, gProps, shape.Width / (double)squaredNumber); } } int rawr = 0; for (int i = 0; i < squaredNumber; i++) { for (int o = 0; o < squaredNumber; o++) { result[rawr] = newParticles[i][o]; rawr++; } } return result; }