private void UpdatePoint(Transform point, int index) { Vector3 updated_position; PlotPoint pointFromGraph = Graph.PlotPoints[index]; int currentIndex = pointFromGraph.currentPointIndex; // Get bounds of BoxCollider to help with normalizing plot point Vector3 max_range = GraphRadius; Vector3 min_range = -GraphRadius; if (currentIndex < pointFromGraph.XPoints.Count) { updated_position.x = Util.NormalizeToRange(min_range.x, max_range.x, pointFromGraph.XPoints[currentIndex], GraphXMax, GraphXMin); updated_position.y = Util.NormalizeToRange(min_range.y, max_range.y, pointFromGraph.YPoints[currentIndex], GraphYMax, GraphYMin); updated_position.z = Util.NormalizeToRange(min_range.z, max_range.z, pointFromGraph.ZPoints[currentIndex], GraphZMax, GraphZMin); point.localPosition = updated_position; if (Graph.isTimeGraph()) { UpdateTime(currentIndex); } pointFromGraph.currentPointIndex++; } else { pointFromGraph.currentPointIndex = 0; } }
public void AddPlotPoint(PlotPoint point) { PlotPoints.Add(point); CalculateMaxPoints(); CalculateMinPoints(); CalculateMidPoints(); }
private DynamicGraph CreateSineGraph() { DynamicGraph graph = new DynamicGraph(); string sineString = SineData.ToString(); DataParser parser = new DataParser(sineString); List <float> x_values = parser.GetListFromColumn(0); // lat List <float> y_values = parser.GetListFromColumn(1); // alt List <float> z_values = parser.GetListFromColumn(2); // long PlotPoint new_point = new PlotPoint(x_values, y_values, z_values); graph.AddPlotPoint(new_point); return(graph); }
private DynamicGraph CreateDroneGraph() { DynamicGraph graph = new DynamicGraph(); string droneString = DroneData.ToString(); DataParser parser = new DataParser(droneString); List <float> x_values = parser.GetListFromColumn(4); // lat List <float> y_values = parser.GetListFromColumn(2); // alt List <float> z_values = parser.GetListFromColumn(3); // long List <string> time_values = parser.GetTimePoints(1); // time PlotPoint new_point = new PlotPoint(x_values, y_values, z_values); graph.AddPlotPoint(new_point); graph.AddTimePoints(time_values); return(graph); }