module GJK.CollisionSpec where import GJK.Point (Pt) import GJK.Support (isCollision) import Test.Hspec spec :: Spec spec = describe "collision" $ do it "shoult find collision for inner polygon" $ isCollision polygon inner `shouldBe` True it "should not find collison for outer polygon" $ isCollision polygon outer `shouldBe` False inner :: [Pt] inner = [(145.63095,6.0234867), (148.85714,6.0), (147.89875,18.336034)] outer :: [Pt] outer = [(-145.63095,-6.0234867), (-148.85714,-6.0), (-147.89875,-18.336034)] polygon :: [Pt] polygon = [ (139.17857,6.0704), (142.40476,6.0469733), (145.63095,6.0234867), (148.85714,6.0), (147.89875,18.336034), (144.4624,30.087212), (140.17162,41.636725), (138.36944,68.981639), (137.73101,96.540654), (136.37472,123.9676), (150.19177,123.61152), (164.00883,123.25543), (177.82588,122.89935), (185.00665,127.58098), (190.9907,135.33072), (197.71169,141.19113), (199.02091,154.95038), (197.44984,169.18769), (202.38455,182.3452), (206.25152,188.6), (199.97172,193.42446), (197.29801,198.75726), (189.50963,202.65248), (179.81968,204.03986), (171.31917,206.99592), (169.3488,223.48563), (167.37843,239.97534), (165.40806,256.46505), (164.24008,273.96448), (159.82797,290.87333), (155.48766,307.79525), (156.54064,313.27045), (160.71456,318.38221), (162.91958,323.72325), (155.80489,337.62366), (148.6902,351.52408), (141.57551,365.42449), (128.85958,373.21405), (117.55062,382.86298), (106.29592,392.58362), (108.33764,401.26715), (110.38688,409.94899), (112.1795,418.68823), (114.70465,430.05987), (108.16003,440.09535), (104.27689,450.32682), (96.442887,451.79346), (88.608884,453.26011), (80.774881,454.72675), (75.326819,446.28062), (67.769397,438.84088), (66.282582,428.5048), (67.700871,419.96118), (71.641538,411.46724), (74.36394,403.0588), (73.079495,395.03705), (68.822842,387.01472), (66.42807,378.99274), (61.155271,374.19988), (53.665446,371.24121), (47.535604,367.1574), (39.41249,356.14722), (32.714949,343.67355), (25.13649,332.10423), (19.570258,326.7377), (24.211787,319.4322), (24.6413,312.92678), (24.522209,299.82585), (21.928665,286.63534), (20.85883,273.5), (28.080043,253.59142), (33.947501,233.15747), (42.846111,213.89987), (43.027779,202.6816), (41.13384,191.12284), (40.532747,179.77616), (40.105987,162.99701), (43.132751,146.23134), (43.266082,129.40315), (41.218892,115.46725), (36.99227,101.69368), (33.518309,87.970109), (31.908966,74.634958), (33.794832,60.876757), (33.550433,47.376398), (35.472187,39.405204), (27.203997,34.874597), (23.553492,28.78485), (18.132204,24.599655), (19.020117,18.0171), (18.660865,11.90844), (24.962761,11.109781), (31.264657,10.311122), (37.566553,9.5124627), (45.570266,6.7217735), (52.069862,13.115795), (59.174551,15.814881), (66.125532,17.494749), (60.477337,26.272902), (61.398652,31.34984), (58.116471,38.942736), (67.239702,39.703007), (72.0,42.866284), (74.670209,56.143639), (77.340418,69.420994), (80.010627,82.698349), (84.795758,117.82934), (87.660612,153.25473), (91.700336,188.5), (94.057138,172.58703), (96.530163,156.68896), (98.023683,140.6653), (101.30239,122.57318), (97.125272,104.389), (96.249823,86.245585), (98.245583,71.836862), (100.27465,57.167253), (103.29534,42.959979), (107.9678,35.160614), (109.17039,26.41331), (109.76531,17.5), (119.56973,13.690153), (129.37415,9.8803067), (139.17857,6.07046) ]