aboutsummaryrefslogtreecommitdiffstats
path: root/Domains/crossingScenario/queries/crossingScenarioQueries.vql
diff options
context:
space:
mode:
Diffstat (limited to 'Domains/crossingScenario/queries/crossingScenarioQueries.vql')
-rw-r--r--Domains/crossingScenario/queries/crossingScenarioQueries.vql65
1 files changed, 43 insertions, 22 deletions
diff --git a/Domains/crossingScenario/queries/crossingScenarioQueries.vql b/Domains/crossingScenario/queries/crossingScenarioQueries.vql
index d1c72820..6c94a702 100644
--- a/Domains/crossingScenario/queries/crossingScenarioQueries.vql
+++ b/Domains/crossingScenario/queries/crossingScenarioQueries.vql
@@ -463,30 +463,41 @@ pattern collisionExists_qualAbstr(a1:Actor, a2:Actor) {
463} 463}
464 464
465//<<END QUALITATIF ABSTRACTION>> 465//<<END QUALITATIF ABSTRACTION>>
466/* 466
467//// 467////
468//VS VisionBlocked 468//VS VisionBlocked
469//// 469////
470//TODO Very prone to corner cases 470//TODO Very prone to corner cases
471 471/*
472@Constraint(severity="error", key={a1, a2}, message="x") 472@Constraint(severity="error", key={a1}, message="x")
473pattern collisionExists_vsVisionBlocked(a1:Actor, a2:Actor) { 473pattern collisionExists_vsVisionBlocked(a1:Actor) {
474 VisionBlocked.source(vb, a1); 474 VisionBlocked.source(vb, a1);
475 VisionBlocked.target(vb, a2); 475 VisionBlocked.target(vb, a2);
476 neg find helper_collidingActors(a1, a2); 476 CollisionExists.source(ce, a1);
477 CollisionExists.target(ce, a3);
478 a2 != a3;
477} or { 479} or {
478 VisionBlocked.source(vb, a1); 480 VisionBlocked.source(vb, a1);
479 VisionBlocked.target(vb, a2); 481 VisionBlocked.target(vb, a2);
480 neg find helper_collidingActors(a2, a1); 482 CollisionExists.source(ce, a3);
481} 483 CollisionExists.target(ce, a1);
482 484 a2 != a3;
483private pattern helper_collidingActors(a1:Actor, a2:Actor){ 485} or {
484 CollisionExists.source(vb, a1); 486 VisionBlocked.source(vb, a2);
485 CollisionExists.target(vb, a2); 487 VisionBlocked.target(vb, a1);
488 CollisionExists.source(ce, a3);
489 CollisionExists.target(ce, a1);
490 a2 != a3;
491} or {
492 VisionBlocked.source(vb, a2);
493 VisionBlocked.target(vb, a1);
494 CollisionExists.source(ce, a1);
495 CollisionExists.target(ce, a3);
496 a2 != a3;
486} 497}
487 498*/
488//<<END QUALITATIF ABSTRACTION>> 499//<<END QUALITATIF ABSTRACTION>>
489 500/*
490//// 501////
491//CollisionExists - Time 502//CollisionExists - Time
492//// 503////
@@ -592,7 +603,7 @@ pattern collisionExists_defineCollision_x2(a1:Actor, a2:Actor) {
592 check((xPos1 + (xSpeed1 * cTime)) + (w1/2) < (xPos2 + (xSpeed2 * cTime)) - (w2/2)); 603 check((xPos1 + (xSpeed1 * cTime)) + (w1/2) < (xPos2 + (xSpeed2 * cTime)) - (w2/2));
593} 604}
594 605
595*/ 606
596///////*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*////// 607///////*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*//////
597//VisionBlocked 608//VisionBlocked
598///////*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*////// 609///////*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*//////
@@ -708,8 +719,10 @@ pattern visionBlocked_ites_bottom(a1:Actor, a2:Actor, vb:VisionBlocked) {
708 > ((y1-y2)/(x1-x2))); 719 > ((y1-y2)/(x1-x2)));
709} 720}
710 721
711@Constraint(severity="error", key={a1, a2}, message="x") 722//TODO refactor?
712pattern visionBlocked_blockerNotToRightOfBoth(a1:Actor, a2:Actor) { 723//TODO CORNER CASES
724@Constraint(severity="error", key={a1, vb}, message="x")
725pattern visionBlocked_xdistBSlargerThanxdistTS(a1:Actor, a2:Actor, vb:VisionBlocked) {
713 //This second one is required because we do not want to enforce both a1->c->a2 and a2->c->a1 726 //This second one is required because we do not want to enforce both a1->c->a2 and a2->c->a1
714 VisionBlocked.source(vb, a1); 727 VisionBlocked.source(vb, a1);
715 VisionBlocked.target(vb, a2); 728 VisionBlocked.target(vb, a2);
@@ -719,23 +732,31 @@ pattern visionBlocked_blockerNotToRightOfBoth(a1:Actor, a2:Actor) {
719 Actor.xPos(a2, x2); 732 Actor.xPos(a2, x2);
720 Actor.xPos(aBlocker, xBlocker); 733 Actor.xPos(aBlocker, xBlocker);
721 734
722 check( x1 < xBlocker && x2 < xBlocker); 735 //check(slope of a1-to-BlockerBottom > slope of a1-to-a2)
736 //TODO implement ABSOLUTE VALUE or MULTI-CHECK
737 check((x1-xBlocker)*(x1-xBlocker) > (x1-x2)*(x1-x2));
723} 738}
724 739
725@Constraint(severity="error", key={a1, a2}, message="x") 740//TODO refactor?
726pattern visionBlocked_blockerNotToLeftOfBoth(a1:Actor, a2:Actor) { 741//TODO CORNER CASES
742@Constraint(severity="error", key={a1, vb}, message="x")
743pattern visionBlocked_xdistBTlargerThanxdistST(a1:Actor, a2:Actor, vb:VisionBlocked) {
727 //This second one is required because we do not want to enforce both a1->c->a2 and a2->c->a1 744 //This second one is required because we do not want to enforce both a1->c->a2 and a2->c->a1
728 VisionBlocked.source(vb, a1); 745 VisionBlocked.source(vb, a2);
729 VisionBlocked.target(vb, a2); 746 VisionBlocked.target(vb, a1);
730 VisionBlocked.blockedBy(vb, aBlocker); 747 VisionBlocked.blockedBy(vb, aBlocker);
731 748
732 Actor.xPos(a1, x1); 749 Actor.xPos(a1, x1);
733 Actor.xPos(a2, x2); 750 Actor.xPos(a2, x2);
734 Actor.xPos(aBlocker, xBlocker); 751 Actor.xPos(aBlocker, xBlocker);
735 752
736 check( x1 > xBlocker && x2 > xBlocker); 753 //check(slope of a1-to-BlockerBottom > slope of a1-to-a2)
754 //TODO implement ABSOLUTE VALUE or MULTI-CHECK
755 check((x1-xBlocker)*(x1-xBlocker) > (x1-x2)*(x1-x2));
737} 756}
738 757
758//TODO same as above for Y???
759//TODO same as above for Y ????
739 760
740/////*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*////// 761/////*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*-_-*//////
741//SeparationDistance 762//SeparationDistance