public Particle(string initLine, int id) { // initLine in Format p=<XP,YP,ZP>, v=<XV,YV,ZV>, a=<XA,YA,ZA> string[] parameters = initLine.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries); foreach (string param in parameters) { char p = param[0]; string[] values = param.Remove(param.Length - 1).Remove(0, 3).Split(','); switch (p) { case 'p': this.Position = new ValueTriple(int.Parse(values[0]), int.Parse(values[1]), int.Parse(values[2])); break; case 'v': this.Velocity = new ValueTriple(int.Parse(values[0]), int.Parse(values[1]), int.Parse(values[2])); break; case 'a': this.Acceleration = new ValueTriple(int.Parse(values[0]), int.Parse(values[1]), int.Parse(values[2])); break; } } this.ID = id; }
public bool Match(ValueTriple v) { return((this.Position.X == v.X) && (this.Position.Y == v.Y) && (this.Position.Z == v.Z)); }