Пример #1
0
		public AscentPlot (List<Sample> samples, List<StageDescription> stages, int xdim, int ydim)
		{
			this.samples = samples;
			zoomedSamples = samples;
			this.stages = stages;
			timeScale = new Scale(samples.First().time, samples.Last().time, xdim);
			plots.Add(new PlotElement("acceleration", "m/s²", s => s.acceleration, new Color(0.3f, 0.3f, 1), fixedMin:0));
			plots.Add(new PlotElement("surface velocity", "m/s", s => s.velocity, new Color(1, 0.3f, 0.3f)));
			plots.Add(new PlotElement("altitude", "m", s => s.altitude, new Color(0.5f, 0.5f, 0.3f), false));
			plots.Add(new PlotElement("throttle", "%", s => s.throttle * 100, new Color(0.3f, 0.3f, 0.3f), fixedMin:0, fixedMax:100));
			texture = new Texture2D(xdim, ydim, TextureFormat.RGB24, false);
			drawTexture();
		}
Пример #2
0
		private int[] validRange(Scale timeScale)
		{
			int[] res = {0,samples.Count()};
			for (int i = 1 ; i < samples.Count() ; i++)
			{
				if (samples[i].time < timeScale.min)
					res[0] = i;
				if (samples[i].time > timeScale.max)
				{
					res[1] = i;
					return res;
				}
			}
			return res;
		}
Пример #3
0
		public void draw(Texture2D texture, Scale timeScale, List<Sample> samples)
		{
			if (!active)
				return;

			Color pulsed = Color.Lerp(Color.white, colour, (float)Math.Pow(Math.Cos(pulse)/2 + 1, 3));
			Scale valScale = new Scale(
				fixedMin ?? samples.Min(selector),
				fixedMax ?? samples.Max(selector),
				texture.width);
			for (int i = 1 ; i < samples.Count() ; i++)
			{
				TextureUtils.drawLine(texture,
					timeScale.toPlot(samples[i-1].time), valScale.toPlot(selector(samples[i-1])),
					timeScale.toPlot(samples[i].time), valScale.toPlot(selector(samples[i])),
					pulsed);
			}
		}