implemented partitioning

This commit is contained in:
2025-11-11 12:50:43 -08:00
parent 4fc8d98e9d
commit 792ca1042c
8 changed files with 295 additions and 74 deletions

13
agent.m
View File

@@ -114,9 +114,10 @@ classdef agent
% Network connections
end
function [obj, f] = plot(obj, f)
function [obj, f] = plot(obj, ind, f)
arguments (Input)
obj (1, 1) {mustBeA(obj, 'agent')};
ind (1, :) double = NaN;
f (1, 1) {mustBeA(f, 'matlab.ui.Figure')} = figure;
end
arguments (Output)
@@ -128,22 +129,22 @@ classdef agent
f = firstPlotSetup(f);
% Plot points representing the agent position
hold(f.CurrentAxes, "on");
o = scatter3(obj.pos(1), obj.pos(2), obj.pos(3), 'filled', 'ko', 'SizeData', 25);
hold(f.CurrentAxes, "off");
hold(f.Children(1).Children(end), "on");
o = scatter3(f.Children(1).Children(end), obj.pos(1), obj.pos(2), obj.pos(3), 'filled', 'ko', 'SizeData', 25);
hold(f.Children(1).Children(end), "off");
% Check if this is a tiled layout figure
if strcmp(f.Children(1).Type, 'tiledlayout')
% Add to other perspectives
o = [o; copyobj(o(1), f.Children(1).Children(2))];
o = [o; copyobj(o(1), f.Children(1).Children(3))];
o = [o; copyobj(o(1), f.Children(1).Children(5))];
o = [o; copyobj(o(1), f.Children(1).Children(4))];
end
obj.scatterPoints = o;
% Plot collision geometry
[obj.collisionGeometry, f] = obj.collisionGeometry.plotWireframe(f);
[obj.collisionGeometry, f] = obj.collisionGeometry.plotWireframe(ind, f);
end
end
end