Files
secondo/Algebras/MovingRegion/Tests/trapeziumintersection.tests

123 lines
3.9 KiB
Plaintext
Raw Normal View History

2026-01-23 17:03:45 +08:00
# Unit tests for trapezium intersections.
###############################################################################
create database mratest;
open database mratest;
###############################################################################
#testcase "1 - no bbox overlap"
#yields (int 1)
query unittest1 (10.0,
1.0, 1.0, 2.0, 2.0, 1.0, 2.0, 2.0, 3.0,
3.0, 1.0, 4.0, 2.0, 3.0, 2.0, 4.0, 3.0);
#testcase "2 - touch in one segment"
#yields (int 2)
query unittest1 (10.0,
1.0, 1.0, 2.0, 2.0, 1.0, 2.0, 2.0, 3.0,
2.0, 2.0, 4.0, 2.0, 2.0, 3.0, 4.0, 3.0);
#testcase "3 - same plane, no overlap"
#yields (int 4)
query unittest1 (10.0,
1.0, 1.0, 3.0, 3.0, 2.0, 2.0, 4.0, 4.0,
3.5, 3.5, 5.5, 5.5, 4.5, 4.5, 6.5, 6.5);
#testcase "4 - same plane, overlap"
#yields (int 3)
query unittest1 (10.0,
1.0, 1.0, 3.0, 3.0, 2.0, 2.0, 4.0, 4.0,
3.2, 3.2, 4.5, 4.5, 3.7, 3.7, 5.0, 5.0);
#testcase "5 - same plane, overlap"
#yields (int 3)
query unittest1 (10.0,
1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0,
3.0, 3.0, 4.0, 4.0, 1.0, 1.0, 2.0, 2.0);
#testcase "6 - parallel"
#yields (int 5)
query unittest1 (10.0,
1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0,
1.1, 1.0, 2.1, 2.0, 3.1, 3.0, 4.1, 4.0);
#testcase "7 - intersection line parallel to xy-plane, outside z range"
#yields (int 6)
query unittest1 (10.0,
0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0, 2.0,
1.0, 0.0, 1.0, 1.0, 3.0, 0.0, 3.0, 2.0);
#testcase "8 - intersection line parallel to xy-plane, intersection"
#yields (int 7)
query unittest1 (10.0,
1.0, 1.0, 2.0, 2.0, 0.0, 2.0, 1.0, 3.0,
0.0, 2.0, 1.0, 3.0, 1.0, 1.0, 2.0, 2.0);
#testcase "9 - normal intersection"
#yields (int 8)
query unittest1 (10.0,
0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0,
0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0);
#testcase "10 - normal intersection"
#yields (int 8)
query unittest1 (10.0,
0.0, 1.0, 2.0, 1.0, 0.0, 1.0, 2.0, 1.0,
1.0, 0.0, 1.0, 2.0, 1.0, 0.0, 1.0, 2.0);
#testcase "11 - normal intersection"
#yields (int 8)
query unittest1 (10.0,
1.0, 0.0, 1.0, 2.0, 1.0, 0.0, 1.0, 2.0,
0.0, 1.0, 0.5, 1.0, 0.0, 1.0, 1.5, 1.0);
#testcase "12 - normal intersection"
#yields (int 8)
query unittest1 (10.0,
1.0, 0.0, 1.0, 2.0, 1.0, 0.0, 1.0, 2.0,
0.0, 1.0, 0.5, 1.0, 1.5, 1.0, 2.0, 1.0);
#testcase "13 - normal non-intersection"
#yields (int 9)
query unittest1 (10.0,
1.0, 0.0, 1.0, 2.0, 1.0, 0.0, 1.0, 4.0,
-1.0, 3.0, 1.5, 3.0, -1.0, 3.0, -0.5, 3.0);
#testcase "14 - triangle, normal intersection"
#yields (int 8)
query unittest1 (10.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0,
0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0);
#testcase "15 - triangle, normal non-intersection"
#yields (int 9)
query unittest1 (10.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0,
0.0, 0.5, 2.0, 0.5, 2.0, 0.5, 2.0, 0.5);
#testcase "16 - triangle, same plane, intersection"
#yields (int 3)
query unittest1 (10.0,
0.0, 0.0, 1.0, 1.0, 0.5, 0.5, 0.5, 0.5,
0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 1.7, 1.7);
#testcase "17 - triangle, same plane, non-intersection"
#yields (int 4)
query unittest1 (10.0,
0.0, 0.0, 1.0, 1.0, 0.5, 0.5, 0.5, 0.5,
1.1, 1.1, 1.1, 1.1, 0.6, 0.6, 2.1, 2.1);
#testcase "18 - intersection line parallel to xy-plane, no overlap"
#yields (int 10)
query unittest1 (10.0,
0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 2.0, 1.0,
1.5, 1.0, 3.5, 1.0, 2.5, 0.0, 3.5, 0.0);
###############################################################################
#teardown
close database;
delete database mratest;