/// <summary> /// Attempts to add a 3D point to the grid with the specified position and radius. /// </summary> /// <param name="Position">The position of the particle to add</param> /// <param name="Radius">The radius of the particle to add</param> public void VG_AddPoint3D(Vector Position, double Radius) { //If the capacity is too low, we need to return if (Position.Capacity < 3) return; //If we are in point mode: if (((VG_Series)(this.Series[0])).VG_PointMode) { //We don't care about size Vector PerspectivePosition = VG_ProjectTo2D(Position); if (PerspectivePosition == null) return; VG_Point newpoint = new VG_Point(PerspectivePosition[0], PerspectivePosition[1], ((VG_Series)(this.Series[0])).MarkerSize, true); this.Series[0].Points.Add(newpoint); } else //Otherwise if it is like normal: { //Obtain the 2D projected coordinates Vector Results = VG_ProjectTo2D(Position, Radius); if (Results == null) return; Vector PerspectivePosition = new Vector(); PerspectivePosition[0] = Results[0]; PerspectivePosition[1] = Results[1]; //Obtain the size of the particle double PerspectiveRadius = Results[2]; if (PerspectiveRadius <= 0) return; //Continue plotting the new perspective particle as if it were 2D int EffectiveRadius = VG_RadiusToMarkerSize_2D(PerspectiveRadius); if (EffectiveRadius <= 0) return; VG_Point newpoint = new VG_Point(PerspectivePosition[0], PerspectivePosition[1], EffectiveRadius, true); this.Series[0].Points.Add(newpoint); } }
/// <summary> /// Plots the topmost level of particles from a list of particles in 3D /// </summary> /// <param name="ParticleList">The list of particles to plot</param> public void VG_PlotList_3D(List<Physics.Particle> ParticleList) { //Clear the top list of particles this.Series[0].Points.Clear(); //Store all of the VG_Points List<VG_Point> PointList = new List<VG_Point>(); //If we are in point mode: if (((VG_Series)(this.Series[0])).VG_PointMode) { //For each particle: Parallel.ForEach(ParticleList, P => { //We don't care about size Vector PerspectivePosition = VG_ProjectTo2D(P.Position); if (PerspectivePosition == null) return; VG_Point newpoint = new VG_Point(PerspectivePosition[0], PerspectivePosition[1], ((VG_Series)(this.Series[0])).MarkerSize, true); lock (PointList) { PointList.Add(newpoint); } }); } else //Otherwise if we aren't in point mode: { //For each particle: Parallel.ForEach(ParticleList, P => { //Obtain the 2D projected coordinates Vector Results = VG_ProjectTo2D(P.Position, P.Radius); if (Results == null) return; Vector PerspectivePosition = new Vector(); PerspectivePosition[0] = Results[0]; PerspectivePosition[1] = Results[1]; //Obtain the size of the particle double PerspectiveRadius = Results[2]; if (PerspectiveRadius <= 0) return; //Continue plotting the new perspective particle as if it were 2D int EffectiveRadius = VG_RadiusToMarkerSize_2D(PerspectiveRadius); if (EffectiveRadius <= 0) return; VG_Point newpoint = new VG_Point(PerspectivePosition[0], PerspectivePosition[1], EffectiveRadius, true); lock (PointList) { PointList.Add(newpoint); } }); } foreach (VG_Point x in PointList) { this.Series[0].Points.Add(x); } }
/// <summary> /// Attempts to add a 2D point to the grid with the specified position and radius. /// </summary> /// <param name="Position">The position of the particle to add</param> /// <param name="Radius">The radius of the particle to add</param> public void VG_AddPoint2D(Vector Position, double Radius) { //If the capacity is too low, we need to return if (Position.Capacity < 2) return; //If we are in point mode: if (((VG_Series)(this.Series[0])).VG_PointMode) { VG_Point newpoint = new VG_Point(Position[this.VG_XIndex], Position[this.VG_YIndex], ((VG_Series)(this.Series[0])).MarkerSize, false); this.Series[0].Points.Add(newpoint); } else //Otherwise plot it like normal: { int EffectiveRadius = VG_RadiusToMarkerSize_2D(Radius); VG_Point newpoint = new VG_Point(Position[this.VG_XIndex], Position[this.VG_YIndex], EffectiveRadius, false); this.Series[0].Points.Add(newpoint); } }