copied agent trail lines to other perspective plots

This commit is contained in:
2026-01-14 19:11:24 -08:00
parent 105d91a492
commit 9031c9206e
4 changed files with 15 additions and 11 deletions

View File

@@ -32,11 +32,9 @@ function obj = plotConnections(obj)
end
% Copy to other plots
if size(obj.spatialPlotIndices, 2) > 1
for ii = 2:size(obj.spatialPlotIndices, 2)
o = [o, copyobj(o(:, 1), obj.f.Children(1).Children(obj.spatialPlotIndices(ii)))];
end
end
obj.connectionsPlot = o;
end

View File

@@ -19,8 +19,12 @@ function obj = plotTrails(obj)
hold(obj.f.Children(1).Children(obj.spatialPlotIndices(1)), 'off');
end
% Copy trails to other figures?
obj.trailPlot = o;
% Copy to other plots
for ii = 2:size(obj.spatialPlotIndices, 2)
o = [o, copyobj(o(:, 1), obj.f.Children(1).Children(obj.spatialPlotIndices(ii)))];
end
% Add legend?
obj.trailPlot = o;
end

View File

@@ -40,10 +40,12 @@ function [obj] = updatePlots(obj)
end
% Update agent trails
for jj = 1:size(obj.spatialPlotIndices, 2)
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);
obj.trailPlot((jj - 1) * size(obj.agents, 1) + ii).XData(obj.timestepIndex) = obj.posHist(ii, obj.timestepIndex, 1);
obj.trailPlot((jj - 1) * size(obj.agents, 1) + ii).YData(obj.timestepIndex) = obj.posHist(ii, obj.timestepIndex, 2);
obj.trailPlot((jj - 1) * size(obj.agents, 1) + ii).ZData(obj.timestepIndex) = obj.posHist(ii, obj.timestepIndex, 3);
end
end
drawnow;

View File

@@ -28,7 +28,7 @@ function [obj, f] = plotWireframe(obj, ind, f)
o = plot3(f.CurrentAxes, X, Y, Z, '-', 'Color', obj.tag.color, 'LineWidth', 2);
else
hold(f.Children(1).Children(ind(1)), "on");
o = plot3(f.Children(1).Children(ind(1)), X, Y, Z, '-', 'Color', obj.tag.color, 'LineWidth', 2);
o = plot3(f.Children(1).Children(ind(1)), X, Y, Z, '-', 'Color', obj.tag.color, 'LineWidth', 1);
hold(f.Children(1).Children(ind(1)), "off");
end