Model: True -> true, False -> false

parent c2471afc
......@@ -33,14 +33,14 @@ component CollisionToStop<N1 n = 2,N1 x = 1>{
for i = 1:n
stopOut(i) = False;
stopOut(i) = false;
end
if active
for i = 1:x
if collisionIn(i)
Z curIndex = indexLookup(i,1);
stopOut(curIndex) = True;
stopOut(curIndex) = true;
end
end
end
......
......@@ -10,18 +10,20 @@ component FirstLineIntersection<N1 m1 = 9, N1 m2 = 45>{
out Z linexB,
out Q^{2,1} pos;
//TODO: bug: must not always be earliest crash pos
//TODO: remove: filter all with TimeCutoff and MultiOr
implementation Math{
Z k = 1;
B found = False;
B found = false;
for i = 1:m1
for j = i:m1
if found == False
if found == false
if collisionIn(k)
linexA = i;
linexB = j;
pos = pointsIn(k);
found = True;
found = true;
end
k = k + 1;
end
......@@ -31,4 +33,4 @@ component FirstLineIntersection<N1 m1 = 9, N1 m2 = 45>{
collisionOut = found;
}
}
\ No newline at end of file
}
......@@ -34,14 +34,14 @@ component TimeCutoffFilter<N1 m = 10>(adaptable Q timeCutoff){
Q time2 = distp2/dist2 * (trajectoryInB(3,indexInB + 1) - trajectoryInB(3,indexInB));
if time1 <= time2
aIsFasterOut = True;
aIsFasterOut = true;
else
aIsFasterOut = False;
aIsFasterOut = false;
end
collisionOut = abs(time1 - time2) < timeCutoff;
else
collisionOut = False;
collisionOut = false;
end
}
}
\ No newline at end of file
......@@ -16,6 +16,7 @@ component TrajectoryCollision<N1 m = 10, N1 m1 = 9, N1 m2 = 45>{
instance DualSetCompareMatrix<4,1,9,45> dualSetCompare;
instance LineIntersection lineIntersection[m2];
instance FirstLineIntersection<9,45> firstLineIntersection;
//TODO: filter then get first
instance TimeCutoffFilter<10>(2.0) timeCutoffFilter;
connect trajectoryA -> trajectoryToLinesA.trajectoryIn;
......@@ -39,4 +40,4 @@ component TrajectoryCollision<N1 m = 10, N1 m1 = 9, N1 m2 = 45>{
connect dualSetCompare.outA[:] -> lineIntersection[:].lineA;
connect dualSetCompare.outB[:] -> lineIntersection[:].lineB;
}
\ No newline at end of file
}
......@@ -16,7 +16,7 @@ component LineIntersection{
Q n1 = Ay*Bx - Ax*By;
Q cutoff = 0.00000001;
B res = False;
B res = false;
//if lines are not parallel(ish)
if (abs(n1) > cutoff)
......@@ -24,7 +24,7 @@ component LineIntersection{
if (alpha >= cutoff) && (alpha <= 1)
Q beta = (Ax * Cy - Ay * Cx) / n1;
if (beta >= cutoff) && (beta <= 1)
res = True;
res = true;
point(1,1) = lineA(1,1) + alpha * Ax;
point(2,1) = lineA(2,1) + alpha * Ay;
end
......
......@@ -5,7 +5,7 @@ component MultiOr<N1 x = 2>{
out B boolOut;
implementation Math{
B flag = False;
B flag = false;
for i = 1:x
flag = flag || boolIn(i);
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment