codegen fixes, bug fixes, gets running on testbed environment
This commit is contained in:
@@ -31,7 +31,7 @@ function [obj, f] = plot(obj, ind, f, maxAlt)
|
||||
o = surf(f.CurrentAxes, X, Y, Z);
|
||||
else
|
||||
hold(f.Children(1).Children(ind(1)), "on");
|
||||
o = surf(f.Children(1).Children(ind(1)), X, Y, Z, ones([size(Z), 1]) .* reshape(obj.tag.color, 1, 1, 3), "FaceAlpha", 0.25, "EdgeColor", "none");
|
||||
o = surf(f.Children(1).Children(ind(1)), X, Y, Z, ones([size(Z), 1]) .* reshape(regionTypeColor(obj.tag), 1, 1, 3), "FaceAlpha", 0.25, "EdgeColor", "none");
|
||||
hold(f.Children(1).Children(ind(1)), "off");
|
||||
end
|
||||
|
||||
|
||||
@@ -19,10 +19,10 @@ function [obj, f] = plotWireframe(obj, ind, f)
|
||||
|
||||
% Plot the boundaries of the geometry into 3D view
|
||||
if isnan(ind)
|
||||
o = plot3(f.CurrentAxes, X, Y, Z, "-", "Color", obj.tag.color, "LineWidth", 2);
|
||||
o = plot3(f.CurrentAxes, X, Y, Z, "-", "Color", regionTypeColor(obj.tag), "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", regionTypeColor(obj.tag), "LineWidth", 2);
|
||||
hold(f.Children(1).Children(ind(1)), "off");
|
||||
end
|
||||
|
||||
|
||||
@@ -28,6 +28,12 @@ classdef rectangularPrism
|
||||
end
|
||||
|
||||
methods (Access = public)
|
||||
function obj = rectangularPrism()
|
||||
arguments (Output)
|
||||
obj (1, 1) rectangularPrism
|
||||
end
|
||||
obj.objective = sensingObjective;
|
||||
end
|
||||
[obj ] = initialize(obj, bounds, tag, label, objectiveFunction, discretizationStep);
|
||||
[obj ] = initializeRandom(obj, tag, label, minDimension, maxDimension, domain);
|
||||
[r ] = random(obj);
|
||||
|
||||
@@ -25,10 +25,10 @@ function [obj, f] = plotWireframe(obj, ind, f)
|
||||
|
||||
% Plot the boundaries of the geometry into 3D view
|
||||
if isnan(ind)
|
||||
o = plot3(f.CurrentAxes, X, Y, Z, "-", "Color", obj.tag.color, "LineWidth", 2);
|
||||
o = plot3(f.CurrentAxes, X, Y, Z, "-", "Color", regionTypeColor(obj.tag), "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", 1);
|
||||
o = plot3(f.Children(1).Children(ind(1)), X, Y, Z, "-", "Color", regionTypeColor(obj.tag), "LineWidth", 1);
|
||||
hold(f.Children(1).Children(ind(1)), "off");
|
||||
end
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@ classdef spherical
|
||||
% Rectangular prism geometry
|
||||
properties (SetAccess = private, GetAccess = public)
|
||||
% Spatial
|
||||
center = NaN;
|
||||
center = NaN(1, 3);
|
||||
radius = NaN;
|
||||
diameter = NaN;
|
||||
|
||||
vertices; % fake vertices
|
||||
edges; % fake edges
|
||||
vertices = NaN(6, 3); % fake vertices
|
||||
edges = NaN(8, 2); % fake edges
|
||||
|
||||
% Plotting
|
||||
lines;
|
||||
@@ -22,6 +22,12 @@ classdef spherical
|
||||
end
|
||||
|
||||
methods (Access = public)
|
||||
function obj = spherical()
|
||||
arguments (Output)
|
||||
obj (1, 1) spherical
|
||||
end
|
||||
obj.objective = sensingObjective;
|
||||
end
|
||||
[obj ] = initialize(obj, center, radius, tag, label);
|
||||
[r ] = random(obj);
|
||||
[c ] = contains(obj, pos);
|
||||
|
||||
@@ -1,20 +1,10 @@
|
||||
classdef REGION_TYPE < uint8
|
||||
properties
|
||||
id
|
||||
color
|
||||
end
|
||||
enumeration
|
||||
INVALID (0, [255, 127, 255]); % default value
|
||||
DOMAIN (1, [0, 0, 0]); % domain region
|
||||
OBSTACLE (2, [255, 127, 127]); % obstacle region
|
||||
COLLISION (3, [255, 255, 128]); % collision avoidance region
|
||||
FOV (4, [255, 165, 0]); % field of view region
|
||||
COMMS (5, [0, 255, 0]); % comunications region
|
||||
INVALID (0) % default value
|
||||
DOMAIN (1) % domain region
|
||||
OBSTACLE (2) % obstacle region
|
||||
COLLISION (3) % collision avoidance region
|
||||
FOV (4) % field of view region
|
||||
COMMS (5) % comunications region
|
||||
end
|
||||
methods
|
||||
function obj = REGION_TYPE(id, color)
|
||||
obj.id = id;
|
||||
obj.color = color./ 255;
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
24
geometries/regionTypeColor.m
Normal file
24
geometries/regionTypeColor.m
Normal file
@@ -0,0 +1,24 @@
|
||||
function color = regionTypeColor(tag)
|
||||
% regionTypeColor Return the RGB color (0-1 range) for a REGION_TYPE value.
|
||||
arguments (Input)
|
||||
tag (1, 1) REGION_TYPE
|
||||
end
|
||||
arguments (Output)
|
||||
color (1, 3) double
|
||||
end
|
||||
|
||||
switch tag
|
||||
case REGION_TYPE.DOMAIN
|
||||
color = [0, 0, 0] / 255;
|
||||
case REGION_TYPE.OBSTACLE
|
||||
color = [255, 127, 127] / 255;
|
||||
case REGION_TYPE.COLLISION
|
||||
color = [255, 255, 128] / 255;
|
||||
case REGION_TYPE.FOV
|
||||
color = [255, 165, 0] / 255;
|
||||
case REGION_TYPE.COMMS
|
||||
color = [0, 255, 0] / 255;
|
||||
otherwise % INVALID
|
||||
color = [255, 127, 255] / 255;
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user