added agent position trail to plot
This commit is contained in:
@@ -17,8 +17,8 @@ function [obj] = updatePlots(obj, updatePartitions)
|
||||
obj.agents{ii}.updatePlots();
|
||||
end
|
||||
|
||||
% The remaining updates might be possible to do in a clever way
|
||||
% that moves existing lines instead of clearing and
|
||||
% The remaining updates might should all be possible to do in a clever
|
||||
% way that moves existing lines instead of clearing and
|
||||
% re-plotting, which is much better for performance boost
|
||||
|
||||
% Update agent connections plot
|
||||
@@ -41,15 +41,23 @@ function [obj] = updatePlots(obj, updatePartitions)
|
||||
ylim(obj.f.Children(1).Children(obj.spatialPlotIndices(ii)), [obj.domain.minCorner(2), obj.domain.maxCorner(2)]);
|
||||
zlim(obj.f.Children(1).Children(obj.spatialPlotIndices(ii)), [obj.domain.minCorner(3), obj.domain.maxCorner(3)]);
|
||||
end
|
||||
|
||||
% Update agent trails
|
||||
for ii = 1:size(obj.agents, 1)
|
||||
obj.trailPlot(ii).XData(obj.timestepIndex) = obj.posHist(ii, obj.timestepIndex, 1);
|
||||
obj.trailPlot(ii).YData(obj.timestepIndex) = obj.posHist(ii, obj.timestepIndex, 2);
|
||||
obj.trailPlot(ii).ZData(obj.timestepIndex) = obj.posHist(ii, obj.timestepIndex, 3);
|
||||
end
|
||||
|
||||
drawnow;
|
||||
|
||||
% Update performance plot
|
||||
% Re-normalize performance plot
|
||||
normalizingFactor = 1/max(obj.performance(end));
|
||||
obj.performancePlot(1).YData(1:length(obj.performance)) = obj.performance * normalizingFactor;
|
||||
obj.performancePlot(1).XData(find(isnan(obj.performancePlot(1).XData), 1, 'first')) = obj.t;
|
||||
obj.performancePlot(1).XData(obj.timestepIndex) = obj.t;
|
||||
for ii = 2:(size(obj.agents, 1) + 1)
|
||||
obj.performancePlot(ii).YData(1:length(obj.performance)) = obj.agents{ii - 1}.performance * normalizingFactor;
|
||||
obj.performancePlot(ii).XData(find(isnan(obj.performancePlot(ii).XData), 1, 'first')) = obj.t;
|
||||
obj.performancePlot(ii).XData(obj.timestepIndex) = obj.t;
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user