fixed init generation being really slow
This commit is contained in:
10
validators/arguments/mustBeAgents.m
Normal file
10
validators/arguments/mustBeAgents.m
Normal file
@@ -0,0 +1,10 @@
|
||||
function mustBeAgents(agents)
|
||||
validGeometries = ["rectangularPrismConstraint";];
|
||||
if isa(agents, 'cell')
|
||||
for ii = 1:size(agents, 1)
|
||||
assert(isa(agents{ii}, "agent"), "Agent in index %d is not a valid agent class", ii);
|
||||
end
|
||||
else
|
||||
assert(isa(agents, validGeometries), "Agent is not a valid agent class");
|
||||
end
|
||||
end
|
||||
12
validators/arguments/mustBeDcm.m
Normal file
12
validators/arguments/mustBeDcm.m
Normal file
@@ -0,0 +1,12 @@
|
||||
function mustBeDcm(dcm)
|
||||
% Assert 2D
|
||||
assert(numel(size(dcm)) == 2, "DCM is not 2D");
|
||||
% Assert square
|
||||
assert(size(unique(size(dcm)), 1) == 1, "DCM is not a square matrix");
|
||||
|
||||
epsilon = 1e-9;
|
||||
% Assert inverse equivalent to transpose
|
||||
assert(all(abs(inv(dcm) - dcm') < epsilon, "all"), "DCM inverse is not equivalent to transpose");
|
||||
% Assert determinant is 1
|
||||
assert(det(dcm) > 1 - epsilon && det(dcm) < 1 + epsilon, "DCM has determinant not equal to 1");
|
||||
end
|
||||
10
validators/arguments/mustBeGeometry.m
Normal file
10
validators/arguments/mustBeGeometry.m
Normal file
@@ -0,0 +1,10 @@
|
||||
function mustBeGeometry(geometry)
|
||||
validGeometries = ["rectangularPrism";];
|
||||
if isa(geometry, 'cell')
|
||||
for ii = 1:size(geometry, 1)
|
||||
assert(isa(geometry{ii}, validGeometries), "Geometry in index %d is not a valid geometry class", ii);
|
||||
end
|
||||
else
|
||||
assert(isa(geometry, validGeometries), "Geometry is not a valid geometry class");
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user