private static int DecreaseVectorCoordToPower(ParticelInfluencer attractor, int pToAttrCord) { if (Math.Abs(pToAttrCord) > attractor.Power) { pToAttrCord = (pToAttrCord / (int)Math.Abs(pToAttrCord)) * attractor.Power; } return(pToAttrCord); }
private static MatrixCoords GetAccelerationFromParticleToAttractor(ParticelInfluencer attractor, Particle particle) { var currParticleAttractorVector = attractor.Position - particle.Position; int pToAttrRow = currParticleAttractorVector.Row; pToAttrRow = DecreaseVectorCoordToPower(attractor, pToAttrRow); int pToAttrCol = currParticleAttractorVector.Col; pToAttrCol = DecreaseVectorCoordToPower(attractor, pToAttrCol); var currAcceleration = new MatrixCoords(pToAttrRow, pToAttrCol); return(currAcceleration); }