fixed init generation being really slow
This commit is contained in:
11
validators/agentsCrowdObjective.m
Normal file
11
validators/agentsCrowdObjective.m
Normal file
@@ -0,0 +1,11 @@
|
||||
function c = agentsCrowdObjective(objective, positions, protectedRange)
|
||||
arguments (Input)
|
||||
objective (1, 1) {mustBeA(objective, 'sensingObjective')};
|
||||
positions (:, 3) double; % this could be expanded to handle n obstacles in 1 call
|
||||
protectedRange (1, 1) double;
|
||||
end
|
||||
arguments (Output)
|
||||
c (:, 1) logical;
|
||||
end
|
||||
c = vecnorm(positions(:, 1:2) - objective.groundPos, 2, 2) <= protectedRange;
|
||||
end
|
||||
21
validators/domainContainsObstacle.m
Normal file
21
validators/domainContainsObstacle.m
Normal file
@@ -0,0 +1,21 @@
|
||||
function c = domainContainsObstacle(domain, obstacle)
|
||||
arguments (Input)
|
||||
domain (1, 1) {mustBeGeometry};
|
||||
obstacle (1, 1) {mustBeGeometry}; % this could be expanded to handle n obstacles in 1 call
|
||||
end
|
||||
arguments (Output)
|
||||
c (1, 1) logical;
|
||||
end
|
||||
|
||||
switch class(domain)
|
||||
case 'rectangularPrism'
|
||||
switch class(obstacle)
|
||||
case 'rectangularPrism'
|
||||
c = all(domain.minCorner <= obstacle.minCorner) && all(domain.maxCorner >= obstacle.maxCorner);
|
||||
otherwise
|
||||
error("%s not implemented for obstacles of class %s", coder.mfunctionname, class(domain));
|
||||
end
|
||||
otherwise
|
||||
error("%s not implemented for domains of class %s", coder.mfunctionname, class(domain));
|
||||
end
|
||||
end
|
||||
13
validators/obstacleCoversObjective.m
Normal file
13
validators/obstacleCoversObjective.m
Normal file
@@ -0,0 +1,13 @@
|
||||
function c = obstacleCoversObjective(objective, obstacle)
|
||||
arguments (Input)
|
||||
objective (1, 1) {mustBeA(objective, 'sensingObjective')};
|
||||
obstacle (1, 1) {mustBeGeometry}; % this could be expanded to handle n obstacles in 1 call
|
||||
end
|
||||
arguments (Output)
|
||||
c (1, 1) logical;
|
||||
end
|
||||
|
||||
% Check if the obstacle contains the objective's ground position if the
|
||||
% ground position were raised to the obstacle's center's height
|
||||
c = obstacle.contains([objective.groundPos, obstacle.center(3)]);
|
||||
end
|
||||
11
validators/obstacleCrowdsObjective.m
Normal file
11
validators/obstacleCrowdsObjective.m
Normal file
@@ -0,0 +1,11 @@
|
||||
function c = obstacleCrowdsObjective(objective, obstacle, protectedRange)
|
||||
arguments (Input)
|
||||
objective (1, 1) {mustBeA(objective, 'sensingObjective')};
|
||||
obstacle (1, 1) {mustBeGeometry}; % this could be expanded to handle n obstacles in 1 call
|
||||
protectedRange (1, 1) double;
|
||||
end
|
||||
arguments (Output)
|
||||
c (1, 1) logical;
|
||||
end
|
||||
c = norm(obstacle.distance([objective.groundPos, obstacle.center(3)])) <= protectedRange;
|
||||
end
|
||||
Reference in New Issue
Block a user