/// <summary> /// Creates a new plot vector from a particular particle. /// </summary> /// <param name="SeedParticle">The particle to extract the data from</param> public PlotVector(Physics.Particle SeedParticle) { this.Position = SeedParticle.GetActualPosition(); this.Radius = SeedParticle.Radius; int CurrentLayer = 0; Physics.Particle ParentParticle = SeedParticle.ParentParticle; while (ParentParticle != null) { CurrentLayer++; ParentParticle = ParentParticle.ParentParticle; } this.Layer = CurrentLayer; }
/// <summary> /// Checks the reference particle for any changes in position. /// Adds new positions to the list of positions if needed and deleting old ones when the list gets full. /// </summary> /// <param name="NewParticle">The particle to use for the update</param> public void VG_UpdatePointWatcher(Physics.Particle NewParticle) { //If the input particle is null, do nothing if (NewParticle == null) return; //If this is the first time we are checking a position, just add it if (this.VG_PWPositions.Count == 0) { this.VG_PWPositions.Add(NewParticle.GetActualPosition()); return; } //Check the length of the position list and delete old positions if (this.VG_PWPositions.Count >= this.VG_PWPositions.Capacity) { //If the number of elements in the position list is greater than or equal to the maximum number, delete the first entry this.VG_PWPositions.RemoveAt(0); } //Check to see if the current position is different from the last recorded one Vector LastPosition = this.VG_PWPositions[this.VG_PWPositions.Count - 1]; Vector NewPosition = NewParticle.GetActualPosition(); if (Vector.Vector_Compare(LastPosition, NewPosition) == false) { //If the positions are different, add the new position this.VG_PWPositions.Add(NewPosition); } }