/usr/lib/python2.7/dist-packages/Box2D/Box2D.py is in python-box2d 2.3.2~dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 8333 8334 8335 8336 8337 8338 8339 8340 8341 8342 8343 8344 8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361 8362 8363 8364 8365 8366 8367 8368 8369 8370 8371 8372 8373 8374 8375 8376 8377 8378 8379 8380 8381 8382 8383 8384 8385 8386 8387 8388 8389 8390 8391 8392 8393 8394 8395 8396 8397 8398 8399 8400 8401 8402 8403 8404 8405 8406 8407 8408 8409 8410 8411 8412 8413 8414 8415 8416 8417 8418 8419 8420 8421 8422 8423 8424 8425 8426 8427 8428 8429 8430 8431 8432 8433 8434 8435 8436 8437 8438 8439 8440 8441 8442 8443 8444 8445 8446 8447 8448 8449 8450 8451 8452 8453 8454 8455 8456 8457 8458 8459 8460 8461 8462 8463 8464 8465 8466 8467 8468 8469 8470 8471 8472 8473 8474 8475 8476 8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 8583 8584 8585 8586 8587 8588 8589 8590 8591 8592 8593 8594 8595 8596 8597 8598 8599 8600 8601 8602 8603 8604 8605 8606 8607 8608 8609 8610 8611 8612 8613 8614 8615 8616 8617 8618 8619 8620 8621 8622 8623 8624 8625 8626 8627 8628 8629 8630 8631 8632 8633 8634 8635 8636 8637 8638 8639 8640 8641 8642 8643 8644 8645 8646 8647 8648 8649 8650 8651 8652 8653 8654 8655 8656 8657 8658 8659 8660 8661 8662 8663 8664 8665 8666 8667 8668 8669 8670 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 8682 8683 8684 8685 8686 8687 8688 8689 8690 8691 8692 8693 8694 8695 8696 8697 8698 8699 8700 8701 8702 8703 8704 8705 8706 8707 8708 8709 8710 8711 8712 8713 8714 8715 8716 8717 8718 8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754 8755 8756 8757 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 8804 8805 8806 8807 8808 8809 8810 8811 8812 8813 8814 8815 8816 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 8827 8828 8829 8830 8831 8832 8833 8834 8835 8836 8837 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 8857 8858 8859 8860 8861 8862 8863 8864 8865 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 8895 8896 8897 8898 | # This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.10
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info as _swig_python_version_info
if _swig_python_version_info >= (3, 0, 0):
new_instancemethod = lambda func, inst, cls: _Box2D.SWIG_PyInstanceMethod_New(func)
else:
from new import instancemethod as new_instancemethod
if _swig_python_version_info >= (2, 7, 0):
def swig_import_helper():
import importlib
pkg = __name__.rpartition('.')[0]
mname = '.'.join((pkg, '_Box2D')).lstrip('.')
try:
return importlib.import_module(mname)
except ImportError:
return importlib.import_module('_Box2D')
_Box2D = swig_import_helper()
del swig_import_helper
elif _swig_python_version_info >= (2, 6, 0):
def swig_import_helper():
from os.path import dirname
import imp
fp = None
try:
fp, pathname, description = imp.find_module('_Box2D', [dirname(__file__)])
except ImportError:
import _Box2D
return _Box2D
if fp is not None:
try:
_mod = imp.load_module('_Box2D', fp, pathname, description)
finally:
fp.close()
return _mod
_Box2D = swig_import_helper()
del swig_import_helper
else:
import _Box2D
del _swig_python_version_info
try:
_swig_property = property
except NameError:
pass # Python < 2.2 doesn't have 'property'.
try:
import builtins as __builtin__
except ImportError:
import __builtin__
def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
if (name == "thisown"):
return self.this.own(value)
if (name == "this"):
if type(value).__name__ == 'SwigPyObject':
self.__dict__[name] = value
return
method = class_type.__swig_setmethods__.get(name, None)
if method:
return method(self, value)
if (not static):
object.__setattr__(self, name, value)
else:
raise AttributeError("You cannot add attributes to %s" % self)
def _swig_setattr(self, class_type, name, value):
return _swig_setattr_nondynamic(self, class_type, name, value, 0)
def _swig_getattr(self, class_type, name):
if (name == "thisown"):
return self.this.own()
method = class_type.__swig_getmethods__.get(name, None)
if method:
return method(self)
raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))
def _swig_repr(self):
try:
strthis = "proxy of " + self.this.__repr__()
except __builtin__.Exception:
strthis = ""
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
def _swig_setattr_nondynamic_method(set):
def set_attr(self, name, value):
if (name == "thisown"):
return self.this.own(value)
if hasattr(self, name) or (name == "this"):
set(self, name, value)
else:
raise AttributeError("You cannot add attributes to %s" % self)
return set_attr
try:
import weakref
weakref_proxy = weakref.proxy
except __builtin__.Exception:
weakref_proxy = lambda x: x
def _dir_filter(self):
"""
Using introspection, mimic dir() by adding up all of the __dicts__
for the current class and all base classes (type(self).__mro__ returns
all of the classes that make it up)
Basically filters by:
__x__ OK
__x bad
_classname bad
"""
def check(s):
if s.startswith('__'):
if s.endswith('__'):
return True
else:
return False
else:
for typename in typenames:
if typename in s:
return False
return True
keys = sum([list(c.__dict__.keys()) for c in type(self).__mro__],[])
keys += list(self.__dict__.keys())
typenames = ["_%s" % c.__name__ for c in type(self).__mro__]
ret = [s for s in list(set(keys)) if check(s)]
ret.sort()
return ret
def _init_kwargs(self, **kwargs):
cls = self.__class__
for key, value in kwargs.items():
try:
getattr(cls, key)
except AttributeError:
raise AttributeError('Invalid keyword argument "%s" for %s' % (key, cls))
try:
setattr(self, key, value)
except Exception as ex:
raise ex.__class__('Failed on kwargs for %s.%s: %s' \
% (self.__class__.__name__, key, ex))
def _init_jointdef_kwargs(self, bodyA=None, bodyB=None, **kwargs):
if bodyA is not None or bodyB is not None:
# Make sure that bodyA and bodyB are defined before the rest
_init_kwargs(self, bodyA=bodyA, bodyB=bodyB)
_init_kwargs(self, **kwargs)
_repr_attrs = {'b2AABB': ['center', 'extents', 'lowerBound', 'perimeter', 'upperBound',
'valid', ],
'b2Body': ['active', 'angle', 'angularDamping', 'angularVelocity', 'awake',
'bullet', 'contacts', 'fixedRotation', 'fixtures',
'inertia', 'joints', 'linearDamping', 'linearVelocity',
'localCenter', 'mass', 'massData', 'position',
'sleepingAllowed', 'transform', 'type', 'userData',
'worldCenter', ],
'b2BodyDef': ['active', 'allowSleep', 'angle', 'angularDamping', 'angularVelocity',
'awake', 'bullet', 'fixedRotation', 'fixtures',
'inertiaScale', 'linearDamping', 'linearVelocity', 'position',
'shapeFixture', 'shapes', 'type', 'userData',
],
'b2BroadPhase': ['proxyCount', ],
'b2CircleShape': ['childCount', 'pos', 'radius', 'type', ],
'b2ClipVertex': ['id', 'v', ],
'b2Color': ['b', 'bytes', 'g', 'list', 'r',
],
'b2Contact': ['childIndexA', 'childIndexB', 'enabled', 'fixtureA', 'fixtureB',
'manifold', 'touching', 'worldManifold', ],
'b2ContactEdge': ['contact', 'other', ],
'b2ContactFeature': ['indexA', 'indexB', 'typeA', 'typeB', ],
'b2ContactID': ['cf', 'key', ],
'b2ContactImpulse': ['normalImpulses', 'tangentImpulses', ],
'b2ContactManager': ['allocator', 'broadPhase', 'contactCount', 'contactFilter', 'contactList',
'contactListener', ],
'b2ContactPoint': ['fixtureA', 'fixtureB', 'normal', 'position', 'state',
],
'b2DistanceInput': ['proxyA', 'proxyB', 'transformA', 'transformB', 'useRadii',
],
'b2DistanceJoint': ['active', 'anchorA', 'anchorB', 'bodyA', 'bodyB',
'dampingRatio', 'frequency', 'length', 'type',
'userData', ],
'b2DistanceJointDef': ['anchorA', 'anchorB', 'bodyA', 'bodyB', 'collideConnected',
'dampingRatio', 'frequencyHz', 'length', 'localAnchorA',
'localAnchorB', 'type', 'userData', ],
'b2DistanceOutput': ['distance', 'iterations', 'pointA', 'pointB', ],
'b2DistanceProxy': ['m_buffer', 'shape', 'vertices', ],
'b2Draw': ['flags', ],
'b2DrawExtended': ['center', 'convertVertices', 'flags', 'flipX', 'flipY',
'offset', 'screenSize', 'zoom', ],
'b2EdgeShape': ['all_vertices', 'childCount', 'hasVertex0', 'hasVertex3', 'radius',
'type', 'vertex0', 'vertex1', 'vertex2',
'vertex3', 'vertexCount', 'vertices', ],
'b2Filter': ['categoryBits', 'groupIndex', 'maskBits', ],
'b2Fixture': ['body', 'density', 'filterData', 'friction', 'massData',
'restitution', 'sensor', 'shape', 'type',
'userData', ],
'b2FixtureDef': ['categoryBits', 'density', 'filter', 'friction', 'groupIndex',
'isSensor', 'maskBits', 'restitution', 'shape',
'userData', ],
'b2FixtureProxy': ['aabb', 'childIndex', 'fixture', 'proxyId', ],
'b2FrictionJoint': ['active', 'anchorA', 'anchorB', 'bodyA', 'bodyB',
'maxForce', 'maxTorque', 'type', 'userData',
],
'b2FrictionJointDef': ['anchor', 'bodyA', 'bodyB', 'collideConnected', 'localAnchorA',
'localAnchorB', 'maxForce', 'maxTorque', 'type',
'userData', ],
'b2GearJoint': ['active', 'anchorA', 'anchorB', 'bodyA', 'bodyB',
'ratio', 'type', 'userData', ],
'b2GearJointDef': ['bodyA', 'bodyB', 'collideConnected', 'joint1', 'joint2',
'ratio', 'type', 'userData', ],
'b2Jacobian': ['angularA', 'angularB', 'linearA', 'linearB', ],
'b2Joint': ['active', 'anchorA', 'anchorB', 'bodyA', 'bodyB',
'type', 'userData', ],
'b2JointDef': ['bodyA', 'bodyB', 'collideConnected', 'type', 'userData',
],
'b2JointEdge': ['joint', 'other', ],
'b2WheelJoint': ['active', 'anchorA', 'anchorB', 'bodyA', 'bodyB',
'maxMotorTorque', 'motorEnabled', 'motorSpeed', 'speed',
'springDampingRatio', 'springFrequencyHz', 'translation', 'type',
'userData', ],
'b2WheelJointDef': ['anchor', 'axis', 'bodyA', 'bodyB', 'collideConnected',
'dampingRatio', 'enableMotor', 'frequencyHz', 'localAnchorA',
'localAnchorB', 'localAxisA', 'maxMotorTorque', 'motorSpeed',
'type', 'userData', ],
'b2ChainShape': ['childCount', 'edges', 'radius', 'type', 'vertexCount',
'vertices', ],
'b2Manifold': ['localNormal', 'localPoint', 'pointCount', 'points', 'type_',
],
'b2ManifoldPoint': ['id', 'isNew', 'localPoint', 'normalImpulse', 'tangentImpulse',
],
'b2MassData': ['I', 'center', 'mass', ],
'b2Mat22': ['angle', 'col1', 'col2', 'inverse', ],
'b2Mat33': ['col1', 'col2', 'col3', ],
'b2MouseJoint': ['active', 'anchorA', 'anchorB', 'bodyA', 'bodyB',
'dampingRatio', 'frequency', 'maxForce', 'target',
'type', 'userData', ],
'b2MouseJointDef': ['bodyA', 'bodyB', 'collideConnected', 'dampingRatio', 'frequencyHz',
'maxForce', 'target', 'type', 'userData',
],
'b2Pair': ['proxyIdA', 'proxyIdB', ],
'b2PolygonShape': ['box', 'centroid', 'childCount', 'normals', 'radius',
'type', 'valid', 'vertexCount', 'vertices',
],
'b2PrismaticJoint': ['active', 'anchorA', 'anchorB', 'bodyA', 'bodyB',
'limitEnabled', 'limits', 'lowerLimit', 'maxMotorForce',
'motorEnabled', 'motorSpeed', 'speed', 'translation',
'type', 'upperLimit', 'userData', ],
'b2PrismaticJointDef': ['anchor', 'axis', 'bodyA', 'bodyB', 'collideConnected',
'enableLimit', 'enableMotor', 'localAnchorA', 'localAnchorB',
'localAxis1', 'lowerTranslation', 'maxMotorForce', 'motorSpeed',
'referenceAngle', 'type', 'upperTranslation', 'userData',
],
'b2PulleyJoint': ['active', 'anchorA', 'anchorB', 'bodyA', 'bodyB',
'groundAnchorA', 'groundAnchorB', 'length1', 'length2',
'ratio', 'type', 'userData', ],
'b2PulleyJointDef': ['anchorA', 'anchorB', 'bodyA', 'bodyB', 'collideConnected',
'groundAnchorA', 'groundAnchorB', 'lengthA', 'lengthB',
'localAnchorA', 'localAnchorB', 'maxLengthA', 'maxLengthB',
'ratio', 'type', 'userData', ],
'b2RayCastInput': ['maxFraction', 'p1', 'p2', ],
'b2RayCastOutput': ['fraction', 'normal', ],
'b2RevoluteJoint': ['active', 'anchorA', 'anchorB', 'angle', 'bodyA',
'bodyB', 'limitEnabled', 'limits', 'lowerLimit',
'maxMotorTorque', 'motorEnabled', 'motorSpeed', 'speed',
'type', 'upperLimit', 'userData', ],
'b2RevoluteJointDef': ['anchor', 'bodyA', 'bodyB', 'collideConnected', 'enableLimit',
'enableMotor', 'localAnchorA', 'localAnchorB', 'lowerAngle',
'maxMotorTorque', 'motorSpeed', 'referenceAngle', 'type',
'upperAngle', 'userData', ],
'b2RopeJoint': ['active', 'anchorA', 'anchorB', 'bodyA', 'bodyB',
'limitState', 'maxLength', 'type', 'userData',
],
'b2RopeJointDef': ['anchorA', 'anchorB', 'bodyA', 'bodyB', 'collideConnected',
'localAnchorA', 'localAnchorB', 'maxLength', 'type',
'userData', ],
'b2Shape': ['childCount', 'radius', 'type', ],
'b2Sweep': ['a', 'a0', 'alpha0', 'c', 'c0',
'localCenter', ],
'b2TOIInput': ['proxyA', 'proxyB', 'sweepA', 'sweepB', 'tMax',
],
'b2TOIOutput': ['state', 't', ],
'b2Transform': ['R', 'angle', 'position', ],
'b2Vec2': ['length', 'lengthSquared', 'skew', 'tuple', 'valid',
'x', 'y', ],
'b2Vec3': ['length', 'lengthSquared', 'tuple', 'valid', 'x',
'y', 'z', ],
'b2Version': ['major', 'minor', 'revision', ],
'b2WeldJoint': ['active', 'anchorA', 'anchorB', 'bodyA', 'bodyB',
'type', 'userData', ],
'b2WeldJointDef': ['anchor', 'bodyA', 'bodyB', 'collideConnected', 'localAnchorA',
'localAnchorB', 'referenceAngle', 'type', 'userData',
],
'b2World': ['autoClearForces', 'bodies', 'bodyCount', 'contactCount', 'contactFilter',
'contactListener', 'contactManager', 'contacts', 'continuousPhysics',
'destructionListener', 'gravity', 'jointCount', 'joints',
'locked', 'proxyCount', 'renderer', 'subStepping',
'warmStarting', ],
'b2WorldManifold': ['normal', 'points', ],
}
MAX_REPR_DEPTH = 4
MAX_REPR_STR_LEN = 250
MAX_REPR_SUB_LINES = 10
REPR_INDENT = 4
_repr_state = {}
def _format_repr(obj):
"""
Dynamically creates the object representation string for `obj`.
Attributes found in _repr_attrs[class_name] will be included.
"""
global _repr_state
if 'spaces' not in _repr_state:
_repr_state['spaces'] = 0
if 'depth' not in _repr_state:
_repr_state['depth'] = 1
else:
_repr_state['depth'] += 1
if _repr_state['depth'] > MAX_REPR_DEPTH:
_repr_state['depth'] -= 1
return '%s(max recursion depth hit)' % (' ' * _repr_state['spaces'])
class_line = '%s(' % (obj.__class__.__name__, )
orig_spaces = _repr_state['spaces']
ret = []
props = _repr_attrs.get(obj.__class__.__name__, [])
try:
prop_spacing = _repr_state['spaces'] + len(class_line.lstrip())
separator = '\n' + ' ' * prop_spacing
for prop in props:
_repr_state['spaces'] = len(prop) + 1
try:
s = repr(getattr(obj, prop))
except Exception as ex:
s = '(repr: %s)' % ex
lines = s.split('\n')
if len(lines) > MAX_REPR_SUB_LINES:
length_ = 0
for i, line_ in enumerate(lines[:MAX_REPR_SUB_LINES]):
length_ += len(line_)
if length_ > MAX_REPR_STR_LEN:
ending_delim = []
for j in s[::-1]:
if j in ')]}':
ending_delim.insert(0, j)
else:
break
ret[-1] = '%s... %s' % (ret[-1], ''.join(ending_delim))
break
if i == 0:
ret.append('%s=%s' % (prop, line_))
else:
ret.append(line_)
else:
ret.append('%s=%s' % (prop, lines[0].lstrip()))
if len(lines) > 1:
ret.extend(lines[1:])
ret[-1] += ','
finally:
_repr_state['depth'] -= 1
_repr_state['spaces'] = orig_spaces
if 1<= len(ret) <= 3:
# Closing parenthesis on same line
ret[-1] += ')'
return ''.join(ret)
else:
# Closing parenthesis on next line
ret.append(')')
return '%s%s' % (class_line, separator.join(ret))
def __jointeq(a, b):
"""__jointeq(b2Joint a, b2Joint b) -> bool"""
return _Box2D.__jointeq(a, b)
def __bodyeq(a, b):
"""__bodyeq(b2Body a, b2Body b) -> bool"""
return _Box2D.__bodyeq(a, b)
def __shapeeq(a, b):
"""__shapeeq(b2Shape a, b2Shape b) -> bool"""
return _Box2D.__shapeeq(a, b)
def __fixtureeq(a, b):
"""__fixtureeq(b2Fixture a, b2Fixture b) -> bool"""
return _Box2D.__fixtureeq(a, b)
def __b2ComputeCentroid(vs, count):
"""__b2ComputeCentroid(b2Vec2 vs, int32 count) -> b2Vec2"""
return _Box2D.__b2ComputeCentroid(vs, count)
def b2CheckVertices(vertices, count, additional_checks=True):
"""b2CheckVertices(b2Vec2 vertices, int32 count, bool additional_checks=True) -> bool"""
return _Box2D.b2CheckVertices(vertices, count, additional_checks)
def b2CheckPolygon(shape, additional_checks=True):
"""b2CheckPolygon(b2PolygonShape shape, bool additional_checks=True) -> bool"""
return _Box2D.b2CheckPolygon(shape, additional_checks)
RAND_LIMIT = _Box2D.RAND_LIMIT
def b2Random(*args):
"""
b2Random() -> float32
b2Random(float32 lo, float32 hi) -> float32
"""
return _Box2D.b2Random(*args)
b2_epsilon = 1.192092896e-07
class _indexable_generator(list):
def __init__(self, iter):
list.__init__(self)
self.iter=iter
self.__full=False
def __len__(self):
self.__fill_list__()
return super(_indexable_generator, self).__len__()
def __iter__(self):
for item in self.iter:
self.append(item)
yield item
self.__full=True
def __fill_list__(self):
for item in self.iter:
self.append(item)
self.__full=True
def __getitem__(self, i):
"""Support indexing positive/negative elements of the generator,
but no slices. If you want those, use list(generator)"""
if not self.__full:
if i < 0:
self.__fill_list__()
elif i >= list.__len__(self):
diff=i-list.__len__(self)+1
for j in range(diff):
value = next(self.iter)
self.append(value)
return super(_indexable_generator, self).__getitem__(i)
def _generator_from_linked_list(first):
if first:
one = first
while one:
yield one
one = one.next
def _list_from_linked_list(first):
if not first:
return []
one = first
lst = []
while one:
lst.append(one)
one = one.next
# linked lists are stored in reverse order from creation order
lst.reverse()
return lst
# Support using == on bodies, joints, and shapes
def b2ShapeCompare(a, b):
if not isinstance(a, b2Shape) or not isinstance(b, b2Shape):
return False
return __shapeeq(a, b)
def b2BodyCompare(a, b):
if not isinstance(a, b2Body) or not isinstance(b, b2Body):
return False
return __bodyeq(a, b)
def b2JointCompare(a, b):
if not isinstance(a, b2Joint) or not isinstance(b, b2Joint):
return False
return __jointeq(a, b)
def b2FixtureCompare(a, b):
if not isinstance(a, b2Fixture) or not isinstance(b, b2Fixture):
return False
return __fixtureeq(a, b)
def _b2Distance(*args):
"""
_b2Distance(b2Shape shapeA, int idxA, b2Shape shapeB, int idxB, b2Transform transformA, b2Transform transformB, bool useRadii=True) -> b2DistanceOutput
_b2Distance(b2DistanceInput input) -> b2DistanceOutput
"""
return _Box2D._b2Distance(*args)
import collections
b2DistanceResult = collections.namedtuple('b2DistanceResult',
'pointA pointB distance iterations')
def b2Distance(shapeA=None, idxA=0, shapeB=None, idxB=0, transformA=None, transformB=None, useRadii=True):
"""
Compute the closest points between two shapes.
Can be called one of two ways:
+ b2Distance(b2DistanceInput)
This uses the b2DistanceInput structure, where you define your own
distance proxies
Or more conveniently using kwargs:
+ b2Distance(shapeA=.., idxA=0, shapeB=.., idxB=0, transformA=..,
transformB=.., useRadii=True)
Returns a namedtuple in the form:
b2DistanceResult(pointA=(ax, ay), pointB=(bx, by), distance,
iterations)
"""
if isinstance(shapeA, b2DistanceInput):
out = _b2Distance(shapeA)
else:
out = _b2Distance(shapeA, idxA, shapeB, idxB, transformA, transformB, useRadii)
return b2DistanceResult(pointA=tuple(out.pointA),
pointB=tuple(out.pointB),
distance=out.distance,
iterations=out.iterations)
def b2GetPointStates(manifold1, manifold2):
"""
b2GetPointStates(b2Manifold manifold1, b2Manifold manifold2) -> PyObject *
Compute the point states given two manifolds. The states pertain to the transition from manifold1 to manifold2. So state1 is either persist or remove while state2 is either add or persist.
"""
return _Box2D.b2GetPointStates(manifold1, manifold2)
class b2ContactPoint(object):
"""Proxy of C++ b2ContactPoint class."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, **kwargs):
_Box2D.b2ContactPoint_swiginit(self,_Box2D.new_b2ContactPoint())
_init_kwargs(self, **kwargs)
__swig_destroy__ = _Box2D.delete_b2ContactPoint
fixtureA = _swig_property(_Box2D.b2ContactPoint_fixtureA_get, _Box2D.b2ContactPoint_fixtureA_set)
fixtureB = _swig_property(_Box2D.b2ContactPoint_fixtureB_get, _Box2D.b2ContactPoint_fixtureB_set)
normal = _swig_property(_Box2D.b2ContactPoint_normal_get, _Box2D.b2ContactPoint_normal_set)
position = _swig_property(_Box2D.b2ContactPoint_position_get, _Box2D.b2ContactPoint_position_set)
state = _swig_property(_Box2D.b2ContactPoint_state_get, _Box2D.b2ContactPoint_state_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2ContactPoint self) -> long"""
return _Box2D.b2ContactPoint___hash__(self)
def __repr__(self):
return _format_repr(self)
b2ContactPoint.__hash__ = new_instancemethod(_Box2D.b2ContactPoint___hash__, None, b2ContactPoint)
b2ContactPoint_swigregister = _Box2D.b2ContactPoint_swigregister
b2ContactPoint_swigregister(b2ContactPoint)
b2Globals = _Box2D.b2Globals
def _b2TimeOfImpact(*args):
"""
_b2TimeOfImpact(b2Shape shapeA, int idxA, b2Shape shapeB, int idxB, b2Sweep sweepA, b2Sweep sweepB, float32 tMax) -> b2TOIOutput
_b2TimeOfImpact(b2TOIInput input) -> b2TOIOutput
"""
return _Box2D._b2TimeOfImpact(*args)
def b2TimeOfImpact(shapeA=None, idxA=0, shapeB=None, idxB=0, sweepA=None, sweepB=None, tMax=0.0):
"""
Compute the upper bound on time before two shapes penetrate. Time is represented as
a fraction between [0,tMax]. This uses a swept separating axis and may miss some intermediate,
non-tunneling collision. If you change the time interval, you should call this function
again.
Note: use b2Distance to compute the contact point and normal at the time of impact.
Can be called one of several ways:
+ b2TimeOfImpact(b2TOIInput) # utilizes the b2TOIInput structure, where you define your own proxies
Or utilizing kwargs:
+ b2TimeOfImpact(shapeA=a, shapeB=b, idxA=0, idxB=0, sweepA=sa, sweepB=sb, tMax=t)
Where idxA and idxB are optional and used only if the shapes are loops (they indicate which section to use.)
sweep[A,B] are of type b2Sweep.
Returns a tuple in the form:
(output state, time of impact)
Where output state is in b2TOIOutput.[
e_unknown,
e_failed,
e_overlapped,
e_touching,
e_separated ]
"""
if isinstance(shapeA, b2TOIInput):
toi_input = shapeA
out = _b2TimeOfImpact(toi_input)
else:
out = _b2TimeOfImpact(shapeA, idxA, shapeB, idxB, sweepA, sweepB, tMax)
return (out.state, out.t)
class b2AssertException(object):
"""Proxy of C++ b2AssertException class."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2AssertException self) -> long"""
return _Box2D.b2AssertException___hash__(self)
def __repr__(self):
return _format_repr(self)
def __init__(self):
"""__init__(b2AssertException self) -> b2AssertException"""
_Box2D.b2AssertException_swiginit(self, _Box2D.new_b2AssertException())
__swig_destroy__ = _Box2D.delete_b2AssertException
b2AssertException.__hash__ = new_instancemethod(_Box2D.b2AssertException___hash__, None, b2AssertException)
b2AssertException_swigregister = _Box2D.b2AssertException_swigregister
b2AssertException_swigregister(b2AssertException)
b2_pi = _Box2D.b2_pi
b2_maxManifoldPoints = _Box2D.b2_maxManifoldPoints
b2_maxPolygonVertices = _Box2D.b2_maxPolygonVertices
b2_aabbExtension = _Box2D.b2_aabbExtension
b2_aabbMultiplier = _Box2D.b2_aabbMultiplier
b2_linearSlop = _Box2D.b2_linearSlop
b2_angularSlop = _Box2D.b2_angularSlop
b2_polygonRadius = _Box2D.b2_polygonRadius
b2_maxSubSteps = _Box2D.b2_maxSubSteps
b2_maxTOIContacts = _Box2D.b2_maxTOIContacts
b2_velocityThreshold = _Box2D.b2_velocityThreshold
b2_maxLinearCorrection = _Box2D.b2_maxLinearCorrection
b2_maxAngularCorrection = _Box2D.b2_maxAngularCorrection
b2_maxTranslation = _Box2D.b2_maxTranslation
b2_maxTranslationSquared = _Box2D.b2_maxTranslationSquared
b2_maxRotation = _Box2D.b2_maxRotation
b2_maxRotationSquared = _Box2D.b2_maxRotationSquared
b2_baumgarte = _Box2D.b2_baumgarte
b2_toiBaugarte = _Box2D.b2_toiBaugarte
b2_timeToSleep = _Box2D.b2_timeToSleep
b2_linearSleepTolerance = _Box2D.b2_linearSleepTolerance
b2_angularSleepTolerance = _Box2D.b2_angularSleepTolerance
def b2Alloc(size):
"""
b2Alloc(int32 size) -> void *
Implement this function to use your own memory allocator.
"""
return _Box2D.b2Alloc(size)
def b2Free(mem):
"""
b2Free(void * mem)
If you implement b2Alloc, you should also implement this function.
"""
return _Box2D.b2Free(mem)
def b2Log(string):
"""b2Log(char const * string)"""
return _Box2D.b2Log(string)
class b2Version(object):
"""Version numbering scheme. See http://en.wikipedia.org/wiki/Software_versioning"""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
major = _swig_property(_Box2D.b2Version_major_get, _Box2D.b2Version_major_set)
minor = _swig_property(_Box2D.b2Version_minor_get, _Box2D.b2Version_minor_set)
revision = _swig_property(_Box2D.b2Version_revision_get, _Box2D.b2Version_revision_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2Version self) -> long"""
return _Box2D.b2Version___hash__(self)
def __repr__(self):
return _format_repr(self)
def __repr__(self):
return "b2Version(%s.%s.%s)" % (self.major, self.minor, self.revision)
def __init__(self, **kwargs):
_Box2D.b2Version_swiginit(self,_Box2D.new_b2Version())
_init_kwargs(self, **kwargs)
__swig_destroy__ = _Box2D.delete_b2Version
b2Version.__hash__ = new_instancemethod(_Box2D.b2Version___hash__, None, b2Version)
b2Version_swigregister = _Box2D.b2Version_swigregister
b2Version_swigregister(b2Version)
def b2IsValid(x):
"""
b2IsValid(float32 x) -> bool
This function is used to ensure that a floating point number is not a NaN or infinity.
"""
return _Box2D.b2IsValid(x)
def b2InvSqrt(x):
"""
b2InvSqrt(float32 x) -> float32
This is a approximate yet fast inverse square-root.
"""
return _Box2D.b2InvSqrt(x)
class b2Vec2(object):
"""A 2D column vector."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def SetZero(self):
"""
SetZero(b2Vec2 self)
Set this vector to all zeros.
"""
return _Box2D.b2Vec2_SetZero(self)
def Set(self, x_, y_):
"""
Set(b2Vec2 self, float32 x_, float32 y_)
Set this vector to some specified coordinates.
"""
return _Box2D.b2Vec2_Set(self, x_, y_)
def __neg__(self):
"""__neg__(b2Vec2 self) -> b2Vec2"""
return _Box2D.b2Vec2___neg__(self)
def __call__(self, *args):
"""
__call__(b2Vec2 self, int32 i) -> float32
__call__(b2Vec2 self, int32 i) -> float32 &
"""
return _Box2D.b2Vec2___call__(self, *args)
def __add_vector(self, v):
"""__add_vector(b2Vec2 self, b2Vec2 v)"""
return _Box2D.b2Vec2___add_vector(self, v)
def __sub_vector(self, v):
"""__sub_vector(b2Vec2 self, b2Vec2 v)"""
return _Box2D.b2Vec2___sub_vector(self, v)
def __mul_float(self, a):
"""__mul_float(b2Vec2 self, float32 a)"""
return _Box2D.b2Vec2___mul_float(self, a)
def __Length(self):
"""
__Length(b2Vec2 self) -> float32
Get the length of this vector (the norm).
"""
return _Box2D.b2Vec2___Length(self)
def __LengthSquared(self):
"""
__LengthSquared(b2Vec2 self) -> float32
Get the length squared. For performance, use this instead of b2Vec2::Length(if possible).
"""
return _Box2D.b2Vec2___LengthSquared(self)
def Normalize(self):
"""
Normalize(b2Vec2 self) -> float32
Convert this vector into a unit vector. Returns the length.
"""
return _Box2D.b2Vec2_Normalize(self)
def __IsValid(self):
"""
__IsValid(b2Vec2 self) -> bool
Does this vector contain finite coordinates?
"""
return _Box2D.b2Vec2___IsValid(self)
def __Skew(self):
"""
__Skew(b2Vec2 self) -> b2Vec2
Get the skew vector such that dot(skew_vec, other) == cross(vec, other)
"""
return _Box2D.b2Vec2___Skew(self)
x = _swig_property(_Box2D.b2Vec2_x_get, _Box2D.b2Vec2_x_set)
y = _swig_property(_Box2D.b2Vec2_y_get, _Box2D.b2Vec2_y_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2Vec2 self) -> long"""
return _Box2D.b2Vec2___hash__(self)
def __repr__(self):
return _format_repr(self)
def __init__(self, *args):
"""
__init__(b2Vec2 self, float32 x, float32 y) -> b2Vec2
__init__(b2Vec2 self) -> b2Vec2
__init__(b2Vec2 self, b2Vec2 other) -> b2Vec2
Construct using coordinates.
"""
_Box2D.b2Vec2_swiginit(self, _Box2D.new_b2Vec2(*args))
__iter__ = lambda self: iter( (self.x, self.y) )
__eq__ = lambda self, other: self.__equ(other)
__ne__ = lambda self,other: not self.__equ(other)
def __repr__(self):
return "b2Vec2(%g,%g)" % (self.x, self.y)
def __len__(self):
return 2
def __neg__(self):
return b2Vec2(-self.x, -self.y)
def copy(self):
"""
Return a copy of the vector.
Remember that the following:
a = b2Vec2()
b = a
Does not copy the vector itself, but b now refers to a.
"""
return b2Vec2(self.x, self.y)
__copy__ = copy
def __iadd__(self, other):
self.__add_vector(other)
return self
def __isub__(self, other):
self.__sub_vector(other)
return self
def __imul__(self, a):
self.__mul_float(a)
return self
def __itruediv__(self, a):
self.__div_float(a)
return self
def __idiv__(self, a):
self.__div_float(a)
return self
def __set(self, x, y):
self.x = x
self.y = y
def __nonzero__(self):
return self.x!=0.0 or self.y!=0.0
tuple = property(lambda self: (self.x, self.y), lambda self, value: self.__set(*value))
length = property(__Length, None)
lengthSquared = property(__LengthSquared, None)
valid = property(__IsValid, None)
skew = property(__Skew, None)
def cross(self, *args):
"""
cross(b2Vec2 self, b2Vec2 other) -> float32
cross(b2Vec2 self, float32 s) -> b2Vec2
"""
return _Box2D.b2Vec2_cross(self, *args)
def __getitem__(self, i):
"""__getitem__(b2Vec2 self, int i) -> float32"""
return _Box2D.b2Vec2___getitem__(self, i)
def __setitem__(self, i, value):
"""__setitem__(b2Vec2 self, int i, float32 value)"""
return _Box2D.b2Vec2___setitem__(self, i, value)
def __equ(self, other):
"""__equ(b2Vec2 self, b2Vec2 other) -> bool"""
return _Box2D.b2Vec2___equ(self, other)
def dot(self, other):
"""dot(b2Vec2 self, b2Vec2 other) -> float32"""
return _Box2D.b2Vec2_dot(self, other)
def __truediv__(self, a):
"""__truediv__(b2Vec2 self, float32 a) -> b2Vec2"""
return _Box2D.b2Vec2___truediv__(self, a)
def __div__(self, a):
"""__div__(b2Vec2 self, float32 a) -> b2Vec2"""
return _Box2D.b2Vec2___div__(self, a)
def __mul__(self, a):
"""__mul__(b2Vec2 self, float32 a) -> b2Vec2"""
return _Box2D.b2Vec2___mul__(self, a)
def __add__(self, other):
"""__add__(b2Vec2 self, b2Vec2 other) -> b2Vec2"""
return _Box2D.b2Vec2___add__(self, other)
def __sub__(self, other):
"""__sub__(b2Vec2 self, b2Vec2 other) -> b2Vec2"""
return _Box2D.b2Vec2___sub__(self, other)
def __rmul__(self, a):
"""__rmul__(b2Vec2 self, float32 a) -> b2Vec2"""
return _Box2D.b2Vec2___rmul__(self, a)
def __rdiv__(self, a):
"""__rdiv__(b2Vec2 self, float32 a) -> b2Vec2"""
return _Box2D.b2Vec2___rdiv__(self, a)
def __div_float(self, a):
"""__div_float(b2Vec2 self, float32 a)"""
return _Box2D.b2Vec2___div_float(self, a)
__swig_destroy__ = _Box2D.delete_b2Vec2
b2Vec2.SetZero = new_instancemethod(_Box2D.b2Vec2_SetZero, None, b2Vec2)
b2Vec2.Set = new_instancemethod(_Box2D.b2Vec2_Set, None, b2Vec2)
b2Vec2.__neg__ = new_instancemethod(_Box2D.b2Vec2___neg__, None, b2Vec2)
b2Vec2.__call__ = new_instancemethod(_Box2D.b2Vec2___call__, None, b2Vec2)
b2Vec2.__add_vector = new_instancemethod(_Box2D.b2Vec2___add_vector, None, b2Vec2)
b2Vec2.__sub_vector = new_instancemethod(_Box2D.b2Vec2___sub_vector, None, b2Vec2)
b2Vec2.__mul_float = new_instancemethod(_Box2D.b2Vec2___mul_float, None, b2Vec2)
b2Vec2.__Length = new_instancemethod(_Box2D.b2Vec2___Length, None, b2Vec2)
b2Vec2.__LengthSquared = new_instancemethod(_Box2D.b2Vec2___LengthSquared, None, b2Vec2)
b2Vec2.Normalize = new_instancemethod(_Box2D.b2Vec2_Normalize, None, b2Vec2)
b2Vec2.__IsValid = new_instancemethod(_Box2D.b2Vec2___IsValid, None, b2Vec2)
b2Vec2.__Skew = new_instancemethod(_Box2D.b2Vec2___Skew, None, b2Vec2)
b2Vec2.__hash__ = new_instancemethod(_Box2D.b2Vec2___hash__, None, b2Vec2)
b2Vec2.cross = new_instancemethod(_Box2D.b2Vec2_cross, None, b2Vec2)
b2Vec2.__getitem__ = new_instancemethod(_Box2D.b2Vec2___getitem__, None, b2Vec2)
b2Vec2.__setitem__ = new_instancemethod(_Box2D.b2Vec2___setitem__, None, b2Vec2)
b2Vec2.__equ = new_instancemethod(_Box2D.b2Vec2___equ, None, b2Vec2)
b2Vec2.dot = new_instancemethod(_Box2D.b2Vec2_dot, None, b2Vec2)
b2Vec2.__truediv__ = new_instancemethod(_Box2D.b2Vec2___truediv__, None, b2Vec2)
b2Vec2.__div__ = new_instancemethod(_Box2D.b2Vec2___div__, None, b2Vec2)
b2Vec2.__mul__ = new_instancemethod(_Box2D.b2Vec2___mul__, None, b2Vec2)
b2Vec2.__add__ = new_instancemethod(_Box2D.b2Vec2___add__, None, b2Vec2)
b2Vec2.__sub__ = new_instancemethod(_Box2D.b2Vec2___sub__, None, b2Vec2)
b2Vec2.__rmul__ = new_instancemethod(_Box2D.b2Vec2___rmul__, None, b2Vec2)
b2Vec2.__rdiv__ = new_instancemethod(_Box2D.b2Vec2___rdiv__, None, b2Vec2)
b2Vec2.__div_float = new_instancemethod(_Box2D.b2Vec2___div_float, None, b2Vec2)
b2Vec2_swigregister = _Box2D.b2Vec2_swigregister
b2Vec2_swigregister(b2Vec2)
class b2Vec3(object):
"""A 2D column vector with 3 elements."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def SetZero(self):
"""
SetZero(b2Vec3 self)
Set this vector to all zeros.
"""
return _Box2D.b2Vec3_SetZero(self)
def Set(self, x_, y_, z_):
"""
Set(b2Vec3 self, float32 x_, float32 y_, float32 z_)
Set this vector to some specified coordinates.
"""
return _Box2D.b2Vec3_Set(self, x_, y_, z_)
def __neg__(self):
"""__neg__(b2Vec3 self) -> b2Vec3"""
return _Box2D.b2Vec3___neg__(self)
def __add_vector(self, v):
"""__add_vector(b2Vec3 self, b2Vec3 v)"""
return _Box2D.b2Vec3___add_vector(self, v)
def __sub_vector(self, v):
"""__sub_vector(b2Vec3 self, b2Vec3 v)"""
return _Box2D.b2Vec3___sub_vector(self, v)
def __mul_float(self, s):
"""__mul_float(b2Vec3 self, float32 s)"""
return _Box2D.b2Vec3___mul_float(self, s)
x = _swig_property(_Box2D.b2Vec3_x_get, _Box2D.b2Vec3_x_set)
y = _swig_property(_Box2D.b2Vec3_y_get, _Box2D.b2Vec3_y_set)
z = _swig_property(_Box2D.b2Vec3_z_get, _Box2D.b2Vec3_z_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2Vec3 self) -> long"""
return _Box2D.b2Vec3___hash__(self)
def __repr__(self):
return _format_repr(self)
def __init__(self, *args):
"""
__init__(b2Vec3 self, float32 x, float32 y, float32 z) -> b2Vec3
__init__(b2Vec3 self) -> b2Vec3
__init__(b2Vec3 self, b2Vec3 other) -> b2Vec3
__init__(b2Vec3 self, b2Vec2 other) -> b2Vec3
Construct using coordinates.
"""
_Box2D.b2Vec3_swiginit(self, _Box2D.new_b2Vec3(*args))
__iter__ = lambda self: iter( (self.x, self.y, self.z) )
__eq__ = lambda self, other: (self.x == other.x and self.y == other.y and self.z == other.z)
__ne__ = lambda self, other: (self.x != other.x or self.y != other.y or self.z != other.z)
def __repr__(self):
return "b2Vec3(%g,%g,%g)" % (self.x, self.y, self.z)
def __len__(self):
return 3
def __neg__(self):
return b2Vec3(-self.x, -self.y, -self.z)
def copy(self):
"""
Return a copy of the vector.
Remember that the following:
a = b2Vec3()
b = a
Does not copy the vector itself, but b now refers to a.
"""
return b2Vec3(self.x, self.y, self.z)
__copy__ = copy
def __iadd__(self, other):
self.__add_vector(other)
return self
def __isub__(self, other):
self.__sub_vector(other)
return self
def __imul__(self, a):
self.__mul_float(a)
return self
def __itruediv__(self, a):
self.__div_float(a)
return self
def __idiv__(self, a):
self.__div_float(a)
return self
def dot(self, v):
"""
Dot product with v (list/tuple or b2Vec3)
"""
if isinstance(v, (list, tuple)):
return self.x*v[0] + self.y*v[1] + self.z*v[2]
else:
return self.x*v.x + self.y*v.y + self.z*v.z
def __set(self, x, y, z):
self.x = x
self.y = y
self.z = z
def __nonzero__(self):
return self.x!=0.0 or self.y!=0.0 or self.z!=0.0
tuple = property(lambda self: (self.x, self.y, self.z), lambda self, value: self.__set(*value))
length = property(_Box2D.b2Vec3___Length, None)
lengthSquared = property(_Box2D.b2Vec3___LengthSquared, None)
valid = property(_Box2D.b2Vec3___IsValid, None)
def cross(self, b):
"""cross(b2Vec3 self, b2Vec3 b) -> b2Vec3"""
return _Box2D.b2Vec3_cross(self, b)
def __getitem__(self, i):
"""__getitem__(b2Vec3 self, int i) -> float32"""
return _Box2D.b2Vec3___getitem__(self, i)
def __setitem__(self, i, value):
"""__setitem__(b2Vec3 self, int i, float32 value)"""
return _Box2D.b2Vec3___setitem__(self, i, value)
def __IsValid(self):
"""__IsValid(b2Vec3 self) -> bool"""
return _Box2D.b2Vec3___IsValid(self)
def __Length(self):
"""__Length(b2Vec3 self) -> float32"""
return _Box2D.b2Vec3___Length(self)
def __LengthSquared(self):
"""__LengthSquared(b2Vec3 self) -> float32"""
return _Box2D.b2Vec3___LengthSquared(self)
def __truediv__(self, a):
"""__truediv__(b2Vec3 self, float32 a) -> b2Vec3"""
return _Box2D.b2Vec3___truediv__(self, a)
def __div__(self, a):
"""__div__(b2Vec3 self, float32 a) -> b2Vec3"""
return _Box2D.b2Vec3___div__(self, a)
def __mul__(self, a):
"""__mul__(b2Vec3 self, float32 a) -> b2Vec3"""
return _Box2D.b2Vec3___mul__(self, a)
def __add__(self, other):
"""__add__(b2Vec3 self, b2Vec3 other) -> b2Vec3"""
return _Box2D.b2Vec3___add__(self, other)
def __sub__(self, other):
"""__sub__(b2Vec3 self, b2Vec3 other) -> b2Vec3"""
return _Box2D.b2Vec3___sub__(self, other)
def __rmul__(self, a):
"""__rmul__(b2Vec3 self, float32 a) -> b2Vec3"""
return _Box2D.b2Vec3___rmul__(self, a)
def __rdiv__(self, a):
"""__rdiv__(b2Vec3 self, float32 a) -> b2Vec3"""
return _Box2D.b2Vec3___rdiv__(self, a)
def __div_float(self, a):
"""__div_float(b2Vec3 self, float32 a)"""
return _Box2D.b2Vec3___div_float(self, a)
__swig_destroy__ = _Box2D.delete_b2Vec3
b2Vec3.SetZero = new_instancemethod(_Box2D.b2Vec3_SetZero, None, b2Vec3)
b2Vec3.Set = new_instancemethod(_Box2D.b2Vec3_Set, None, b2Vec3)
b2Vec3.__neg__ = new_instancemethod(_Box2D.b2Vec3___neg__, None, b2Vec3)
b2Vec3.__add_vector = new_instancemethod(_Box2D.b2Vec3___add_vector, None, b2Vec3)
b2Vec3.__sub_vector = new_instancemethod(_Box2D.b2Vec3___sub_vector, None, b2Vec3)
b2Vec3.__mul_float = new_instancemethod(_Box2D.b2Vec3___mul_float, None, b2Vec3)
b2Vec3.__hash__ = new_instancemethod(_Box2D.b2Vec3___hash__, None, b2Vec3)
b2Vec3.cross = new_instancemethod(_Box2D.b2Vec3_cross, None, b2Vec3)
b2Vec3.__getitem__ = new_instancemethod(_Box2D.b2Vec3___getitem__, None, b2Vec3)
b2Vec3.__setitem__ = new_instancemethod(_Box2D.b2Vec3___setitem__, None, b2Vec3)
b2Vec3.__IsValid = new_instancemethod(_Box2D.b2Vec3___IsValid, None, b2Vec3)
b2Vec3.__Length = new_instancemethod(_Box2D.b2Vec3___Length, None, b2Vec3)
b2Vec3.__LengthSquared = new_instancemethod(_Box2D.b2Vec3___LengthSquared, None, b2Vec3)
b2Vec3.__truediv__ = new_instancemethod(_Box2D.b2Vec3___truediv__, None, b2Vec3)
b2Vec3.__div__ = new_instancemethod(_Box2D.b2Vec3___div__, None, b2Vec3)
b2Vec3.__mul__ = new_instancemethod(_Box2D.b2Vec3___mul__, None, b2Vec3)
b2Vec3.__add__ = new_instancemethod(_Box2D.b2Vec3___add__, None, b2Vec3)
b2Vec3.__sub__ = new_instancemethod(_Box2D.b2Vec3___sub__, None, b2Vec3)
b2Vec3.__rmul__ = new_instancemethod(_Box2D.b2Vec3___rmul__, None, b2Vec3)
b2Vec3.__rdiv__ = new_instancemethod(_Box2D.b2Vec3___rdiv__, None, b2Vec3)
b2Vec3.__div_float = new_instancemethod(_Box2D.b2Vec3___div_float, None, b2Vec3)
b2Vec3_swigregister = _Box2D.b2Vec3_swigregister
b2Vec3_swigregister(b2Vec3)
class b2Mat22(object):
"""A 2-by-2 matrix. Stored in column-major order."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def SetIdentity(self):
"""
SetIdentity(b2Mat22 self)
Set this to the identity matrix.
"""
return _Box2D.b2Mat22_SetIdentity(self)
def SetZero(self):
"""
SetZero(b2Mat22 self)
Set this matrix to all zeros.
"""
return _Box2D.b2Mat22_SetZero(self)
def __GetInverse(self):
"""__GetInverse(b2Mat22 self) -> b2Mat22"""
return _Box2D.b2Mat22___GetInverse(self)
def Solve(self, b):
"""
Solve(b2Mat22 self, b2Vec2 b) -> b2Vec2
Solve A * x = b, where b is a column vector. This is more efficient than computing the inverse in one-shot cases.
"""
return _Box2D.b2Mat22_Solve(self, b)
col1 = _swig_property(_Box2D.b2Mat22_col1_get, _Box2D.b2Mat22_col1_set)
col2 = _swig_property(_Box2D.b2Mat22_col2_get, _Box2D.b2Mat22_col2_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2Mat22 self) -> long"""
return _Box2D.b2Mat22___hash__(self)
def __repr__(self):
return _format_repr(self)
def __init__(self, *args):
"""
__init__(b2Mat22 self, b2Vec2 c1, b2Vec2 c2) -> b2Mat22
__init__(b2Mat22 self, float32 a11, float32 a12, float32 a21, float32 a22) -> b2Mat22
__init__(b2Mat22 self) -> b2Mat22
Construct this matrix using an angle. This matrix becomes an orthonormal rotation matrix.
"""
_Box2D.b2Mat22_swiginit(self, _Box2D.new_b2Mat22(*args))
def __GetAngle(self):
"""__GetAngle(b2Mat22 self) -> float32"""
return _Box2D.b2Mat22___GetAngle(self)
def __SetAngle(self, *args):
"""
__SetAngle(b2Mat22 self, b2Vec2 c1, b2Vec2 c2)
__SetAngle(b2Mat22 self, float32 angle)
"""
return _Box2D.b2Mat22___SetAngle(self, *args)
# Read-only
inverse = property(__GetInverse, None)
angle = property(__GetAngle, __SetAngle)
ex = property(lambda self: self.col1,
lambda self, v: setattr(self, 'col1', v))
ey = property(lambda self: self.col2,
lambda self, v: setattr(self, 'col2', v))
set = __SetAngle
def __mul__(self, *args):
"""
__mul__(b2Mat22 self, b2Vec2 v) -> b2Vec2
__mul__(b2Mat22 self, b2Mat22 m) -> b2Mat22
"""
return _Box2D.b2Mat22___mul__(self, *args)
def __add__(self, m):
"""__add__(b2Mat22 self, b2Mat22 m) -> b2Mat22"""
return _Box2D.b2Mat22___add__(self, m)
def __sub__(self, m):
"""__sub__(b2Mat22 self, b2Mat22 m) -> b2Mat22"""
return _Box2D.b2Mat22___sub__(self, m)
def __iadd(self, m):
"""__iadd(b2Mat22 self, b2Mat22 m)"""
return _Box2D.b2Mat22___iadd(self, m)
def __isub(self, m):
"""__isub(b2Mat22 self, b2Mat22 m)"""
return _Box2D.b2Mat22___isub(self, m)
__swig_destroy__ = _Box2D.delete_b2Mat22
b2Mat22.SetIdentity = new_instancemethod(_Box2D.b2Mat22_SetIdentity, None, b2Mat22)
b2Mat22.SetZero = new_instancemethod(_Box2D.b2Mat22_SetZero, None, b2Mat22)
b2Mat22.__GetInverse = new_instancemethod(_Box2D.b2Mat22___GetInverse, None, b2Mat22)
b2Mat22.Solve = new_instancemethod(_Box2D.b2Mat22_Solve, None, b2Mat22)
b2Mat22.__hash__ = new_instancemethod(_Box2D.b2Mat22___hash__, None, b2Mat22)
b2Mat22.__GetAngle = new_instancemethod(_Box2D.b2Mat22___GetAngle, None, b2Mat22)
b2Mat22.__SetAngle = new_instancemethod(_Box2D.b2Mat22___SetAngle, None, b2Mat22)
b2Mat22.__mul__ = new_instancemethod(_Box2D.b2Mat22___mul__, None, b2Mat22)
b2Mat22.__add__ = new_instancemethod(_Box2D.b2Mat22___add__, None, b2Mat22)
b2Mat22.__sub__ = new_instancemethod(_Box2D.b2Mat22___sub__, None, b2Mat22)
b2Mat22.__iadd = new_instancemethod(_Box2D.b2Mat22___iadd, None, b2Mat22)
b2Mat22.__isub = new_instancemethod(_Box2D.b2Mat22___isub, None, b2Mat22)
b2Mat22_swigregister = _Box2D.b2Mat22_swigregister
b2Mat22_swigregister(b2Mat22)
class b2Mat33(object):
"""A 3-by-3 matrix. Stored in column-major order."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def SetZero(self):
"""
SetZero(b2Mat33 self)
Set this matrix to all zeros.
"""
return _Box2D.b2Mat33_SetZero(self)
def Solve33(self, b):
"""
Solve33(b2Mat33 self, b2Vec3 b) -> b2Vec3
Solve A * x = b, where b is a column vector. This is more efficient than computing the inverse in one-shot cases.
"""
return _Box2D.b2Mat33_Solve33(self, b)
def Solve22(self, b):
"""
Solve22(b2Mat33 self, b2Vec2 b) -> b2Vec2
Solve A * x = b, where b is a column vector. This is more efficient than computing the inverse in one-shot cases. Solve only the upper 2-by-2 matrix equation.
"""
return _Box2D.b2Mat33_Solve22(self, b)
def GetInverse22(self, M):
"""GetInverse22(b2Mat33 self, b2Mat33 M)"""
return _Box2D.b2Mat33_GetInverse22(self, M)
def GetSymInverse33(self, M):
"""GetSymInverse33(b2Mat33 self, b2Mat33 M)"""
return _Box2D.b2Mat33_GetSymInverse33(self, M)
col1 = _swig_property(_Box2D.b2Mat33_col1_get, _Box2D.b2Mat33_col1_set)
col2 = _swig_property(_Box2D.b2Mat33_col2_get, _Box2D.b2Mat33_col2_set)
col3 = _swig_property(_Box2D.b2Mat33_col3_get, _Box2D.b2Mat33_col3_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2Mat33 self) -> long"""
return _Box2D.b2Mat33___hash__(self)
def __repr__(self):
return _format_repr(self)
def __init__(self, *args):
"""
__init__(b2Mat33 self, b2Vec3 c1, b2Vec3 c2, b2Vec3 c3) -> b2Mat33
__init__(b2Mat33 self) -> b2Mat33
Construct this matrix using columns.
"""
_Box2D.b2Mat33_swiginit(self, _Box2D.new_b2Mat33(*args))
ex = property(lambda self: self.col1, lambda self, v: setattr(self, 'col1', v))
ey = property(lambda self: self.col2, lambda self, v: setattr(self, 'col2', v))
ez = property(lambda self: self.col3, lambda self, v: setattr(self, 'col3', v))
def __mul__(self, v):
"""__mul__(b2Mat33 self, b2Vec3 v) -> b2Vec3"""
return _Box2D.b2Mat33___mul__(self, v)
def __add__(self, other):
"""__add__(b2Mat33 self, b2Mat33 other) -> b2Mat33"""
return _Box2D.b2Mat33___add__(self, other)
def __sub__(self, other):
"""__sub__(b2Mat33 self, b2Mat33 other) -> b2Mat33"""
return _Box2D.b2Mat33___sub__(self, other)
def __iadd(self, other):
"""__iadd(b2Mat33 self, b2Mat33 other)"""
return _Box2D.b2Mat33___iadd(self, other)
def __isub(self, other):
"""__isub(b2Mat33 self, b2Mat33 other)"""
return _Box2D.b2Mat33___isub(self, other)
__swig_destroy__ = _Box2D.delete_b2Mat33
b2Mat33.SetZero = new_instancemethod(_Box2D.b2Mat33_SetZero, None, b2Mat33)
b2Mat33.Solve33 = new_instancemethod(_Box2D.b2Mat33_Solve33, None, b2Mat33)
b2Mat33.Solve22 = new_instancemethod(_Box2D.b2Mat33_Solve22, None, b2Mat33)
b2Mat33.GetInverse22 = new_instancemethod(_Box2D.b2Mat33_GetInverse22, None, b2Mat33)
b2Mat33.GetSymInverse33 = new_instancemethod(_Box2D.b2Mat33_GetSymInverse33, None, b2Mat33)
b2Mat33.__hash__ = new_instancemethod(_Box2D.b2Mat33___hash__, None, b2Mat33)
b2Mat33.__mul__ = new_instancemethod(_Box2D.b2Mat33___mul__, None, b2Mat33)
b2Mat33.__add__ = new_instancemethod(_Box2D.b2Mat33___add__, None, b2Mat33)
b2Mat33.__sub__ = new_instancemethod(_Box2D.b2Mat33___sub__, None, b2Mat33)
b2Mat33.__iadd = new_instancemethod(_Box2D.b2Mat33___iadd, None, b2Mat33)
b2Mat33.__isub = new_instancemethod(_Box2D.b2Mat33___isub, None, b2Mat33)
b2Mat33_swigregister = _Box2D.b2Mat33_swigregister
b2Mat33_swigregister(b2Mat33)
class b2Rot(object):
"""Proxy of C++ b2Rot class."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, *args):
"""
__init__(b2Rot self) -> b2Rot
__init__(b2Rot self, float32 angle) -> b2Rot
"""
_Box2D.b2Rot_swiginit(self, _Box2D.new_b2Rot(*args))
def __SetAngle(self, angle):
"""__SetAngle(b2Rot self, float32 angle)"""
return _Box2D.b2Rot___SetAngle(self, angle)
def SetIdentity(self):
"""SetIdentity(b2Rot self)"""
return _Box2D.b2Rot_SetIdentity(self)
def __GetAngle(self):
"""__GetAngle(b2Rot self) -> float32"""
return _Box2D.b2Rot___GetAngle(self)
def GetXAxis(self):
"""GetXAxis(b2Rot self) -> b2Vec2"""
return _Box2D.b2Rot_GetXAxis(self)
def GetYAxis(self):
"""GetYAxis(b2Rot self) -> b2Vec2"""
return _Box2D.b2Rot_GetYAxis(self)
s = _swig_property(_Box2D.b2Rot_s_get, _Box2D.b2Rot_s_set)
c = _swig_property(_Box2D.b2Rot_c_get, _Box2D.b2Rot_c_set)
angle = property(__GetAngle, __SetAngle)
x_axis = property(GetXAxis, None)
y_axis = property(GetYAxis, None)
def __mul__(self, v):
"""__mul__(b2Rot self, b2Vec2 v) -> b2Vec2"""
return _Box2D.b2Rot___mul__(self, v)
__swig_destroy__ = _Box2D.delete_b2Rot
b2Rot.__SetAngle = new_instancemethod(_Box2D.b2Rot___SetAngle, None, b2Rot)
b2Rot.SetIdentity = new_instancemethod(_Box2D.b2Rot_SetIdentity, None, b2Rot)
b2Rot.__GetAngle = new_instancemethod(_Box2D.b2Rot___GetAngle, None, b2Rot)
b2Rot.GetXAxis = new_instancemethod(_Box2D.b2Rot_GetXAxis, None, b2Rot)
b2Rot.GetYAxis = new_instancemethod(_Box2D.b2Rot_GetYAxis, None, b2Rot)
b2Rot.__mul__ = new_instancemethod(_Box2D.b2Rot___mul__, None, b2Rot)
b2Rot_swigregister = _Box2D.b2Rot_swigregister
b2Rot_swigregister(b2Rot)
class b2Transform(object):
"""A transform contains translation and rotation. It is used to represent the position and orientation of rigid frames."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, *args):
"""
__init__(b2Transform self) -> b2Transform
__init__(b2Transform self, b2Vec2 position, b2Rot rotation) -> b2Transform
Initialize using a position vector and a rotation matrix.
"""
_Box2D.b2Transform_swiginit(self, _Box2D.new_b2Transform(*args))
def SetIdentity(self):
"""
SetIdentity(b2Transform self)
Set this to the identity transform.
"""
return _Box2D.b2Transform_SetIdentity(self)
def Set(self, position, angle):
"""
Set(b2Transform self, b2Vec2 position, float32 angle)
Set this based on the position and angle.
"""
return _Box2D.b2Transform_Set(self, position, angle)
position = _swig_property(_Box2D.b2Transform_position_get, _Box2D.b2Transform_position_set)
q = _swig_property(_Box2D.b2Transform_q_get, _Box2D.b2Transform_q_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2Transform self) -> long"""
return _Box2D.b2Transform___hash__(self)
def __repr__(self):
return _format_repr(self)
def __get_rotation_matrix(self):
"""__get_rotation_matrix(b2Transform self) -> b2Rot"""
return _Box2D.b2Transform___get_rotation_matrix(self)
def __get_angle(self):
return self.q.angle
def __set_angle(self, angle):
self.q.angle = angle
def __set_rotation_matrix(self, rot_matrix):
self.q.angle = rot_matrix.angle
angle = property(__get_angle, __set_angle)
R = property(__get_rotation_matrix, __set_rotation_matrix)
def __mul__(self, v):
"""__mul__(b2Transform self, b2Vec2 v) -> b2Vec2"""
return _Box2D.b2Transform___mul__(self, v)
__swig_destroy__ = _Box2D.delete_b2Transform
b2Transform.SetIdentity = new_instancemethod(_Box2D.b2Transform_SetIdentity, None, b2Transform)
b2Transform.Set = new_instancemethod(_Box2D.b2Transform_Set, None, b2Transform)
b2Transform.__hash__ = new_instancemethod(_Box2D.b2Transform___hash__, None, b2Transform)
b2Transform.__get_rotation_matrix = new_instancemethod(_Box2D.b2Transform___get_rotation_matrix, None, b2Transform)
b2Transform.__mul__ = new_instancemethod(_Box2D.b2Transform___mul__, None, b2Transform)
b2Transform_swigregister = _Box2D.b2Transform_swigregister
b2Transform_swigregister(b2Transform)
class b2Sweep(object):
"""This describes the motion of a body/shape for TOI computation. Shapes are defined with respect to the body origin, which may no coincide with the center of mass. However, to support dynamics we must interpolate the center of mass position."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def Advance(self, alpha):
"""
Advance(b2Sweep self, float32 alpha)
Advance the sweep forward, yielding a new initial state.
Parameters:
-----------
alpha:
the new initial time.
"""
return _Box2D.b2Sweep_Advance(self, alpha)
def Normalize(self):
"""
Normalize(b2Sweep self)
Normalize the angles.
"""
return _Box2D.b2Sweep_Normalize(self)
localCenter = _swig_property(_Box2D.b2Sweep_localCenter_get, _Box2D.b2Sweep_localCenter_set)
c0 = _swig_property(_Box2D.b2Sweep_c0_get, _Box2D.b2Sweep_c0_set)
c = _swig_property(_Box2D.b2Sweep_c_get, _Box2D.b2Sweep_c_set)
a0 = _swig_property(_Box2D.b2Sweep_a0_get, _Box2D.b2Sweep_a0_set)
a = _swig_property(_Box2D.b2Sweep_a_get, _Box2D.b2Sweep_a_set)
alpha0 = _swig_property(_Box2D.b2Sweep_alpha0_get, _Box2D.b2Sweep_alpha0_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2Sweep self) -> long"""
return _Box2D.b2Sweep___hash__(self)
def __repr__(self):
return _format_repr(self)
def GetTransform(self, *args):
"""
GetTransform(b2Sweep self, b2Transform xfb, float32 beta)
GetTransform(b2Sweep self, float32 alpha) -> b2Transform
Get the interpolated transform at a specific time.
Parameters:
-----------
beta:
is a factor in [0,1], where 0 indicates alpha0.
"""
return _Box2D.b2Sweep_GetTransform(self, *args)
def __init__(self, **kwargs):
_Box2D.b2Sweep_swiginit(self,_Box2D.new_b2Sweep())
_init_kwargs(self, **kwargs)
__swig_destroy__ = _Box2D.delete_b2Sweep
b2Sweep.Advance = new_instancemethod(_Box2D.b2Sweep_Advance, None, b2Sweep)
b2Sweep.Normalize = new_instancemethod(_Box2D.b2Sweep_Normalize, None, b2Sweep)
b2Sweep.__hash__ = new_instancemethod(_Box2D.b2Sweep___hash__, None, b2Sweep)
b2Sweep.GetTransform = new_instancemethod(_Box2D.b2Sweep_GetTransform, None, b2Sweep)
b2Sweep_swigregister = _Box2D.b2Sweep_swigregister
b2Sweep_swigregister(b2Sweep)
def b2DistanceSquared(a, b):
"""b2DistanceSquared(b2Vec2 a, b2Vec2 b) -> float32"""
return _Box2D.b2DistanceSquared(a, b)
def b2Dot(*args):
"""
b2Dot(b2Vec2 a, b2Vec2 b) -> float32
b2Dot(b2Vec3 a, b2Vec3 b) -> float32
Perform the dot product on two vectors.
"""
return _Box2D.b2Dot(*args)
def b2Cross(*args):
"""
b2Cross(b2Vec2 a, b2Vec2 b) -> float32
b2Cross(b2Vec2 a, float32 s) -> b2Vec2
b2Cross(float32 s, b2Vec2 a) -> b2Vec2
b2Cross(b2Vec3 a, b2Vec3 b) -> b2Vec3
Perform the cross product on two vectors.
"""
return _Box2D.b2Cross(*args)
def b2Mul22(A, v):
"""b2Mul22(b2Mat33 A, b2Vec2 v) -> b2Vec2"""
return _Box2D.b2Mul22(A, v)
def b2Mul(*args):
"""
b2Mul(b2Mat22 A, b2Vec2 v) -> b2Vec2
b2Mul(b2Mat22 A, b2Mat22 B) -> b2Mat22
b2Mul(b2Mat33 A, b2Vec3 v) -> b2Vec3
b2Mul(b2Rot q, b2Rot r) -> b2Rot
b2Mul(b2Rot q, b2Vec2 v) -> b2Vec2
b2Mul(b2Transform T, b2Vec2 v) -> b2Vec2
b2Mul(b2Transform A, b2Transform B) -> b2Transform
Multiply a matrix times a vector.
"""
return _Box2D.b2Mul(*args)
def b2MulT(*args):
"""
b2MulT(b2Mat22 A, b2Vec2 v) -> b2Vec2
b2MulT(b2Mat22 A, b2Mat22 B) -> b2Mat22
b2MulT(b2Rot q, b2Rot r) -> b2Rot
b2MulT(b2Rot q, b2Vec2 v) -> b2Vec2
b2MulT(b2Transform T, b2Vec2 v) -> b2Vec2
b2MulT(b2Transform A, b2Transform B) -> b2Transform
Multiply a matrix transpose times a vector. If a rotation matrix is provided, then this transforms the vector from one frame to another (inverse transform).
"""
return _Box2D.b2MulT(*args)
def b2Abs(*args):
"""
b2Abs(b2Vec2 a) -> b2Vec2
b2Abs(b2Mat22 A) -> b2Mat22
"""
return _Box2D.b2Abs(*args)
def b2Min(a, b):
"""b2Min(b2Vec2 a, b2Vec2 b) -> b2Vec2"""
return _Box2D.b2Min(a, b)
def b2Max(a, b):
"""b2Max(b2Vec2 a, b2Vec2 b) -> b2Vec2"""
return _Box2D.b2Max(a, b)
def b2Clamp(a, low, high):
"""b2Clamp(b2Vec2 a, b2Vec2 low, b2Vec2 high) -> b2Vec2"""
return _Box2D.b2Clamp(a, low, high)
def b2NextPowerOfTwo(x):
"""
b2NextPowerOfTwo(uint32 x) -> uint32
"Next Largest Power of 2 Given a binary integer value x, the next largest power of 2 can be computed by a SWAR algorithm that recursively "folds" the upper bits into the lower bits. This process yields a bit vector with the same most significant 1 as x, but all 1's below it. Adding 1 to that value yields the next largest power of 2. For a 32-bit value:"
"""
return _Box2D.b2NextPowerOfTwo(x)
def b2IsPowerOfTwo(x):
"""b2IsPowerOfTwo(uint32 x) -> bool"""
return _Box2D.b2IsPowerOfTwo(x)
class b2ContactFeature(object):
"""The features that intersect to form the contact point This must be 4 bytes or less."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
e_vertex = _Box2D.b2ContactFeature_e_vertex
e_face = _Box2D.b2ContactFeature_e_face
indexA = _swig_property(_Box2D.b2ContactFeature_indexA_get, _Box2D.b2ContactFeature_indexA_set)
indexB = _swig_property(_Box2D.b2ContactFeature_indexB_get, _Box2D.b2ContactFeature_indexB_set)
typeA = _swig_property(_Box2D.b2ContactFeature_typeA_get, _Box2D.b2ContactFeature_typeA_set)
typeB = _swig_property(_Box2D.b2ContactFeature_typeB_get, _Box2D.b2ContactFeature_typeB_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2ContactFeature self) -> long"""
return _Box2D.b2ContactFeature___hash__(self)
def __repr__(self):
return _format_repr(self)
def __init__(self):
"""
__init__(b2ContactFeature self) -> b2ContactFeature
The features that intersect to form the contact point This must be 4 bytes or less.
"""
_Box2D.b2ContactFeature_swiginit(self, _Box2D.new_b2ContactFeature())
__swig_destroy__ = _Box2D.delete_b2ContactFeature
b2ContactFeature.__hash__ = new_instancemethod(_Box2D.b2ContactFeature___hash__, None, b2ContactFeature)
b2ContactFeature_swigregister = _Box2D.b2ContactFeature_swigregister
b2ContactFeature_swigregister(b2ContactFeature)
b2Vec2_zero = b2Globals.b2Vec2_zero
b2_nullFeature = b2Globals.b2_nullFeature
class b2ContactID(object):
"""Proxy of C++ b2ContactID class."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
cf = _swig_property(_Box2D.b2ContactID_cf_get, _Box2D.b2ContactID_cf_set)
key = _swig_property(_Box2D.b2ContactID_key_get, _Box2D.b2ContactID_key_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2ContactID self) -> long"""
return _Box2D.b2ContactID___hash__(self)
def __repr__(self):
return _format_repr(self)
def __init__(self, **kwargs):
_Box2D.b2ContactID_swiginit(self,_Box2D.new_b2ContactID())
_init_kwargs(self, **kwargs)
__swig_destroy__ = _Box2D.delete_b2ContactID
b2ContactID.__hash__ = new_instancemethod(_Box2D.b2ContactID___hash__, None, b2ContactID)
b2ContactID_swigregister = _Box2D.b2ContactID_swigregister
b2ContactID_swigregister(b2ContactID)
class b2ManifoldPoint(object):
"""A manifold point is a contact point belonging to a contact manifold. It holds details related to the geometry and dynamics of the contact points. The local point usage depends on the manifold type: -e_circles: the local center of circleB -e_faceA: the local center of cirlceB or the clip point of polygonB -e_faceB: the clip point of polygonA This structure is stored across time steps, so we keep it small. Note: the impulses are used for internal caching and may not provide reliable contact forces, especially for high speed collisions."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
localPoint = _swig_property(_Box2D.b2ManifoldPoint_localPoint_get, _Box2D.b2ManifoldPoint_localPoint_set)
normalImpulse = _swig_property(_Box2D.b2ManifoldPoint_normalImpulse_get, _Box2D.b2ManifoldPoint_normalImpulse_set)
tangentImpulse = _swig_property(_Box2D.b2ManifoldPoint_tangentImpulse_get, _Box2D.b2ManifoldPoint_tangentImpulse_set)
id = _swig_property(_Box2D.b2ManifoldPoint_id_get, _Box2D.b2ManifoldPoint_id_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2ManifoldPoint self) -> long"""
return _Box2D.b2ManifoldPoint___hash__(self)
def __repr__(self):
return _format_repr(self)
def __init__(self, **kwargs):
_Box2D.b2ManifoldPoint_swiginit(self,_Box2D.new_b2ManifoldPoint())
_init_kwargs(self, **kwargs)
__swig_destroy__ = _Box2D.delete_b2ManifoldPoint
b2ManifoldPoint.__hash__ = new_instancemethod(_Box2D.b2ManifoldPoint___hash__, None, b2ManifoldPoint)
b2ManifoldPoint_swigregister = _Box2D.b2ManifoldPoint_swigregister
b2ManifoldPoint_swigregister(b2ManifoldPoint)
class b2Manifold(object):
"""
A manifold for two touching convex shapes. Box2D supports multiple types of contact:
clip point versus plane with radius
point versus point with radius (circles) The local point usage depends on the manifold type: -e_circles: the local center of circleA -e_faceA: the center of faceA -e_faceB: the center of faceB Similarly the local normal usage: -e_circles: not used -e_faceA: the normal on polygonA -e_faceB: the normal on polygonB We store contacts in this way so that position correction can account for movement, which is critical for continuous physics. All contact scenarios must be expressed in one of these types. This structure is stored across time steps, so we keep it small.
"""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
e_circles = _Box2D.b2Manifold_e_circles
e_faceA = _Box2D.b2Manifold_e_faceA
e_faceB = _Box2D.b2Manifold_e_faceB
localNormal = _swig_property(_Box2D.b2Manifold_localNormal_get, _Box2D.b2Manifold_localNormal_set)
localPoint = _swig_property(_Box2D.b2Manifold_localPoint_get, _Box2D.b2Manifold_localPoint_set)
type_ = _swig_property(_Box2D.b2Manifold_type__get, _Box2D.b2Manifold_type__set)
pointCount = _swig_property(_Box2D.b2Manifold_pointCount_get, _Box2D.b2Manifold_pointCount_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2Manifold self) -> long"""
return _Box2D.b2Manifold___hash__(self)
def __repr__(self):
return _format_repr(self)
def __GetPoints(self):
return [self.__GetPoint(i) for i in range(self.pointCount)]
points = property(__GetPoints, None)
def __GetPoint(self, i):
"""__GetPoint(b2Manifold self, int i) -> b2ManifoldPoint"""
return _Box2D.b2Manifold___GetPoint(self, i)
def __init__(self, **kwargs):
_Box2D.b2Manifold_swiginit(self,_Box2D.new_b2Manifold())
_init_kwargs(self, **kwargs)
__swig_destroy__ = _Box2D.delete_b2Manifold
b2Manifold.__hash__ = new_instancemethod(_Box2D.b2Manifold___hash__, None, b2Manifold)
b2Manifold.__GetPoint = new_instancemethod(_Box2D.b2Manifold___GetPoint, None, b2Manifold)
b2Manifold_swigregister = _Box2D.b2Manifold_swigregister
b2Manifold_swigregister(b2Manifold)
class b2WorldManifold(object):
"""This is used to compute the current state of a contact manifold."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def Initialize(self, manifold, xfA, radiusA, xfB, radiusB):
"""
Initialize(b2WorldManifold self, b2Manifold manifold, b2Transform xfA, float32 radiusA, b2Transform xfB, float32 radiusB)
Evaluate the manifold with supplied transforms. This assumes modest motion from the original state. This does not change the point count, impulses, etc. The radii must come from the shapes that generated the manifold.
"""
return _Box2D.b2WorldManifold_Initialize(self, manifold, xfA, radiusA, xfB, radiusB)
normal = _swig_property(_Box2D.b2WorldManifold_normal_get, _Box2D.b2WorldManifold_normal_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2WorldManifold self) -> long"""
return _Box2D.b2WorldManifold___hash__(self)
def __repr__(self):
return _format_repr(self)
def __get_points(self):
"""__get_points(b2WorldManifold self) -> PyObject *"""
return _Box2D.b2WorldManifold___get_points(self)
points = property(__get_points, None)
def __init__(self, **kwargs):
_Box2D.b2WorldManifold_swiginit(self,_Box2D.new_b2WorldManifold())
_init_kwargs(self, **kwargs)
__swig_destroy__ = _Box2D.delete_b2WorldManifold
b2WorldManifold.Initialize = new_instancemethod(_Box2D.b2WorldManifold_Initialize, None, b2WorldManifold)
b2WorldManifold.__hash__ = new_instancemethod(_Box2D.b2WorldManifold___hash__, None, b2WorldManifold)
b2WorldManifold.__get_points = new_instancemethod(_Box2D.b2WorldManifold___get_points, None, b2WorldManifold)
b2WorldManifold_swigregister = _Box2D.b2WorldManifold_swigregister
b2WorldManifold_swigregister(b2WorldManifold)
b2_nullState = _Box2D.b2_nullState
b2_addState = _Box2D.b2_addState
b2_persistState = _Box2D.b2_persistState
b2_removeState = _Box2D.b2_removeState
class b2ClipVertex(object):
"""Used for computing contact manifolds."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
v = _swig_property(_Box2D.b2ClipVertex_v_get, _Box2D.b2ClipVertex_v_set)
id = _swig_property(_Box2D.b2ClipVertex_id_get, _Box2D.b2ClipVertex_id_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2ClipVertex self) -> long"""
return _Box2D.b2ClipVertex___hash__(self)
def __repr__(self):
return _format_repr(self)
def __init__(self, **kwargs):
_Box2D.b2ClipVertex_swiginit(self,_Box2D.new_b2ClipVertex())
_init_kwargs(self, **kwargs)
__swig_destroy__ = _Box2D.delete_b2ClipVertex
b2ClipVertex.__hash__ = new_instancemethod(_Box2D.b2ClipVertex___hash__, None, b2ClipVertex)
b2ClipVertex_swigregister = _Box2D.b2ClipVertex_swigregister
b2ClipVertex_swigregister(b2ClipVertex)
class b2RayCastInput(object):
"""Ray-cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1)."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
p1 = _swig_property(_Box2D.b2RayCastInput_p1_get, _Box2D.b2RayCastInput_p1_set)
p2 = _swig_property(_Box2D.b2RayCastInput_p2_get, _Box2D.b2RayCastInput_p2_set)
maxFraction = _swig_property(_Box2D.b2RayCastInput_maxFraction_get, _Box2D.b2RayCastInput_maxFraction_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2RayCastInput self) -> long"""
return _Box2D.b2RayCastInput___hash__(self)
def __repr__(self):
return _format_repr(self)
def __init__(self, **kwargs):
_Box2D.b2RayCastInput_swiginit(self,_Box2D.new_b2RayCastInput())
_init_kwargs(self, **kwargs)
__swig_destroy__ = _Box2D.delete_b2RayCastInput
b2RayCastInput.__hash__ = new_instancemethod(_Box2D.b2RayCastInput___hash__, None, b2RayCastInput)
b2RayCastInput_swigregister = _Box2D.b2RayCastInput_swigregister
b2RayCastInput_swigregister(b2RayCastInput)
class b2RayCastOutput(object):
"""Ray-cast output data. The ray hits at p1 + fraction * (p2 - p1), where p1 and p2 come from b2RayCastInput."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
normal = _swig_property(_Box2D.b2RayCastOutput_normal_get, _Box2D.b2RayCastOutput_normal_set)
fraction = _swig_property(_Box2D.b2RayCastOutput_fraction_get, _Box2D.b2RayCastOutput_fraction_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2RayCastOutput self) -> long"""
return _Box2D.b2RayCastOutput___hash__(self)
def __repr__(self):
return _format_repr(self)
def __init__(self, **kwargs):
_Box2D.b2RayCastOutput_swiginit(self,_Box2D.new_b2RayCastOutput())
_init_kwargs(self, **kwargs)
__swig_destroy__ = _Box2D.delete_b2RayCastOutput
b2RayCastOutput.__hash__ = new_instancemethod(_Box2D.b2RayCastOutput___hash__, None, b2RayCastOutput)
b2RayCastOutput_swigregister = _Box2D.b2RayCastOutput_swigregister
b2RayCastOutput_swigregister(b2RayCastOutput)
class b2AABB(object):
"""An axis aligned bounding box."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __IsValid(self):
"""
__IsValid(b2AABB self) -> bool
Verify that the bounds are sorted.
"""
return _Box2D.b2AABB___IsValid(self)
def __GetCenter(self):
"""
__GetCenter(b2AABB self) -> b2Vec2
Get the center of the AABB.
"""
return _Box2D.b2AABB___GetCenter(self)
def __GetExtents(self):
"""
__GetExtents(b2AABB self) -> b2Vec2
Get the extents of the AABB (half-widths).
"""
return _Box2D.b2AABB___GetExtents(self)
def __GetPerimeter(self):
"""
__GetPerimeter(b2AABB self) -> float32
Get the perimeter length.
"""
return _Box2D.b2AABB___GetPerimeter(self)
def Combine(self, *args):
"""
Combine(b2AABB self, b2AABB aabb)
Combine(b2AABB self, b2AABB aabb1, b2AABB aabb2)
Combine two AABBs into this one.
"""
return _Box2D.b2AABB_Combine(self, *args)
def RayCast(self, output, input):
"""RayCast(b2AABB self, b2RayCastOutput output, b2RayCastInput input) -> bool"""
return _Box2D.b2AABB_RayCast(self, output, input)
lowerBound = _swig_property(_Box2D.b2AABB_lowerBound_get, _Box2D.b2AABB_lowerBound_set)
upperBound = _swig_property(_Box2D.b2AABB_upperBound_get, _Box2D.b2AABB_upperBound_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2AABB self) -> long"""
return _Box2D.b2AABB___hash__(self)
def __repr__(self):
return _format_repr(self)
# Read-only
valid = property(__IsValid, None)
extents = property(__GetExtents, None)
center = property(__GetCenter, None)
perimeter = property(__GetPerimeter, None)
def __contains__(self, *args):
"""
__contains__(b2AABB self, b2AABB aabb) -> bool
__contains__(b2AABB self, b2Vec2 point) -> bool
"""
return _Box2D.b2AABB___contains__(self, *args)
def overlaps(self, aabb2):
"""overlaps(b2AABB self, b2AABB aabb2) -> bool"""
return _Box2D.b2AABB_overlaps(self, aabb2)
def __init__(self, **kwargs):
_Box2D.b2AABB_swiginit(self,_Box2D.new_b2AABB())
_init_kwargs(self, **kwargs)
__swig_destroy__ = _Box2D.delete_b2AABB
b2AABB.__IsValid = new_instancemethod(_Box2D.b2AABB___IsValid, None, b2AABB)
b2AABB.__GetCenter = new_instancemethod(_Box2D.b2AABB___GetCenter, None, b2AABB)
b2AABB.__GetExtents = new_instancemethod(_Box2D.b2AABB___GetExtents, None, b2AABB)
b2AABB.__GetPerimeter = new_instancemethod(_Box2D.b2AABB___GetPerimeter, None, b2AABB)
b2AABB.Combine = new_instancemethod(_Box2D.b2AABB_Combine, None, b2AABB)
b2AABB.RayCast = new_instancemethod(_Box2D.b2AABB_RayCast, None, b2AABB)
b2AABB.__hash__ = new_instancemethod(_Box2D.b2AABB___hash__, None, b2AABB)
b2AABB.__contains__ = new_instancemethod(_Box2D.b2AABB___contains__, None, b2AABB)
b2AABB.overlaps = new_instancemethod(_Box2D.b2AABB_overlaps, None, b2AABB)
b2AABB_swigregister = _Box2D.b2AABB_swigregister
b2AABB_swigregister(b2AABB)
def b2CollideCircles(manifold, circleA, xfA, circleB, xfB):
"""
b2CollideCircles(b2Manifold manifold, b2CircleShape circleA, b2Transform xfA, b2CircleShape circleB, b2Transform xfB)
Compute the collision manifold between two circles.
"""
return _Box2D.b2CollideCircles(manifold, circleA, xfA, circleB, xfB)
def b2CollidePolygonAndCircle(manifold, polygonA, xfA, circleB, xfB):
"""
b2CollidePolygonAndCircle(b2Manifold manifold, b2PolygonShape polygonA, b2Transform xfA, b2CircleShape circleB, b2Transform xfB)
Compute the collision manifold between a polygon and a circle.
"""
return _Box2D.b2CollidePolygonAndCircle(manifold, polygonA, xfA, circleB, xfB)
def b2CollidePolygons(manifold, polygonA, xfA, polygonB, xfB):
"""
b2CollidePolygons(b2Manifold manifold, b2PolygonShape polygonA, b2Transform xfA, b2PolygonShape polygonB, b2Transform xfB)
Compute the collision manifold between two polygons.
"""
return _Box2D.b2CollidePolygons(manifold, polygonA, xfA, polygonB, xfB)
def b2CollideEdgeAndCircle(manifold, polygonA, xfA, circleB, xfB):
"""
b2CollideEdgeAndCircle(b2Manifold manifold, b2EdgeShape polygonA, b2Transform xfA, b2CircleShape circleB, b2Transform xfB)
Compute the collision manifold between an edge and a circle.
"""
return _Box2D.b2CollideEdgeAndCircle(manifold, polygonA, xfA, circleB, xfB)
def b2CollideEdgeAndPolygon(manifold, edgeA, xfA, circleB, xfB):
"""
b2CollideEdgeAndPolygon(b2Manifold manifold, b2EdgeShape edgeA, b2Transform xfA, b2PolygonShape circleB, b2Transform xfB)
Compute the collision manifold between an edge and a circle.
"""
return _Box2D.b2CollideEdgeAndPolygon(manifold, edgeA, xfA, circleB, xfB)
def b2ClipSegmentToLine(vOut, vIn, normal, offset, vertexIndexA):
"""
b2ClipSegmentToLine(b2ClipVertex vOut, b2ClipVertex vIn, b2Vec2 normal, float32 offset, int32 vertexIndexA) -> int32
Clipping for contact manifolds.
"""
return _Box2D.b2ClipSegmentToLine(vOut, vIn, normal, offset, vertexIndexA)
def b2TestOverlap(*args):
"""
b2TestOverlap(b2Shape shapeA, int32 indexA, b2Shape shapeB, int32 indexB, b2Transform xfA, b2Transform xfB) -> bool
b2TestOverlap(b2AABB a, b2AABB b) -> bool
Determine if two generic shapes overlap.
"""
return _Box2D.b2TestOverlap(*args)
class _b2Vec2Array(object):
"""Proxy of C++ _b2Vec2Array class."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, nelements):
"""__init__(_b2Vec2Array self, size_t nelements) -> _b2Vec2Array"""
_Box2D._b2Vec2Array_swiginit(self, _Box2D.new__b2Vec2Array(nelements))
__swig_destroy__ = _Box2D.delete__b2Vec2Array
def __getitem__(self, index):
"""__getitem__(_b2Vec2Array self, size_t index) -> b2Vec2"""
return _Box2D._b2Vec2Array___getitem__(self, index)
def __setitem__(self, index, value):
"""__setitem__(_b2Vec2Array self, size_t index, b2Vec2 value)"""
return _Box2D._b2Vec2Array___setitem__(self, index, value)
def cast(self):
"""cast(_b2Vec2Array self) -> b2Vec2"""
return _Box2D._b2Vec2Array_cast(self)
def frompointer(t):
"""frompointer(b2Vec2 t) -> _b2Vec2Array"""
return _Box2D._b2Vec2Array_frompointer(t)
frompointer = staticmethod(frompointer)
_b2Vec2Array.__getitem__ = new_instancemethod(_Box2D._b2Vec2Array___getitem__, None, _b2Vec2Array)
_b2Vec2Array.__setitem__ = new_instancemethod(_Box2D._b2Vec2Array___setitem__, None, _b2Vec2Array)
_b2Vec2Array.cast = new_instancemethod(_Box2D._b2Vec2Array_cast, None, _b2Vec2Array)
_b2Vec2Array_swigregister = _Box2D._b2Vec2Array_swigregister
_b2Vec2Array_swigregister(_b2Vec2Array)
def _b2Vec2Array_frompointer(t):
"""_b2Vec2Array_frompointer(b2Vec2 t) -> _b2Vec2Array"""
return _Box2D._b2Vec2Array_frompointer(t)
e_convertVertices = _Box2D.e_convertVertices
class b2Color(object):
"""Color for debug drawing. Each value has the range [0,1]."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def Set(self, ri, gi, bi):
"""Set(b2Color self, float32 ri, float32 gi, float32 bi)"""
return _Box2D.b2Color_Set(self, ri, gi, bi)
r = _swig_property(_Box2D.b2Color_r_get, _Box2D.b2Color_r_set)
g = _swig_property(_Box2D.b2Color_g_get, _Box2D.b2Color_g_set)
b = _swig_property(_Box2D.b2Color_b_get, _Box2D.b2Color_b_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2Color self) -> long"""
return _Box2D.b2Color___hash__(self)
def __repr__(self):
return _format_repr(self)
def __init__(self, *args):
"""
__init__(b2Color self) -> b2Color
__init__(b2Color self, float32 r, float32 g, float32 b) -> b2Color
__init__(b2Color self, b2Color other) -> b2Color
Color for debug drawing. Each value has the range [0,1].
"""
_Box2D.b2Color_swiginit(self, _Box2D.new_b2Color(*args))
def __get_bytes(self):
"""__get_bytes(b2Color self) -> PyObject *"""
return _Box2D.b2Color___get_bytes(self)
__iter__ = lambda self: iter((self.r, self.g, self.b))
__eq__ = lambda self, other: self.__equ(other)
__ne__ = lambda self,other: not self.__equ(other)
def __repr__(self):
return "b2Color(%g,%g,%g)" % (self.r, self.g, self.b)
def __len__(self):
return 3
def __copy__(self):
return b2Color(self.r, self.g, self.b)
def copy(self):
return b2Color(self.r, self.g, self.b)
def __set_bytes(self, value):
if len(value) != 3:
raise ValueError('Expected length 3 list')
self.r, self.g, self.b = value[0]/255, value[1]/255, value[2]/255
def __set_tuple(self, value):
if len(value) != 3:
raise ValueError('Expected length 3 list')
self.r, self.g, self.b = value[0], value[1], value[2]
def __nonzero__(self):
return self.r!=0.0 or self.g!=0.0 or self.b!=0.0
list = property(lambda self: list(self), __set_tuple)
bytes = property(__get_bytes, __set_bytes)
def __getitem__(self, i):
"""__getitem__(b2Color self, int i) -> float32"""
return _Box2D.b2Color___getitem__(self, i)
def __setitem__(self, i, value):
"""__setitem__(b2Color self, int i, float32 value)"""
return _Box2D.b2Color___setitem__(self, i, value)
def __truediv__(self, a):
"""__truediv__(b2Color self, float32 a) -> b2Color"""
return _Box2D.b2Color___truediv__(self, a)
def __add__(self, o):
"""__add__(b2Color self, b2Color o) -> b2Color"""
return _Box2D.b2Color___add__(self, o)
def __sub__(self, o):
"""__sub__(b2Color self, b2Color o) -> b2Color"""
return _Box2D.b2Color___sub__(self, o)
def __div__(self, a):
"""__div__(b2Color self, float32 a) -> b2Color"""
return _Box2D.b2Color___div__(self, a)
def __rmul__(self, a):
"""__rmul__(b2Color self, float32 a) -> b2Color"""
return _Box2D.b2Color___rmul__(self, a)
def __mul__(self, a):
"""__mul__(b2Color self, float32 a) -> b2Color"""
return _Box2D.b2Color___mul__(self, a)
def __isub(self, o):
"""__isub(b2Color self, b2Color o)"""
return _Box2D.b2Color___isub(self, o)
def __itruediv(self, o):
"""__itruediv(b2Color self, b2Color o)"""
return _Box2D.b2Color___itruediv(self, o)
def __idiv(self, o):
"""__idiv(b2Color self, b2Color o)"""
return _Box2D.b2Color___idiv(self, o)
def __imul(self, o):
"""__imul(b2Color self, b2Color o)"""
return _Box2D.b2Color___imul(self, o)
def __iadd(self, o):
"""__iadd(b2Color self, b2Color o)"""
return _Box2D.b2Color___iadd(self, o)
def __equ(self, b):
"""__equ(b2Color self, b2Color b) -> bool"""
return _Box2D.b2Color___equ(self, b)
__swig_destroy__ = _Box2D.delete_b2Color
b2Color.Set = new_instancemethod(_Box2D.b2Color_Set, None, b2Color)
b2Color.__hash__ = new_instancemethod(_Box2D.b2Color___hash__, None, b2Color)
b2Color.__get_bytes = new_instancemethod(_Box2D.b2Color___get_bytes, None, b2Color)
b2Color.__getitem__ = new_instancemethod(_Box2D.b2Color___getitem__, None, b2Color)
b2Color.__setitem__ = new_instancemethod(_Box2D.b2Color___setitem__, None, b2Color)
b2Color.__truediv__ = new_instancemethod(_Box2D.b2Color___truediv__, None, b2Color)
b2Color.__add__ = new_instancemethod(_Box2D.b2Color___add__, None, b2Color)
b2Color.__sub__ = new_instancemethod(_Box2D.b2Color___sub__, None, b2Color)
b2Color.__div__ = new_instancemethod(_Box2D.b2Color___div__, None, b2Color)
b2Color.__rmul__ = new_instancemethod(_Box2D.b2Color___rmul__, None, b2Color)
b2Color.__mul__ = new_instancemethod(_Box2D.b2Color___mul__, None, b2Color)
b2Color.__isub = new_instancemethod(_Box2D.b2Color___isub, None, b2Color)
b2Color.__itruediv = new_instancemethod(_Box2D.b2Color___itruediv, None, b2Color)
b2Color.__idiv = new_instancemethod(_Box2D.b2Color___idiv, None, b2Color)
b2Color.__imul = new_instancemethod(_Box2D.b2Color___imul, None, b2Color)
b2Color.__iadd = new_instancemethod(_Box2D.b2Color___iadd, None, b2Color)
b2Color.__equ = new_instancemethod(_Box2D.b2Color___equ, None, b2Color)
b2Color_swigregister = _Box2D.b2Color_swigregister
b2Color_swigregister(b2Color)
class b2Draw(object):
"""Implement and register this class with a b2Worldto provide debug drawing of physics entities in your game."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, **kwargs):
if self.__class__ == b2Draw:
_self = None
else:
_self = self
_Box2D.b2Draw_swiginit(self,_Box2D.new_b2Draw(_self, ))
_init_kwargs(self, **kwargs)
__swig_destroy__ = _Box2D.delete_b2Draw
e_shapeBit = _Box2D.b2Draw_e_shapeBit
e_jointBit = _Box2D.b2Draw_e_jointBit
e_aabbBit = _Box2D.b2Draw_e_aabbBit
e_pairBit = _Box2D.b2Draw_e_pairBit
e_centerOfMassBit = _Box2D.b2Draw_e_centerOfMassBit
def __SetFlags(self, flags):
"""
__SetFlags(b2Draw self, uint32 flags)
Set the drawing flags.
"""
return _Box2D.b2Draw___SetFlags(self, flags)
def __GetFlags(self):
"""
__GetFlags(b2Draw self) -> uint32
Get the drawing flags.
"""
return _Box2D.b2Draw___GetFlags(self)
def AppendFlags(self, flags):
"""
AppendFlags(b2Draw self, uint32 flags)
Append flags to the current flags.
"""
return _Box2D.b2Draw_AppendFlags(self, flags)
def ClearFlags(self, flags):
"""
ClearFlags(b2Draw self, uint32 flags)
Clear flags from the current flags.
"""
return _Box2D.b2Draw_ClearFlags(self, flags)
def DrawPolygon(self, vertices, vertexCount, color):
"""
DrawPolygon(b2Draw self, b2Vec2 vertices, int32 vertexCount, b2Color color)
Draw a closed polygon provided in CCW order.
"""
return _Box2D.b2Draw_DrawPolygon(self, vertices, vertexCount, color)
def DrawSolidPolygon(self, vertices, vertexCount, color):
"""
DrawSolidPolygon(b2Draw self, b2Vec2 vertices, int32 vertexCount, b2Color color)
Draw a solid closed polygon provided in CCW order.
"""
return _Box2D.b2Draw_DrawSolidPolygon(self, vertices, vertexCount, color)
def DrawCircle(self, center, radius, color):
"""
DrawCircle(b2Draw self, b2Vec2 center, float32 radius, b2Color color)
Draw a circle.
"""
return _Box2D.b2Draw_DrawCircle(self, center, radius, color)
def DrawSolidCircle(self, center, radius, axis, color):
"""
DrawSolidCircle(b2Draw self, b2Vec2 center, float32 radius, b2Vec2 axis, b2Color color)
Draw a solid circle.
"""
return _Box2D.b2Draw_DrawSolidCircle(self, center, radius, axis, color)
def DrawSegment(self, p1, p2, color):
"""
DrawSegment(b2Draw self, b2Vec2 p1, b2Vec2 p2, b2Color color)
Draw a line segment.
"""
return _Box2D.b2Draw_DrawSegment(self, p1, p2, color)
def DrawTransform(self, xf):
"""
DrawTransform(b2Draw self, b2Transform xf)
Draw a transform. Choose your own length scale.
Parameters:
-----------
xf:
a transform.
"""
return _Box2D.b2Draw_DrawTransform(self, xf)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2Draw self) -> long"""
return _Box2D.b2Draw___hash__(self)
def __repr__(self):
return _format_repr(self)
_flag_entries = [
['drawShapes', e_shapeBit],
['drawJoints', e_jointBit ],
['drawAABBs', e_aabbBit ],
['drawPairs', e_pairBit ],
['drawCOMs', e_centerOfMassBit ],
['convertVertices', e_convertVertices ],
]
def _SetFlags(self, value):
flags = 0
for name_, mask in self._flag_entries:
if name_ in value and value[name_]:
flags |= mask
self.__SetFlags(flags)
def _GetFlags(self):
flags = self.__GetFlags()
ret={}
for name_, mask in self._flag_entries:
ret[name_]=((flags & mask)==mask)
return ret
flags=property(_GetFlags, _SetFlags, doc='Sets whether or not shapes, joints, etc. will be drawn.')
def __disown__(self):
self.this.disown()
_Box2D.disown_b2Draw(self)
return weakref_proxy(self)
b2Draw.__SetFlags = new_instancemethod(_Box2D.b2Draw___SetFlags, None, b2Draw)
b2Draw.__GetFlags = new_instancemethod(_Box2D.b2Draw___GetFlags, None, b2Draw)
b2Draw.AppendFlags = new_instancemethod(_Box2D.b2Draw_AppendFlags, None, b2Draw)
b2Draw.ClearFlags = new_instancemethod(_Box2D.b2Draw_ClearFlags, None, b2Draw)
b2Draw.DrawPolygon = new_instancemethod(_Box2D.b2Draw_DrawPolygon, None, b2Draw)
b2Draw.DrawSolidPolygon = new_instancemethod(_Box2D.b2Draw_DrawSolidPolygon, None, b2Draw)
b2Draw.DrawCircle = new_instancemethod(_Box2D.b2Draw_DrawCircle, None, b2Draw)
b2Draw.DrawSolidCircle = new_instancemethod(_Box2D.b2Draw_DrawSolidCircle, None, b2Draw)
b2Draw.DrawSegment = new_instancemethod(_Box2D.b2Draw_DrawSegment, None, b2Draw)
b2Draw.DrawTransform = new_instancemethod(_Box2D.b2Draw_DrawTransform, None, b2Draw)
b2Draw.__hash__ = new_instancemethod(_Box2D.b2Draw___hash__, None, b2Draw)
b2Draw_swigregister = _Box2D.b2Draw_swigregister
b2Draw_swigregister(b2Draw)
class b2DrawExtended(b2Draw):
"""Proxy of C++ b2DrawExtended class."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
convertVertices = _swig_property(_Box2D.b2DrawExtended_convertVertices_get, _Box2D.b2DrawExtended_convertVertices_set)
center = _swig_property(_Box2D.b2DrawExtended_center_get, _Box2D.b2DrawExtended_center_set)
offset = _swig_property(_Box2D.b2DrawExtended_offset_get, _Box2D.b2DrawExtended_offset_set)
zoom = _swig_property(_Box2D.b2DrawExtended_zoom_get, _Box2D.b2DrawExtended_zoom_set)
screenSize = _swig_property(_Box2D.b2DrawExtended_screenSize_get, _Box2D.b2DrawExtended_screenSize_set)
flipY = _swig_property(_Box2D.b2DrawExtended_flipY_get, _Box2D.b2DrawExtended_flipY_set)
flipX = _swig_property(_Box2D.b2DrawExtended_flipX_get, _Box2D.b2DrawExtended_flipX_set)
def __Convert(self, verts, vertexCount):
"""__Convert(b2DrawExtended self, b2Vec2 verts, int32 vertexCount) -> PyObject *"""
return _Box2D.b2DrawExtended___Convert(self, verts, vertexCount)
def to_screen(self, point):
"""to_screen(b2DrawExtended self, b2Vec2 point) -> PyObject *"""
return _Box2D.b2DrawExtended_to_screen(self, point)
def DrawPolygon(self, conv_vertices, vertexCount, color):
"""
DrawPolygon(b2DrawExtended self, b2Vec2 conv_vertices, int32 vertexCount, b2Color color)
Draw a closed polygon provided in CCW order.
"""
return _Box2D.b2DrawExtended_DrawPolygon(self, conv_vertices, vertexCount, color)
def DrawSolidPolygon(self, conv_vertices, vertexCount, color):
"""
DrawSolidPolygon(b2DrawExtended self, b2Vec2 conv_vertices, int32 vertexCount, b2Color color)
Draw a solid closed polygon provided in CCW order.
"""
return _Box2D.b2DrawExtended_DrawSolidPolygon(self, conv_vertices, vertexCount, color)
def DrawCircle(self, conv_p1, radius, color):
"""
DrawCircle(b2DrawExtended self, b2Vec2 conv_p1, float32 radius, b2Color color)
Draw a circle.
"""
return _Box2D.b2DrawExtended_DrawCircle(self, conv_p1, radius, color)
def DrawSolidCircle(self, conv_p1, radius, axis, color):
"""
DrawSolidCircle(b2DrawExtended self, b2Vec2 conv_p1, float32 radius, b2Vec2 axis, b2Color color)
Draw a solid circle.
"""
return _Box2D.b2DrawExtended_DrawSolidCircle(self, conv_p1, radius, axis, color)
def DrawSegment(self, conv_p1, conv_p2, color):
"""
DrawSegment(b2DrawExtended self, b2Vec2 conv_p1, b2Vec2 conv_p2, b2Color color)
Draw a line segment.
"""
return _Box2D.b2DrawExtended_DrawSegment(self, conv_p1, conv_p2, color)
def DrawTransform(self, xf):
"""
DrawTransform(b2DrawExtended self, b2Transform xf)
Draw a transform. Choose your own length scale.
Parameters:
-----------
xf:
a transform.
"""
return _Box2D.b2DrawExtended_DrawTransform(self, xf)
def __SetFlags(self, flags):
"""__SetFlags(b2DrawExtended self, uint32 flags)"""
return _Box2D.b2DrawExtended___SetFlags(self, flags)
__swig_destroy__ = _Box2D.delete_b2DrawExtended
def __init__(self, **kwargs):
if self.__class__ == b2DrawExtended:
_self = None
else:
_self = self
_Box2D.b2DrawExtended_swiginit(self,_Box2D.new_b2DrawExtended(_self, ))
_init_kwargs(self, **kwargs)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2DrawExtended self) -> long"""
return _Box2D.b2DrawExtended___hash__(self)
def __repr__(self):
return _format_repr(self)
def __disown__(self):
self.this.disown()
_Box2D.disown_b2DrawExtended(self)
return weakref_proxy(self)
b2DrawExtended.__Convert = new_instancemethod(_Box2D.b2DrawExtended___Convert, None, b2DrawExtended)
b2DrawExtended.to_screen = new_instancemethod(_Box2D.b2DrawExtended_to_screen, None, b2DrawExtended)
b2DrawExtended.DrawPolygon = new_instancemethod(_Box2D.b2DrawExtended_DrawPolygon, None, b2DrawExtended)
b2DrawExtended.DrawSolidPolygon = new_instancemethod(_Box2D.b2DrawExtended_DrawSolidPolygon, None, b2DrawExtended)
b2DrawExtended.DrawCircle = new_instancemethod(_Box2D.b2DrawExtended_DrawCircle, None, b2DrawExtended)
b2DrawExtended.DrawSolidCircle = new_instancemethod(_Box2D.b2DrawExtended_DrawSolidCircle, None, b2DrawExtended)
b2DrawExtended.DrawSegment = new_instancemethod(_Box2D.b2DrawExtended_DrawSegment, None, b2DrawExtended)
b2DrawExtended.DrawTransform = new_instancemethod(_Box2D.b2DrawExtended_DrawTransform, None, b2DrawExtended)
b2DrawExtended.__SetFlags = new_instancemethod(_Box2D.b2DrawExtended___SetFlags, None, b2DrawExtended)
b2DrawExtended.__hash__ = new_instancemethod(_Box2D.b2DrawExtended___hash__, None, b2DrawExtended)
b2DrawExtended_swigregister = _Box2D.b2DrawExtended_swigregister
b2DrawExtended_swigregister(b2DrawExtended)
class b2MassData(object):
"""This holds the mass data computed for a shape."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
mass = _swig_property(_Box2D.b2MassData_mass_get, _Box2D.b2MassData_mass_set)
center = _swig_property(_Box2D.b2MassData_center_get, _Box2D.b2MassData_center_set)
I = _swig_property(_Box2D.b2MassData_I_get, _Box2D.b2MassData_I_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2MassData self) -> long"""
return _Box2D.b2MassData___hash__(self)
def __repr__(self):
return _format_repr(self)
def __init__(self, **kwargs):
_Box2D.b2MassData_swiginit(self,_Box2D.new_b2MassData())
_init_kwargs(self, **kwargs)
__swig_destroy__ = _Box2D.delete_b2MassData
b2MassData.__hash__ = new_instancemethod(_Box2D.b2MassData___hash__, None, b2MassData)
b2MassData_swigregister = _Box2D.b2MassData_swigregister
b2MassData_swigregister(b2MassData)
b2_chunkSize = b2Globals.b2_chunkSize
b2_maxBlockSize = b2Globals.b2_maxBlockSize
b2_blockSizes = b2Globals.b2_blockSizes
b2_chunkArrayIncrement = b2Globals.b2_chunkArrayIncrement
class b2Shape(object):
"""A shape is used for collision detection. You can create a shape however you like. Shapes used for simulation in b2Worldare created automatically when a b2Fixtureis created. Shapes may encapsulate a one or more child shapes."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined - class is abstract")
__repr__ = _swig_repr
e_circle = _Box2D.b2Shape_e_circle
e_edge = _Box2D.b2Shape_e_edge
e_polygon = _Box2D.b2Shape_e_polygon
e_chain = _Box2D.b2Shape_e_chain
e_typeCount = _Box2D.b2Shape_e_typeCount
__swig_destroy__ = _Box2D.delete_b2Shape
def __GetType(self):
"""
__GetType(b2Shape self) -> b2Shape::Type
Get the type of this shape. You can use this to down cast to the concrete shape.
the shape type.
"""
return _Box2D.b2Shape___GetType(self)
def __GetChildCount(self):
"""
__GetChildCount(b2Shape self) -> int32
Get the number of child primitives.
"""
return _Box2D.b2Shape___GetChildCount(self)
def TestPoint(self, xf, p):
"""
TestPoint(b2Shape self, b2Transform xf, b2Vec2 p) -> bool
Test a point for containment in this shape. This only works for convex shapes.
Parameters:
-----------
xf:
the shape world transform.
p:
a point in world coordinates.
"""
return _Box2D.b2Shape_TestPoint(self, xf, p)
def RayCast(self, output, input, transform, childIndex):
"""
RayCast(b2Shape self, b2RayCastOutput output, b2RayCastInput input, b2Transform transform, int32 childIndex) -> bool
Cast a ray against a child shape.
Parameters:
-----------
output:
the ray-cast results.
input:
the ray-cast input parameters.
transform:
the transform to be applied to the shape.
childIndex:
the child shape index
"""
return _Box2D.b2Shape_RayCast(self, output, input, transform, childIndex)
def __ComputeAABB(self, aabb, xf, childIndex):
"""
__ComputeAABB(b2Shape self, b2AABB aabb, b2Transform xf, int32 childIndex)
Given a transform, compute the associated axis aligned bounding box for a child shape.
Parameters:
-----------
aabb:
returns the axis aligned box.
xf:
the world transform of the shape.
childIndex:
the child shape
"""
return _Box2D.b2Shape___ComputeAABB(self, aabb, xf, childIndex)
def __ComputeMass(self, massData, density):
"""
__ComputeMass(b2Shape self, b2MassData massData, float32 density)
Compute the mass properties of this shape using its dimensions and density. The inertia tensor is computed about the local origin.
Parameters:
-----------
massData:
returns the mass data for this shape.
density:
the density in kilograms per meter squared.
"""
return _Box2D.b2Shape___ComputeMass(self, massData, density)
radius = _swig_property(_Box2D.b2Shape_radius_get, _Box2D.b2Shape_radius_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2Shape self) -> long"""
return _Box2D.b2Shape___hash__(self)
def __repr__(self):
return _format_repr(self)
__eq__ = b2ShapeCompare
__ne__ = lambda self,other: not b2ShapeCompare(self,other)
# Read-only
type = property(__GetType, None)
def getAsType(self):
return self
@property
def childCount(self):
"""
Get the number of child primitives.
"""
return self.__GetChildCount()
def getAABB(self, transform, childIndex):
"""
Given a transform, compute the associated axis aligned bounding box for a child shape.
"""
if childIndex >= self.childCount:
raise ValueError('Child index should be at most childCount=%d' % self.childCount)
aabb=b2AABB()
self.__ComputeAABB(aabb, transform, childIndex)
return aabb
def getMass(self, density):
"""
Compute the mass properties of this shape using its dimensions and density.
The inertia tensor is computed about the local origin.
"""
m=b2MassData()
self.__ComputeMass(m, density)
return m
b2Shape.__GetType = new_instancemethod(_Box2D.b2Shape___GetType, None, b2Shape)
b2Shape.__GetChildCount = new_instancemethod(_Box2D.b2Shape___GetChildCount, None, b2Shape)
b2Shape.TestPoint = new_instancemethod(_Box2D.b2Shape_TestPoint, None, b2Shape)
b2Shape.RayCast = new_instancemethod(_Box2D.b2Shape_RayCast, None, b2Shape)
b2Shape.__ComputeAABB = new_instancemethod(_Box2D.b2Shape___ComputeAABB, None, b2Shape)
b2Shape.__ComputeMass = new_instancemethod(_Box2D.b2Shape___ComputeMass, None, b2Shape)
b2Shape.__hash__ = new_instancemethod(_Box2D.b2Shape___hash__, None, b2Shape)
b2Shape_swigregister = _Box2D.b2Shape_swigregister
b2Shape_swigregister(b2Shape)
class b2CircleShape(b2Shape):
"""A circle shape."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, **kwargs):
_Box2D.b2CircleShape_swiginit(self,_Box2D.new_b2CircleShape())
_init_kwargs(self, **kwargs)
pos = _swig_property(_Box2D.b2CircleShape_pos_get, _Box2D.b2CircleShape_pos_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2CircleShape self) -> long"""
return _Box2D.b2CircleShape___hash__(self)
def __repr__(self):
return _format_repr(self)
__swig_destroy__ = _Box2D.delete_b2CircleShape
b2CircleShape.__hash__ = new_instancemethod(_Box2D.b2CircleShape___hash__, None, b2CircleShape)
b2CircleShape_swigregister = _Box2D.b2CircleShape_swigregister
b2CircleShape_swigregister(b2CircleShape)
class b2EdgeShape(b2Shape):
"""A line segment (edge) shape. These can be connected in chains or loops to other edge shapes. The connectivity information is used to ensure correct contact normals."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, **kwargs):
_Box2D.b2EdgeShape_swiginit(self,_Box2D.new_b2EdgeShape())
_init_kwargs(self, **kwargs)
def __Set(self, v1, v2):
"""
__Set(b2EdgeShape self, b2Vec2 v1, b2Vec2 v2)
Set this as an isolated edge.
"""
return _Box2D.b2EdgeShape___Set(self, v1, v2)
vertex1 = _swig_property(_Box2D.b2EdgeShape_vertex1_get, _Box2D.b2EdgeShape_vertex1_set)
vertex2 = _swig_property(_Box2D.b2EdgeShape_vertex2_get, _Box2D.b2EdgeShape_vertex2_set)
vertex0 = _swig_property(_Box2D.b2EdgeShape_vertex0_get, _Box2D.b2EdgeShape_vertex0_set)
vertex3 = _swig_property(_Box2D.b2EdgeShape_vertex3_get, _Box2D.b2EdgeShape_vertex3_set)
hasVertex0 = _swig_property(_Box2D.b2EdgeShape_hasVertex0_get, _Box2D.b2EdgeShape_hasVertex0_set)
hasVertex3 = _swig_property(_Box2D.b2EdgeShape_hasVertex3_get, _Box2D.b2EdgeShape_hasVertex3_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2EdgeShape self) -> long"""
return _Box2D.b2EdgeShape___hash__(self)
def __repr__(self):
return _format_repr(self)
def __repr__(self):
return "b2EdgeShape(vertices: %s)" % (self.vertices)
@property
def all_vertices(self):
"""Returns all of the vertices as a list of tuples [ (x0,y0), (x1,y1), (x2,y2) (x3,y3) ]
Note that the validity of vertices 0 and 4 depend on whether or not
hasVertex0 and hasVertex3 are set.
"""
return [tuple(self.vertex0), tuple(self.vertex1), tuple(self.vertex2), tuple(self.vertex3)]
def __get_vertices(self):
"""Returns the basic vertices as a list of tuples [ (x1,y1), (x2,y2) ]
To include the supporting vertices, see 'all_vertices'
If you want to set vertex3 but not vertex0, pass in None for vertex0.
"""
return [tuple(self.vertex1), tuple(self.vertex2)]
def __set_vertices(self, vertices):
if len(vertices)==2:
self.vertex1, self.vertex2=vertices
self.hasVertex0=False
self.hasVertex3=False
elif len(vertices)==3:
self.vertex0, self.vertex1, self.vertex2=vertices
self.hasVertex0=(vertices[0] != None)
self.hasVertex3=False
elif len(vertices)==4:
self.vertex0, self.vertex1, self.vertex2, self.vertex3=vertices
self.hasVertex0=(vertices[0] != None)
self.hasVertex3=True
else:
raise ValueError('Expected from 2 to 4 vertices.')
@property
def vertexCount(self):
"""
Returns the number of valid vertices (as in, it counts whether or not
hasVertex0 or hasVertex3 are set)
"""
if self.hasVertex0 and self.hasVertex3:
return 4
elif self.hasVertex0 or self.hasVertex3:
return 3
else:
return 2
def __iter__(self):
"""
Iterates over the vertices in the Edge
"""
for v in self.vertices:
yield v
vertices=property(__get_vertices, __set_vertices)
__swig_destroy__ = _Box2D.delete_b2EdgeShape
b2EdgeShape.__Set = new_instancemethod(_Box2D.b2EdgeShape___Set, None, b2EdgeShape)
b2EdgeShape.__hash__ = new_instancemethod(_Box2D.b2EdgeShape___hash__, None, b2EdgeShape)
b2EdgeShape_swigregister = _Box2D.b2EdgeShape_swigregister
b2EdgeShape_swigregister(b2EdgeShape)
class b2ChainShape(b2Shape):
"""A loop shape is a free form sequence of line segments that form a circular list. The loop may cross upon itself, but this is not recommended for smooth collision. The loop has double sided collision, so you can use inside and outside collision. Therefore, you may use any winding order. Since there may be many vertices, they are allocated using b2Alloc."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, **kwargs):
_Box2D.b2ChainShape_swiginit(self,_Box2D.new_b2ChainShape())
_init_kwargs(self, **kwargs)
__swig_destroy__ = _Box2D.delete_b2ChainShape
def CreateLoop(self, vertices, count):
"""CreateLoop(b2ChainShape self, b2Vec2 vertices, int32 count)"""
return _Box2D.b2ChainShape_CreateLoop(self, vertices, count)
def CreateChain(self, vertices, count):
"""CreateChain(b2ChainShape self, b2Vec2 vertices, int32 count)"""
return _Box2D.b2ChainShape_CreateChain(self, vertices, count)
def SetPrevVertex(self, prevVertex):
"""SetPrevVertex(b2ChainShape self, b2Vec2 prevVertex)"""
return _Box2D.b2ChainShape_SetPrevVertex(self, prevVertex)
def SetNextVertex(self, nextVertex):
"""SetNextVertex(b2ChainShape self, b2Vec2 nextVertex)"""
return _Box2D.b2ChainShape_SetNextVertex(self, nextVertex)
def __GetChildEdge(self, edge, index):
"""
__GetChildEdge(b2ChainShape self, b2EdgeShape edge, int32 index)
Get a child edge.
"""
return _Box2D.b2ChainShape___GetChildEdge(self, edge, index)
m_prevVertex = _swig_property(_Box2D.b2ChainShape_m_prevVertex_get, _Box2D.b2ChainShape_m_prevVertex_set)
m_nextVertex = _swig_property(_Box2D.b2ChainShape_m_nextVertex_get, _Box2D.b2ChainShape_m_nextVertex_set)
m_hasPrevVertex = _swig_property(_Box2D.b2ChainShape_m_hasPrevVertex_get, _Box2D.b2ChainShape_m_hasPrevVertex_set)
m_hasNextVertex = _swig_property(_Box2D.b2ChainShape_m_hasNextVertex_get, _Box2D.b2ChainShape_m_hasNextVertex_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2ChainShape self) -> long"""
return _Box2D.b2ChainShape___hash__(self)
def __repr__(self):
return _format_repr(self)
def __get_vertices(self):
"""__get_vertices(b2ChainShape self) -> PyObject *"""
return _Box2D.b2ChainShape___get_vertices(self)
def __repr__(self):
return "b2ChainShape(vertices: %s)" % (self.vertices)
def getChildEdge(self, index):
if childIndex >= self.childCount:
raise ValueError('Child index should be at most childCount=%d' % self.childCount)
edge=b2EdgeShape()
self.__GetChildEdge(edge, index)
return edge
@property
def edges(self):
return [self.getChildEdge(i) for i in range(self.childCount)]
@property
def vertexCount(self):
return self.__get_count()
def __get_vertices(self):
"""Returns all of the vertices as a list of tuples [ (x1,y1), (x2,y2) ... (xN,yN) ]"""
return [ (self.__get_vertex(i).x, self.__get_vertex(i).y )
for i in range(0, self.vertexCount)]
def __iter__(self):
"""
Iterates over the vertices in the Chain
"""
for v in self.vertices:
yield v
def __set_vertices(self, values, loop=True):
if not values or not isinstance(values, (list, tuple)) or (len(values) < 2):
raise ValueError('Expected tuple or list of length >= 2.')
for i,value in enumerate(values):
if isinstance(value, (tuple, list)):
if len(value) != 2:
raise ValueError('Expected tuple or list of length 2, got length %d' % len(value))
for j in value:
if not isinstance(j, (int, float)):
raise ValueError('Expected int or float values, got %s' % (type(j)))
elif isinstance(value, b2Vec2):
pass
else:
raise ValueError('Expected tuple, list, or b2Vec2, got %s' % type(value))
vecs=_b2Vec2Array(len(values))
for i, value in enumerate(values):
if isinstance(value, b2Vec2):
vecs[i]=value
else:
vecs[i]=b2Vec2(value)
self.__create(vecs, len(values), loop)
vertices = property(__get_vertices, __set_vertices)
vertices_chain = property(__get_vertices, lambda self, v : self.__set_vertices(v, loop=False))
vertices_loop = vertices
def __create(self, v, c, loop):
"""__create(b2ChainShape self, _b2Vec2Array v, int c, bool loop)"""
return _Box2D.b2ChainShape___create(self, v, c, loop)
def __get_vertex(self, vnum):
"""__get_vertex(b2ChainShape self, uint16 vnum) -> b2Vec2"""
return _Box2D.b2ChainShape___get_vertex(self, vnum)
def __get_count(self):
"""__get_count(b2ChainShape self) -> int32"""
return _Box2D.b2ChainShape___get_count(self)
b2ChainShape.CreateLoop = new_instancemethod(_Box2D.b2ChainShape_CreateLoop, None, b2ChainShape)
b2ChainShape.CreateChain = new_instancemethod(_Box2D.b2ChainShape_CreateChain, None, b2ChainShape)
b2ChainShape.SetPrevVertex = new_instancemethod(_Box2D.b2ChainShape_SetPrevVertex, None, b2ChainShape)
b2ChainShape.SetNextVertex = new_instancemethod(_Box2D.b2ChainShape_SetNextVertex, None, b2ChainShape)
b2ChainShape.__GetChildEdge = new_instancemethod(_Box2D.b2ChainShape___GetChildEdge, None, b2ChainShape)
b2ChainShape.__hash__ = new_instancemethod(_Box2D.b2ChainShape___hash__, None, b2ChainShape)
b2ChainShape.__get_vertices = new_instancemethod(_Box2D.b2ChainShape___get_vertices, None, b2ChainShape)
b2ChainShape.__create = new_instancemethod(_Box2D.b2ChainShape___create, None, b2ChainShape)
b2ChainShape.__get_vertex = new_instancemethod(_Box2D.b2ChainShape___get_vertex, None, b2ChainShape)
b2ChainShape.__get_count = new_instancemethod(_Box2D.b2ChainShape___get_count, None, b2ChainShape)
b2ChainShape_swigregister = _Box2D.b2ChainShape_swigregister
b2ChainShape_swigregister(b2ChainShape)
class b2PolygonShape(b2Shape):
"""A convex polygon. It is assumed that the interior of the polygon is to the left of each edge. Polygons have a maximum number of vertices equal to b2_maxPolygonVertices. In most cases you should not need many vertices for a convex polygon."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, **kwargs):
_Box2D.b2PolygonShape_swiginit(self,_Box2D.new_b2PolygonShape())
_init_kwargs(self, **kwargs)
def SetAsBox(self, *args):
"""
SetAsBox(b2PolygonShape self, float32 hx, float32 hy)
SetAsBox(b2PolygonShape self, float32 hx, float32 hy, b2Vec2 center, float32 angle)
Build vertices to represent an oriented box.
Parameters:
-----------
hx:
the half-width.
hy:
the half-height.
center:
the center of the box in local coordinates.
angle:
the rotation of the box in local coordinates.
"""
return _Box2D.b2PolygonShape_SetAsBox(self, *args)
def Validate(self):
"""Validate(b2PolygonShape self) -> bool"""
return _Box2D.b2PolygonShape_Validate(self)
centroid = _swig_property(_Box2D.b2PolygonShape_centroid_get, _Box2D.b2PolygonShape_centroid_set)
vertexCount = _swig_property(_Box2D.b2PolygonShape_vertexCount_get, _Box2D.b2PolygonShape_vertexCount_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2PolygonShape self) -> long"""
return _Box2D.b2PolygonShape___hash__(self)
def __repr__(self):
return _format_repr(self)
def __get_vertices(self):
"""__get_vertices(b2PolygonShape self) -> PyObject *"""
return _Box2D.b2PolygonShape___get_vertices(self)
def __get_normals(self):
"""__get_normals(b2PolygonShape self) -> PyObject *"""
return _Box2D.b2PolygonShape___get_normals(self)
def __repr__(self):
return "b2PolygonShape(vertices: %s)" % (self.vertices)
def __clear_vertices(self):
self.vertexCount=0
for i in range(0, b2_maxPolygonVertices):
self.set_vertex(i, 0, 0)
def __set_vertices(self, values):
if not values:
self.__clear_vertices()
else:
if len(values) < 2 or len(values) > b2_maxPolygonVertices:
raise ValueError('Expected tuple or list of length >= 2 and less than b2_maxPolygonVertices=%d, got length %d.' %
(b2_maxPolygonVertices, len(values)))
for i,value in enumerate(values):
if isinstance(value, (tuple, list, b2Vec2)):
if len(value) != 2:
raise ValueError('Expected tuple or list of length 2, got length %d' % len(value))
self.set_vertex(i, *value)
else:
raise ValueError('Expected tuple, list, or b2Vec2, got %s' % type(value))
self.vertexCount=i+1 # follow along in case of an exception to indicate valid number set
self.__set_vertices_internal() # calculates normals, centroid, etc.
def __iter__(self):
"""
Iterates over the vertices in the polygon
"""
for v in self.vertices:
yield v
def __IsValid(self):
return b2CheckPolygon(self)
valid = property(__IsValid, None, doc="Checks the polygon to see if it can be properly created. Raises ValueError for invalid shapes.")
vertices = property(__get_vertices, __set_vertices, doc="All of the vertices as a list of tuples [ (x1,y1), (x2,y2) ... (xN,yN) ]")
normals = property(__get_normals, None, doc="All of the normals as a list of tuples [ (x1,y1), (x2,y2) ... (xN,yN) ]")
box = property(None, lambda self, value: self.SetAsBox(*value), doc="Property replacement for running SetAsBox (Write-only)")
def __get_vertex(self, vnum):
"""__get_vertex(b2PolygonShape self, uint16 vnum) -> b2Vec2"""
return _Box2D.b2PolygonShape___get_vertex(self, vnum)
def __get_normal(self, vnum):
"""__get_normal(b2PolygonShape self, uint16 vnum) -> b2Vec2"""
return _Box2D.b2PolygonShape___get_normal(self, vnum)
def set_vertex(self, *args):
"""
set_vertex(b2PolygonShape self, uint16 vnum, b2Vec2 value)
set_vertex(b2PolygonShape self, uint16 vnum, float32 x, float32 y)
"""
return _Box2D.b2PolygonShape_set_vertex(self, *args)
def __set_vertices_internal(self, *args):
"""
__set_vertices_internal(b2PolygonShape self, b2Vec2 points, int32 count)
__set_vertices_internal(b2PolygonShape self)
"""
return _Box2D.b2PolygonShape___set_vertices_internal(self, *args)
__swig_destroy__ = _Box2D.delete_b2PolygonShape
b2PolygonShape.SetAsBox = new_instancemethod(_Box2D.b2PolygonShape_SetAsBox, None, b2PolygonShape)
b2PolygonShape.Validate = new_instancemethod(_Box2D.b2PolygonShape_Validate, None, b2PolygonShape)
b2PolygonShape.__hash__ = new_instancemethod(_Box2D.b2PolygonShape___hash__, None, b2PolygonShape)
b2PolygonShape.__get_vertices = new_instancemethod(_Box2D.b2PolygonShape___get_vertices, None, b2PolygonShape)
b2PolygonShape.__get_normals = new_instancemethod(_Box2D.b2PolygonShape___get_normals, None, b2PolygonShape)
b2PolygonShape.__get_vertex = new_instancemethod(_Box2D.b2PolygonShape___get_vertex, None, b2PolygonShape)
b2PolygonShape.__get_normal = new_instancemethod(_Box2D.b2PolygonShape___get_normal, None, b2PolygonShape)
b2PolygonShape.set_vertex = new_instancemethod(_Box2D.b2PolygonShape_set_vertex, None, b2PolygonShape)
b2PolygonShape.__set_vertices_internal = new_instancemethod(_Box2D.b2PolygonShape___set_vertices_internal, None, b2PolygonShape)
b2PolygonShape_swigregister = _Box2D.b2PolygonShape_swigregister
b2PolygonShape_swigregister(b2PolygonShape)
b2_nullNode = _Box2D.b2_nullNode
class b2TreeNode(object):
"""Proxy of C++ b2TreeNode class."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def IsLeaf(self):
"""IsLeaf(b2TreeNode self) -> bool"""
return _Box2D.b2TreeNode_IsLeaf(self)
aabb = _swig_property(_Box2D.b2TreeNode_aabb_get, _Box2D.b2TreeNode_aabb_set)
child1 = _swig_property(_Box2D.b2TreeNode_child1_get, _Box2D.b2TreeNode_child1_set)
child2 = _swig_property(_Box2D.b2TreeNode_child2_get, _Box2D.b2TreeNode_child2_set)
height = _swig_property(_Box2D.b2TreeNode_height_get, _Box2D.b2TreeNode_height_set)
def __init__(self):
"""__init__(b2TreeNode self) -> b2TreeNode"""
_Box2D.b2TreeNode_swiginit(self, _Box2D.new_b2TreeNode())
__swig_destroy__ = _Box2D.delete_b2TreeNode
b2TreeNode.IsLeaf = new_instancemethod(_Box2D.b2TreeNode_IsLeaf, None, b2TreeNode)
b2TreeNode_swigregister = _Box2D.b2TreeNode_swigregister
b2TreeNode_swigregister(b2TreeNode)
class b2Pair(object):
"""Proxy of C++ b2Pair class."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
proxyIdA = _swig_property(_Box2D.b2Pair_proxyIdA_get, _Box2D.b2Pair_proxyIdA_set)
proxyIdB = _swig_property(_Box2D.b2Pair_proxyIdB_get, _Box2D.b2Pair_proxyIdB_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2Pair self) -> long"""
return _Box2D.b2Pair___hash__(self)
def __repr__(self):
return _format_repr(self)
def __init__(self, **kwargs):
_Box2D.b2Pair_swiginit(self,_Box2D.new_b2Pair())
_init_kwargs(self, **kwargs)
__swig_destroy__ = _Box2D.delete_b2Pair
b2Pair.__hash__ = new_instancemethod(_Box2D.b2Pair___hash__, None, b2Pair)
b2Pair_swigregister = _Box2D.b2Pair_swigregister
b2Pair_swigregister(b2Pair)
class b2BroadPhase(object):
"""The broad-phase is used for computing pairs and performing volume queries and ray casts. This broad-phase does not persist pairs. Instead, this reports potentially new pairs. It is up to the client to consume the new pairs and to track subsequent overlap."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
e_nullProxy = _Box2D.b2BroadPhase_e_nullProxy
def __init__(self):
"""
__init__(b2BroadPhase self) -> b2BroadPhase
The broad-phase is used for computing pairs and performing volume queries and ray casts. This broad-phase does not persist pairs. Instead, this reports potentially new pairs. It is up to the client to consume the new pairs and to track subsequent overlap.
"""
_Box2D.b2BroadPhase_swiginit(self, _Box2D.new_b2BroadPhase())
__swig_destroy__ = _Box2D.delete_b2BroadPhase
def MoveProxy(self, proxyId, aabb, displacement):
"""
MoveProxy(b2BroadPhase self, int32 proxyId, b2AABB aabb, b2Vec2 displacement)
Call MoveProxy as many times as you like, then when you are done call UpdatePairs to finalized the proxy pairs (for your time step).
"""
return _Box2D.b2BroadPhase_MoveProxy(self, proxyId, aabb, displacement)
def TouchProxy(self, proxyId):
"""
TouchProxy(b2BroadPhase self, int32 proxyId)
Call to trigger a re-processing of it's pairs on the next call to UpdatePairs.
"""
return _Box2D.b2BroadPhase_TouchProxy(self, proxyId)
def GetFatAABB(self, proxyId):
"""
GetFatAABB(b2BroadPhase self, int32 proxyId) -> b2AABB
Get the fat AABB for a proxy.
"""
return _Box2D.b2BroadPhase_GetFatAABB(self, proxyId)
def TestOverlap(self, proxyIdA, proxyIdB):
"""
TestOverlap(b2BroadPhase self, int32 proxyIdA, int32 proxyIdB) -> bool
Test overlap of fat AABBs.
"""
return _Box2D.b2BroadPhase_TestOverlap(self, proxyIdA, proxyIdB)
def __GetProxyCount(self):
"""
__GetProxyCount(b2BroadPhase self) -> int32
Get the number of proxies.
"""
return _Box2D.b2BroadPhase___GetProxyCount(self)
def __GetTreeHeight(self):
"""__GetTreeHeight(b2BroadPhase self) -> int32"""
return _Box2D.b2BroadPhase___GetTreeHeight(self)
def __GetTreeBalance(self):
"""__GetTreeBalance(b2BroadPhase self) -> int32"""
return _Box2D.b2BroadPhase___GetTreeBalance(self)
def __GetTreeQuality(self):
"""__GetTreeQuality(b2BroadPhase self) -> float32"""
return _Box2D.b2BroadPhase___GetTreeQuality(self)
def ShiftOrigin(self, newOrigin):
"""ShiftOrigin(b2BroadPhase self, b2Vec2 newOrigin)"""
return _Box2D.b2BroadPhase_ShiftOrigin(self, newOrigin)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2BroadPhase self) -> long"""
return _Box2D.b2BroadPhase___hash__(self)
def __repr__(self):
return _format_repr(self)
proxyCount=property(__GetProxyCount, None)
treeHeight=property(__GetTreeHeight, None)
treeBalance=property(__GetTreeBalance, None)
treeQuality=property(__GetTreeQuality, None)
b2BroadPhase.MoveProxy = new_instancemethod(_Box2D.b2BroadPhase_MoveProxy, None, b2BroadPhase)
b2BroadPhase.TouchProxy = new_instancemethod(_Box2D.b2BroadPhase_TouchProxy, None, b2BroadPhase)
b2BroadPhase.GetFatAABB = new_instancemethod(_Box2D.b2BroadPhase_GetFatAABB, None, b2BroadPhase)
b2BroadPhase.TestOverlap = new_instancemethod(_Box2D.b2BroadPhase_TestOverlap, None, b2BroadPhase)
b2BroadPhase.__GetProxyCount = new_instancemethod(_Box2D.b2BroadPhase___GetProxyCount, None, b2BroadPhase)
b2BroadPhase.__GetTreeHeight = new_instancemethod(_Box2D.b2BroadPhase___GetTreeHeight, None, b2BroadPhase)
b2BroadPhase.__GetTreeBalance = new_instancemethod(_Box2D.b2BroadPhase___GetTreeBalance, None, b2BroadPhase)
b2BroadPhase.__GetTreeQuality = new_instancemethod(_Box2D.b2BroadPhase___GetTreeQuality, None, b2BroadPhase)
b2BroadPhase.ShiftOrigin = new_instancemethod(_Box2D.b2BroadPhase_ShiftOrigin, None, b2BroadPhase)
b2BroadPhase.__hash__ = new_instancemethod(_Box2D.b2BroadPhase___hash__, None, b2BroadPhase)
b2BroadPhase_swigregister = _Box2D.b2BroadPhase_swigregister
b2BroadPhase_swigregister(b2BroadPhase)
def b2PairLessThan(pair1, pair2):
"""
b2PairLessThan(b2Pair pair1, b2Pair pair2) -> bool
This is used to sort pairs.
"""
return _Box2D.b2PairLessThan(pair1, pair2)
class b2DistanceProxy(object):
"""A distance proxy is used by the GJK algorithm. It encapsulates any shape."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, shape, index=0):
_Box2D.b2DistanceProxy_swiginit(self,_Box2D.new_b2DistanceProxy())
self.Set(shape, index)
def Set(self, shape, index):
"""
Set(b2DistanceProxy self, b2Shape shape, int32 index)
Initialize the proxy using the given shape. The shape must remain in scope while the proxy is in use.
"""
return _Box2D.b2DistanceProxy_Set(self, shape, index)
def GetSupport(self, d):
"""
GetSupport(b2DistanceProxy self, b2Vec2 d) -> int32
Get the supporting vertex index in the given direction.
"""
return _Box2D.b2DistanceProxy_GetSupport(self, d)
def GetSupportVertex(self, d):
"""
GetSupportVertex(b2DistanceProxy self, b2Vec2 d) -> b2Vec2
Get the supporting vertex in the given direction.
"""
return _Box2D.b2DistanceProxy_GetSupportVertex(self, d)
def __get_vertex_count(self):
"""
__get_vertex_count(b2DistanceProxy self) -> int32
Get the vertex count.
"""
return _Box2D.b2DistanceProxy___get_vertex_count(self)
def __get_vertex(self, index):
"""
__get_vertex(b2DistanceProxy self, int32 index) -> b2Vec2
Get a vertex by index. Used by b2Distance.
"""
return _Box2D.b2DistanceProxy___get_vertex(self, index)
m_buffer = _swig_property(_Box2D.b2DistanceProxy_m_buffer_get, _Box2D.b2DistanceProxy_m_buffer_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2DistanceProxy self) -> long"""
return _Box2D.b2DistanceProxy___hash__(self)
def __repr__(self):
return _format_repr(self)
def __get_vertices(self):
"""Returns all of the vertices as a list of tuples [ (x1,y1), (x2,y2) ... (xN,yN) ]"""
return [ (self.__get_vertex(i).x, self.__get_vertex(i).y )
for i in range(0, self.__get_vertex_count())]
vertices = property(__get_vertices, None)
__swig_destroy__ = _Box2D.delete_b2DistanceProxy
b2DistanceProxy.Set = new_instancemethod(_Box2D.b2DistanceProxy_Set, None, b2DistanceProxy)
b2DistanceProxy.GetSupport = new_instancemethod(_Box2D.b2DistanceProxy_GetSupport, None, b2DistanceProxy)
b2DistanceProxy.GetSupportVertex = new_instancemethod(_Box2D.b2DistanceProxy_GetSupportVertex, None, b2DistanceProxy)
b2DistanceProxy.__get_vertex_count = new_instancemethod(_Box2D.b2DistanceProxy___get_vertex_count, None, b2DistanceProxy)
b2DistanceProxy.__get_vertex = new_instancemethod(_Box2D.b2DistanceProxy___get_vertex, None, b2DistanceProxy)
b2DistanceProxy.__hash__ = new_instancemethod(_Box2D.b2DistanceProxy___hash__, None, b2DistanceProxy)
b2DistanceProxy_swigregister = _Box2D.b2DistanceProxy_swigregister
b2DistanceProxy_swigregister(b2DistanceProxy)
class b2DistanceInput(object):
"""Input for b2Distance. You have to option to use the shape radii in the computation. Even"""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
proxyA = _swig_property(_Box2D.b2DistanceInput_proxyA_get, _Box2D.b2DistanceInput_proxyA_set)
proxyB = _swig_property(_Box2D.b2DistanceInput_proxyB_get, _Box2D.b2DistanceInput_proxyB_set)
transformA = _swig_property(_Box2D.b2DistanceInput_transformA_get, _Box2D.b2DistanceInput_transformA_set)
transformB = _swig_property(_Box2D.b2DistanceInput_transformB_get, _Box2D.b2DistanceInput_transformB_set)
useRadii = _swig_property(_Box2D.b2DistanceInput_useRadii_get, _Box2D.b2DistanceInput_useRadii_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2DistanceInput self) -> long"""
return _Box2D.b2DistanceInput___hash__(self)
def __repr__(self):
return _format_repr(self)
def __init__(self, **kwargs):
_Box2D.b2DistanceInput_swiginit(self,_Box2D.new_b2DistanceInput())
_init_kwargs(self, **kwargs)
__swig_destroy__ = _Box2D.delete_b2DistanceInput
b2DistanceInput.__hash__ = new_instancemethod(_Box2D.b2DistanceInput___hash__, None, b2DistanceInput)
b2DistanceInput_swigregister = _Box2D.b2DistanceInput_swigregister
b2DistanceInput_swigregister(b2DistanceInput)
class b2DistanceOutput(object):
"""Output for b2Distance."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
pointA = _swig_property(_Box2D.b2DistanceOutput_pointA_get, _Box2D.b2DistanceOutput_pointA_set)
pointB = _swig_property(_Box2D.b2DistanceOutput_pointB_get, _Box2D.b2DistanceOutput_pointB_set)
distance = _swig_property(_Box2D.b2DistanceOutput_distance_get, _Box2D.b2DistanceOutput_distance_set)
iterations = _swig_property(_Box2D.b2DistanceOutput_iterations_get, _Box2D.b2DistanceOutput_iterations_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2DistanceOutput self) -> long"""
return _Box2D.b2DistanceOutput___hash__(self)
def __repr__(self):
return _format_repr(self)
def __init__(self, **kwargs):
_Box2D.b2DistanceOutput_swiginit(self,_Box2D.new_b2DistanceOutput())
_init_kwargs(self, **kwargs)
__swig_destroy__ = _Box2D.delete_b2DistanceOutput
b2DistanceOutput.__hash__ = new_instancemethod(_Box2D.b2DistanceOutput___hash__, None, b2DistanceOutput)
b2DistanceOutput_swigregister = _Box2D.b2DistanceOutput_swigregister
b2DistanceOutput_swigregister(b2DistanceOutput)
class b2TOIInput(object):
"""Input parameters for b2TimeOfImpact."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
proxyA = _swig_property(_Box2D.b2TOIInput_proxyA_get, _Box2D.b2TOIInput_proxyA_set)
proxyB = _swig_property(_Box2D.b2TOIInput_proxyB_get, _Box2D.b2TOIInput_proxyB_set)
sweepA = _swig_property(_Box2D.b2TOIInput_sweepA_get, _Box2D.b2TOIInput_sweepA_set)
sweepB = _swig_property(_Box2D.b2TOIInput_sweepB_get, _Box2D.b2TOIInput_sweepB_set)
tMax = _swig_property(_Box2D.b2TOIInput_tMax_get, _Box2D.b2TOIInput_tMax_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2TOIInput self) -> long"""
return _Box2D.b2TOIInput___hash__(self)
def __repr__(self):
return _format_repr(self)
def __init__(self, **kwargs):
_Box2D.b2TOIInput_swiginit(self,_Box2D.new_b2TOIInput())
_init_kwargs(self, **kwargs)
__swig_destroy__ = _Box2D.delete_b2TOIInput
b2TOIInput.__hash__ = new_instancemethod(_Box2D.b2TOIInput___hash__, None, b2TOIInput)
b2TOIInput_swigregister = _Box2D.b2TOIInput_swigregister
b2TOIInput_swigregister(b2TOIInput)
class b2TOIOutput(object):
"""Proxy of C++ b2TOIOutput class."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
e_unknown = _Box2D.b2TOIOutput_e_unknown
e_failed = _Box2D.b2TOIOutput_e_failed
e_overlapped = _Box2D.b2TOIOutput_e_overlapped
e_touching = _Box2D.b2TOIOutput_e_touching
e_separated = _Box2D.b2TOIOutput_e_separated
state = _swig_property(_Box2D.b2TOIOutput_state_get, _Box2D.b2TOIOutput_state_set)
t = _swig_property(_Box2D.b2TOIOutput_t_get, _Box2D.b2TOIOutput_t_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2TOIOutput self) -> long"""
return _Box2D.b2TOIOutput___hash__(self)
def __repr__(self):
return _format_repr(self)
def __init__(self):
"""__init__(b2TOIOutput self) -> b2TOIOutput"""
_Box2D.b2TOIOutput_swiginit(self, _Box2D.new_b2TOIOutput())
__swig_destroy__ = _Box2D.delete_b2TOIOutput
b2TOIOutput.__hash__ = new_instancemethod(_Box2D.b2TOIOutput___hash__, None, b2TOIOutput)
b2TOIOutput_swigregister = _Box2D.b2TOIOutput_swigregister
b2TOIOutput_swigregister(b2TOIOutput)
b2_staticBody = _Box2D.b2_staticBody
b2_kinematicBody = _Box2D.b2_kinematicBody
b2_dynamicBody = _Box2D.b2_dynamicBody
class b2BodyDef(object):
"""A body definition holds all the data needed to construct a rigid body. You can safely re-use body definitions. Shapes are added to a body after construction."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, **kwargs):
_Box2D.b2BodyDef_swiginit(self,_Box2D.new_b2BodyDef())
_init_kwargs(self, **kwargs)
type = _swig_property(_Box2D.b2BodyDef_type_get, _Box2D.b2BodyDef_type_set)
position = _swig_property(_Box2D.b2BodyDef_position_get, _Box2D.b2BodyDef_position_set)
angle = _swig_property(_Box2D.b2BodyDef_angle_get, _Box2D.b2BodyDef_angle_set)
linearVelocity = _swig_property(_Box2D.b2BodyDef_linearVelocity_get, _Box2D.b2BodyDef_linearVelocity_set)
angularVelocity = _swig_property(_Box2D.b2BodyDef_angularVelocity_get, _Box2D.b2BodyDef_angularVelocity_set)
linearDamping = _swig_property(_Box2D.b2BodyDef_linearDamping_get, _Box2D.b2BodyDef_linearDamping_set)
angularDamping = _swig_property(_Box2D.b2BodyDef_angularDamping_get, _Box2D.b2BodyDef_angularDamping_set)
allowSleep = _swig_property(_Box2D.b2BodyDef_allowSleep_get, _Box2D.b2BodyDef_allowSleep_set)
awake = _swig_property(_Box2D.b2BodyDef_awake_get, _Box2D.b2BodyDef_awake_set)
fixedRotation = _swig_property(_Box2D.b2BodyDef_fixedRotation_get, _Box2D.b2BodyDef_fixedRotation_set)
bullet = _swig_property(_Box2D.b2BodyDef_bullet_get, _Box2D.b2BodyDef_bullet_set)
active = _swig_property(_Box2D.b2BodyDef_active_get, _Box2D.b2BodyDef_active_set)
gravityScale = _swig_property(_Box2D.b2BodyDef_gravityScale_get, _Box2D.b2BodyDef_gravityScale_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2BodyDef self) -> long"""
return _Box2D.b2BodyDef___hash__(self)
def __repr__(self):
return _format_repr(self)
def __GetUserData(self):
"""__GetUserData(b2BodyDef self) -> PyObject *"""
return _Box2D.b2BodyDef___GetUserData(self)
def __SetUserData(self, data):
"""__SetUserData(b2BodyDef self, PyObject * data)"""
return _Box2D.b2BodyDef___SetUserData(self, data)
def ClearUserData(self):
"""ClearUserData(b2BodyDef self)"""
return _Box2D.b2BodyDef_ClearUserData(self)
userData = property(__GetUserData, __SetUserData)
def __del__(self):
self.ClearUserData()
_fixtures = None
_shapes = None
_shapeFixture = None
@property
def fixtures(self):
return self._fixtures
@fixtures.setter
def fixtures(self, fixtures):
if isinstance(fixtures, b2FixtureDef):
self._fixtures = [fixtures]
else:
self._fixtures = list(fixtures)
@property
def shapes(self):
return self._shapes
@shapes.setter
def shapes(self, shapes):
if isinstance(shapes, b2Shape):
self._shapes = [shapes]
else:
self._shapes = list(shapes)
@property
def shapeFixture(self):
return self._shapeFixture
@shapeFixture.setter
def shapeFixture(self, fixture):
self._shapeFixture = fixture
__swig_destroy__ = _Box2D.delete_b2BodyDef
b2BodyDef.__hash__ = new_instancemethod(_Box2D.b2BodyDef___hash__, None, b2BodyDef)
b2BodyDef.__GetUserData = new_instancemethod(_Box2D.b2BodyDef___GetUserData, None, b2BodyDef)
b2BodyDef.__SetUserData = new_instancemethod(_Box2D.b2BodyDef___SetUserData, None, b2BodyDef)
b2BodyDef.ClearUserData = new_instancemethod(_Box2D.b2BodyDef_ClearUserData, None, b2BodyDef)
b2BodyDef_swigregister = _Box2D.b2BodyDef_swigregister
b2BodyDef_swigregister(b2BodyDef)
class b2Body(object):
"""A rigid body. These are created via b2World::CreateBody."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def __SetTransform(self, position, angle):
"""
__SetTransform(b2Body self, b2Vec2 position, float32 angle)
Set the position of the body's origin and rotation. This breaks any contacts and wakes the other bodies. Manipulating a body's transform may cause non-physical behavior.
Parameters:
-----------
position:
the world position of the body's local origin.
angle:
the world rotation in radians.
"""
return _Box2D.b2Body___SetTransform(self, position, angle)
def __GetTransform(self):
"""
__GetTransform(b2Body self) -> b2Transform
Get the body transform for the body's origin.
the world transform of the body's origin.
"""
return _Box2D.b2Body___GetTransform(self)
def __GetPosition(self):
"""
__GetPosition(b2Body self) -> b2Vec2
Get the world body origin position.
the world position of the body's origin.
"""
return _Box2D.b2Body___GetPosition(self)
def __GetAngle(self):
"""
__GetAngle(b2Body self) -> float32
Get the angle in radians.
the current world rotation angle in radians.
"""
return _Box2D.b2Body___GetAngle(self)
def __GetWorldCenter(self):
"""
__GetWorldCenter(b2Body self) -> b2Vec2
Get the world position of the center of mass.
"""
return _Box2D.b2Body___GetWorldCenter(self)
def __GetLocalCenter(self):
"""
__GetLocalCenter(b2Body self) -> b2Vec2
Get the local position of the center of mass.
"""
return _Box2D.b2Body___GetLocalCenter(self)
def __SetLinearVelocity(self, v):
"""
__SetLinearVelocity(b2Body self, b2Vec2 v)
Set the linear velocity of the center of mass.
Parameters:
-----------
v:
the new linear velocity of the center of mass.
"""
return _Box2D.b2Body___SetLinearVelocity(self, v)
def __GetLinearVelocity(self):
"""
__GetLinearVelocity(b2Body self) -> b2Vec2
Get the linear velocity of the center of mass.
the linear velocity of the center of mass.
"""
return _Box2D.b2Body___GetLinearVelocity(self)
def __SetAngularVelocity(self, omega):
"""
__SetAngularVelocity(b2Body self, float32 omega)
Set the angular velocity.
Parameters:
-----------
omega:
the new angular velocity in radians/second.
"""
return _Box2D.b2Body___SetAngularVelocity(self, omega)
def __GetAngularVelocity(self):
"""
__GetAngularVelocity(b2Body self) -> float32
Get the angular velocity.
the angular velocity in radians/second.
"""
return _Box2D.b2Body___GetAngularVelocity(self)
def ApplyForce(self, force, point, wake):
"""
ApplyForce(b2Body self, b2Vec2 force, b2Vec2 point, bool wake)
Apply a force at a world point. If the force is not applied at the center of mass, it will generate a torque and affect the angular velocity. This wakes up the body.
Parameters:
-----------
force:
the world force vector, usually in Newtons (N).
point:
the world position of the point of application.
"""
return _Box2D.b2Body_ApplyForce(self, force, point, wake)
def ApplyForceToCenter(self, force, wake):
"""ApplyForceToCenter(b2Body self, b2Vec2 force, bool wake)"""
return _Box2D.b2Body_ApplyForceToCenter(self, force, wake)
def ApplyTorque(self, torque, wake):
"""
ApplyTorque(b2Body self, float32 torque, bool wake)
Apply a torque. This affects the angular velocity without affecting the linear velocity of the center of mass. This wakes up the body.
Parameters:
-----------
torque:
about the z-axis (out of the screen), usually in N-m.
"""
return _Box2D.b2Body_ApplyTorque(self, torque, wake)
def ApplyLinearImpulse(self, impulse, point, wake):
"""
ApplyLinearImpulse(b2Body self, b2Vec2 impulse, b2Vec2 point, bool wake)
Apply an impulse at a point. This immediately modifies the velocity. It also modifies the angular velocity if the point of application is not at the center of mass. This wakes up the body.
Parameters:
-----------
impulse:
the world impulse vector, usually in N-seconds or kg-m/s.
point:
the world position of the point of application.
"""
return _Box2D.b2Body_ApplyLinearImpulse(self, impulse, point, wake)
def ApplyAngularImpulse(self, impulse, wake):
"""
ApplyAngularImpulse(b2Body self, float32 impulse, bool wake)
Apply an angular impulse.
Parameters:
-----------
impulse:
the angular impulse in units of kg*m*m/s
"""
return _Box2D.b2Body_ApplyAngularImpulse(self, impulse, wake)
def __GetMass(self):
"""
__GetMass(b2Body self) -> float32
Get the total mass of the body.
the mass, usually in kilograms (kg).
"""
return _Box2D.b2Body___GetMass(self)
def __GetInertia(self):
"""
__GetInertia(b2Body self) -> float32
Get the rotational inertia of the body about the local origin.
the rotational inertia, usually in kg-m^2.
"""
return _Box2D.b2Body___GetInertia(self)
def GetMassData(self, data):
"""
GetMassData(b2Body self, b2MassData data)
Get the mass data of the body.
a struct containing the mass, inertia and center of the body.
"""
return _Box2D.b2Body_GetMassData(self, data)
def __SetMassData(self, data):
"""
__SetMassData(b2Body self, b2MassData data)
Set the mass properties to override the mass properties of the fixtures. Note that this changes the center of mass position. Note that creating or destroying fixtures can also alter the mass. This function has no effect if the body isn't dynamic.
Parameters:
-----------
massData:
the mass properties.
"""
return _Box2D.b2Body___SetMassData(self, data)
def ResetMassData(self):
"""
ResetMassData(b2Body self)
This resets the mass properties to the sum of the mass properties of the fixtures. This normally does not need to be called unless you called SetMassData to override the mass and you later want to reset the mass.
"""
return _Box2D.b2Body_ResetMassData(self)
def GetWorldPoint(self, localPoint):
"""
GetWorldPoint(b2Body self, b2Vec2 localPoint) -> b2Vec2
Get the world coordinates of a point given the local coordinates.
Parameters:
-----------
localPoint:
a point on the body measured relative the the body's origin.
the same point expressed in world coordinates.
"""
return _Box2D.b2Body_GetWorldPoint(self, localPoint)
def GetWorldVector(self, localVector):
"""
GetWorldVector(b2Body self, b2Vec2 localVector) -> b2Vec2
Get the world coordinates of a vector given the local coordinates.
Parameters:
-----------
localVector:
a vector fixed in the body.
the same vector expressed in world coordinates.
"""
return _Box2D.b2Body_GetWorldVector(self, localVector)
def GetLocalPoint(self, worldPoint):
"""
GetLocalPoint(b2Body self, b2Vec2 worldPoint) -> b2Vec2
Gets a local point relative to the body's origin given a world point.
Parameters:
-----------
a:
point in world coordinates.
the corresponding local point relative to the body's origin.
"""
return _Box2D.b2Body_GetLocalPoint(self, worldPoint)
def GetLocalVector(self, worldVector):
"""
GetLocalVector(b2Body self, b2Vec2 worldVector) -> b2Vec2
Gets a local vector given a world vector.
Parameters:
-----------
a:
vector in world coordinates.
the corresponding local vector.
"""
return _Box2D.b2Body_GetLocalVector(self, worldVector)
def GetLinearVelocityFromWorldPoint(self, worldPoint):
"""
GetLinearVelocityFromWorldPoint(b2Body self, b2Vec2 worldPoint) -> b2Vec2
Get the world linear velocity of a world point attached to this body.
Parameters:
-----------
a:
point in world coordinates.
the world velocity of a point.
"""
return _Box2D.b2Body_GetLinearVelocityFromWorldPoint(self, worldPoint)
def GetLinearVelocityFromLocalPoint(self, localPoint):
"""
GetLinearVelocityFromLocalPoint(b2Body self, b2Vec2 localPoint) -> b2Vec2
Get the world velocity of a local point.
Parameters:
-----------
a:
point in local coordinates.
the world velocity of a point.
"""
return _Box2D.b2Body_GetLinearVelocityFromLocalPoint(self, localPoint)
def __GetLinearDamping(self):
"""
__GetLinearDamping(b2Body self) -> float32
Get the linear damping of the body.
"""
return _Box2D.b2Body___GetLinearDamping(self)
def __SetLinearDamping(self, linearDamping):
"""
__SetLinearDamping(b2Body self, float32 linearDamping)
Set the linear damping of the body.
"""
return _Box2D.b2Body___SetLinearDamping(self, linearDamping)
def __GetAngularDamping(self):
"""
__GetAngularDamping(b2Body self) -> float32
Get the angular damping of the body.
"""
return _Box2D.b2Body___GetAngularDamping(self)
def __SetAngularDamping(self, angularDamping):
"""
__SetAngularDamping(b2Body self, float32 angularDamping)
Set the angular damping of the body.
"""
return _Box2D.b2Body___SetAngularDamping(self, angularDamping)
def __GetGravityScale(self):
"""__GetGravityScale(b2Body self) -> float32"""
return _Box2D.b2Body___GetGravityScale(self)
def __SetGravityScale(self, scale):
"""__SetGravityScale(b2Body self, float32 scale)"""
return _Box2D.b2Body___SetGravityScale(self, scale)
def __SetType(self, type):
"""
__SetType(b2Body self, b2BodyType type)
Set the type of this body. This may alter the mass and velocity.
"""
return _Box2D.b2Body___SetType(self, type)
def __GetType(self):
"""
__GetType(b2Body self) -> b2BodyType
Get the type of this body.
"""
return _Box2D.b2Body___GetType(self)
def __SetBullet(self, flag):
"""
__SetBullet(b2Body self, bool flag)
Should this body be treated like a bullet for continuous collision detection?
"""
return _Box2D.b2Body___SetBullet(self, flag)
def __IsBullet(self):
"""
__IsBullet(b2Body self) -> bool
Is this body treated like a bullet for continuous collision detection?
"""
return _Box2D.b2Body___IsBullet(self)
def __SetSleepingAllowed(self, flag):
"""
__SetSleepingAllowed(b2Body self, bool flag)
You can disable sleeping on this body. If you disable sleeping, the body will be woken.
"""
return _Box2D.b2Body___SetSleepingAllowed(self, flag)
def __IsSleepingAllowed(self):
"""
__IsSleepingAllowed(b2Body self) -> bool
Is this body allowed to sleep.
"""
return _Box2D.b2Body___IsSleepingAllowed(self)
def __SetAwake(self, flag):
"""
__SetAwake(b2Body self, bool flag)
Set the sleep state of the body. A sleeping body has very low CPU cost.
Parameters:
-----------
flag:
set to true to put body to sleep, false to wake it.
"""
return _Box2D.b2Body___SetAwake(self, flag)
def __IsAwake(self):
"""
__IsAwake(b2Body self) -> bool
Get the sleeping state of this body.
true if the body is sleeping.
"""
return _Box2D.b2Body___IsAwake(self)
def __SetActive(self, flag):
"""
__SetActive(b2Body self, bool flag)
Set the active state of the body. An inactive body is not simulated and cannot be collided with or woken up. If you pass a flag of true, all fixtures will be added to the broad-phase. If you pass a flag of false, all fixtures will be removed from the broad-phase and all contacts will be destroyed. Fixtures and joints are otherwise unaffected. You may continue to create/destroy fixtures and joints on inactive bodies. Fixtures on an inactive body are implicitly inactive and will not participate in collisions, ray-casts, or queries. Joints connected to an inactive body are implicitly inactive. An inactive body is still owned by a b2Worldobject and remains in the body list.
"""
return _Box2D.b2Body___SetActive(self, flag)
def __IsActive(self):
"""
__IsActive(b2Body self) -> bool
Get the active state of the body.
"""
return _Box2D.b2Body___IsActive(self)
def __SetFixedRotation(self, flag):
"""
__SetFixedRotation(b2Body self, bool flag)
Set this body to have fixed rotation. This causes the mass to be reset.
"""
return _Box2D.b2Body___SetFixedRotation(self, flag)
def __IsFixedRotation(self):
"""
__IsFixedRotation(b2Body self) -> bool
Does this body have fixed rotation?
"""
return _Box2D.b2Body___IsFixedRotation(self)
def __GetFixtureList_internal(self, *args):
"""
__GetFixtureList_internal(b2Body self) -> b2Fixture
__GetFixtureList_internal(b2Body self) -> b2Fixture
Get the list of all fixtures attached to this body.
"""
return _Box2D.b2Body___GetFixtureList_internal(self, *args)
def __GetJointList_internal(self, *args):
"""
__GetJointList_internal(b2Body self) -> b2JointEdge
__GetJointList_internal(b2Body self) -> b2JointEdge
Get the list of all joints attached to this body.
"""
return _Box2D.b2Body___GetJointList_internal(self, *args)
def __GetContactList_internal(self, *args):
"""
__GetContactList_internal(b2Body self) -> b2ContactEdge
__GetContactList_internal(b2Body self) -> b2ContactEdge
Get the list of all contacts attached to this body.
WARNING:
this list changes during the time step and you may miss some collisions if you don't use b2ContactListener.
"""
return _Box2D.b2Body___GetContactList_internal(self, *args)
def __GetNext(self, *args):
"""
__GetNext(b2Body self) -> b2Body
__GetNext(b2Body self) -> b2Body
Get the next body in the world's body list.
"""
return _Box2D.b2Body___GetNext(self, *args)
def __GetWorld(self, *args):
"""
__GetWorld(b2Body self) -> b2World
__GetWorld(b2Body self) -> b2World
Get the parent world of this body.
"""
return _Box2D.b2Body___GetWorld(self, *args)
def Dump(self):
"""Dump(b2Body self)"""
return _Box2D.b2Body_Dump(self)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2Body self) -> long"""
return _Box2D.b2Body___hash__(self)
def __repr__(self):
return _format_repr(self)
def DestroyFixture(self, fixture):
"""
DestroyFixture(b2Body self, b2Fixture fixture)
Destroy a fixture. This removes the fixture from the broad-phase and destroys all contacts associated with this fixture. This will automatically adjust the mass of the body if the body is dynamic and the fixture has positive density. All fixtures attached to a body are implicitly destroyed when the body is destroyed.
Parameters:
-----------
fixture:
the fixture to be removed.
WARNING:
This function is locked during callbacks.
"""
return _Box2D.b2Body_DestroyFixture(self, fixture)
def __CreateFixture(self, *args):
"""
__CreateFixture(b2Body self, b2Shape shape, float32 density) -> b2Fixture
__CreateFixture(b2Body self, b2FixtureDef defn) -> b2Fixture
"""
return _Box2D.b2Body___CreateFixture(self, *args)
def __GetUserData(self):
"""__GetUserData(b2Body self) -> PyObject *"""
return _Box2D.b2Body___GetUserData(self)
def __SetUserData(self, data):
"""__SetUserData(b2Body self, PyObject * data)"""
return _Box2D.b2Body___SetUserData(self, data)
def ClearUserData(self):
"""ClearUserData(b2Body self)"""
return _Box2D.b2Body_ClearUserData(self)
userData = property(__GetUserData, __SetUserData)
__eq__ = b2BodyCompare
__ne__ = lambda self,other: not b2BodyCompare(self,other)
def __GetMassData(self):
"""
Get a b2MassData object that represents this b2Body
NOTE: To just get the mass, use body.mass
"""
ret = b2MassData()
ret.center=self.localCenter
ret.I = self.inertia
ret.mass = self.mass
return ret
def __SetInertia(self, inertia):
"""
Set the body's inertia
"""
md = self.massData
md.I = inertia
self.massData=md
def __SetMass(self, mass):
"""
Set the body's mass
"""
md = self.massData
md.mass = mass
self.massData=md
def __SetLocalCenter(self, lcenter):
"""
Set the body's local center
"""
md = self.massData
md.center = lcenter
self.massData=md
def __iter__(self):
"""
Iterates over the fixtures in the body
"""
for fixture in self.fixtures:
yield fixture
def __CreateShapeFixture(self, type_, **kwargs):
"""
Internal function to handle creating circles, polygons, etc.
without first creating a fixture. type_ is b2Shape.
"""
shape=type_()
fixture=b2FixtureDef(shape=shape)
for key, value in kwargs.items():
# Note that these hasattrs use the types to get around
# the fact that some properties are write-only (like 'box' in
# polygon shapes), and as such do not show up with 'hasattr'.
if hasattr(type_, key):
to_set=shape
elif hasattr(b2FixtureDef, key):
to_set=fixture
else:
raise AttributeError('Property %s not found in either %s or b2FixtureDef' % (key, type_.__name__))
try:
setattr(to_set, key, value)
except Exception as ex:
raise ex.__class__('Failed on kwargs, class="%s" key="%s": %s' \
% (to_set.__class__.__name__, key, ex))
return self.CreateFixture(fixture)
def CreatePolygonFixture(self, **kwargs):
"""
Create a polygon shape without an explicit fixture definition.
Takes kwargs; you can pass in properties for either the polygon
or the fixture to this function. For example:
CreatePolygonFixture(box=(1, 1), friction=0.2, density=1.0)
where 'box' is a property from the polygon shape, and
'friction' and 'density' are from the fixture definition.
"""
return self.__CreateShapeFixture(b2PolygonShape, **kwargs)
def CreateCircleFixture(self, **kwargs):
"""
Create a circle shape without an explicit fixture definition.
Takes kwargs; you can pass in properties for either the circle
or the fixture to this function. For example:
CreateCircleFixture(radius=0.2, friction=0.2, density=1.0)
where 'radius' is a property from the circle shape, and
'friction' and 'density' are from the fixture definition.
"""
return self.__CreateShapeFixture(b2CircleShape, **kwargs)
def CreateEdgeFixture(self, **kwargs):
"""
Create a edge shape without an explicit fixture definition.
Takes kwargs; you can pass in properties for either the edge
or the fixture to this function. For example:
CreateEdgeFixture(vertices=[(0,0),(1,0)], friction=0.2, density=1.0)
where 'vertices' is a property from the edge shape, and
'friction' and 'density' are from the fixture definition.
"""
return self.__CreateShapeFixture(b2EdgeShape, **kwargs)
def CreateLoopFixture(self, **kwargs):
"""
Create a loop shape without an explicit fixture definition.
Takes kwargs; you can pass in properties for either the loop
or the fixture to this function. For example:
CreateLoopFixture(vertices=[...], friction=0.2, density=1.0)
where 'vertices' is a property from the loop shape, and
'friction' and 'density' are from the fixture definition.
"""
return self.__CreateShapeFixture(b2ChainShape, **kwargs)
CreateChainFixture = CreateLoopFixture
def CreateFixturesFromShapes(self, shapes=None, shapeFixture=None):
"""
Create fixture(s) on the body from one or more shapes, and optionally a single
fixture definition.
Takes kwargs; examples of valid combinations are as follows:
CreateFixturesFromShapes(shapes=b2CircleShape(radius=0.2))
CreateFixturesFromShapes(shapes=b2CircleShape(radius=0.2), shapeFixture=b2FixtureDef(friction=0.2))
CreateFixturesFromShapes(shapes=[b2CircleShape(radius=0.2), b2PolygonShape(box=[1,2])])
"""
if shapes==None:
raise TypeError('At least one shape required')
if shapeFixture==None:
shapeFixture=b2FixtureDef()
oldShape=None
else:
oldShape = shapeFixture.shape
ret=None
try:
if isinstance(shapes, (list, tuple)):
ret = []
for shape in shapes:
shapeFixture.shape = shape
ret.append(self.__CreateFixture(shapeFixture))
else:
shapeFixture.shape=shapes
ret = self.__CreateFixture(shapeFixture)
finally:
shapeFixture.shape=oldShape
return ret
def CreateFixture(self, defn=None, **kwargs):
"""
Create a fixtures on the body.
Takes kwargs; examples of valid combinations are as follows:
CreateFixture(b2FixtureDef(shape=s, restitution=0.2, ...))
CreateFixture(shape=s, restitution=0.2, ...)
"""
if defn is not None and isinstance(defn, b2FixtureDef):
return self.__CreateFixture(defn)
else:
if 'shape' not in kwargs:
raise ValueError('Must specify the shape for the fixture')
return self.__CreateFixture(b2FixtureDef(**kwargs))
def CreateEdgeChain(self, edge_list):
"""
Creates a body a set of connected edge chains.
Expects edge_list to be a list of vertices, length >= 2.
"""
prev=None
if len(edge_list) < 2:
raise ValueError('Edge list length >= 2')
shape=b2EdgeShape(vertices=[list(i) for i in edge_list[0:2]])
self.CreateFixturesFromShapes(shape)
prev = edge_list[1]
for edge in edge_list[1:]:
if len(edge) != 2:
raise ValueError('Vertex length != 2, "%s"' % list(edge))
shape.vertices = [list(prev), list(edge)]
self.CreateFixturesFromShapes(shape)
prev=edge
# Read-write properties
sleepingAllowed = property(__IsSleepingAllowed, __SetSleepingAllowed)
angularVelocity = property(__GetAngularVelocity, __SetAngularVelocity)
linearVelocity = property(__GetLinearVelocity, __SetLinearVelocity)
awake = property(__IsAwake, __SetAwake)
angularDamping = property(__GetAngularDamping, __SetAngularDamping)
fixedRotation = property(__IsFixedRotation, __SetFixedRotation)
linearDamping = property(__GetLinearDamping, __SetLinearDamping)
bullet = property(__IsBullet, __SetBullet)
type = property(__GetType, __SetType)
active = property(__IsActive, __SetActive)
angle = property(__GetAngle, lambda self, angle: self.__SetTransform(self.position, angle))
transform = property(__GetTransform, lambda self, value: self.__SetTransform(*value))
massData = property(__GetMassData, __SetMassData)
mass = property(__GetMass, __SetMass)
localCenter = property(__GetLocalCenter, __SetLocalCenter)
inertia = property(__GetInertia, __SetInertia)
position = property(__GetPosition, lambda self, pos: self.__SetTransform(pos, self.angle))
gravityScale = property(__GetGravityScale, __SetGravityScale)
# Read-only
joints = property(lambda self: _list_from_linked_list(self.__GetJointList_internal()), None,
doc="""All joints connected to the body as a list.
NOTE: This re-creates the list on every call. See also joints_gen.""")
contacts = property(lambda self: _list_from_linked_list(self.__GetContactList_internal()), None,
doc="""All contacts related to the body as a list.
NOTE: This re-creates the list on every call. See also contacts_gen.""")
fixtures = property(lambda self: _list_from_linked_list(self.__GetFixtureList_internal()), None,
doc="""All fixtures contained in this body as a list.
NOTE: This re-creates the list on every call. See also fixtures_gen.""")
joints_gen = property(lambda self: _indexable_generator(_generator_from_linked_list(self.__GetJointList_internal())), None,
doc="""Indexable generator of the connected joints to this body.
NOTE: When not using the whole list, this may be preferable to using 'joints'.""")
contacts_gen = property(lambda self: _indexable_generator(_generator_from_linked_list(self.__GetContactList_internal())), None,
doc="""Indexable generator of the related contacts.
NOTE: When not using the whole list, this may be preferable to using 'contacts'.""")
fixtures_gen = property(lambda self: _indexable_generator(_generator_from_linked_list(self.__GetFixtureList_internal())), None,
doc="""Indexable generator of the contained fixtures.
NOTE: When not using the whole list, this may be preferable to using 'fixtures'.""")
next = property(__GetNext, None)
worldCenter = property(__GetWorldCenter, None)
world = property(__GetWorld, None)
b2Body.__SetTransform = new_instancemethod(_Box2D.b2Body___SetTransform, None, b2Body)
b2Body.__GetTransform = new_instancemethod(_Box2D.b2Body___GetTransform, None, b2Body)
b2Body.__GetPosition = new_instancemethod(_Box2D.b2Body___GetPosition, None, b2Body)
b2Body.__GetAngle = new_instancemethod(_Box2D.b2Body___GetAngle, None, b2Body)
b2Body.__GetWorldCenter = new_instancemethod(_Box2D.b2Body___GetWorldCenter, None, b2Body)
b2Body.__GetLocalCenter = new_instancemethod(_Box2D.b2Body___GetLocalCenter, None, b2Body)
b2Body.__SetLinearVelocity = new_instancemethod(_Box2D.b2Body___SetLinearVelocity, None, b2Body)
b2Body.__GetLinearVelocity = new_instancemethod(_Box2D.b2Body___GetLinearVelocity, None, b2Body)
b2Body.__SetAngularVelocity = new_instancemethod(_Box2D.b2Body___SetAngularVelocity, None, b2Body)
b2Body.__GetAngularVelocity = new_instancemethod(_Box2D.b2Body___GetAngularVelocity, None, b2Body)
b2Body.ApplyForce = new_instancemethod(_Box2D.b2Body_ApplyForce, None, b2Body)
b2Body.ApplyForceToCenter = new_instancemethod(_Box2D.b2Body_ApplyForceToCenter, None, b2Body)
b2Body.ApplyTorque = new_instancemethod(_Box2D.b2Body_ApplyTorque, None, b2Body)
b2Body.ApplyLinearImpulse = new_instancemethod(_Box2D.b2Body_ApplyLinearImpulse, None, b2Body)
b2Body.ApplyAngularImpulse = new_instancemethod(_Box2D.b2Body_ApplyAngularImpulse, None, b2Body)
b2Body.__GetMass = new_instancemethod(_Box2D.b2Body___GetMass, None, b2Body)
b2Body.__GetInertia = new_instancemethod(_Box2D.b2Body___GetInertia, None, b2Body)
b2Body.GetMassData = new_instancemethod(_Box2D.b2Body_GetMassData, None, b2Body)
b2Body.__SetMassData = new_instancemethod(_Box2D.b2Body___SetMassData, None, b2Body)
b2Body.ResetMassData = new_instancemethod(_Box2D.b2Body_ResetMassData, None, b2Body)
b2Body.GetWorldPoint = new_instancemethod(_Box2D.b2Body_GetWorldPoint, None, b2Body)
b2Body.GetWorldVector = new_instancemethod(_Box2D.b2Body_GetWorldVector, None, b2Body)
b2Body.GetLocalPoint = new_instancemethod(_Box2D.b2Body_GetLocalPoint, None, b2Body)
b2Body.GetLocalVector = new_instancemethod(_Box2D.b2Body_GetLocalVector, None, b2Body)
b2Body.GetLinearVelocityFromWorldPoint = new_instancemethod(_Box2D.b2Body_GetLinearVelocityFromWorldPoint, None, b2Body)
b2Body.GetLinearVelocityFromLocalPoint = new_instancemethod(_Box2D.b2Body_GetLinearVelocityFromLocalPoint, None, b2Body)
b2Body.__GetLinearDamping = new_instancemethod(_Box2D.b2Body___GetLinearDamping, None, b2Body)
b2Body.__SetLinearDamping = new_instancemethod(_Box2D.b2Body___SetLinearDamping, None, b2Body)
b2Body.__GetAngularDamping = new_instancemethod(_Box2D.b2Body___GetAngularDamping, None, b2Body)
b2Body.__SetAngularDamping = new_instancemethod(_Box2D.b2Body___SetAngularDamping, None, b2Body)
b2Body.__GetGravityScale = new_instancemethod(_Box2D.b2Body___GetGravityScale, None, b2Body)
b2Body.__SetGravityScale = new_instancemethod(_Box2D.b2Body___SetGravityScale, None, b2Body)
b2Body.__SetType = new_instancemethod(_Box2D.b2Body___SetType, None, b2Body)
b2Body.__GetType = new_instancemethod(_Box2D.b2Body___GetType, None, b2Body)
b2Body.__SetBullet = new_instancemethod(_Box2D.b2Body___SetBullet, None, b2Body)
b2Body.__IsBullet = new_instancemethod(_Box2D.b2Body___IsBullet, None, b2Body)
b2Body.__SetSleepingAllowed = new_instancemethod(_Box2D.b2Body___SetSleepingAllowed, None, b2Body)
b2Body.__IsSleepingAllowed = new_instancemethod(_Box2D.b2Body___IsSleepingAllowed, None, b2Body)
b2Body.__SetAwake = new_instancemethod(_Box2D.b2Body___SetAwake, None, b2Body)
b2Body.__IsAwake = new_instancemethod(_Box2D.b2Body___IsAwake, None, b2Body)
b2Body.__SetActive = new_instancemethod(_Box2D.b2Body___SetActive, None, b2Body)
b2Body.__IsActive = new_instancemethod(_Box2D.b2Body___IsActive, None, b2Body)
b2Body.__SetFixedRotation = new_instancemethod(_Box2D.b2Body___SetFixedRotation, None, b2Body)
b2Body.__IsFixedRotation = new_instancemethod(_Box2D.b2Body___IsFixedRotation, None, b2Body)
b2Body.__GetFixtureList_internal = new_instancemethod(_Box2D.b2Body___GetFixtureList_internal, None, b2Body)
b2Body.__GetJointList_internal = new_instancemethod(_Box2D.b2Body___GetJointList_internal, None, b2Body)
b2Body.__GetContactList_internal = new_instancemethod(_Box2D.b2Body___GetContactList_internal, None, b2Body)
b2Body.__GetNext = new_instancemethod(_Box2D.b2Body___GetNext, None, b2Body)
b2Body.__GetWorld = new_instancemethod(_Box2D.b2Body___GetWorld, None, b2Body)
b2Body.Dump = new_instancemethod(_Box2D.b2Body_Dump, None, b2Body)
b2Body.__hash__ = new_instancemethod(_Box2D.b2Body___hash__, None, b2Body)
b2Body.DestroyFixture = new_instancemethod(_Box2D.b2Body_DestroyFixture, None, b2Body)
b2Body.__CreateFixture = new_instancemethod(_Box2D.b2Body___CreateFixture, None, b2Body)
b2Body.__GetUserData = new_instancemethod(_Box2D.b2Body___GetUserData, None, b2Body)
b2Body.__SetUserData = new_instancemethod(_Box2D.b2Body___SetUserData, None, b2Body)
b2Body.ClearUserData = new_instancemethod(_Box2D.b2Body_ClearUserData, None, b2Body)
b2Body_swigregister = _Box2D.b2Body_swigregister
b2Body_swigregister(b2Body)
class b2Filter(object):
"""This holds contact filtering data."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, **kwargs):
_Box2D.b2Filter_swiginit(self,_Box2D.new_b2Filter())
_init_kwargs(self, **kwargs)
categoryBits = _swig_property(_Box2D.b2Filter_categoryBits_get, _Box2D.b2Filter_categoryBits_set)
maskBits = _swig_property(_Box2D.b2Filter_maskBits_get, _Box2D.b2Filter_maskBits_set)
groupIndex = _swig_property(_Box2D.b2Filter_groupIndex_get, _Box2D.b2Filter_groupIndex_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2Filter self) -> long"""
return _Box2D.b2Filter___hash__(self)
def __repr__(self):
return _format_repr(self)
__swig_destroy__ = _Box2D.delete_b2Filter
b2Filter.__hash__ = new_instancemethod(_Box2D.b2Filter___hash__, None, b2Filter)
b2Filter_swigregister = _Box2D.b2Filter_swigregister
b2Filter_swigregister(b2Filter)
class b2FixtureDef(object):
"""A fixture definition is used to create a fixture. This class defines an abstract fixture definition. You can reuse fixture definitions safely."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, **kwargs):
_Box2D.b2FixtureDef_swiginit(self,_Box2D.new_b2FixtureDef())
_init_kwargs(self, **kwargs)
shape = _swig_property(_Box2D.b2FixtureDef_shape_get, _Box2D.b2FixtureDef_shape_set)
friction = _swig_property(_Box2D.b2FixtureDef_friction_get, _Box2D.b2FixtureDef_friction_set)
restitution = _swig_property(_Box2D.b2FixtureDef_restitution_get, _Box2D.b2FixtureDef_restitution_set)
density = _swig_property(_Box2D.b2FixtureDef_density_get, _Box2D.b2FixtureDef_density_set)
isSensor = _swig_property(_Box2D.b2FixtureDef_isSensor_get, _Box2D.b2FixtureDef_isSensor_set)
filter = _swig_property(_Box2D.b2FixtureDef_filter_get, _Box2D.b2FixtureDef_filter_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2FixtureDef self) -> long"""
return _Box2D.b2FixtureDef___hash__(self)
def __repr__(self):
return _format_repr(self)
def __GetUserData(self):
"""__GetUserData(b2FixtureDef self) -> PyObject *"""
return _Box2D.b2FixtureDef___GetUserData(self)
def __SetUserData(self, data):
"""__SetUserData(b2FixtureDef self, PyObject * data)"""
return _Box2D.b2FixtureDef___SetUserData(self, data)
def ClearUserData(self):
"""ClearUserData(b2FixtureDef self)"""
return _Box2D.b2FixtureDef_ClearUserData(self)
userData = property(__GetUserData, __SetUserData)
def __del__(self):
self.ClearUserData()
def __SetCategoryBits(self, value):
self.filter.categoryBits=value
def __SetGroupIndex(self, value):
self.filter.groupIndex=value
def __SetMaskBits(self, value):
self.filter.maskBits=value
categoryBits=property(lambda self: self.filter.categoryBits, __SetCategoryBits)
groupIndex=property(lambda self: self.filter.groupIndex, __SetGroupIndex)
maskBits=property(lambda self: self.filter.maskBits, __SetMaskBits)
__swig_destroy__ = _Box2D.delete_b2FixtureDef
b2FixtureDef.__hash__ = new_instancemethod(_Box2D.b2FixtureDef___hash__, None, b2FixtureDef)
b2FixtureDef.__GetUserData = new_instancemethod(_Box2D.b2FixtureDef___GetUserData, None, b2FixtureDef)
b2FixtureDef.__SetUserData = new_instancemethod(_Box2D.b2FixtureDef___SetUserData, None, b2FixtureDef)
b2FixtureDef.ClearUserData = new_instancemethod(_Box2D.b2FixtureDef_ClearUserData, None, b2FixtureDef)
b2FixtureDef_swigregister = _Box2D.b2FixtureDef_swigregister
b2FixtureDef_swigregister(b2FixtureDef)
class b2FixtureProxy(object):
"""This proxy is used internally to connect fixtures to the broad-phase."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
aabb = _swig_property(_Box2D.b2FixtureProxy_aabb_get, _Box2D.b2FixtureProxy_aabb_set)
fixture = _swig_property(_Box2D.b2FixtureProxy_fixture_get, _Box2D.b2FixtureProxy_fixture_set)
childIndex = _swig_property(_Box2D.b2FixtureProxy_childIndex_get, _Box2D.b2FixtureProxy_childIndex_set)
proxyId = _swig_property(_Box2D.b2FixtureProxy_proxyId_get, _Box2D.b2FixtureProxy_proxyId_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2FixtureProxy self) -> long"""
return _Box2D.b2FixtureProxy___hash__(self)
def __repr__(self):
return _format_repr(self)
def __init__(self):
"""
__init__(b2FixtureProxy self) -> b2FixtureProxy
This proxy is used internally to connect fixtures to the broad-phase.
"""
_Box2D.b2FixtureProxy_swiginit(self, _Box2D.new_b2FixtureProxy())
__swig_destroy__ = _Box2D.delete_b2FixtureProxy
b2FixtureProxy.__hash__ = new_instancemethod(_Box2D.b2FixtureProxy___hash__, None, b2FixtureProxy)
b2FixtureProxy_swigregister = _Box2D.b2FixtureProxy_swigregister
b2FixtureProxy_swigregister(b2FixtureProxy)
class b2Fixture(object):
"""
A fixture is used to attach a shape to a body for collision detection. A fixture inherits its transform from its parent. Fixtures hold additional non-geometric data such as friction, collision filters, etc. Fixtures are created via b2Body::CreateFixture.
WARNING:
you cannot reuse fixtures.
"""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def __GetType(self):
"""
__GetType(b2Fixture self) -> b2Shape::Type
Get the type of the child shape. You can use this to down cast to the concrete shape.
the shape type.
"""
return _Box2D.b2Fixture___GetType(self)
def __GetShape(self, *args):
"""
__GetShape(b2Fixture self) -> b2Shape
__GetShape(b2Fixture self) -> b2Shape
Get the child shape. You can modify the child shape, however you should not change the number of vertices because this will crash some collision caching mechanisms. Manipulating the shape may lead to non-physical behavior.
"""
return _Box2D.b2Fixture___GetShape(self, *args)
def __SetSensor(self, sensor):
"""
__SetSensor(b2Fixture self, bool sensor)
Set if this fixture is a sensor.
"""
return _Box2D.b2Fixture___SetSensor(self, sensor)
def __IsSensor(self):
"""
__IsSensor(b2Fixture self) -> bool
Is this fixture a sensor (non-solid)?
the true if the shape is a sensor.
"""
return _Box2D.b2Fixture___IsSensor(self)
def __SetFilterData(self, filter):
"""
__SetFilterData(b2Fixture self, b2Filter filter)
Set the contact filtering data. This will not update contacts until the next time step when either parent body is active and awake. This automatically calls Refilter.
"""
return _Box2D.b2Fixture___SetFilterData(self, filter)
def __GetFilterData(self):
"""
__GetFilterData(b2Fixture self) -> b2Filter
Get the contact filtering data.
"""
return _Box2D.b2Fixture___GetFilterData(self)
def Refilter(self):
"""
Refilter(b2Fixture self)
Call this if you want to establish collision that was previously disabled by b2ContactFilter::ShouldCollide.
"""
return _Box2D.b2Fixture_Refilter(self)
def __GetBody(self, *args):
"""
__GetBody(b2Fixture self) -> b2Body
__GetBody(b2Fixture self) -> b2Body
Get the parent body of this fixture. This is NULL if the fixture is not attached.
the parent body.
"""
return _Box2D.b2Fixture___GetBody(self, *args)
def __GetNext(self, *args):
"""
__GetNext(b2Fixture self) -> b2Fixture
__GetNext(b2Fixture self) -> b2Fixture
Get the next fixture in the parent body's fixture list.
the next shape.
"""
return _Box2D.b2Fixture___GetNext(self, *args)
def TestPoint(self, p):
"""
TestPoint(b2Fixture self, b2Vec2 p) -> bool
Test a point for containment in this fixture.
Parameters:
-----------
p:
a point in world coordinates.
"""
return _Box2D.b2Fixture_TestPoint(self, p)
def RayCast(self, output, input, childIndex):
"""
RayCast(b2Fixture self, b2RayCastOutput output, b2RayCastInput input, int32 childIndex) -> bool
Cast a ray against this shape.
Parameters:
-----------
output:
the ray-cast results.
input:
the ray-cast input parameters.
"""
return _Box2D.b2Fixture_RayCast(self, output, input, childIndex)
def __GetMassData(self, massData):
"""
__GetMassData(b2Fixture self, b2MassData massData)
Get the mass data for this fixture. The mass data is based on the density and the shape. The rotational inertia is about the shape's origin. This operation may be expensive.
"""
return _Box2D.b2Fixture___GetMassData(self, massData)
def __SetDensity(self, density):
"""
__SetDensity(b2Fixture self, float32 density)
Set the density of this fixture. This will _not_ automatically adjust the mass of the body. You must call b2Body::ResetMassDatato update the body's mass.
"""
return _Box2D.b2Fixture___SetDensity(self, density)
def __GetDensity(self):
"""
__GetDensity(b2Fixture self) -> float32
Get the density of this fixture.
"""
return _Box2D.b2Fixture___GetDensity(self)
def __GetFriction(self):
"""
__GetFriction(b2Fixture self) -> float32
Get the coefficient of friction.
"""
return _Box2D.b2Fixture___GetFriction(self)
def __SetFriction(self, friction):
"""
__SetFriction(b2Fixture self, float32 friction)
Set the coefficient of friction. This will immediately update the mixed friction on all associated contacts.
"""
return _Box2D.b2Fixture___SetFriction(self, friction)
def __GetRestitution(self):
"""
__GetRestitution(b2Fixture self) -> float32
Get the coefficient of restitution.
"""
return _Box2D.b2Fixture___GetRestitution(self)
def __SetRestitution(self, restitution):
"""
__SetRestitution(b2Fixture self, float32 restitution)
Set the coefficient of restitution. This will immediately update the mixed restitution on all associated contacts.
"""
return _Box2D.b2Fixture___SetRestitution(self, restitution)
def GetAABB(self, childIndex):
"""
GetAABB(b2Fixture self, int32 childIndex) -> b2AABB
Get the fixture's AABB. This AABB may be enlarge and/or stale. If you need a more accurate AABB, compute it using the shape and the body transform.
"""
return _Box2D.b2Fixture_GetAABB(self, childIndex)
def Dump(self, bodyIndex):
"""Dump(b2Fixture self, int32 bodyIndex)"""
return _Box2D.b2Fixture_Dump(self, bodyIndex)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2Fixture self) -> long"""
return _Box2D.b2Fixture___hash__(self)
def __repr__(self):
return _format_repr(self)
def __GetUserData(self):
"""__GetUserData(b2Fixture self) -> PyObject *"""
return _Box2D.b2Fixture___GetUserData(self)
def __SetUserData(self, data):
"""__SetUserData(b2Fixture self, PyObject * data)"""
return _Box2D.b2Fixture___SetUserData(self, data)
def ClearUserData(self):
"""ClearUserData(b2Fixture self)"""
return _Box2D.b2Fixture_ClearUserData(self)
userData = property(__GetUserData, __SetUserData)
__swig_destroy__ = _Box2D.delete_b2Fixture
__eq__ = b2FixtureCompare
__ne__ = lambda self,other: not b2FixtureCompare(self,other)
# Read-write properties
friction = property(__GetFriction, __SetFriction)
restitution = property(__GetRestitution, __SetRestitution)
filterData = property(__GetFilterData, __SetFilterData)
sensor = property(__IsSensor, __SetSensor)
density = property(__GetDensity, __SetDensity)
# Read-only
next = property(__GetNext, None)
type = property(__GetType, None)
shape = property(__GetShape, None)
body = property(__GetBody, None)
@property
def massData(self):
md=b2MassData()
self.__GetMassData(md)
return md
b2Fixture.__GetType = new_instancemethod(_Box2D.b2Fixture___GetType, None, b2Fixture)
b2Fixture.__GetShape = new_instancemethod(_Box2D.b2Fixture___GetShape, None, b2Fixture)
b2Fixture.__SetSensor = new_instancemethod(_Box2D.b2Fixture___SetSensor, None, b2Fixture)
b2Fixture.__IsSensor = new_instancemethod(_Box2D.b2Fixture___IsSensor, None, b2Fixture)
b2Fixture.__SetFilterData = new_instancemethod(_Box2D.b2Fixture___SetFilterData, None, b2Fixture)
b2Fixture.__GetFilterData = new_instancemethod(_Box2D.b2Fixture___GetFilterData, None, b2Fixture)
b2Fixture.Refilter = new_instancemethod(_Box2D.b2Fixture_Refilter, None, b2Fixture)
b2Fixture.__GetBody = new_instancemethod(_Box2D.b2Fixture___GetBody, None, b2Fixture)
b2Fixture.__GetNext = new_instancemethod(_Box2D.b2Fixture___GetNext, None, b2Fixture)
b2Fixture.TestPoint = new_instancemethod(_Box2D.b2Fixture_TestPoint, None, b2Fixture)
b2Fixture.RayCast = new_instancemethod(_Box2D.b2Fixture_RayCast, None, b2Fixture)
b2Fixture.__GetMassData = new_instancemethod(_Box2D.b2Fixture___GetMassData, None, b2Fixture)
b2Fixture.__SetDensity = new_instancemethod(_Box2D.b2Fixture___SetDensity, None, b2Fixture)
b2Fixture.__GetDensity = new_instancemethod(_Box2D.b2Fixture___GetDensity, None, b2Fixture)
b2Fixture.__GetFriction = new_instancemethod(_Box2D.b2Fixture___GetFriction, None, b2Fixture)
b2Fixture.__SetFriction = new_instancemethod(_Box2D.b2Fixture___SetFriction, None, b2Fixture)
b2Fixture.__GetRestitution = new_instancemethod(_Box2D.b2Fixture___GetRestitution, None, b2Fixture)
b2Fixture.__SetRestitution = new_instancemethod(_Box2D.b2Fixture___SetRestitution, None, b2Fixture)
b2Fixture.GetAABB = new_instancemethod(_Box2D.b2Fixture_GetAABB, None, b2Fixture)
b2Fixture.Dump = new_instancemethod(_Box2D.b2Fixture_Dump, None, b2Fixture)
b2Fixture.__hash__ = new_instancemethod(_Box2D.b2Fixture___hash__, None, b2Fixture)
b2Fixture.__GetUserData = new_instancemethod(_Box2D.b2Fixture___GetUserData, None, b2Fixture)
b2Fixture.__SetUserData = new_instancemethod(_Box2D.b2Fixture___SetUserData, None, b2Fixture)
b2Fixture.ClearUserData = new_instancemethod(_Box2D.b2Fixture_ClearUserData, None, b2Fixture)
b2Fixture_swigregister = _Box2D.b2Fixture_swigregister
b2Fixture_swigregister(b2Fixture)
class b2DestructionListener(object):
"""Joints and fixtures are destroyed when their associated body is destroyed. Implement this listener so that you may nullify references to these joints and shapes."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
__swig_destroy__ = _Box2D.delete_b2DestructionListener
def SayGoodbye(self, *args):
"""
SayGoodbye(b2DestructionListener self, b2Joint joint)
SayGoodbye(b2DestructionListener self, b2Fixture fixture)
Called when any fixture is about to be destroyed due to the destruction of its parent body.
"""
return _Box2D.b2DestructionListener_SayGoodbye(self, *args)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2DestructionListener self) -> long"""
return _Box2D.b2DestructionListener___hash__(self)
def __repr__(self):
return _format_repr(self)
def __init__(self, **kwargs):
if self.__class__ == b2DestructionListener:
_self = None
else:
_self = self
_Box2D.b2DestructionListener_swiginit(self,_Box2D.new_b2DestructionListener(_self, ))
_init_kwargs(self, **kwargs)
def __disown__(self):
self.this.disown()
_Box2D.disown_b2DestructionListener(self)
return weakref_proxy(self)
b2DestructionListener.SayGoodbye = new_instancemethod(_Box2D.b2DestructionListener_SayGoodbye, None, b2DestructionListener)
b2DestructionListener.__hash__ = new_instancemethod(_Box2D.b2DestructionListener___hash__, None, b2DestructionListener)
b2DestructionListener_swigregister = _Box2D.b2DestructionListener_swigregister
b2DestructionListener_swigregister(b2DestructionListener)
class b2ContactFilter(object):
"""Implement this class to provide collision filtering. In other words, you can implement this class if you want finer control over contact creation."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
__swig_destroy__ = _Box2D.delete_b2ContactFilter
def ShouldCollide(self, fixtureA, fixtureB):
"""
ShouldCollide(b2ContactFilter self, b2Fixture fixtureA, b2Fixture fixtureB) -> bool
Return true if contact calculations should be performed between these two shapes.
WARNING:
for performance reasons this is only called when the AABBs begin to overlap.
"""
return _Box2D.b2ContactFilter_ShouldCollide(self, fixtureA, fixtureB)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2ContactFilter self) -> long"""
return _Box2D.b2ContactFilter___hash__(self)
def __repr__(self):
return _format_repr(self)
def __init__(self, **kwargs):
if self.__class__ == b2ContactFilter:
_self = None
else:
_self = self
_Box2D.b2ContactFilter_swiginit(self,_Box2D.new_b2ContactFilter(_self, ))
_init_kwargs(self, **kwargs)
def __disown__(self):
self.this.disown()
_Box2D.disown_b2ContactFilter(self)
return weakref_proxy(self)
b2ContactFilter.ShouldCollide = new_instancemethod(_Box2D.b2ContactFilter_ShouldCollide, None, b2ContactFilter)
b2ContactFilter.__hash__ = new_instancemethod(_Box2D.b2ContactFilter___hash__, None, b2ContactFilter)
b2ContactFilter_swigregister = _Box2D.b2ContactFilter_swigregister
b2ContactFilter_swigregister(b2ContactFilter)
class b2ContactImpulse(object):
"""Contact impulses for reporting. Impulses are used instead of forces because sub-step forces may approach infinity for rigid body collisions. These match up one-to-one with the contact points in b2Manifold."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
count = _swig_property(_Box2D.b2ContactImpulse_count_get, _Box2D.b2ContactImpulse_count_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2ContactImpulse self) -> long"""
return _Box2D.b2ContactImpulse___hash__(self)
def __repr__(self):
return _format_repr(self)
def __get_normal_impulses(self):
"""__get_normal_impulses(b2ContactImpulse self) -> PyObject *"""
return _Box2D.b2ContactImpulse___get_normal_impulses(self)
def __get_tangent_impulses(self):
"""__get_tangent_impulses(b2ContactImpulse self) -> PyObject *"""
return _Box2D.b2ContactImpulse___get_tangent_impulses(self)
normalImpulses = property(__get_normal_impulses, None)
tangentImpulses = property(__get_tangent_impulses, None)
def __init__(self, **kwargs):
_Box2D.b2ContactImpulse_swiginit(self,_Box2D.new_b2ContactImpulse())
_init_kwargs(self, **kwargs)
__swig_destroy__ = _Box2D.delete_b2ContactImpulse
b2ContactImpulse.__hash__ = new_instancemethod(_Box2D.b2ContactImpulse___hash__, None, b2ContactImpulse)
b2ContactImpulse.__get_normal_impulses = new_instancemethod(_Box2D.b2ContactImpulse___get_normal_impulses, None, b2ContactImpulse)
b2ContactImpulse.__get_tangent_impulses = new_instancemethod(_Box2D.b2ContactImpulse___get_tangent_impulses, None, b2ContactImpulse)
b2ContactImpulse_swigregister = _Box2D.b2ContactImpulse_swigregister
b2ContactImpulse_swigregister(b2ContactImpulse)
class b2ContactListener(object):
"""
Implement this class to get contact information. You can use these results for things like sounds and game logic. You can also get contact results by traversing the contact lists after the time step. However, you might miss some contacts because continuous physics leads to sub-stepping. Additionally you may receive multiple callbacks for the same contact in a single time step. You should strive to make your callbacks efficient because there may be many callbacks per time step.
WARNING:
You cannot create/destroy Box2D entities inside these callbacks.
"""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
__swig_destroy__ = _Box2D.delete_b2ContactListener
def BeginContact(self, contact):
"""
BeginContact(b2ContactListener self, b2Contact contact)
Called when two fixtures begin to touch.
"""
return _Box2D.b2ContactListener_BeginContact(self, contact)
def EndContact(self, contact):
"""
EndContact(b2ContactListener self, b2Contact contact)
Called when two fixtures cease to touch.
"""
return _Box2D.b2ContactListener_EndContact(self, contact)
def PreSolve(self, contact, oldManifold):
"""
PreSolve(b2ContactListener self, b2Contact contact, b2Manifold oldManifold)
This is called after a contact is updated. This allows you to inspect a contact before it goes to the solver. If you are careful, you can modify the contact manifold (e.g. disable contact). A copy of the old manifold is provided so that you can detect changes. Note: this is called only for awake bodies. Note: this is called even when the number of contact points is zero. Note: this is not called for sensors. Note: if you set the number of contact points to zero, you will not get an EndContact callback. However, you may get a BeginContact callback the next step.
"""
return _Box2D.b2ContactListener_PreSolve(self, contact, oldManifold)
def PostSolve(self, contact, impulse):
"""
PostSolve(b2ContactListener self, b2Contact contact, b2ContactImpulse impulse)
This lets you inspect a contact after the solver is finished. This is useful for inspecting impulses. Note: the contact manifold does not include time of impact impulses, which can be arbitrarily large if the sub-step is small. Hence the impulse is provided explicitly in a separate data structure. Note: this is only called for contacts that are touching, solid, and awake.
"""
return _Box2D.b2ContactListener_PostSolve(self, contact, impulse)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2ContactListener self) -> long"""
return _Box2D.b2ContactListener___hash__(self)
def __repr__(self):
return _format_repr(self)
def __init__(self, **kwargs):
if self.__class__ == b2ContactListener:
_self = None
else:
_self = self
_Box2D.b2ContactListener_swiginit(self,_Box2D.new_b2ContactListener(_self, ))
_init_kwargs(self, **kwargs)
def __disown__(self):
self.this.disown()
_Box2D.disown_b2ContactListener(self)
return weakref_proxy(self)
b2ContactListener.BeginContact = new_instancemethod(_Box2D.b2ContactListener_BeginContact, None, b2ContactListener)
b2ContactListener.EndContact = new_instancemethod(_Box2D.b2ContactListener_EndContact, None, b2ContactListener)
b2ContactListener.PreSolve = new_instancemethod(_Box2D.b2ContactListener_PreSolve, None, b2ContactListener)
b2ContactListener.PostSolve = new_instancemethod(_Box2D.b2ContactListener_PostSolve, None, b2ContactListener)
b2ContactListener.__hash__ = new_instancemethod(_Box2D.b2ContactListener___hash__, None, b2ContactListener)
b2ContactListener_swigregister = _Box2D.b2ContactListener_swigregister
b2ContactListener_swigregister(b2ContactListener)
class b2QueryCallback(object):
"""Callback class for AABB queries. See b2World::Query"""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
__swig_destroy__ = _Box2D.delete_b2QueryCallback
def ReportFixture(self, fixture):
"""
ReportFixture(b2QueryCallback self, b2Fixture fixture) -> bool
Called for each fixture found in the query AABB.
false to terminate the query.
"""
return _Box2D.b2QueryCallback_ReportFixture(self, fixture)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2QueryCallback self) -> long"""
return _Box2D.b2QueryCallback___hash__(self)
def __repr__(self):
return _format_repr(self)
def __init__(self, **kwargs):
if self.__class__ == b2QueryCallback:
_self = None
else:
_self = self
_Box2D.b2QueryCallback_swiginit(self,_Box2D.new_b2QueryCallback(_self, ))
_init_kwargs(self, **kwargs)
def __disown__(self):
self.this.disown()
_Box2D.disown_b2QueryCallback(self)
return weakref_proxy(self)
b2QueryCallback.ReportFixture = new_instancemethod(_Box2D.b2QueryCallback_ReportFixture, None, b2QueryCallback)
b2QueryCallback.__hash__ = new_instancemethod(_Box2D.b2QueryCallback___hash__, None, b2QueryCallback)
b2QueryCallback_swigregister = _Box2D.b2QueryCallback_swigregister
b2QueryCallback_swigregister(b2QueryCallback)
class b2RayCastCallback(object):
"""Callback class for ray casts. See b2World::RayCast"""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
__swig_destroy__ = _Box2D.delete_b2RayCastCallback
def ReportFixture(self, fixture, point, normal, fraction):
"""
ReportFixture(b2RayCastCallback self, b2Fixture fixture, b2Vec2 point, b2Vec2 normal, float32 fraction) -> float32
Called for each fixture found in the query. You control how the ray cast proceeds by returning a float: return -1: ignore this fixture and continue return 0: terminate the ray cast return fraction: clip the ray to this point return 1: don't clip the ray and continue
Parameters:
-----------
fixture:
the fixture hit by the ray
point:
the point of initial intersection
normal:
the normal vector at the point of intersection
-1 to filter, 0 to terminate, fraction to clip the ray for closest hit, 1 to continue
"""
return _Box2D.b2RayCastCallback_ReportFixture(self, fixture, point, normal, fraction)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2RayCastCallback self) -> long"""
return _Box2D.b2RayCastCallback___hash__(self)
def __repr__(self):
return _format_repr(self)
def __init__(self):
"""
__init__(b2RayCastCallback self) -> b2RayCastCallback
Callback class for ray casts. See b2World::RayCast
"""
if self.__class__ == b2RayCastCallback:
_self = None
else:
_self = self
_Box2D.b2RayCastCallback_swiginit(self, _Box2D.new_b2RayCastCallback(_self, ))
def __disown__(self):
self.this.disown()
_Box2D.disown_b2RayCastCallback(self)
return weakref_proxy(self)
b2RayCastCallback.ReportFixture = new_instancemethod(_Box2D.b2RayCastCallback_ReportFixture, None, b2RayCastCallback)
b2RayCastCallback.__hash__ = new_instancemethod(_Box2D.b2RayCastCallback___hash__, None, b2RayCastCallback)
b2RayCastCallback_swigregister = _Box2D.b2RayCastCallback_swigregister
b2RayCastCallback_swigregister(b2RayCastCallback)
class b2Profile(object):
"""Proxy of C++ b2Profile class."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
step = _swig_property(_Box2D.b2Profile_step_get, _Box2D.b2Profile_step_set)
collide = _swig_property(_Box2D.b2Profile_collide_get, _Box2D.b2Profile_collide_set)
solve = _swig_property(_Box2D.b2Profile_solve_get, _Box2D.b2Profile_solve_set)
solveInit = _swig_property(_Box2D.b2Profile_solveInit_get, _Box2D.b2Profile_solveInit_set)
solveVelocity = _swig_property(_Box2D.b2Profile_solveVelocity_get, _Box2D.b2Profile_solveVelocity_set)
solvePosition = _swig_property(_Box2D.b2Profile_solvePosition_get, _Box2D.b2Profile_solvePosition_set)
broadphase = _swig_property(_Box2D.b2Profile_broadphase_get, _Box2D.b2Profile_broadphase_set)
solveTOI = _swig_property(_Box2D.b2Profile_solveTOI_get, _Box2D.b2Profile_solveTOI_set)
def __init__(self):
"""__init__(b2Profile self) -> b2Profile"""
_Box2D.b2Profile_swiginit(self, _Box2D.new_b2Profile())
__swig_destroy__ = _Box2D.delete_b2Profile
b2Profile_swigregister = _Box2D.b2Profile_swigregister
b2Profile_swigregister(b2Profile)
class b2SolverData(object):
"""Proxy of C++ b2SolverData class."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
step = _swig_property(_Box2D.b2SolverData_step_get, _Box2D.b2SolverData_step_set)
positions = _swig_property(_Box2D.b2SolverData_positions_get, _Box2D.b2SolverData_positions_set)
velocities = _swig_property(_Box2D.b2SolverData_velocities_get, _Box2D.b2SolverData_velocities_set)
def __init__(self):
"""__init__(b2SolverData self) -> b2SolverData"""
_Box2D.b2SolverData_swiginit(self, _Box2D.new_b2SolverData())
__swig_destroy__ = _Box2D.delete_b2SolverData
b2SolverData_swigregister = _Box2D.b2SolverData_swigregister
b2SolverData_swigregister(b2SolverData)
class b2ContactManager(object):
"""Proxy of C++ b2ContactManager class."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self):
"""__init__(b2ContactManager self) -> b2ContactManager"""
_Box2D.b2ContactManager_swiginit(self, _Box2D.new_b2ContactManager())
def AddPair(self, proxyUserDataA, proxyUserDataB):
"""AddPair(b2ContactManager self, void * proxyUserDataA, void * proxyUserDataB)"""
return _Box2D.b2ContactManager_AddPair(self, proxyUserDataA, proxyUserDataB)
def FindNewContacts(self):
"""FindNewContacts(b2ContactManager self)"""
return _Box2D.b2ContactManager_FindNewContacts(self)
def Destroy(self, c):
"""Destroy(b2ContactManager self, b2Contact c)"""
return _Box2D.b2ContactManager_Destroy(self, c)
def Collide(self):
"""Collide(b2ContactManager self)"""
return _Box2D.b2ContactManager_Collide(self)
broadPhase = _swig_property(_Box2D.b2ContactManager_broadPhase_get, _Box2D.b2ContactManager_broadPhase_set)
contactList = _swig_property(_Box2D.b2ContactManager_contactList_get, _Box2D.b2ContactManager_contactList_set)
contactCount = _swig_property(_Box2D.b2ContactManager_contactCount_get, _Box2D.b2ContactManager_contactCount_set)
contactFilter = _swig_property(_Box2D.b2ContactManager_contactFilter_get, _Box2D.b2ContactManager_contactFilter_set)
contactListener = _swig_property(_Box2D.b2ContactManager_contactListener_get, _Box2D.b2ContactManager_contactListener_set)
allocator = _swig_property(_Box2D.b2ContactManager_allocator_get, _Box2D.b2ContactManager_allocator_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2ContactManager self) -> long"""
return _Box2D.b2ContactManager___hash__(self)
def __repr__(self):
return _format_repr(self)
__swig_destroy__ = _Box2D.delete_b2ContactManager
b2ContactManager.AddPair = new_instancemethod(_Box2D.b2ContactManager_AddPair, None, b2ContactManager)
b2ContactManager.FindNewContacts = new_instancemethod(_Box2D.b2ContactManager_FindNewContacts, None, b2ContactManager)
b2ContactManager.Destroy = new_instancemethod(_Box2D.b2ContactManager_Destroy, None, b2ContactManager)
b2ContactManager.Collide = new_instancemethod(_Box2D.b2ContactManager_Collide, None, b2ContactManager)
b2ContactManager.__hash__ = new_instancemethod(_Box2D.b2ContactManager___hash__, None, b2ContactManager)
b2ContactManager_swigregister = _Box2D.b2ContactManager_swigregister
b2ContactManager_swigregister(b2ContactManager)
b2_stackSize = b2Globals.b2_stackSize
b2_maxStackEntries = b2Globals.b2_maxStackEntries
class b2World(object):
"""The world class manages all physics entities, dynamic simulation, and asynchronous queries. The world also contains efficient memory management facilities."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, gravity=(0, -10), doSleep=True, **kwargs):
"""__init__(self, gravity=(0, -10), doSleep=True, **kwargs) -> b2World
Additional kwargs like contactListener will be passed after the world is created.
Examples:
b2World(gravity=(0,-10), doSleep=True)
b2World(contactListener=myListener)
"""
_Box2D.b2World_swiginit(self,_Box2D.new_b2World(gravity))
self.allowSleeping = doSleep
for key, value in kwargs.items():
try:
setattr(self, key, value)
except Exception as ex:
raise ex.__class__('Failed on kwargs, class="%s" key="%s": %s' \
% (self.__class__.__name__, key, ex))
__swig_destroy__ = _Box2D.delete_b2World
def __SetDestructionListener_internal(self, listener):
"""
__SetDestructionListener_internal(b2World self, b2DestructionListener listener)
Register a destruction listener. The listener is owned by you and must remain in scope.
"""
return _Box2D.b2World___SetDestructionListener_internal(self, listener)
def __SetContactFilter_internal(self, filter):
"""
__SetContactFilter_internal(b2World self, b2ContactFilter filter)
Register a contact filter to provide specific control over collision. Otherwise the default filter is used (b2_defaultFilter). The listener is owned by you and must remain in scope.
"""
return _Box2D.b2World___SetContactFilter_internal(self, filter)
def __SetContactListener_internal(self, listener):
"""
__SetContactListener_internal(b2World self, b2ContactListener listener)
Register a contact event listener. The listener is owned by you and must remain in scope.
"""
return _Box2D.b2World___SetContactListener_internal(self, listener)
def __SetDebugDraw_internal(self, debugDraw):
"""
__SetDebugDraw_internal(b2World self, b2Draw debugDraw)
Register a routine for debug drawing. The debug draw functions are called inside with b2World::DrawDebugDatamethod. The debug draw object is owned by you and must remain in scope.
"""
return _Box2D.b2World___SetDebugDraw_internal(self, debugDraw)
def Step(self, timeStep, velocityIterations, positionIterations):
"""
Step(b2World self, float32 timeStep, int32 velocityIterations, int32 positionIterations)
Take a time step. This performs collision detection, integration, and constraint solution.
Parameters:
-----------
timeStep:
the amount of time to simulate, this should not vary.
velocityIterations:
for the velocity constraint solver.
positionIterations:
for the position constraint solver.
"""
return _Box2D.b2World_Step(self, timeStep, velocityIterations, positionIterations)
def ClearForces(self):
"""
ClearForces(b2World self)
Manually clear the force buffer on all bodies. By default, forces are cleared automatically after each call to Step. The default behavior is modified by calling SetAutoClearForces. The purpose of this function is to support sub-stepping. Sub-stepping is often used to maintain a fixed sized time step under a variable frame-rate. When you perform sub-stepping you will disable auto clearing of forces and instead call ClearForces after all sub-steps are complete in one pass of your game loop.
See:
SetAutoClearForces
"""
return _Box2D.b2World_ClearForces(self)
def DrawDebugData(self):
"""
DrawDebugData(b2World self)
Call this to draw shapes and other debug draw data.
"""
return _Box2D.b2World_DrawDebugData(self)
def QueryAABB(self, callback, aabb):
"""
QueryAABB(b2World self, b2QueryCallback callback, b2AABB aabb)
Query the world for all fixtures that potentially overlap the provided AABB.
Parameters:
-----------
callback:
a user implemented callback class.
aabb:
the query box.
"""
return _Box2D.b2World_QueryAABB(self, callback, aabb)
def RayCast(self, callback, point1, point2):
"""
RayCast(b2World self, b2RayCastCallback callback, b2Vec2 point1, b2Vec2 point2)
Ray-cast the world for all fixtures in the path of the ray. Your callback controls whether you get the closest point, any point, or n-points. The ray-cast ignores shapes that contain the starting point.
Parameters:
-----------
callback:
a user implemented callback class.
point1:
the ray starting point
point2:
the ray ending point
"""
return _Box2D.b2World_RayCast(self, callback, point1, point2)
def __GetBodyList_internal(self, *args):
"""
__GetBodyList_internal(b2World self) -> b2Body
__GetBodyList_internal(b2World self) -> b2Body
Get the world body list. With the returned body, use b2Body::GetNextto get the next body in the world list. A NULL body indicates the end of the list.
the head of the world body list.
"""
return _Box2D.b2World___GetBodyList_internal(self, *args)
def __GetJointList_internal(self, *args):
"""
__GetJointList_internal(b2World self) -> b2Joint
__GetJointList_internal(b2World self) -> b2Joint
Get the world joint list. With the returned joint, use b2Joint::GetNextto get the next joint in the world list. A NULL joint indicates the end of the list.
the head of the world joint list.
"""
return _Box2D.b2World___GetJointList_internal(self, *args)
def __GetContactList_internal(self, *args):
"""
__GetContactList_internal(b2World self) -> b2Contact
__GetContactList_internal(b2World self) -> b2Contact
Get the world contact list. With the returned contact, use b2Contact::GetNextto get the next contact in the world list. A NULL contact indicates the end of the list.
the head of the world contact list.
WARNING:
contacts are
"""
return _Box2D.b2World___GetContactList_internal(self, *args)
def SetAllowSleeping(self, flag):
"""SetAllowSleeping(b2World self, bool flag)"""
return _Box2D.b2World_SetAllowSleeping(self, flag)
def GetAllowSleeping(self):
"""GetAllowSleeping(b2World self) -> bool"""
return _Box2D.b2World_GetAllowSleeping(self)
def __SetWarmStarting(self, flag):
"""
__SetWarmStarting(b2World self, bool flag)
Enable/disable warm starting. For testing.
"""
return _Box2D.b2World___SetWarmStarting(self, flag)
def __GetWarmStarting(self):
"""__GetWarmStarting(b2World self) -> bool"""
return _Box2D.b2World___GetWarmStarting(self)
def __SetContinuousPhysics(self, flag):
"""
__SetContinuousPhysics(b2World self, bool flag)
Enable/disable continuous physics. For testing.
"""
return _Box2D.b2World___SetContinuousPhysics(self, flag)
def __GetContinuousPhysics(self):
"""__GetContinuousPhysics(b2World self) -> bool"""
return _Box2D.b2World___GetContinuousPhysics(self)
def __SetSubStepping(self, flag):
"""
__SetSubStepping(b2World self, bool flag)
Enable/disable single stepped continuous physics. For testing.
"""
return _Box2D.b2World___SetSubStepping(self, flag)
def __GetSubStepping(self):
"""__GetSubStepping(b2World self) -> bool"""
return _Box2D.b2World___GetSubStepping(self)
def __GetProxyCount(self):
"""
__GetProxyCount(b2World self) -> int32
Get the number of broad-phase proxies.
"""
return _Box2D.b2World___GetProxyCount(self)
def __GetBodyCount(self):
"""
__GetBodyCount(b2World self) -> int32
Get the number of bodies.
"""
return _Box2D.b2World___GetBodyCount(self)
def __GetJointCount(self):
"""
__GetJointCount(b2World self) -> int32
Get the number of joints.
"""
return _Box2D.b2World___GetJointCount(self)
def __GetContactCount(self):
"""
__GetContactCount(b2World self) -> int32
Get the number of contacts (each may have 0 or more contact points).
"""
return _Box2D.b2World___GetContactCount(self)
def GetTreeHeight(self):
"""GetTreeHeight(b2World self) -> int32"""
return _Box2D.b2World_GetTreeHeight(self)
def GetTreeBalance(self):
"""GetTreeBalance(b2World self) -> int32"""
return _Box2D.b2World_GetTreeBalance(self)
def GetTreeQuality(self):
"""GetTreeQuality(b2World self) -> float32"""
return _Box2D.b2World_GetTreeQuality(self)
def __SetGravity(self, gravity):
"""
__SetGravity(b2World self, b2Vec2 gravity)
Change the global gravity vector.
"""
return _Box2D.b2World___SetGravity(self, gravity)
def __GetGravity(self):
"""
__GetGravity(b2World self) -> b2Vec2
Get the global gravity vector.
"""
return _Box2D.b2World___GetGravity(self)
def __IsLocked(self):
"""
__IsLocked(b2World self) -> bool
Is the world locked (in the middle of a time step).
"""
return _Box2D.b2World___IsLocked(self)
def __SetAutoClearForces(self, flag):
"""
__SetAutoClearForces(b2World self, bool flag)
Set flag to control automatic clearing of forces after each time step.
"""
return _Box2D.b2World___SetAutoClearForces(self, flag)
def __GetAutoClearForces(self):
"""
__GetAutoClearForces(b2World self) -> bool
Get the flag that controls automatic clearing of forces after each time step.
"""
return _Box2D.b2World___GetAutoClearForces(self)
def ShiftOrigin(self, newOrigin):
"""ShiftOrigin(b2World self, b2Vec2 newOrigin)"""
return _Box2D.b2World_ShiftOrigin(self, newOrigin)
def __GetContactManager(self):
"""
__GetContactManager(b2World self) -> b2ContactManager
Get the contact manager for testing.
"""
return _Box2D.b2World___GetContactManager(self)
def GetProfile(self):
"""GetProfile(b2World self) -> b2Profile"""
return _Box2D.b2World_GetProfile(self)
def Dump(self):
"""Dump(b2World self)"""
return _Box2D.b2World_Dump(self)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2World self) -> long"""
return _Box2D.b2World___hash__(self)
def __repr__(self):
return _format_repr(self)
def __CreateBody(self, defn):
"""__CreateBody(b2World self, b2BodyDef defn) -> b2Body"""
return _Box2D.b2World___CreateBody(self, defn)
def __CreateJoint(self, defn):
"""__CreateJoint(b2World self, b2JointDef defn) -> b2Joint"""
return _Box2D.b2World___CreateJoint(self, defn)
def DestroyBody(self, body):
"""
DestroyBody(b2World self, b2Body body)
Destroy a rigid body given a definition. No reference to the definition is retained. This function is locked during callbacks.
WARNING:
This automatically deletes all associated shapes and joints.
This function is locked during callbacks.
"""
return _Box2D.b2World_DestroyBody(self, body)
def DestroyJoint(self, joint):
"""
DestroyJoint(b2World self, b2Joint joint)
Destroy a joint. This may cause the connected bodies to begin colliding.
WARNING:
This function is locked during callbacks.
"""
return _Box2D.b2World_DestroyJoint(self, joint)
def __iter__(self):
"""
Iterates over the bodies in the world
"""
for body in self.bodies:
yield body
def CreateDynamicBody(self, **kwargs):
"""
Create a single dynamic body in the world.
Accepts only kwargs to a b2BodyDef. For more information, see
CreateBody and b2BodyDef.
"""
kwargs['type'] = b2_dynamicBody
return self.CreateBody(**kwargs)
def CreateKinematicBody(self, **kwargs):
"""
Create a single kinematic body in the world.
Accepts only kwargs to a b2BodyDef. For more information, see
CreateBody and b2BodyDef.
"""
kwargs['type'] = b2_kinematicBody
return self.CreateBody(**kwargs)
def CreateStaticBody(self, **kwargs):
"""
Create a single static body in the world.
Accepts only kwargs to a b2BodyDef. For more information, see
CreateBody and b2BodyDef.
"""
kwargs['type'] = b2_staticBody
return self.CreateBody(**kwargs)
def CreateBody(self, defn=None, **kwargs):
"""
Create a body in the world.
Takes a single b2BodyDef argument, or kwargs to pass to a temporary b2BodyDef.
world.CreateBody(position=(1,2), angle=1)
is short for:
world.CreateBody(b2BodyDef(position=(1,2), angle=1))
If the definition (or kwargs) sets 'fixtures', they will be created on the
newly created body. A single fixture is also accepted.
CreateBody(..., fixtures=[])
This is short for:
body = CreateBody(...)
for fixture in []:
body.CreateFixture(fixture)
'shapes' and 'shapeFixture' are also accepted:
CreateBody(..., shapes=[], shapeFixture=b2FixtureDef())
This is short for:
body = CreateBody(...)
body.CreateFixturesFromShapes(shapes=[], shapeFixture=b2FixtureDef())
"""
if defn is not None:
if not isinstance(defn, b2BodyDef):
raise TypeError('Expected b2BodyDef')
else:
defn = b2BodyDef(**kwargs)
body=self.__CreateBody(defn)
if defn.fixtures:
if isinstance(defn.fixtures, (list, tuple)):
for fixture in defn.fixtures:
body.CreateFixture(fixture)
else:
body.CreateFixture(defn.fixtures)
if defn.shapes:
body.CreateFixturesFromShapes(shapes=defn.shapes, shapeFixture=defn.shapeFixture)
if 'massData' in kwargs:
body.massData=kwargs['massData']
if 'localCenter' in kwargs:
body.localCenter=kwargs['localCenter']
if 'inertia' in kwargs:
body.inertia=kwargs['inertia']
if 'mass' in kwargs:
body.mass=kwargs['mass']
return body
def CreateDistanceJoint(self, **kwargs):
"""
Create a single b2DistanceJoint. Only accepts kwargs to the joint definition.
Raises ValueError if either bodyA or bodyB is left unset.
"""
if 'bodyA' not in kwargs or 'bodyB' not in kwargs:
raise ValueError('Requires at least bodyA and bodyB be set')
return self.__CreateJoint(b2DistanceJointDef(**kwargs))
def CreateRopeJoint(self, **kwargs):
"""
Create a single b2RopeJoint. Only accepts kwargs to the joint definition.
Raises ValueError if either bodyA or bodyB is left unset.
"""
if 'bodyA' not in kwargs or 'bodyB' not in kwargs:
raise ValueError('Requires at least bodyA and bodyB be set')
return self.__CreateJoint(b2RopeJointDef(**kwargs))
def CreateFrictionJoint(self, **kwargs):
"""
Create a single b2FrictionJoint. Only accepts kwargs to the joint definition.
Raises ValueError if either bodyA or bodyB is left unset.
"""
if 'bodyA' not in kwargs or 'bodyB' not in kwargs:
raise ValueError('Requires at least bodyA and bodyB be set')
return self.__CreateJoint(b2FrictionJointDef(**kwargs))
def CreateGearJoint(self, **kwargs):
"""
Create a single b2GearJoint. Only accepts kwargs to the joint definition.
Raises ValueError if either joint1 or joint2 is left unset.
"""
if 'joint1' not in kwargs or 'joint2' not in kwargs:
raise ValueError('Gear joint requires that both joint1 and joint2 be set')
return self.__CreateJoint(b2GearJointDef(**kwargs))
def CreateWheelJoint(self, **kwargs):
"""
Create a single b2WheelJoint. Only accepts kwargs to the joint definition.
Raises ValueError if either bodyA or bodyB is left unset.
"""
if 'bodyA' not in kwargs or 'bodyB' not in kwargs:
raise ValueError('Requires at least bodyA and bodyB be set')
return self.__CreateJoint(b2WheelJointDef(**kwargs))
def CreateMouseJoint(self, **kwargs):
"""
Create a single b2MouseJoint. Only accepts kwargs to the joint definition.
Raises ValueError if either bodyA or bodyB is left unset.
"""
if 'bodyA' not in kwargs or 'bodyB' not in kwargs:
raise ValueError('Requires at least bodyA and bodyB be set')
return self.__CreateJoint(b2MouseJointDef(**kwargs))
def CreatePrismaticJoint(self, **kwargs):
"""
Create a single b2PrismaticJoint. Only accepts kwargs to the joint definition.
Raises ValueError if either bodyA or bodyB is left unset.
"""
if 'bodyA' not in kwargs or 'bodyB' not in kwargs:
raise ValueError('Requires at least bodyA and bodyB be set')
return self.__CreateJoint(b2PrismaticJointDef(**kwargs))
def CreatePulleyJoint(self, **kwargs):
"""
Create a single b2PulleyJoint. Only accepts kwargs to the joint definition.
Raises ValueError if either bodyA or bodyB is left unset.
"""
if 'bodyA' not in kwargs or 'bodyB' not in kwargs:
raise ValueError('Requires at least bodyA and bodyB be set')
return self.__CreateJoint(b2PulleyJointDef(**kwargs))
def CreateRevoluteJoint(self, **kwargs):
"""
Create a single b2RevoluteJoint. Only accepts kwargs to the joint definition.
Raises ValueError if either bodyA or bodyB is left unset.
"""
if 'bodyA' not in kwargs or 'bodyB' not in kwargs:
raise ValueError('Requires at least bodyA and bodyB be set')
return self.__CreateJoint(b2RevoluteJointDef(**kwargs))
def CreateWeldJoint(self, **kwargs):
"""
Create a single b2WeldJoint. Only accepts kwargs to the joint definition.
Raises ValueError if either bodyA or bodyB is left unset.
"""
if 'bodyA' not in kwargs or 'bodyB' not in kwargs:
raise ValueError('Requires at least bodyA and bodyB be set')
return self.__CreateJoint(b2WeldJointDef(**kwargs))
def CreateMotorJoint(self, **kwargs):
"""
Create a single b2MotorJoint. Only accepts kwargs to the joint definition.
Raises ValueError if either bodyA or bodyB is left unset.
"""
if 'bodyA' not in kwargs or 'bodyB' not in kwargs:
raise ValueError('Requires at least bodyA and bodyB be set')
return self.__CreateJoint(b2MotorJointDef(**kwargs))
def CreateJoint(self, defn=None, type=None, **kwargs):
"""
Create a joint in the world.
Takes a single b2JointDef argument, or kwargs to pass to a temporary b2JointDef.
All of these are exactly equivalent:
world.CreateJoint(type=b2RevoluteJoint, bodyA=body, bodyB=body2)
world.CreateJoint(type=b2RevoluteJointDef, bodyA=body, bodyB=body2)
world.CreateJoint(b2RevoluteJointDef(bodyA=body, bodyB=body2))
"""
if defn is not None:
if not isinstance(defn, b2JointDef):
raise TypeError('Expected b2JointDef')
if defn.bodyA is None or defn.bodyB is None:
raise ValueError('bodyA and bodyB must be set')
else:
if type is not None:
if issubclass(type, b2JointDef):
class_type = type
elif issubclass(type, b2Joint): # a b2Joint passed in, so get the b2JointDef
class_type = globals()[type.__name__ + 'Def']
else:
raise TypeError('Expected "type" to be a b2Joint or b2JointDef')
else:
raise TypeError('Expected "type" to be a b2Joint or b2JointDef')
defn = class_type(**kwargs)
if isinstance(defn, b2GearJointDef):
if not defn.joint1 or not defn.joint2:
raise ValueError('Gear joint requires that both joint1 and joint2 be set')
else:
if not defn.bodyA or not defn.bodyB:
raise ValueError('Body or bodies not set (bodyA, bodyB)')
return self.__CreateJoint(defn)
# The logic behind these functions is that they increase the refcount
# of the listeners as you set them, so it is no longer necessary to keep
# a copy on your own. Upon destruction of the object, it should be cleared
# also clearing the refcount of the function.
# Now using it also to buffer previously write-only values in the shadowed
# class to make them read-write.
def __GetData(self, name):
if name in list(self.__data.keys()):
return self.__data[name]
else:
return None
def __SetData(self, name, value, fcn):
self.__data[name] = value
fcn(value)
# Read-write properties
gravity = property(__GetGravity, __SetGravity)
autoClearForces = property(__GetAutoClearForces, __SetAutoClearForces)
__data = {} # holds the listeners so they can be properly destroyed, and buffer other data
destructionListener = property(lambda self: self.__GetData('destruction'),
lambda self, fcn: self.__SetData('destruction', fcn, self.__SetDestructionListener_internal))
contactListener= property(lambda self: self.__GetData('contact'),
lambda self, fcn: self.__SetData('contact', fcn, self.__SetContactListener_internal))
contactFilter= property(lambda self: self.__GetData('contactfilter'),
lambda self, fcn: self.__SetData('contactfilter', fcn, self.__SetContactFilter_internal))
renderer= property(lambda self: self.__GetData('renderer'),
lambda self, fcn: self.__SetData('renderer', fcn, self.__SetDebugDraw_internal))
continuousPhysics = property(__GetContinuousPhysics, __SetContinuousPhysics)
warmStarting = property(__GetWarmStarting, __SetWarmStarting)
subStepping = property(__GetSubStepping, __SetSubStepping)
# Read-only
contactManager= property(__GetContactManager, None)
contactCount = property(__GetContactCount, None)
bodyCount = property(__GetBodyCount, None)
jointCount = property(__GetJointCount, None)
proxyCount = property(__GetProxyCount, None)
joints = property(lambda self: _list_from_linked_list(self.__GetJointList_internal()), None,
doc="""All joints in the world. NOTE: This re-creates the list on every call. See also joints_gen.""")
bodies = property(lambda self: _list_from_linked_list(self.__GetBodyList_internal()), None,
doc="""All bodies in the world. NOTE: This re-creates the list on every call. See also bodies_gen.""")
contacts= property(lambda self: _list_from_linked_list(self.__GetContactList_internal()), None,
doc="""All contacts in the world. NOTE: This re-creates the list on every call. See also contacts_gen.""")
joints_gen = property(lambda self: _indexable_generator(_generator_from_linked_list(self.__GetJointList_internal())), None,
doc="""Indexable generator of the connected joints to this body.
NOTE: When not using the whole list, this may be preferable to using 'joints'.""")
bodies_gen = property(lambda self: _indexable_generator(_generator_from_linked_list(self.__GetBodyList_internal())), None,
doc="""Indexable generator of all bodies.
NOTE: When not using the whole list, this may be preferable to using 'bodies'.""")
contacts_gen = property(lambda self: _indexable_generator(_generator_from_linked_list(self.__GetContactList_internal())), None,
doc="""Indexable generator of all contacts.
NOTE: When not using the whole list, this may be preferable to using 'contacts'.""")
locked = property(__IsLocked, None)
b2World.__SetDestructionListener_internal = new_instancemethod(_Box2D.b2World___SetDestructionListener_internal, None, b2World)
b2World.__SetContactFilter_internal = new_instancemethod(_Box2D.b2World___SetContactFilter_internal, None, b2World)
b2World.__SetContactListener_internal = new_instancemethod(_Box2D.b2World___SetContactListener_internal, None, b2World)
b2World.__SetDebugDraw_internal = new_instancemethod(_Box2D.b2World___SetDebugDraw_internal, None, b2World)
b2World.Step = new_instancemethod(_Box2D.b2World_Step, None, b2World)
b2World.ClearForces = new_instancemethod(_Box2D.b2World_ClearForces, None, b2World)
b2World.DrawDebugData = new_instancemethod(_Box2D.b2World_DrawDebugData, None, b2World)
b2World.QueryAABB = new_instancemethod(_Box2D.b2World_QueryAABB, None, b2World)
b2World.RayCast = new_instancemethod(_Box2D.b2World_RayCast, None, b2World)
b2World.__GetBodyList_internal = new_instancemethod(_Box2D.b2World___GetBodyList_internal, None, b2World)
b2World.__GetJointList_internal = new_instancemethod(_Box2D.b2World___GetJointList_internal, None, b2World)
b2World.__GetContactList_internal = new_instancemethod(_Box2D.b2World___GetContactList_internal, None, b2World)
b2World.SetAllowSleeping = new_instancemethod(_Box2D.b2World_SetAllowSleeping, None, b2World)
b2World.GetAllowSleeping = new_instancemethod(_Box2D.b2World_GetAllowSleeping, None, b2World)
b2World.__SetWarmStarting = new_instancemethod(_Box2D.b2World___SetWarmStarting, None, b2World)
b2World.__GetWarmStarting = new_instancemethod(_Box2D.b2World___GetWarmStarting, None, b2World)
b2World.__SetContinuousPhysics = new_instancemethod(_Box2D.b2World___SetContinuousPhysics, None, b2World)
b2World.__GetContinuousPhysics = new_instancemethod(_Box2D.b2World___GetContinuousPhysics, None, b2World)
b2World.__SetSubStepping = new_instancemethod(_Box2D.b2World___SetSubStepping, None, b2World)
b2World.__GetSubStepping = new_instancemethod(_Box2D.b2World___GetSubStepping, None, b2World)
b2World.__GetProxyCount = new_instancemethod(_Box2D.b2World___GetProxyCount, None, b2World)
b2World.__GetBodyCount = new_instancemethod(_Box2D.b2World___GetBodyCount, None, b2World)
b2World.__GetJointCount = new_instancemethod(_Box2D.b2World___GetJointCount, None, b2World)
b2World.__GetContactCount = new_instancemethod(_Box2D.b2World___GetContactCount, None, b2World)
b2World.GetTreeHeight = new_instancemethod(_Box2D.b2World_GetTreeHeight, None, b2World)
b2World.GetTreeBalance = new_instancemethod(_Box2D.b2World_GetTreeBalance, None, b2World)
b2World.GetTreeQuality = new_instancemethod(_Box2D.b2World_GetTreeQuality, None, b2World)
b2World.__SetGravity = new_instancemethod(_Box2D.b2World___SetGravity, None, b2World)
b2World.__GetGravity = new_instancemethod(_Box2D.b2World___GetGravity, None, b2World)
b2World.__IsLocked = new_instancemethod(_Box2D.b2World___IsLocked, None, b2World)
b2World.__SetAutoClearForces = new_instancemethod(_Box2D.b2World___SetAutoClearForces, None, b2World)
b2World.__GetAutoClearForces = new_instancemethod(_Box2D.b2World___GetAutoClearForces, None, b2World)
b2World.ShiftOrigin = new_instancemethod(_Box2D.b2World_ShiftOrigin, None, b2World)
b2World.__GetContactManager = new_instancemethod(_Box2D.b2World___GetContactManager, None, b2World)
b2World.GetProfile = new_instancemethod(_Box2D.b2World_GetProfile, None, b2World)
b2World.Dump = new_instancemethod(_Box2D.b2World_Dump, None, b2World)
b2World.__hash__ = new_instancemethod(_Box2D.b2World___hash__, None, b2World)
b2World.__CreateBody = new_instancemethod(_Box2D.b2World___CreateBody, None, b2World)
b2World.__CreateJoint = new_instancemethod(_Box2D.b2World___CreateJoint, None, b2World)
b2World.DestroyBody = new_instancemethod(_Box2D.b2World_DestroyBody, None, b2World)
b2World.DestroyJoint = new_instancemethod(_Box2D.b2World_DestroyJoint, None, b2World)
b2World_swigregister = _Box2D.b2World_swigregister
b2World_swigregister(b2World)
def b2MixFriction(friction1, friction2):
"""
b2MixFriction(float32 friction1, float32 friction2) -> float32
Friction mixing law. Feel free to customize this.
"""
return _Box2D.b2MixFriction(friction1, friction2)
def b2MixRestitution(restitution1, restitution2):
"""
b2MixRestitution(float32 restitution1, float32 restitution2) -> float32
Restitution mixing law. Feel free to customize this.
"""
return _Box2D.b2MixRestitution(restitution1, restitution2)
class b2ContactEdge(object):
"""A contact edge is used to connect bodies and contacts together in a contact graph where each body is a node and each contact is an edge. A contact edge belongs to a doubly linked list maintained in each attached body. Each contact has two contact nodes, one for each attached body."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
other = _swig_property(_Box2D.b2ContactEdge_other_get, _Box2D.b2ContactEdge_other_set)
contact = _swig_property(_Box2D.b2ContactEdge_contact_get, _Box2D.b2ContactEdge_contact_set)
prev = _swig_property(_Box2D.b2ContactEdge_prev_get, _Box2D.b2ContactEdge_prev_set)
next = _swig_property(_Box2D.b2ContactEdge_next_get, _Box2D.b2ContactEdge_next_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2ContactEdge self) -> long"""
return _Box2D.b2ContactEdge___hash__(self)
def __repr__(self):
return _format_repr(self)
def __init__(self, **kwargs):
_Box2D.b2ContactEdge_swiginit(self,_Box2D.new_b2ContactEdge())
_init_kwargs(self, **kwargs)
__swig_destroy__ = _Box2D.delete_b2ContactEdge
b2ContactEdge.__hash__ = new_instancemethod(_Box2D.b2ContactEdge___hash__, None, b2ContactEdge)
b2ContactEdge_swigregister = _Box2D.b2ContactEdge_swigregister
b2ContactEdge_swigregister(b2ContactEdge)
class b2Contact(object):
"""The class manages contact between two shapes. A contact exists for each overlapping AABB in the broad-phase (except if filtered). Therefore a contact object may exist that has no contact points."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined - class is abstract")
__repr__ = _swig_repr
def __GetManifold(self, *args):
"""
__GetManifold(b2Contact self) -> b2Manifold
__GetManifold(b2Contact self) -> b2Manifold
Get the contact manifold. Do not modify the manifold unless you understand the internals of Box2D.
"""
return _Box2D.b2Contact___GetManifold(self, *args)
def __GetWorldManifold_internal(self, worldManifold):
"""
__GetWorldManifold_internal(b2Contact self, b2WorldManifold worldManifold)
Get the world manifold.
"""
return _Box2D.b2Contact___GetWorldManifold_internal(self, worldManifold)
def __IsTouching(self):
"""
__IsTouching(b2Contact self) -> bool
Is this contact touching?
"""
return _Box2D.b2Contact___IsTouching(self)
def __SetEnabled(self, flag):
"""
__SetEnabled(b2Contact self, bool flag)
Enable/disable this contact. This can be used inside the pre-solve contact listener. The contact is only disabled for the current time step (or sub-step in continuous collisions).
"""
return _Box2D.b2Contact___SetEnabled(self, flag)
def __IsEnabled(self):
"""
__IsEnabled(b2Contact self) -> bool
Has this contact been disabled?
"""
return _Box2D.b2Contact___IsEnabled(self)
def __GetNext(self, *args):
"""
__GetNext(b2Contact self) -> b2Contact
__GetNext(b2Contact self) -> b2Contact
Get the next contact in the world's contact list.
"""
return _Box2D.b2Contact___GetNext(self, *args)
def __GetFixtureA(self, *args):
"""
__GetFixtureA(b2Contact self) -> b2Fixture
__GetFixtureA(b2Contact self) -> b2Fixture
Get fixture A in this contact.
"""
return _Box2D.b2Contact___GetFixtureA(self, *args)
def __GetChildIndexA(self):
"""
__GetChildIndexA(b2Contact self) -> int32
Get the child primitive index for fixture A.
"""
return _Box2D.b2Contact___GetChildIndexA(self)
def __GetFixtureB(self, *args):
"""
__GetFixtureB(b2Contact self) -> b2Fixture
__GetFixtureB(b2Contact self) -> b2Fixture
Get fixture B in this contact.
"""
return _Box2D.b2Contact___GetFixtureB(self, *args)
def __GetChildIndexB(self):
"""
__GetChildIndexB(b2Contact self) -> int32
Get the child primitive index for fixture B.
"""
return _Box2D.b2Contact___GetChildIndexB(self)
def __SetFriction(self, friction):
"""
__SetFriction(b2Contact self, float32 friction)
Override the default friction mixture. You can call this in b2ContactListener::PreSolve. This value persists until set or reset.
"""
return _Box2D.b2Contact___SetFriction(self, friction)
def __GetFriction(self):
"""
__GetFriction(b2Contact self) -> float32
Get the friction.
"""
return _Box2D.b2Contact___GetFriction(self)
def ResetFriction(self):
"""
ResetFriction(b2Contact self)
Reset the friction mixture to the default value.
"""
return _Box2D.b2Contact_ResetFriction(self)
def __SetRestitution(self, restitution):
"""
__SetRestitution(b2Contact self, float32 restitution)
Override the default restitution mixture. You can call this in b2ContactListener::PreSolve. The value persists until you set or reset.
"""
return _Box2D.b2Contact___SetRestitution(self, restitution)
def __GetRestitution(self):
"""
__GetRestitution(b2Contact self) -> float32
Get the restitution.
"""
return _Box2D.b2Contact___GetRestitution(self)
def ResetRestitution(self):
"""
ResetRestitution(b2Contact self)
Reset the restitution to the default value.
"""
return _Box2D.b2Contact_ResetRestitution(self)
def __SetTangentSpeed(self, speed):
"""__SetTangentSpeed(b2Contact self, float32 speed)"""
return _Box2D.b2Contact___SetTangentSpeed(self, speed)
def __GetTangentSpeed(self):
"""__GetTangentSpeed(b2Contact self) -> float32"""
return _Box2D.b2Contact___GetTangentSpeed(self)
def Evaluate(self, manifold, xfA, xfB):
"""
Evaluate(b2Contact self, b2Manifold manifold, b2Transform xfA, b2Transform xfB)
Evaluate this contact with your own manifold and transforms.
"""
return _Box2D.b2Contact_Evaluate(self, manifold, xfA, xfB)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2Contact self) -> long"""
return _Box2D.b2Contact___hash__(self)
def __repr__(self):
return _format_repr(self)
def __GetWorldManifold(self):
ret=b2WorldManifold()
self.__GetWorldManifold_internal(ret)
return ret
# Read-write properties
enabled = property(__IsEnabled, __SetEnabled)
# Read-only
next = property(__GetNext, None)
fixtureB = property(__GetFixtureB, None)
fixtureA = property(__GetFixtureA, None)
manifold = property(__GetManifold, None)
childIndexA = property(__GetChildIndexA, None)
childIndexB = property(__GetChildIndexB, None)
worldManifold = property(__GetWorldManifold, None)
touching = property(__IsTouching, None)
friction = property(__GetFriction, __SetFriction)
restitution = property(__GetRestitution, __SetRestitution)
tangentSpeed = property(__GetTangentSpeed, __SetTangentSpeed)
b2Contact.__GetManifold = new_instancemethod(_Box2D.b2Contact___GetManifold, None, b2Contact)
b2Contact.__GetWorldManifold_internal = new_instancemethod(_Box2D.b2Contact___GetWorldManifold_internal, None, b2Contact)
b2Contact.__IsTouching = new_instancemethod(_Box2D.b2Contact___IsTouching, None, b2Contact)
b2Contact.__SetEnabled = new_instancemethod(_Box2D.b2Contact___SetEnabled, None, b2Contact)
b2Contact.__IsEnabled = new_instancemethod(_Box2D.b2Contact___IsEnabled, None, b2Contact)
b2Contact.__GetNext = new_instancemethod(_Box2D.b2Contact___GetNext, None, b2Contact)
b2Contact.__GetFixtureA = new_instancemethod(_Box2D.b2Contact___GetFixtureA, None, b2Contact)
b2Contact.__GetChildIndexA = new_instancemethod(_Box2D.b2Contact___GetChildIndexA, None, b2Contact)
b2Contact.__GetFixtureB = new_instancemethod(_Box2D.b2Contact___GetFixtureB, None, b2Contact)
b2Contact.__GetChildIndexB = new_instancemethod(_Box2D.b2Contact___GetChildIndexB, None, b2Contact)
b2Contact.__SetFriction = new_instancemethod(_Box2D.b2Contact___SetFriction, None, b2Contact)
b2Contact.__GetFriction = new_instancemethod(_Box2D.b2Contact___GetFriction, None, b2Contact)
b2Contact.ResetFriction = new_instancemethod(_Box2D.b2Contact_ResetFriction, None, b2Contact)
b2Contact.__SetRestitution = new_instancemethod(_Box2D.b2Contact___SetRestitution, None, b2Contact)
b2Contact.__GetRestitution = new_instancemethod(_Box2D.b2Contact___GetRestitution, None, b2Contact)
b2Contact.ResetRestitution = new_instancemethod(_Box2D.b2Contact_ResetRestitution, None, b2Contact)
b2Contact.__SetTangentSpeed = new_instancemethod(_Box2D.b2Contact___SetTangentSpeed, None, b2Contact)
b2Contact.__GetTangentSpeed = new_instancemethod(_Box2D.b2Contact___GetTangentSpeed, None, b2Contact)
b2Contact.Evaluate = new_instancemethod(_Box2D.b2Contact_Evaluate, None, b2Contact)
b2Contact.__hash__ = new_instancemethod(_Box2D.b2Contact___hash__, None, b2Contact)
b2Contact_swigregister = _Box2D.b2Contact_swigregister
b2Contact_swigregister(b2Contact)
e_wheelJoint = _Box2D.e_wheelJoint
e_ropeJoint = _Box2D.e_ropeJoint
class b2Jacobian(object):
"""Proxy of C++ b2Jacobian class."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
linear = _swig_property(_Box2D.b2Jacobian_linear_get, _Box2D.b2Jacobian_linear_set)
angularA = _swig_property(_Box2D.b2Jacobian_angularA_get, _Box2D.b2Jacobian_angularA_set)
angularB = _swig_property(_Box2D.b2Jacobian_angularB_get, _Box2D.b2Jacobian_angularB_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2Jacobian self) -> long"""
return _Box2D.b2Jacobian___hash__(self)
def __repr__(self):
return _format_repr(self)
def __init__(self, **kwargs):
_Box2D.b2Jacobian_swiginit(self,_Box2D.new_b2Jacobian())
_init_kwargs(self, **kwargs)
__swig_destroy__ = _Box2D.delete_b2Jacobian
b2Jacobian.__hash__ = new_instancemethod(_Box2D.b2Jacobian___hash__, None, b2Jacobian)
b2Jacobian_swigregister = _Box2D.b2Jacobian_swigregister
b2Jacobian_swigregister(b2Jacobian)
class b2JointEdge(object):
"""A joint edge is used to connect bodies and joints together in a joint graph where each body is a node and each joint is an edge. A joint edge belongs to a doubly linked list maintained in each attached body. Each joint has two joint nodes, one for each attached body."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
other = _swig_property(_Box2D.b2JointEdge_other_get, _Box2D.b2JointEdge_other_set)
joint = _swig_property(_Box2D.b2JointEdge_joint_get, _Box2D.b2JointEdge_joint_set)
prev = _swig_property(_Box2D.b2JointEdge_prev_get, _Box2D.b2JointEdge_prev_set)
next = _swig_property(_Box2D.b2JointEdge_next_get, _Box2D.b2JointEdge_next_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2JointEdge self) -> long"""
return _Box2D.b2JointEdge___hash__(self)
def __repr__(self):
return _format_repr(self)
def __init__(self, **kwargs):
_Box2D.b2JointEdge_swiginit(self,_Box2D.new_b2JointEdge())
_init_kwargs(self, **kwargs)
__swig_destroy__ = _Box2D.delete_b2JointEdge
b2JointEdge.__hash__ = new_instancemethod(_Box2D.b2JointEdge___hash__, None, b2JointEdge)
b2JointEdge_swigregister = _Box2D.b2JointEdge_swigregister
b2JointEdge_swigregister(b2JointEdge)
class b2JointDef(object):
"""Joint definitions are used to construct joints."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, **kwargs):
_Box2D.b2JointDef_swiginit(self,_Box2D.new_b2JointDef())
_init_kwargs(self, **kwargs)
type = _swig_property(_Box2D.b2JointDef_type_get, _Box2D.b2JointDef_type_set)
bodyA = _swig_property(_Box2D.b2JointDef_bodyA_get, _Box2D.b2JointDef_bodyA_set)
bodyB = _swig_property(_Box2D.b2JointDef_bodyB_get, _Box2D.b2JointDef_bodyB_set)
collideConnected = _swig_property(_Box2D.b2JointDef_collideConnected_get, _Box2D.b2JointDef_collideConnected_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2JointDef self) -> long"""
return _Box2D.b2JointDef___hash__(self)
def __repr__(self):
return _format_repr(self)
def __GetUserData(self):
"""__GetUserData(b2JointDef self) -> PyObject *"""
return _Box2D.b2JointDef___GetUserData(self)
def __SetUserData(self, data):
"""__SetUserData(b2JointDef self, PyObject * data)"""
return _Box2D.b2JointDef___SetUserData(self, data)
def ClearUserData(self):
"""ClearUserData(b2JointDef self)"""
return _Box2D.b2JointDef_ClearUserData(self)
userData = property(__GetUserData, __SetUserData)
def __del__(self):
self.ClearUserData()
def to_kwargs(self):
"""
Returns a dictionary representing this joint definition
"""
def is_prop(attr):
try:
is_property = isinstance(getattr(cls, attr), property)
except AttributeError:
return False
return is_property and attr not in skip_props
skip_props = ['anchor', 'anchorA', 'anchorB', 'axis']
cls = type(self)
return {attr: getattr(self, attr)
for attr in dir(self)
if is_prop(attr)
}
__swig_destroy__ = _Box2D.delete_b2JointDef
b2JointDef.__hash__ = new_instancemethod(_Box2D.b2JointDef___hash__, None, b2JointDef)
b2JointDef.__GetUserData = new_instancemethod(_Box2D.b2JointDef___GetUserData, None, b2JointDef)
b2JointDef.__SetUserData = new_instancemethod(_Box2D.b2JointDef___SetUserData, None, b2JointDef)
b2JointDef.ClearUserData = new_instancemethod(_Box2D.b2JointDef_ClearUserData, None, b2JointDef)
b2JointDef_swigregister = _Box2D.b2JointDef_swigregister
b2JointDef_swigregister(b2JointDef)
class b2Joint(object):
"""The base joint class. Joints are used to constraint two bodies together in various fashions. Some joints also feature limits and motors."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined - class is abstract")
__repr__ = _swig_repr
def __GetType(self):
"""
__GetType(b2Joint self) -> b2JointType
Get the type of the concrete joint.
"""
return _Box2D.b2Joint___GetType(self)
def __GetBodyA(self):
"""
__GetBodyA(b2Joint self) -> b2Body
Get the first body attached to this joint.
"""
return _Box2D.b2Joint___GetBodyA(self)
def __GetBodyB(self):
"""
__GetBodyB(b2Joint self) -> b2Body
Get the second body attached to this joint.
"""
return _Box2D.b2Joint___GetBodyB(self)
def __GetAnchorA(self):
"""
__GetAnchorA(b2Joint self) -> b2Vec2
Get the anchor point on bodyA in world coordinates.
"""
return _Box2D.b2Joint___GetAnchorA(self)
def __GetAnchorB(self):
"""
__GetAnchorB(b2Joint self) -> b2Vec2
Get the anchor point on bodyB in world coordinates.
"""
return _Box2D.b2Joint___GetAnchorB(self)
def GetReactionForce(self, inv_dt):
"""
GetReactionForce(b2Joint self, float32 inv_dt) -> b2Vec2
Get the reaction force on body2 at the joint anchor in Newtons.
"""
return _Box2D.b2Joint_GetReactionForce(self, inv_dt)
def GetReactionTorque(self, inv_dt):
"""
GetReactionTorque(b2Joint self, float32 inv_dt) -> float32
Get the reaction torque on body2 in N*m.
"""
return _Box2D.b2Joint_GetReactionTorque(self, inv_dt)
def __GetNext(self, *args):
"""
__GetNext(b2Joint self) -> b2Joint
__GetNext(b2Joint self) -> b2Joint
Get the next joint the world joint list.
"""
return _Box2D.b2Joint___GetNext(self, *args)
def __IsActive(self):
"""
__IsActive(b2Joint self) -> bool
Short-cut function to determine if either body is inactive.
"""
return _Box2D.b2Joint___IsActive(self)
def __GetCollideConnected(self):
"""__GetCollideConnected(b2Joint self) -> bool"""
return _Box2D.b2Joint___GetCollideConnected(self)
def Dump(self):
"""Dump(b2Joint self)"""
return _Box2D.b2Joint_Dump(self)
def ShiftOrigin(self, newOrigin):
"""ShiftOrigin(b2Joint self, b2Vec2 newOrigin)"""
return _Box2D.b2Joint_ShiftOrigin(self, newOrigin)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2Joint self) -> long"""
return _Box2D.b2Joint___hash__(self)
def __repr__(self):
return _format_repr(self)
def __GetUserData(self):
"""__GetUserData(b2Joint self) -> PyObject *"""
return _Box2D.b2Joint___GetUserData(self)
def __SetUserData(self, data):
"""__SetUserData(b2Joint self, PyObject * data)"""
return _Box2D.b2Joint___SetUserData(self, data)
def ClearUserData(self):
"""ClearUserData(b2Joint self)"""
return _Box2D.b2Joint_ClearUserData(self)
userData = property(__GetUserData, __SetUserData)
__eq__ = b2JointCompare
__ne__ = lambda self,other: not b2JointCompare(self,other)
# Read-only
next = property(__GetNext, None)
bodyA = property(__GetBodyA, None)
bodyB = property(__GetBodyB, None)
type = property(__GetType, None)
active = property(__IsActive, None)
anchorB = property(__GetAnchorB, None)
anchorA = property(__GetAnchorA, None)
collideConnected = property(__GetCollideConnected, None)
def getAsType(self):
"""
Backward compatibility
"""
return self
b2Joint.__GetType = new_instancemethod(_Box2D.b2Joint___GetType, None, b2Joint)
b2Joint.__GetBodyA = new_instancemethod(_Box2D.b2Joint___GetBodyA, None, b2Joint)
b2Joint.__GetBodyB = new_instancemethod(_Box2D.b2Joint___GetBodyB, None, b2Joint)
b2Joint.__GetAnchorA = new_instancemethod(_Box2D.b2Joint___GetAnchorA, None, b2Joint)
b2Joint.__GetAnchorB = new_instancemethod(_Box2D.b2Joint___GetAnchorB, None, b2Joint)
b2Joint.GetReactionForce = new_instancemethod(_Box2D.b2Joint_GetReactionForce, None, b2Joint)
b2Joint.GetReactionTorque = new_instancemethod(_Box2D.b2Joint_GetReactionTorque, None, b2Joint)
b2Joint.__GetNext = new_instancemethod(_Box2D.b2Joint___GetNext, None, b2Joint)
b2Joint.__IsActive = new_instancemethod(_Box2D.b2Joint___IsActive, None, b2Joint)
b2Joint.__GetCollideConnected = new_instancemethod(_Box2D.b2Joint___GetCollideConnected, None, b2Joint)
b2Joint.Dump = new_instancemethod(_Box2D.b2Joint_Dump, None, b2Joint)
b2Joint.ShiftOrigin = new_instancemethod(_Box2D.b2Joint_ShiftOrigin, None, b2Joint)
b2Joint.__hash__ = new_instancemethod(_Box2D.b2Joint___hash__, None, b2Joint)
b2Joint.__GetUserData = new_instancemethod(_Box2D.b2Joint___GetUserData, None, b2Joint)
b2Joint.__SetUserData = new_instancemethod(_Box2D.b2Joint___SetUserData, None, b2Joint)
b2Joint.ClearUserData = new_instancemethod(_Box2D.b2Joint_ClearUserData, None, b2Joint)
b2Joint_swigregister = _Box2D.b2Joint_swigregister
b2Joint_swigregister(b2Joint)
class b2DistanceJointDef(b2JointDef):
"""
Distance joint definition. This requires defining an anchor point on both bodies and the non-zero length of the distance joint. The definition uses local anchor points so that the initial configuration can violate the constraint slightly. This helps when saving and loading a game.
WARNING:
Do not use a zero or short length.
"""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, **kwargs):
_Box2D.b2DistanceJointDef_swiginit(self,_Box2D.new_b2DistanceJointDef())
_init_jointdef_kwargs(self, **kwargs)
if 'localAnchorA' in kwargs and 'localAnchorB' in kwargs and 'length' not in kwargs:
self.__update_length()
def Initialize(self, bodyA, bodyB, anchorA, anchorB):
"""
Initialize(b2DistanceJointDef self, b2Body bodyA, b2Body bodyB, b2Vec2 anchorA, b2Vec2 anchorB)
Initialize the bodies, anchors, and length using the world anchors.
"""
return _Box2D.b2DistanceJointDef_Initialize(self, bodyA, bodyB, anchorA, anchorB)
localAnchorA = _swig_property(_Box2D.b2DistanceJointDef_localAnchorA_get, _Box2D.b2DistanceJointDef_localAnchorA_set)
localAnchorB = _swig_property(_Box2D.b2DistanceJointDef_localAnchorB_get, _Box2D.b2DistanceJointDef_localAnchorB_set)
length = _swig_property(_Box2D.b2DistanceJointDef_length_get, _Box2D.b2DistanceJointDef_length_set)
frequencyHz = _swig_property(_Box2D.b2DistanceJointDef_frequencyHz_get, _Box2D.b2DistanceJointDef_frequencyHz_set)
dampingRatio = _swig_property(_Box2D.b2DistanceJointDef_dampingRatio_get, _Box2D.b2DistanceJointDef_dampingRatio_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2DistanceJointDef self) -> long"""
return _Box2D.b2DistanceJointDef___hash__(self)
def __repr__(self):
return _format_repr(self)
def __update_length(self):
if self.bodyA and self.bodyB:
d = self.anchorB - self.anchorA
self.length = d.length
def __set_anchorA(self, value):
if not self.bodyA:
raise ValueError('bodyA not set.')
self.localAnchorA=self.bodyA.GetLocalPoint(value)
self.__update_length()
def __set_anchorB(self, value):
if not self.bodyB:
raise ValueError('bodyB not set.')
self.localAnchorB=self.bodyB.GetLocalPoint(value)
self.__update_length()
def __get_anchorA(self):
if not self.bodyA:
raise ValueError('bodyA not set.')
return self.bodyA.GetWorldPoint(self.localAnchorA)
def __get_anchorB(self):
if not self.bodyB:
raise ValueError('bodyB not set.')
return self.bodyB.GetWorldPoint(self.localAnchorB)
anchorA = property(__get_anchorA, __set_anchorA,
doc="""Body A's anchor in world coordinates.
Getting the property depends on both bodyA and localAnchorA.
Setting the property requires that bodyA be set.""")
anchorB = property(__get_anchorB, __set_anchorB,
doc="""Body B's anchor in world coordinates.
Getting the property depends on both bodyB and localAnchorB.
Setting the property requires that bodyB be set.""")
__swig_destroy__ = _Box2D.delete_b2DistanceJointDef
b2DistanceJointDef.Initialize = new_instancemethod(_Box2D.b2DistanceJointDef_Initialize, None, b2DistanceJointDef)
b2DistanceJointDef.__hash__ = new_instancemethod(_Box2D.b2DistanceJointDef___hash__, None, b2DistanceJointDef)
b2DistanceJointDef_swigregister = _Box2D.b2DistanceJointDef_swigregister
b2DistanceJointDef_swigregister(b2DistanceJointDef)
class b2DistanceJoint(b2Joint):
"""A distance joint constrains two points on two bodies to remain at a fixed distance from each other. You can view this as a massless, rigid rod."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def GetLocalAnchorA(self):
"""GetLocalAnchorA(b2DistanceJoint self) -> b2Vec2"""
return _Box2D.b2DistanceJoint_GetLocalAnchorA(self)
def GetLocalAnchorB(self):
"""GetLocalAnchorB(b2DistanceJoint self) -> b2Vec2"""
return _Box2D.b2DistanceJoint_GetLocalAnchorB(self)
def __SetLength(self, length):
"""
__SetLength(b2DistanceJoint self, float32 length)
Set/get the natural length. Manipulating the length can lead to non-physical behavior when the frequency is zero.
"""
return _Box2D.b2DistanceJoint___SetLength(self, length)
def __GetLength(self):
"""__GetLength(b2DistanceJoint self) -> float32"""
return _Box2D.b2DistanceJoint___GetLength(self)
def __SetFrequency(self, hz):
"""__SetFrequency(b2DistanceJoint self, float32 hz)"""
return _Box2D.b2DistanceJoint___SetFrequency(self, hz)
def __GetFrequency(self):
"""__GetFrequency(b2DistanceJoint self) -> float32"""
return _Box2D.b2DistanceJoint___GetFrequency(self)
def __SetDampingRatio(self, ratio):
"""__SetDampingRatio(b2DistanceJoint self, float32 ratio)"""
return _Box2D.b2DistanceJoint___SetDampingRatio(self, ratio)
def __GetDampingRatio(self):
"""__GetDampingRatio(b2DistanceJoint self) -> float32"""
return _Box2D.b2DistanceJoint___GetDampingRatio(self)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2DistanceJoint self) -> long"""
return _Box2D.b2DistanceJoint___hash__(self)
def __repr__(self):
return _format_repr(self)
# Read-write properties
length = property(__GetLength, __SetLength)
frequency = property(__GetFrequency, __SetFrequency)
dampingRatio = property(__GetDampingRatio, __SetDampingRatio)
__swig_destroy__ = _Box2D.delete_b2DistanceJoint
b2DistanceJoint.GetLocalAnchorA = new_instancemethod(_Box2D.b2DistanceJoint_GetLocalAnchorA, None, b2DistanceJoint)
b2DistanceJoint.GetLocalAnchorB = new_instancemethod(_Box2D.b2DistanceJoint_GetLocalAnchorB, None, b2DistanceJoint)
b2DistanceJoint.__SetLength = new_instancemethod(_Box2D.b2DistanceJoint___SetLength, None, b2DistanceJoint)
b2DistanceJoint.__GetLength = new_instancemethod(_Box2D.b2DistanceJoint___GetLength, None, b2DistanceJoint)
b2DistanceJoint.__SetFrequency = new_instancemethod(_Box2D.b2DistanceJoint___SetFrequency, None, b2DistanceJoint)
b2DistanceJoint.__GetFrequency = new_instancemethod(_Box2D.b2DistanceJoint___GetFrequency, None, b2DistanceJoint)
b2DistanceJoint.__SetDampingRatio = new_instancemethod(_Box2D.b2DistanceJoint___SetDampingRatio, None, b2DistanceJoint)
b2DistanceJoint.__GetDampingRatio = new_instancemethod(_Box2D.b2DistanceJoint___GetDampingRatio, None, b2DistanceJoint)
b2DistanceJoint.__hash__ = new_instancemethod(_Box2D.b2DistanceJoint___hash__, None, b2DistanceJoint)
b2DistanceJoint_swigregister = _Box2D.b2DistanceJoint_swigregister
b2DistanceJoint_swigregister(b2DistanceJoint)
class b2FrictionJointDef(b2JointDef):
"""Friction joint definition."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, **kwargs):
_Box2D.b2FrictionJointDef_swiginit(self,_Box2D.new_b2FrictionJointDef())
_init_jointdef_kwargs(self, **kwargs)
def Initialize(self, bodyA, bodyB, anchor):
"""
Initialize(b2FrictionJointDef self, b2Body bodyA, b2Body bodyB, b2Vec2 anchor)
Initialize the bodies, anchors, axis, and reference angle using the world anchor and world axis.
"""
return _Box2D.b2FrictionJointDef_Initialize(self, bodyA, bodyB, anchor)
localAnchorA = _swig_property(_Box2D.b2FrictionJointDef_localAnchorA_get, _Box2D.b2FrictionJointDef_localAnchorA_set)
localAnchorB = _swig_property(_Box2D.b2FrictionJointDef_localAnchorB_get, _Box2D.b2FrictionJointDef_localAnchorB_set)
maxForce = _swig_property(_Box2D.b2FrictionJointDef_maxForce_get, _Box2D.b2FrictionJointDef_maxForce_set)
maxTorque = _swig_property(_Box2D.b2FrictionJointDef_maxTorque_get, _Box2D.b2FrictionJointDef_maxTorque_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2FrictionJointDef self) -> long"""
return _Box2D.b2FrictionJointDef___hash__(self)
def __repr__(self):
return _format_repr(self)
def __set_anchor(self, value):
if not self.bodyA:
raise ValueError('bodyA not set.')
if not self.bodyB:
raise ValueError('bodyB not set.')
self.localAnchorA=self.bodyA.GetLocalPoint(value)
self.localAnchorB=self.bodyB.GetLocalPoint(value)
def __get_anchor(self):
if self.bodyA:
return self.bodyA.GetWorldPoint(self.localAnchorA)
if self.bodyB:
return self.bodyB.GetWorldPoint(self.localAnchorB)
raise ValueError('Neither body was set; unable to get world point.')
anchor = property(__get_anchor, __set_anchor,
doc="""The anchor in world coordinates.
Getting the property depends on either bodyA and localAnchorA or
bodyB and localAnchorB.
Setting the property requires that both bodies be set.""")
__swig_destroy__ = _Box2D.delete_b2FrictionJointDef
b2FrictionJointDef.Initialize = new_instancemethod(_Box2D.b2FrictionJointDef_Initialize, None, b2FrictionJointDef)
b2FrictionJointDef.__hash__ = new_instancemethod(_Box2D.b2FrictionJointDef___hash__, None, b2FrictionJointDef)
b2FrictionJointDef_swigregister = _Box2D.b2FrictionJointDef_swigregister
b2FrictionJointDef_swigregister(b2FrictionJointDef)
class b2FrictionJoint(b2Joint):
"""Friction joint. This is used for top-down friction. It provides 2D translational friction and angular friction."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def GetLocalAnchorA(self):
"""GetLocalAnchorA(b2FrictionJoint self) -> b2Vec2"""
return _Box2D.b2FrictionJoint_GetLocalAnchorA(self)
def GetLocalAnchorB(self):
"""GetLocalAnchorB(b2FrictionJoint self) -> b2Vec2"""
return _Box2D.b2FrictionJoint_GetLocalAnchorB(self)
def __SetMaxForce(self, force):
"""
__SetMaxForce(b2FrictionJoint self, float32 force)
Set the maximum friction force in N.
"""
return _Box2D.b2FrictionJoint___SetMaxForce(self, force)
def __GetMaxForce(self):
"""
__GetMaxForce(b2FrictionJoint self) -> float32
Get the maximum friction force in N.
"""
return _Box2D.b2FrictionJoint___GetMaxForce(self)
def __SetMaxTorque(self, torque):
"""
__SetMaxTorque(b2FrictionJoint self, float32 torque)
Set the maximum friction torque in N*m.
"""
return _Box2D.b2FrictionJoint___SetMaxTorque(self, torque)
def __GetMaxTorque(self):
"""
__GetMaxTorque(b2FrictionJoint self) -> float32
Get the maximum friction torque in N*m.
"""
return _Box2D.b2FrictionJoint___GetMaxTorque(self)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2FrictionJoint self) -> long"""
return _Box2D.b2FrictionJoint___hash__(self)
def __repr__(self):
return _format_repr(self)
# Read-write properties
maxForce = property(__GetMaxForce, __SetMaxForce)
maxTorque = property(__GetMaxTorque, __SetMaxTorque)
__swig_destroy__ = _Box2D.delete_b2FrictionJoint
b2FrictionJoint.GetLocalAnchorA = new_instancemethod(_Box2D.b2FrictionJoint_GetLocalAnchorA, None, b2FrictionJoint)
b2FrictionJoint.GetLocalAnchorB = new_instancemethod(_Box2D.b2FrictionJoint_GetLocalAnchorB, None, b2FrictionJoint)
b2FrictionJoint.__SetMaxForce = new_instancemethod(_Box2D.b2FrictionJoint___SetMaxForce, None, b2FrictionJoint)
b2FrictionJoint.__GetMaxForce = new_instancemethod(_Box2D.b2FrictionJoint___GetMaxForce, None, b2FrictionJoint)
b2FrictionJoint.__SetMaxTorque = new_instancemethod(_Box2D.b2FrictionJoint___SetMaxTorque, None, b2FrictionJoint)
b2FrictionJoint.__GetMaxTorque = new_instancemethod(_Box2D.b2FrictionJoint___GetMaxTorque, None, b2FrictionJoint)
b2FrictionJoint.__hash__ = new_instancemethod(_Box2D.b2FrictionJoint___hash__, None, b2FrictionJoint)
b2FrictionJoint_swigregister = _Box2D.b2FrictionJoint_swigregister
b2FrictionJoint_swigregister(b2FrictionJoint)
class b2GearJointDef(b2JointDef):
"""Gear joint definition. This definition requires two existing revolute or prismatic joints (any combination will work). The provided joints must attach a dynamic body to a static body."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, **kwargs):
_Box2D.b2GearJointDef_swiginit(self,_Box2D.new_b2GearJointDef())
_init_kwargs(self, **kwargs)
joint1 = _swig_property(_Box2D.b2GearJointDef_joint1_get, _Box2D.b2GearJointDef_joint1_set)
joint2 = _swig_property(_Box2D.b2GearJointDef_joint2_get, _Box2D.b2GearJointDef_joint2_set)
ratio = _swig_property(_Box2D.b2GearJointDef_ratio_get, _Box2D.b2GearJointDef_ratio_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2GearJointDef self) -> long"""
return _Box2D.b2GearJointDef___hash__(self)
def __repr__(self):
return _format_repr(self)
__swig_destroy__ = _Box2D.delete_b2GearJointDef
b2GearJointDef.__hash__ = new_instancemethod(_Box2D.b2GearJointDef___hash__, None, b2GearJointDef)
b2GearJointDef_swigregister = _Box2D.b2GearJointDef_swigregister
b2GearJointDef_swigregister(b2GearJointDef)
class b2GearJoint(b2Joint):
"""
A gear joint is used to connect two joints together. Either joint can be a revolute or prismatic joint. You specify a gear ratio to bind the motions together: coordinate1 + ratio * coordinate2 = constant The ratio can be negative or positive. If one joint is a revolute joint and the other joint is a prismatic joint, then the ratio will have units of length or units of 1/length.
WARNING:
The revolute and prismatic joints must be attached to fixed bodies (which must be body1 on those joints).
"""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def GetJoint1(self):
"""GetJoint1(b2GearJoint self) -> b2Joint"""
return _Box2D.b2GearJoint_GetJoint1(self)
def GetJoint2(self):
"""GetJoint2(b2GearJoint self) -> b2Joint"""
return _Box2D.b2GearJoint_GetJoint2(self)
def __SetRatio(self, ratio):
"""
__SetRatio(b2GearJoint self, float32 ratio)
Set/Get the gear ratio.
"""
return _Box2D.b2GearJoint___SetRatio(self, ratio)
def __GetRatio(self):
"""__GetRatio(b2GearJoint self) -> float32"""
return _Box2D.b2GearJoint___GetRatio(self)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2GearJoint self) -> long"""
return _Box2D.b2GearJoint___hash__(self)
def __repr__(self):
return _format_repr(self)
# Read-write properties
ratio = property(__GetRatio, __SetRatio)
__swig_destroy__ = _Box2D.delete_b2GearJoint
b2GearJoint.GetJoint1 = new_instancemethod(_Box2D.b2GearJoint_GetJoint1, None, b2GearJoint)
b2GearJoint.GetJoint2 = new_instancemethod(_Box2D.b2GearJoint_GetJoint2, None, b2GearJoint)
b2GearJoint.__SetRatio = new_instancemethod(_Box2D.b2GearJoint___SetRatio, None, b2GearJoint)
b2GearJoint.__GetRatio = new_instancemethod(_Box2D.b2GearJoint___GetRatio, None, b2GearJoint)
b2GearJoint.__hash__ = new_instancemethod(_Box2D.b2GearJoint___hash__, None, b2GearJoint)
b2GearJoint_swigregister = _Box2D.b2GearJoint_swigregister
b2GearJoint_swigregister(b2GearJoint)
class b2MotorJointDef(b2JointDef):
"""Proxy of C++ b2MotorJointDef class."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, bodyA=None, bodyB=None, **kwargs):
_Box2D.b2MotorJointDef_swiginit(self,_Box2D.new_b2MotorJointDef())
_init_jointdef_kwargs(self, bodyA=bodyA, bodyB=bodyB, **kwargs)
if bodyA is not None and bodyB is not None:
if not kwargs:
self.Initialize(bodyA, bodyB)
def Initialize(self, bodyA, bodyB):
"""Initialize(b2MotorJointDef self, b2Body bodyA, b2Body bodyB)"""
return _Box2D.b2MotorJointDef_Initialize(self, bodyA, bodyB)
linearOffset = _swig_property(_Box2D.b2MotorJointDef_linearOffset_get, _Box2D.b2MotorJointDef_linearOffset_set)
angularOffset = _swig_property(_Box2D.b2MotorJointDef_angularOffset_get, _Box2D.b2MotorJointDef_angularOffset_set)
maxForce = _swig_property(_Box2D.b2MotorJointDef_maxForce_get, _Box2D.b2MotorJointDef_maxForce_set)
maxTorque = _swig_property(_Box2D.b2MotorJointDef_maxTorque_get, _Box2D.b2MotorJointDef_maxTorque_set)
correctionFactor = _swig_property(_Box2D.b2MotorJointDef_correctionFactor_get, _Box2D.b2MotorJointDef_correctionFactor_set)
__swig_destroy__ = _Box2D.delete_b2MotorJointDef
b2MotorJointDef.Initialize = new_instancemethod(_Box2D.b2MotorJointDef_Initialize, None, b2MotorJointDef)
b2MotorJointDef_swigregister = _Box2D.b2MotorJointDef_swigregister
b2MotorJointDef_swigregister(b2MotorJointDef)
class b2MotorJoint(b2Joint):
"""Proxy of C++ b2MotorJoint class."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def __SetLinearOffset(self, linearOffset):
"""__SetLinearOffset(b2MotorJoint self, b2Vec2 linearOffset)"""
return _Box2D.b2MotorJoint___SetLinearOffset(self, linearOffset)
def __GetLinearOffset(self):
"""__GetLinearOffset(b2MotorJoint self) -> b2Vec2"""
return _Box2D.b2MotorJoint___GetLinearOffset(self)
def __SetAngularOffset(self, angularOffset):
"""__SetAngularOffset(b2MotorJoint self, float32 angularOffset)"""
return _Box2D.b2MotorJoint___SetAngularOffset(self, angularOffset)
def __GetAngularOffset(self):
"""__GetAngularOffset(b2MotorJoint self) -> float32"""
return _Box2D.b2MotorJoint___GetAngularOffset(self)
def __SetMaxForce(self, force):
"""__SetMaxForce(b2MotorJoint self, float32 force)"""
return _Box2D.b2MotorJoint___SetMaxForce(self, force)
def __GetMaxForce(self):
"""__GetMaxForce(b2MotorJoint self) -> float32"""
return _Box2D.b2MotorJoint___GetMaxForce(self)
def __SetMaxTorque(self, torque):
"""__SetMaxTorque(b2MotorJoint self, float32 torque)"""
return _Box2D.b2MotorJoint___SetMaxTorque(self, torque)
def __GetMaxTorque(self):
"""__GetMaxTorque(b2MotorJoint self) -> float32"""
return _Box2D.b2MotorJoint___GetMaxTorque(self)
# Read-write properties
maxForce = property(__GetMaxForce, __SetMaxForce)
maxTorque = property(__GetMaxTorque, __SetMaxTorque)
linearOffset = property(__GetLinearOffset, __SetLinearOffset)
angularOffset = property(__GetAngularOffset, __SetAngularOffset)
__swig_destroy__ = _Box2D.delete_b2MotorJoint
b2MotorJoint.__SetLinearOffset = new_instancemethod(_Box2D.b2MotorJoint___SetLinearOffset, None, b2MotorJoint)
b2MotorJoint.__GetLinearOffset = new_instancemethod(_Box2D.b2MotorJoint___GetLinearOffset, None, b2MotorJoint)
b2MotorJoint.__SetAngularOffset = new_instancemethod(_Box2D.b2MotorJoint___SetAngularOffset, None, b2MotorJoint)
b2MotorJoint.__GetAngularOffset = new_instancemethod(_Box2D.b2MotorJoint___GetAngularOffset, None, b2MotorJoint)
b2MotorJoint.__SetMaxForce = new_instancemethod(_Box2D.b2MotorJoint___SetMaxForce, None, b2MotorJoint)
b2MotorJoint.__GetMaxForce = new_instancemethod(_Box2D.b2MotorJoint___GetMaxForce, None, b2MotorJoint)
b2MotorJoint.__SetMaxTorque = new_instancemethod(_Box2D.b2MotorJoint___SetMaxTorque, None, b2MotorJoint)
b2MotorJoint.__GetMaxTorque = new_instancemethod(_Box2D.b2MotorJoint___GetMaxTorque, None, b2MotorJoint)
b2MotorJoint_swigregister = _Box2D.b2MotorJoint_swigregister
b2MotorJoint_swigregister(b2MotorJoint)
class b2MouseJointDef(b2JointDef):
"""Mouse joint definition. This requires a world target point, tuning parameters, and the time step."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, **kwargs):
_Box2D.b2MouseJointDef_swiginit(self,_Box2D.new_b2MouseJointDef())
_init_kwargs(self, **kwargs)
target = _swig_property(_Box2D.b2MouseJointDef_target_get, _Box2D.b2MouseJointDef_target_set)
maxForce = _swig_property(_Box2D.b2MouseJointDef_maxForce_get, _Box2D.b2MouseJointDef_maxForce_set)
frequencyHz = _swig_property(_Box2D.b2MouseJointDef_frequencyHz_get, _Box2D.b2MouseJointDef_frequencyHz_set)
dampingRatio = _swig_property(_Box2D.b2MouseJointDef_dampingRatio_get, _Box2D.b2MouseJointDef_dampingRatio_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2MouseJointDef self) -> long"""
return _Box2D.b2MouseJointDef___hash__(self)
def __repr__(self):
return _format_repr(self)
__swig_destroy__ = _Box2D.delete_b2MouseJointDef
b2MouseJointDef.__hash__ = new_instancemethod(_Box2D.b2MouseJointDef___hash__, None, b2MouseJointDef)
b2MouseJointDef_swigregister = _Box2D.b2MouseJointDef_swigregister
b2MouseJointDef_swigregister(b2MouseJointDef)
class b2MouseJoint(b2Joint):
"""A mouse joint is used to make a point on a body track a specified world point. This a soft constraint with a maximum force. This allows the constraint to stretch and without applying huge forces. NOTE: this joint is not documented in the manual because it was developed to be used in the testbed. If you want to learn how to use the mouse joint, look at the testbed."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def __SetTarget(self, target):
"""
__SetTarget(b2MouseJoint self, b2Vec2 target)
Use this to update the target point.
"""
return _Box2D.b2MouseJoint___SetTarget(self, target)
def __GetTarget(self):
"""__GetTarget(b2MouseJoint self) -> b2Vec2"""
return _Box2D.b2MouseJoint___GetTarget(self)
def __SetMaxForce(self, force):
"""
__SetMaxForce(b2MouseJoint self, float32 force)
Set/get the maximum force in Newtons.
"""
return _Box2D.b2MouseJoint___SetMaxForce(self, force)
def __GetMaxForce(self):
"""__GetMaxForce(b2MouseJoint self) -> float32"""
return _Box2D.b2MouseJoint___GetMaxForce(self)
def __SetFrequency(self, hz):
"""
__SetFrequency(b2MouseJoint self, float32 hz)
Set/get the frequency in Hertz.
"""
return _Box2D.b2MouseJoint___SetFrequency(self, hz)
def __GetFrequency(self):
"""__GetFrequency(b2MouseJoint self) -> float32"""
return _Box2D.b2MouseJoint___GetFrequency(self)
def __SetDampingRatio(self, ratio):
"""
__SetDampingRatio(b2MouseJoint self, float32 ratio)
Set/get the damping ratio (dimensionless).
"""
return _Box2D.b2MouseJoint___SetDampingRatio(self, ratio)
def __GetDampingRatio(self):
"""__GetDampingRatio(b2MouseJoint self) -> float32"""
return _Box2D.b2MouseJoint___GetDampingRatio(self)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2MouseJoint self) -> long"""
return _Box2D.b2MouseJoint___hash__(self)
def __repr__(self):
return _format_repr(self)
# Read-write properties
maxForce = property(__GetMaxForce, __SetMaxForce)
frequency = property(__GetFrequency, __SetFrequency)
dampingRatio = property(__GetDampingRatio, __SetDampingRatio)
target = property(__GetTarget, __SetTarget)
__swig_destroy__ = _Box2D.delete_b2MouseJoint
b2MouseJoint.__SetTarget = new_instancemethod(_Box2D.b2MouseJoint___SetTarget, None, b2MouseJoint)
b2MouseJoint.__GetTarget = new_instancemethod(_Box2D.b2MouseJoint___GetTarget, None, b2MouseJoint)
b2MouseJoint.__SetMaxForce = new_instancemethod(_Box2D.b2MouseJoint___SetMaxForce, None, b2MouseJoint)
b2MouseJoint.__GetMaxForce = new_instancemethod(_Box2D.b2MouseJoint___GetMaxForce, None, b2MouseJoint)
b2MouseJoint.__SetFrequency = new_instancemethod(_Box2D.b2MouseJoint___SetFrequency, None, b2MouseJoint)
b2MouseJoint.__GetFrequency = new_instancemethod(_Box2D.b2MouseJoint___GetFrequency, None, b2MouseJoint)
b2MouseJoint.__SetDampingRatio = new_instancemethod(_Box2D.b2MouseJoint___SetDampingRatio, None, b2MouseJoint)
b2MouseJoint.__GetDampingRatio = new_instancemethod(_Box2D.b2MouseJoint___GetDampingRatio, None, b2MouseJoint)
b2MouseJoint.__hash__ = new_instancemethod(_Box2D.b2MouseJoint___hash__, None, b2MouseJoint)
b2MouseJoint_swigregister = _Box2D.b2MouseJoint_swigregister
b2MouseJoint_swigregister(b2MouseJoint)
class b2PrismaticJointDef(b2JointDef):
"""
Prismatic joint definition. This requires defining a line of motion using an axis and an anchor point. The definition uses local anchor points and a local axis so that the initial configuration can violate the constraint slightly. The joint translation is zero when the local anchor points coincide in world space. Using local anchors and a local axis helps when saving and loading a game.
WARNING:
at least one body should by dynamic with a non-fixed rotation.
"""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, **kwargs):
_Box2D.b2PrismaticJointDef_swiginit(self,_Box2D.new_b2PrismaticJointDef())
_init_jointdef_kwargs(self, **kwargs)
if self.bodyA and self.bodyB and 'referenceAngle' not in kwargs:
self.referenceAngle = self.bodyB.angle - self.bodyA.angle
def Initialize(self, bodyA, bodyB, anchor, axis):
"""
Initialize(b2PrismaticJointDef self, b2Body bodyA, b2Body bodyB, b2Vec2 anchor, b2Vec2 axis)
Initialize the bodies, anchors, axis, and reference angle using the world anchor and world axis.
"""
return _Box2D.b2PrismaticJointDef_Initialize(self, bodyA, bodyB, anchor, axis)
localAnchorA = _swig_property(_Box2D.b2PrismaticJointDef_localAnchorA_get, _Box2D.b2PrismaticJointDef_localAnchorA_set)
localAnchorB = _swig_property(_Box2D.b2PrismaticJointDef_localAnchorB_get, _Box2D.b2PrismaticJointDef_localAnchorB_set)
localAxisA = _swig_property(_Box2D.b2PrismaticJointDef_localAxisA_get, _Box2D.b2PrismaticJointDef_localAxisA_set)
referenceAngle = _swig_property(_Box2D.b2PrismaticJointDef_referenceAngle_get, _Box2D.b2PrismaticJointDef_referenceAngle_set)
enableLimit = _swig_property(_Box2D.b2PrismaticJointDef_enableLimit_get, _Box2D.b2PrismaticJointDef_enableLimit_set)
lowerTranslation = _swig_property(_Box2D.b2PrismaticJointDef_lowerTranslation_get, _Box2D.b2PrismaticJointDef_lowerTranslation_set)
upperTranslation = _swig_property(_Box2D.b2PrismaticJointDef_upperTranslation_get, _Box2D.b2PrismaticJointDef_upperTranslation_set)
enableMotor = _swig_property(_Box2D.b2PrismaticJointDef_enableMotor_get, _Box2D.b2PrismaticJointDef_enableMotor_set)
maxMotorForce = _swig_property(_Box2D.b2PrismaticJointDef_maxMotorForce_get, _Box2D.b2PrismaticJointDef_maxMotorForce_set)
motorSpeed = _swig_property(_Box2D.b2PrismaticJointDef_motorSpeed_get, _Box2D.b2PrismaticJointDef_motorSpeed_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2PrismaticJointDef self) -> long"""
return _Box2D.b2PrismaticJointDef___hash__(self)
def __repr__(self):
return _format_repr(self)
def __set_anchor(self, value):
if not self.bodyA:
raise ValueError('bodyA not set.')
if not self.bodyB:
raise ValueError('bodyB not set.')
self.localAnchorA=self.bodyA.GetLocalPoint(value)
self.localAnchorB=self.bodyB.GetLocalPoint(value)
def __get_anchor(self):
if self.bodyA:
return self.bodyA.GetWorldPoint(self.localAnchorA)
if self.bodyB:
return self.bodyB.GetWorldPoint(self.localAnchorB)
raise ValueError('Neither body was set; unable to get world point.')
def __set_axis(self, value):
if not self.bodyA:
raise ValueError('bodyA not set.')
self.localAxisA=self.bodyA.GetLocalVector(value)
def __get_axis(self):
if not self.bodyA:
raise ValueError('Body A unset; unable to get world vector.')
return self.bodyA.GetWorldVector(self.localAxisA)
anchor = property(__get_anchor, __set_anchor,
doc="""The anchor in world coordinates.
Getting the property depends on either bodyA and localAnchorA or
bodyB and localAnchorB.
Setting the property requires that both bodies be set.""")
axis = property(__get_axis, __set_axis,
doc="""The world translation axis on bodyA.
Getting the property depends on bodyA and localAxisA.
Setting the property requires that bodyA be set.""")
__swig_destroy__ = _Box2D.delete_b2PrismaticJointDef
b2PrismaticJointDef.Initialize = new_instancemethod(_Box2D.b2PrismaticJointDef_Initialize, None, b2PrismaticJointDef)
b2PrismaticJointDef.__hash__ = new_instancemethod(_Box2D.b2PrismaticJointDef___hash__, None, b2PrismaticJointDef)
b2PrismaticJointDef_swigregister = _Box2D.b2PrismaticJointDef_swigregister
b2PrismaticJointDef_swigregister(b2PrismaticJointDef)
class b2PrismaticJoint(b2Joint):
"""A prismatic joint. This joint provides one degree of freedom: translation along an axis fixed in body1. Relative rotation is prevented. You can use a joint limit to restrict the range of motion and a joint motor to drive the motion or to model joint friction."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def GetLocalAnchorA(self):
"""GetLocalAnchorA(b2PrismaticJoint self) -> b2Vec2"""
return _Box2D.b2PrismaticJoint_GetLocalAnchorA(self)
def GetLocalAnchorB(self):
"""GetLocalAnchorB(b2PrismaticJoint self) -> b2Vec2"""
return _Box2D.b2PrismaticJoint_GetLocalAnchorB(self)
def GetLocalAxisA(self):
"""GetLocalAxisA(b2PrismaticJoint self) -> b2Vec2"""
return _Box2D.b2PrismaticJoint_GetLocalAxisA(self)
def GetReferenceAngle(self):
"""GetReferenceAngle(b2PrismaticJoint self) -> float32"""
return _Box2D.b2PrismaticJoint_GetReferenceAngle(self)
def __GetJointTranslation(self):
"""
__GetJointTranslation(b2PrismaticJoint self) -> float32
Get the current joint translation, usually in meters.
"""
return _Box2D.b2PrismaticJoint___GetJointTranslation(self)
def __GetJointSpeed(self):
"""
__GetJointSpeed(b2PrismaticJoint self) -> float32
Get the current joint translation speed, usually in meters per second.
"""
return _Box2D.b2PrismaticJoint___GetJointSpeed(self)
def __IsLimitEnabled(self):
"""
__IsLimitEnabled(b2PrismaticJoint self) -> bool
Is the joint limit enabled?
"""
return _Box2D.b2PrismaticJoint___IsLimitEnabled(self)
def __EnableLimit(self, flag):
"""
__EnableLimit(b2PrismaticJoint self, bool flag)
Enable/disable the joint limit.
"""
return _Box2D.b2PrismaticJoint___EnableLimit(self, flag)
def __GetLowerLimit(self):
"""
__GetLowerLimit(b2PrismaticJoint self) -> float32
Get the lower joint limit, usually in meters.
"""
return _Box2D.b2PrismaticJoint___GetLowerLimit(self)
def __GetUpperLimit(self):
"""
__GetUpperLimit(b2PrismaticJoint self) -> float32
Get the upper joint limit, usually in meters.
"""
return _Box2D.b2PrismaticJoint___GetUpperLimit(self)
def SetLimits(self, lower, upper):
"""
SetLimits(b2PrismaticJoint self, float32 lower, float32 upper)
Set the joint limits, usually in meters.
"""
return _Box2D.b2PrismaticJoint_SetLimits(self, lower, upper)
def __IsMotorEnabled(self):
"""
__IsMotorEnabled(b2PrismaticJoint self) -> bool
Is the joint motor enabled?
"""
return _Box2D.b2PrismaticJoint___IsMotorEnabled(self)
def __EnableMotor(self, flag):
"""
__EnableMotor(b2PrismaticJoint self, bool flag)
Enable/disable the joint motor.
"""
return _Box2D.b2PrismaticJoint___EnableMotor(self, flag)
def __SetMotorSpeed(self, speed):
"""
__SetMotorSpeed(b2PrismaticJoint self, float32 speed)
Set the motor speed, usually in meters per second.
"""
return _Box2D.b2PrismaticJoint___SetMotorSpeed(self, speed)
def __GetMotorSpeed(self):
"""
__GetMotorSpeed(b2PrismaticJoint self) -> float32
Get the motor speed, usually in meters per second.
"""
return _Box2D.b2PrismaticJoint___GetMotorSpeed(self)
def __SetMaxMotorForce(self, force):
"""
__SetMaxMotorForce(b2PrismaticJoint self, float32 force)
Set the maximum motor force, usually in N.
"""
return _Box2D.b2PrismaticJoint___SetMaxMotorForce(self, force)
def __GetMaxMotorForce(self):
"""__GetMaxMotorForce(b2PrismaticJoint self) -> float32"""
return _Box2D.b2PrismaticJoint___GetMaxMotorForce(self)
def GetMotorForce(self, inv_dt):
"""
GetMotorForce(b2PrismaticJoint self, float32 inv_dt) -> float32
Get the current motor force given the inverse time step, usually in N.
"""
return _Box2D.b2PrismaticJoint_GetMotorForce(self, inv_dt)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2PrismaticJoint self) -> long"""
return _Box2D.b2PrismaticJoint___hash__(self)
def __repr__(self):
return _format_repr(self)
# Read-write properties
motorSpeed = property(__GetMotorSpeed, __SetMotorSpeed)
motorEnabled = property(__IsMotorEnabled, __EnableMotor)
limitEnabled = property(__IsLimitEnabled, __EnableLimit)
upperLimit = property(__GetUpperLimit, lambda self, v: self.SetLimits(self.lowerLimit, v))
lowerLimit = property(__GetLowerLimit, lambda self, v: self.SetLimits(v, self.upperLimit))
limits = property(lambda self: (self.lowerLimit, self.upperLimit), lambda self, v: self.SetLimits(*v) )
maxMotorForce = property(__GetMaxMotorForce, __SetMaxMotorForce)
# Read-only
translation = property(__GetJointTranslation, None)
speed = property(__GetJointSpeed, None)
__swig_destroy__ = _Box2D.delete_b2PrismaticJoint
b2PrismaticJoint.GetLocalAnchorA = new_instancemethod(_Box2D.b2PrismaticJoint_GetLocalAnchorA, None, b2PrismaticJoint)
b2PrismaticJoint.GetLocalAnchorB = new_instancemethod(_Box2D.b2PrismaticJoint_GetLocalAnchorB, None, b2PrismaticJoint)
b2PrismaticJoint.GetLocalAxisA = new_instancemethod(_Box2D.b2PrismaticJoint_GetLocalAxisA, None, b2PrismaticJoint)
b2PrismaticJoint.GetReferenceAngle = new_instancemethod(_Box2D.b2PrismaticJoint_GetReferenceAngle, None, b2PrismaticJoint)
b2PrismaticJoint.__GetJointTranslation = new_instancemethod(_Box2D.b2PrismaticJoint___GetJointTranslation, None, b2PrismaticJoint)
b2PrismaticJoint.__GetJointSpeed = new_instancemethod(_Box2D.b2PrismaticJoint___GetJointSpeed, None, b2PrismaticJoint)
b2PrismaticJoint.__IsLimitEnabled = new_instancemethod(_Box2D.b2PrismaticJoint___IsLimitEnabled, None, b2PrismaticJoint)
b2PrismaticJoint.__EnableLimit = new_instancemethod(_Box2D.b2PrismaticJoint___EnableLimit, None, b2PrismaticJoint)
b2PrismaticJoint.__GetLowerLimit = new_instancemethod(_Box2D.b2PrismaticJoint___GetLowerLimit, None, b2PrismaticJoint)
b2PrismaticJoint.__GetUpperLimit = new_instancemethod(_Box2D.b2PrismaticJoint___GetUpperLimit, None, b2PrismaticJoint)
b2PrismaticJoint.SetLimits = new_instancemethod(_Box2D.b2PrismaticJoint_SetLimits, None, b2PrismaticJoint)
b2PrismaticJoint.__IsMotorEnabled = new_instancemethod(_Box2D.b2PrismaticJoint___IsMotorEnabled, None, b2PrismaticJoint)
b2PrismaticJoint.__EnableMotor = new_instancemethod(_Box2D.b2PrismaticJoint___EnableMotor, None, b2PrismaticJoint)
b2PrismaticJoint.__SetMotorSpeed = new_instancemethod(_Box2D.b2PrismaticJoint___SetMotorSpeed, None, b2PrismaticJoint)
b2PrismaticJoint.__GetMotorSpeed = new_instancemethod(_Box2D.b2PrismaticJoint___GetMotorSpeed, None, b2PrismaticJoint)
b2PrismaticJoint.__SetMaxMotorForce = new_instancemethod(_Box2D.b2PrismaticJoint___SetMaxMotorForce, None, b2PrismaticJoint)
b2PrismaticJoint.__GetMaxMotorForce = new_instancemethod(_Box2D.b2PrismaticJoint___GetMaxMotorForce, None, b2PrismaticJoint)
b2PrismaticJoint.GetMotorForce = new_instancemethod(_Box2D.b2PrismaticJoint_GetMotorForce, None, b2PrismaticJoint)
b2PrismaticJoint.__hash__ = new_instancemethod(_Box2D.b2PrismaticJoint___hash__, None, b2PrismaticJoint)
b2PrismaticJoint_swigregister = _Box2D.b2PrismaticJoint_swigregister
b2PrismaticJoint_swigregister(b2PrismaticJoint)
class b2PulleyJointDef(b2JointDef):
"""Pulley joint definition. This requires two ground anchors, two dynamic body anchor points, max lengths for each side, and a pulley ratio."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, **kwargs):
_Box2D.b2PulleyJointDef_swiginit(self,_Box2D.new_b2PulleyJointDef())
_init_jointdef_kwargs(self, **kwargs)
self.__init_pulley__(**kwargs)
def __init_pulley__(self, anchorA=None, anchorB=None, lengthA=None, lengthB=None, groundAnchorA=None, groundAnchorB=None, maxLengthA=None, maxLengthB=None, ratio=None, **kwargs):
lengthA_set, lengthB_set = False, False
if anchorA is not None or anchorB is not None:
# Some undoing -- if the user specified the length, we might
# have overwritten it, so reset it.
if lengthA is not None:
self.lengthA = lengthA
lengthA_set = True
if lengthB is not None:
self.lengthB = lengthB
lengthB_set = True
if anchorA is not None and groundAnchorA is not None and lengthA is None:
d1 = self.anchorA - self.groundAnchorA
self.lengthA = d1.length
lengthA_set = True
if anchorB is not None and groundAnchorB is not None and lengthB is None:
d2 = self.anchorB - self.groundAnchorB
self.lengthB = d2.length
lengthB_set=True
if ratio is not None:
# Ratio too small?
assert(self.ratio > globals()['b2_epsilon'])
if lengthA_set and lengthB_set and maxLengthA is None and maxLengthB is None:
C = self.lengthA + self.ratio * self.lengthB
self.maxLengthA = C - self.ratio * b2_minPulleyLength
self.maxLengthB = (C - b2_minPulleyLength) / self.ratio
def Initialize(self, bodyA, bodyB, groundAnchorA, groundAnchorB, anchorA, anchorB, ratio):
"""
Initialize(b2PulleyJointDef self, b2Body bodyA, b2Body bodyB, b2Vec2 groundAnchorA, b2Vec2 groundAnchorB, b2Vec2 anchorA, b2Vec2 anchorB, float32 ratio)
Initialize the bodies, anchors, lengths, max lengths, and ratio using the world anchors.
"""
return _Box2D.b2PulleyJointDef_Initialize(self, bodyA, bodyB, groundAnchorA, groundAnchorB, anchorA, anchorB, ratio)
groundAnchorA = _swig_property(_Box2D.b2PulleyJointDef_groundAnchorA_get, _Box2D.b2PulleyJointDef_groundAnchorA_set)
groundAnchorB = _swig_property(_Box2D.b2PulleyJointDef_groundAnchorB_get, _Box2D.b2PulleyJointDef_groundAnchorB_set)
localAnchorA = _swig_property(_Box2D.b2PulleyJointDef_localAnchorA_get, _Box2D.b2PulleyJointDef_localAnchorA_set)
localAnchorB = _swig_property(_Box2D.b2PulleyJointDef_localAnchorB_get, _Box2D.b2PulleyJointDef_localAnchorB_set)
lengthA = _swig_property(_Box2D.b2PulleyJointDef_lengthA_get, _Box2D.b2PulleyJointDef_lengthA_set)
lengthB = _swig_property(_Box2D.b2PulleyJointDef_lengthB_get, _Box2D.b2PulleyJointDef_lengthB_set)
ratio = _swig_property(_Box2D.b2PulleyJointDef_ratio_get, _Box2D.b2PulleyJointDef_ratio_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2PulleyJointDef self) -> long"""
return _Box2D.b2PulleyJointDef___hash__(self)
def __repr__(self):
return _format_repr(self)
def __update_length(self):
if self.bodyA:
d1 = self.anchorA - self.groundAnchorA
self.lengthA = d1.length
if self.bodyB:
d1 = self.anchorB - self.groundAnchorB
self.lengthB = d1.length
def __set_anchorA(self, value):
if not self.bodyA:
raise ValueError('bodyA not set.')
self.localAnchorA=self.bodyA.GetLocalPoint(value)
self.__update_length()
def __set_anchorB(self, value):
if not self.bodyB:
raise ValueError('bodyB not set.')
self.localAnchorB=self.bodyB.GetLocalPoint(value)
self.__update_length()
def __get_anchorA(self):
if not self.bodyA:
raise ValueError('bodyA not set.')
return self.bodyA.GetWorldPoint(self.localAnchorA)
def __get_anchorB(self):
if not self.bodyB:
raise ValueError('bodyB not set.')
return self.bodyB.GetWorldPoint(self.localAnchorB)
anchorA = property(__get_anchorA, __set_anchorA,
doc="""Body A's anchor in world coordinates.
Getting the property depends on both bodyA and localAnchorA.
Setting the property requires that bodyA be set.""")
anchorB = property(__get_anchorB, __set_anchorB,
doc="""Body B's anchor in world coordinates.
Getting the property depends on both bodyB and localAnchorB.
Setting the property requires that bodyB be set.""")
__swig_destroy__ = _Box2D.delete_b2PulleyJointDef
b2PulleyJointDef.Initialize = new_instancemethod(_Box2D.b2PulleyJointDef_Initialize, None, b2PulleyJointDef)
b2PulleyJointDef.__hash__ = new_instancemethod(_Box2D.b2PulleyJointDef___hash__, None, b2PulleyJointDef)
b2PulleyJointDef_swigregister = _Box2D.b2PulleyJointDef_swigregister
b2PulleyJointDef_swigregister(b2PulleyJointDef)
b2_minPulleyLength = b2Globals.b2_minPulleyLength
class b2PulleyJoint(b2Joint):
"""The pulley joint is connected to two bodies and two fixed ground points. The pulley supports a ratio such that: length1 + ratio * length2 <= constant Yes, the force transmitted is scaled by the ratio. The pulley also enforces a maximum length limit on both sides. This is useful to prevent one side of the pulley hitting the top."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def __GetGroundAnchorA(self):
"""
__GetGroundAnchorA(b2PulleyJoint self) -> b2Vec2
Get the first ground anchor.
"""
return _Box2D.b2PulleyJoint___GetGroundAnchorA(self)
def __GetGroundAnchorB(self):
"""
__GetGroundAnchorB(b2PulleyJoint self) -> b2Vec2
Get the second ground anchor.
"""
return _Box2D.b2PulleyJoint___GetGroundAnchorB(self)
def __GetLengthA(self):
"""__GetLengthA(b2PulleyJoint self) -> float32"""
return _Box2D.b2PulleyJoint___GetLengthA(self)
def __GetLengthB(self):
"""__GetLengthB(b2PulleyJoint self) -> float32"""
return _Box2D.b2PulleyJoint___GetLengthB(self)
def __GetRatio(self):
"""
__GetRatio(b2PulleyJoint self) -> float32
Get the pulley ratio.
"""
return _Box2D.b2PulleyJoint___GetRatio(self)
def GetCurrentLengthA(self):
"""GetCurrentLengthA(b2PulleyJoint self) -> float32"""
return _Box2D.b2PulleyJoint_GetCurrentLengthA(self)
def GetCurrentLengthB(self):
"""GetCurrentLengthB(b2PulleyJoint self) -> float32"""
return _Box2D.b2PulleyJoint_GetCurrentLengthB(self)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2PulleyJoint self) -> long"""
return _Box2D.b2PulleyJoint___hash__(self)
def __repr__(self):
return _format_repr(self)
# Read-only
groundAnchorB = property(__GetGroundAnchorB, None)
groundAnchorA = property(__GetGroundAnchorA, None)
ratio = property(__GetRatio, None)
lengthB = length2 = property(__GetLengthB, None)
lengthA = length1 = property(__GetLengthA, None)
__swig_destroy__ = _Box2D.delete_b2PulleyJoint
b2PulleyJoint.__GetGroundAnchorA = new_instancemethod(_Box2D.b2PulleyJoint___GetGroundAnchorA, None, b2PulleyJoint)
b2PulleyJoint.__GetGroundAnchorB = new_instancemethod(_Box2D.b2PulleyJoint___GetGroundAnchorB, None, b2PulleyJoint)
b2PulleyJoint.__GetLengthA = new_instancemethod(_Box2D.b2PulleyJoint___GetLengthA, None, b2PulleyJoint)
b2PulleyJoint.__GetLengthB = new_instancemethod(_Box2D.b2PulleyJoint___GetLengthB, None, b2PulleyJoint)
b2PulleyJoint.__GetRatio = new_instancemethod(_Box2D.b2PulleyJoint___GetRatio, None, b2PulleyJoint)
b2PulleyJoint.GetCurrentLengthA = new_instancemethod(_Box2D.b2PulleyJoint_GetCurrentLengthA, None, b2PulleyJoint)
b2PulleyJoint.GetCurrentLengthB = new_instancemethod(_Box2D.b2PulleyJoint_GetCurrentLengthB, None, b2PulleyJoint)
b2PulleyJoint.__hash__ = new_instancemethod(_Box2D.b2PulleyJoint___hash__, None, b2PulleyJoint)
b2PulleyJoint_swigregister = _Box2D.b2PulleyJoint_swigregister
b2PulleyJoint_swigregister(b2PulleyJoint)
class b2RevoluteJointDef(b2JointDef):
"""Revolute joint definition. This requires defining an anchor point where the bodies are joined. The definition uses local anchor points so that the initial configuration can violate the constraint slightly. You also need to specify the initial relative angle for joint limits. This helps when saving and loading a game. The local anchor points are measured from the body's origin rather than the center of mass because: 1. you might not know where the center of mass will be. 2. if you add/remove shapes from a body and recompute the mass, the joints will be broken."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, **kwargs):
_Box2D.b2RevoluteJointDef_swiginit(self,_Box2D.new_b2RevoluteJointDef())
_init_jointdef_kwargs(self, **kwargs)
if self.bodyA and self.bodyB and 'referenceAngle' not in kwargs:
self.referenceAngle = self.bodyB.angle - self.bodyA.angle
def Initialize(self, bodyA, bodyB, anchor):
"""
Initialize(b2RevoluteJointDef self, b2Body bodyA, b2Body bodyB, b2Vec2 anchor)
Initialize the bodies, anchors, and reference angle using a world anchor point.
"""
return _Box2D.b2RevoluteJointDef_Initialize(self, bodyA, bodyB, anchor)
localAnchorA = _swig_property(_Box2D.b2RevoluteJointDef_localAnchorA_get, _Box2D.b2RevoluteJointDef_localAnchorA_set)
localAnchorB = _swig_property(_Box2D.b2RevoluteJointDef_localAnchorB_get, _Box2D.b2RevoluteJointDef_localAnchorB_set)
referenceAngle = _swig_property(_Box2D.b2RevoluteJointDef_referenceAngle_get, _Box2D.b2RevoluteJointDef_referenceAngle_set)
enableLimit = _swig_property(_Box2D.b2RevoluteJointDef_enableLimit_get, _Box2D.b2RevoluteJointDef_enableLimit_set)
lowerAngle = _swig_property(_Box2D.b2RevoluteJointDef_lowerAngle_get, _Box2D.b2RevoluteJointDef_lowerAngle_set)
upperAngle = _swig_property(_Box2D.b2RevoluteJointDef_upperAngle_get, _Box2D.b2RevoluteJointDef_upperAngle_set)
enableMotor = _swig_property(_Box2D.b2RevoluteJointDef_enableMotor_get, _Box2D.b2RevoluteJointDef_enableMotor_set)
motorSpeed = _swig_property(_Box2D.b2RevoluteJointDef_motorSpeed_get, _Box2D.b2RevoluteJointDef_motorSpeed_set)
maxMotorTorque = _swig_property(_Box2D.b2RevoluteJointDef_maxMotorTorque_get, _Box2D.b2RevoluteJointDef_maxMotorTorque_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2RevoluteJointDef self) -> long"""
return _Box2D.b2RevoluteJointDef___hash__(self)
def __repr__(self):
return _format_repr(self)
def __set_anchor(self, value):
if not self.bodyA:
raise ValueError('bodyA not set.')
if not self.bodyB:
raise ValueError('bodyB not set.')
self.localAnchorA=self.bodyA.GetLocalPoint(value)
self.localAnchorB=self.bodyB.GetLocalPoint(value)
def __get_anchor(self):
if self.bodyA:
return self.bodyA.GetWorldPoint(self.localAnchorA)
if self.bodyB:
return self.bodyB.GetWorldPoint(self.localAnchorB)
raise ValueError('Neither body was set; unable to get world point.')
anchor = property(__get_anchor, __set_anchor,
doc="""The anchor in world coordinates.
Getting the property depends on either bodyA and localAnchorA or
bodyB and localAnchorB.
Setting the property requires that both bodies be set.""")
__swig_destroy__ = _Box2D.delete_b2RevoluteJointDef
b2RevoluteJointDef.Initialize = new_instancemethod(_Box2D.b2RevoluteJointDef_Initialize, None, b2RevoluteJointDef)
b2RevoluteJointDef.__hash__ = new_instancemethod(_Box2D.b2RevoluteJointDef___hash__, None, b2RevoluteJointDef)
b2RevoluteJointDef_swigregister = _Box2D.b2RevoluteJointDef_swigregister
b2RevoluteJointDef_swigregister(b2RevoluteJointDef)
class b2RevoluteJoint(b2Joint):
"""A revolute joint constrains two bodies to share a common point while they are free to rotate about the point. The relative rotation about the shared point is the joint angle. You can limit the relative rotation with a joint limit that specifies a lower and upper angle. You can use a motor to drive the relative rotation about the shared point. A maximum motor torque is provided so that infinite forces are not generated."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def GetLocalAnchorA(self):
"""GetLocalAnchorA(b2RevoluteJoint self) -> b2Vec2"""
return _Box2D.b2RevoluteJoint_GetLocalAnchorA(self)
def GetLocalAnchorB(self):
"""GetLocalAnchorB(b2RevoluteJoint self) -> b2Vec2"""
return _Box2D.b2RevoluteJoint_GetLocalAnchorB(self)
def GetReferenceAngle(self):
"""GetReferenceAngle(b2RevoluteJoint self) -> float32"""
return _Box2D.b2RevoluteJoint_GetReferenceAngle(self)
def __GetJointAngle(self):
"""
__GetJointAngle(b2RevoluteJoint self) -> float32
Get the current joint angle in radians.
"""
return _Box2D.b2RevoluteJoint___GetJointAngle(self)
def __GetJointSpeed(self):
"""
__GetJointSpeed(b2RevoluteJoint self) -> float32
Get the current joint angle speed in radians per second.
"""
return _Box2D.b2RevoluteJoint___GetJointSpeed(self)
def __IsLimitEnabled(self):
"""
__IsLimitEnabled(b2RevoluteJoint self) -> bool
Is the joint limit enabled?
"""
return _Box2D.b2RevoluteJoint___IsLimitEnabled(self)
def __EnableLimit(self, flag):
"""
__EnableLimit(b2RevoluteJoint self, bool flag)
Enable/disable the joint limit.
"""
return _Box2D.b2RevoluteJoint___EnableLimit(self, flag)
def __GetLowerLimit(self):
"""
__GetLowerLimit(b2RevoluteJoint self) -> float32
Get the lower joint limit in radians.
"""
return _Box2D.b2RevoluteJoint___GetLowerLimit(self)
def __GetUpperLimit(self):
"""
__GetUpperLimit(b2RevoluteJoint self) -> float32
Get the upper joint limit in radians.
"""
return _Box2D.b2RevoluteJoint___GetUpperLimit(self)
def SetLimits(self, lower, upper):
"""
SetLimits(b2RevoluteJoint self, float32 lower, float32 upper)
Set the joint limits in radians.
"""
return _Box2D.b2RevoluteJoint_SetLimits(self, lower, upper)
def __IsMotorEnabled(self):
"""
__IsMotorEnabled(b2RevoluteJoint self) -> bool
Is the joint motor enabled?
"""
return _Box2D.b2RevoluteJoint___IsMotorEnabled(self)
def __EnableMotor(self, flag):
"""
__EnableMotor(b2RevoluteJoint self, bool flag)
Enable/disable the joint motor.
"""
return _Box2D.b2RevoluteJoint___EnableMotor(self, flag)
def __SetMotorSpeed(self, speed):
"""
__SetMotorSpeed(b2RevoluteJoint self, float32 speed)
Set the motor speed in radians per second.
"""
return _Box2D.b2RevoluteJoint___SetMotorSpeed(self, speed)
def __GetMotorSpeed(self):
"""
__GetMotorSpeed(b2RevoluteJoint self) -> float32
Get the motor speed in radians per second.
"""
return _Box2D.b2RevoluteJoint___GetMotorSpeed(self)
def __SetMaxMotorTorque(self, torque):
"""
__SetMaxMotorTorque(b2RevoluteJoint self, float32 torque)
Set the maximum motor torque, usually in N-m.
"""
return _Box2D.b2RevoluteJoint___SetMaxMotorTorque(self, torque)
def GetMaxMotorTorque(self):
"""GetMaxMotorTorque(b2RevoluteJoint self) -> float32"""
return _Box2D.b2RevoluteJoint_GetMaxMotorTorque(self)
def GetMotorTorque(self, inv_dt):
"""
GetMotorTorque(b2RevoluteJoint self, float32 inv_dt) -> float32
Get the current motor torque given the inverse time step. Unit is N*m.
"""
return _Box2D.b2RevoluteJoint_GetMotorTorque(self, inv_dt)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2RevoluteJoint self) -> long"""
return _Box2D.b2RevoluteJoint___hash__(self)
def __repr__(self):
return _format_repr(self)
# Read-write properties
motorSpeed = property(__GetMotorSpeed, __SetMotorSpeed)
upperLimit = property(__GetUpperLimit, lambda self, v: self.SetLimits(self.lowerLimit, v))
lowerLimit = property(__GetLowerLimit, lambda self, v: self.SetLimits(v, self.upperLimit))
limits = property(lambda self: (self.lowerLimit, self.upperLimit), lambda self, v: self.SetLimits(*v) )
motorEnabled = property(__IsMotorEnabled, __EnableMotor)
limitEnabled = property(__IsLimitEnabled, __EnableLimit)
# Read-only
angle = property(__GetJointAngle, None)
speed = property(__GetJointSpeed, None)
# Write-only
maxMotorTorque = property(None, __SetMaxMotorTorque)
__swig_destroy__ = _Box2D.delete_b2RevoluteJoint
b2RevoluteJoint.GetLocalAnchorA = new_instancemethod(_Box2D.b2RevoluteJoint_GetLocalAnchorA, None, b2RevoluteJoint)
b2RevoluteJoint.GetLocalAnchorB = new_instancemethod(_Box2D.b2RevoluteJoint_GetLocalAnchorB, None, b2RevoluteJoint)
b2RevoluteJoint.GetReferenceAngle = new_instancemethod(_Box2D.b2RevoluteJoint_GetReferenceAngle, None, b2RevoluteJoint)
b2RevoluteJoint.__GetJointAngle = new_instancemethod(_Box2D.b2RevoluteJoint___GetJointAngle, None, b2RevoluteJoint)
b2RevoluteJoint.__GetJointSpeed = new_instancemethod(_Box2D.b2RevoluteJoint___GetJointSpeed, None, b2RevoluteJoint)
b2RevoluteJoint.__IsLimitEnabled = new_instancemethod(_Box2D.b2RevoluteJoint___IsLimitEnabled, None, b2RevoluteJoint)
b2RevoluteJoint.__EnableLimit = new_instancemethod(_Box2D.b2RevoluteJoint___EnableLimit, None, b2RevoluteJoint)
b2RevoluteJoint.__GetLowerLimit = new_instancemethod(_Box2D.b2RevoluteJoint___GetLowerLimit, None, b2RevoluteJoint)
b2RevoluteJoint.__GetUpperLimit = new_instancemethod(_Box2D.b2RevoluteJoint___GetUpperLimit, None, b2RevoluteJoint)
b2RevoluteJoint.SetLimits = new_instancemethod(_Box2D.b2RevoluteJoint_SetLimits, None, b2RevoluteJoint)
b2RevoluteJoint.__IsMotorEnabled = new_instancemethod(_Box2D.b2RevoluteJoint___IsMotorEnabled, None, b2RevoluteJoint)
b2RevoluteJoint.__EnableMotor = new_instancemethod(_Box2D.b2RevoluteJoint___EnableMotor, None, b2RevoluteJoint)
b2RevoluteJoint.__SetMotorSpeed = new_instancemethod(_Box2D.b2RevoluteJoint___SetMotorSpeed, None, b2RevoluteJoint)
b2RevoluteJoint.__GetMotorSpeed = new_instancemethod(_Box2D.b2RevoluteJoint___GetMotorSpeed, None, b2RevoluteJoint)
b2RevoluteJoint.__SetMaxMotorTorque = new_instancemethod(_Box2D.b2RevoluteJoint___SetMaxMotorTorque, None, b2RevoluteJoint)
b2RevoluteJoint.GetMaxMotorTorque = new_instancemethod(_Box2D.b2RevoluteJoint_GetMaxMotorTorque, None, b2RevoluteJoint)
b2RevoluteJoint.GetMotorTorque = new_instancemethod(_Box2D.b2RevoluteJoint_GetMotorTorque, None, b2RevoluteJoint)
b2RevoluteJoint.__hash__ = new_instancemethod(_Box2D.b2RevoluteJoint___hash__, None, b2RevoluteJoint)
b2RevoluteJoint_swigregister = _Box2D.b2RevoluteJoint_swigregister
b2RevoluteJoint_swigregister(b2RevoluteJoint)
class b2RopeJointDef(b2JointDef):
"""Rope joint definition. This requires two body anchor points and a maximum lengths. Note: by default the connected objects will not collide. see collideConnected in b2JointDef."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, **kwargs):
_Box2D.b2RopeJointDef_swiginit(self,_Box2D.new_b2RopeJointDef())
_init_jointdef_kwargs(self, **kwargs)
localAnchorA = _swig_property(_Box2D.b2RopeJointDef_localAnchorA_get, _Box2D.b2RopeJointDef_localAnchorA_set)
localAnchorB = _swig_property(_Box2D.b2RopeJointDef_localAnchorB_get, _Box2D.b2RopeJointDef_localAnchorB_set)
maxLength = _swig_property(_Box2D.b2RopeJointDef_maxLength_get, _Box2D.b2RopeJointDef_maxLength_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2RopeJointDef self) -> long"""
return _Box2D.b2RopeJointDef___hash__(self)
def __repr__(self):
return _format_repr(self)
def __set_anchorA(self, value):
if not self.bodyA:
raise ValueError('bodyA not set.')
self.localAnchorA=self.bodyA.GetLocalPoint(value)
def __set_anchorB(self, value):
if not self.bodyB:
raise ValueError('bodyB not set.')
self.localAnchorB=self.bodyB.GetLocalPoint(value)
def __get_anchorA(self):
if not self.bodyA:
raise ValueError('bodyA not set.')
return self.bodyA.GetWorldPoint(self.localAnchorA)
def __get_anchorB(self):
if not self.bodyB:
raise ValueError('bodyB not set.')
return self.bodyB.GetWorldPoint(self.localAnchorB)
anchorA = property(__get_anchorA, __set_anchorA,
doc="""Body A's anchor in world coordinates.
Getting the property depends on both bodyA and localAnchorA.
Setting the property requires that bodyA be set.""")
anchorB = property(__get_anchorB, __set_anchorB,
doc="""Body B's anchor in world coordinates.
Getting the property depends on both bodyB and localAnchorB.
Setting the property requires that bodyB be set.""")
__swig_destroy__ = _Box2D.delete_b2RopeJointDef
b2RopeJointDef.__hash__ = new_instancemethod(_Box2D.b2RopeJointDef___hash__, None, b2RopeJointDef)
b2RopeJointDef_swigregister = _Box2D.b2RopeJointDef_swigregister
b2RopeJointDef_swigregister(b2RopeJointDef)
class b2RopeJoint(b2Joint):
"""A rope joint enforces a maximum distance between two points on two bodies. It has no other effect. Warning: if you attempt to change the maximum length during the simulation you will get some non-physical behavior. A model that would allow you to dynamically modify the length would have some sponginess, so I chose not to implement it that way. See b2DistanceJointif you want to dynamically control length."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def GetLocalAnchorA(self):
"""GetLocalAnchorA(b2RopeJoint self) -> b2Vec2"""
return _Box2D.b2RopeJoint_GetLocalAnchorA(self)
def GetLocalAnchorB(self):
"""GetLocalAnchorB(b2RopeJoint self) -> b2Vec2"""
return _Box2D.b2RopeJoint_GetLocalAnchorB(self)
def SetMaxLength(self, length):
"""SetMaxLength(b2RopeJoint self, float32 length)"""
return _Box2D.b2RopeJoint_SetMaxLength(self, length)
def __GetMaxLength(self):
"""
__GetMaxLength(b2RopeJoint self) -> float32
Get the maximum length of the rope.
"""
return _Box2D.b2RopeJoint___GetMaxLength(self)
def __GetLimitState(self):
"""__GetLimitState(b2RopeJoint self) -> b2LimitState"""
return _Box2D.b2RopeJoint___GetLimitState(self)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2RopeJoint self) -> long"""
return _Box2D.b2RopeJoint___hash__(self)
def __repr__(self):
return _format_repr(self)
# Read-only properties
maxLength = property(__GetMaxLength, None)
limitState = property(__GetLimitState, None)
# Read-write properties
__swig_destroy__ = _Box2D.delete_b2RopeJoint
b2RopeJoint.GetLocalAnchorA = new_instancemethod(_Box2D.b2RopeJoint_GetLocalAnchorA, None, b2RopeJoint)
b2RopeJoint.GetLocalAnchorB = new_instancemethod(_Box2D.b2RopeJoint_GetLocalAnchorB, None, b2RopeJoint)
b2RopeJoint.SetMaxLength = new_instancemethod(_Box2D.b2RopeJoint_SetMaxLength, None, b2RopeJoint)
b2RopeJoint.__GetMaxLength = new_instancemethod(_Box2D.b2RopeJoint___GetMaxLength, None, b2RopeJoint)
b2RopeJoint.__GetLimitState = new_instancemethod(_Box2D.b2RopeJoint___GetLimitState, None, b2RopeJoint)
b2RopeJoint.__hash__ = new_instancemethod(_Box2D.b2RopeJoint___hash__, None, b2RopeJoint)
b2RopeJoint_swigregister = _Box2D.b2RopeJoint_swigregister
b2RopeJoint_swigregister(b2RopeJoint)
class b2WeldJointDef(b2JointDef):
"""Weld joint definition. You need to specify local anchor points where they are attached and the relative body angle. The position of the anchor points is important for computing the reaction torque."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, **kwargs):
_Box2D.b2WeldJointDef_swiginit(self,_Box2D.new_b2WeldJointDef())
_init_jointdef_kwargs(self, **kwargs)
if self.bodyA and self.bodyB and 'referenceAngle' not in kwargs:
self.referenceAngle = self.bodyB.angle - self.bodyA.angle
def Initialize(self, bodyA, bodyB, anchor):
"""
Initialize(b2WeldJointDef self, b2Body bodyA, b2Body bodyB, b2Vec2 anchor)
Initialize the bodies, anchors, and reference angle using a world anchor point.
"""
return _Box2D.b2WeldJointDef_Initialize(self, bodyA, bodyB, anchor)
localAnchorA = _swig_property(_Box2D.b2WeldJointDef_localAnchorA_get, _Box2D.b2WeldJointDef_localAnchorA_set)
localAnchorB = _swig_property(_Box2D.b2WeldJointDef_localAnchorB_get, _Box2D.b2WeldJointDef_localAnchorB_set)
referenceAngle = _swig_property(_Box2D.b2WeldJointDef_referenceAngle_get, _Box2D.b2WeldJointDef_referenceAngle_set)
frequencyHz = _swig_property(_Box2D.b2WeldJointDef_frequencyHz_get, _Box2D.b2WeldJointDef_frequencyHz_set)
dampingRatio = _swig_property(_Box2D.b2WeldJointDef_dampingRatio_get, _Box2D.b2WeldJointDef_dampingRatio_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2WeldJointDef self) -> long"""
return _Box2D.b2WeldJointDef___hash__(self)
def __repr__(self):
return _format_repr(self)
def __set_anchor(self, value):
if not self.bodyA:
raise ValueError('bodyA not set.')
if not self.bodyB:
raise ValueError('bodyB not set.')
self.localAnchorA=self.bodyA.GetLocalPoint(value)
self.localAnchorB=self.bodyB.GetLocalPoint(value)
def __get_anchor(self):
if self.bodyA:
return self.bodyA.GetWorldPoint(self.localAnchorA)
if self.bodyB:
return self.bodyB.GetWorldPoint(self.localAnchorB)
raise ValueError('Neither body was set; unable to get world point.')
anchor = property(__get_anchor, __set_anchor,
doc="""The anchor in world coordinates.
Getting the property depends on either bodyA and localAnchorA or
bodyB and localAnchorB.
Setting the property requires that both bodies be set.""")
__swig_destroy__ = _Box2D.delete_b2WeldJointDef
b2WeldJointDef.Initialize = new_instancemethod(_Box2D.b2WeldJointDef_Initialize, None, b2WeldJointDef)
b2WeldJointDef.__hash__ = new_instancemethod(_Box2D.b2WeldJointDef___hash__, None, b2WeldJointDef)
b2WeldJointDef_swigregister = _Box2D.b2WeldJointDef_swigregister
b2WeldJointDef_swigregister(b2WeldJointDef)
class b2WeldJoint(b2Joint):
"""A weld joint essentially glues two bodies together. A weld joint may distort somewhat because the island constraint solver is approximate."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def GetLocalAnchorA(self):
"""GetLocalAnchorA(b2WeldJoint self) -> b2Vec2"""
return _Box2D.b2WeldJoint_GetLocalAnchorA(self)
def GetLocalAnchorB(self):
"""GetLocalAnchorB(b2WeldJoint self) -> b2Vec2"""
return _Box2D.b2WeldJoint_GetLocalAnchorB(self)
def GetReferenceAngle(self):
"""GetReferenceAngle(b2WeldJoint self) -> float32"""
return _Box2D.b2WeldJoint_GetReferenceAngle(self)
def SetFrequency(self, hz):
"""SetFrequency(b2WeldJoint self, float32 hz)"""
return _Box2D.b2WeldJoint_SetFrequency(self, hz)
def GetFrequency(self):
"""GetFrequency(b2WeldJoint self) -> float32"""
return _Box2D.b2WeldJoint_GetFrequency(self)
def SetDampingRatio(self, ratio):
"""SetDampingRatio(b2WeldJoint self, float32 ratio)"""
return _Box2D.b2WeldJoint_SetDampingRatio(self, ratio)
def GetDampingRatio(self):
"""GetDampingRatio(b2WeldJoint self) -> float32"""
return _Box2D.b2WeldJoint_GetDampingRatio(self)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2WeldJoint self) -> long"""
return _Box2D.b2WeldJoint___hash__(self)
def __repr__(self):
return _format_repr(self)
__swig_destroy__ = _Box2D.delete_b2WeldJoint
b2WeldJoint.GetLocalAnchorA = new_instancemethod(_Box2D.b2WeldJoint_GetLocalAnchorA, None, b2WeldJoint)
b2WeldJoint.GetLocalAnchorB = new_instancemethod(_Box2D.b2WeldJoint_GetLocalAnchorB, None, b2WeldJoint)
b2WeldJoint.GetReferenceAngle = new_instancemethod(_Box2D.b2WeldJoint_GetReferenceAngle, None, b2WeldJoint)
b2WeldJoint.SetFrequency = new_instancemethod(_Box2D.b2WeldJoint_SetFrequency, None, b2WeldJoint)
b2WeldJoint.GetFrequency = new_instancemethod(_Box2D.b2WeldJoint_GetFrequency, None, b2WeldJoint)
b2WeldJoint.SetDampingRatio = new_instancemethod(_Box2D.b2WeldJoint_SetDampingRatio, None, b2WeldJoint)
b2WeldJoint.GetDampingRatio = new_instancemethod(_Box2D.b2WeldJoint_GetDampingRatio, None, b2WeldJoint)
b2WeldJoint.__hash__ = new_instancemethod(_Box2D.b2WeldJoint___hash__, None, b2WeldJoint)
b2WeldJoint_swigregister = _Box2D.b2WeldJoint_swigregister
b2WeldJoint_swigregister(b2WeldJoint)
class b2WheelJointDef(b2JointDef):
"""Line joint definition. This requires defining a line of motion using an axis and an anchor point. The definition uses local anchor points and a local axis so that the initial configuration can violate the constraint slightly. The joint translation is zero when the local anchor points coincide in world space. Using local anchors and a local axis helps when saving and loading a game."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, **kwargs):
_Box2D.b2WheelJointDef_swiginit(self,_Box2D.new_b2WheelJointDef())
_init_jointdef_kwargs(self, **kwargs)
def Initialize(self, bodyA, bodyB, anchor, axis):
"""
Initialize(b2WheelJointDef self, b2Body bodyA, b2Body bodyB, b2Vec2 anchor, b2Vec2 axis)
Initialize the bodies, anchors, axis, and reference angle using the world anchor and world axis.
"""
return _Box2D.b2WheelJointDef_Initialize(self, bodyA, bodyB, anchor, axis)
localAnchorA = _swig_property(_Box2D.b2WheelJointDef_localAnchorA_get, _Box2D.b2WheelJointDef_localAnchorA_set)
localAnchorB = _swig_property(_Box2D.b2WheelJointDef_localAnchorB_get, _Box2D.b2WheelJointDef_localAnchorB_set)
localAxisA = _swig_property(_Box2D.b2WheelJointDef_localAxisA_get, _Box2D.b2WheelJointDef_localAxisA_set)
enableMotor = _swig_property(_Box2D.b2WheelJointDef_enableMotor_get, _Box2D.b2WheelJointDef_enableMotor_set)
maxMotorTorque = _swig_property(_Box2D.b2WheelJointDef_maxMotorTorque_get, _Box2D.b2WheelJointDef_maxMotorTorque_set)
motorSpeed = _swig_property(_Box2D.b2WheelJointDef_motorSpeed_get, _Box2D.b2WheelJointDef_motorSpeed_set)
frequencyHz = _swig_property(_Box2D.b2WheelJointDef_frequencyHz_get, _Box2D.b2WheelJointDef_frequencyHz_set)
dampingRatio = _swig_property(_Box2D.b2WheelJointDef_dampingRatio_get, _Box2D.b2WheelJointDef_dampingRatio_set)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2WheelJointDef self) -> long"""
return _Box2D.b2WheelJointDef___hash__(self)
def __repr__(self):
return _format_repr(self)
def __set_anchor(self, value):
if not self.bodyA:
raise ValueError('bodyA not set.')
if not self.bodyB:
raise ValueError('bodyB not set.')
self.localAnchorA=self.bodyA.GetLocalPoint(value)
self.localAnchorB=self.bodyB.GetLocalPoint(value)
def __get_anchor(self):
if self.bodyA:
return self.bodyA.GetWorldPoint(self.localAnchorA)
if self.bodyB:
return self.bodyB.GetWorldPoint(self.localAnchorB)
raise ValueError('Neither body was set; unable to get world point.')
def __set_axis(self, value):
if not self.bodyA:
raise ValueError('bodyA not set.')
self.localAxisA=self.bodyA.GetLocalVector(value)
def __get_axis(self):
if self.bodyA:
return self.bodyA.GetWorldVector(self.localAxisA)
raise ValueError('Body A unset; unable to get world vector.')
anchor = property(__get_anchor, __set_anchor,
doc="""The anchor in world coordinates.
Getting the property depends on either bodyA and localAnchorA or
bodyB and localAnchorB.
Setting the property requires that both bodies be set.""")
axis = property(__get_axis, __set_axis,
doc="""The world translation axis on bodyA.
Getting the property depends on bodyA and localAxisA.
Setting the property requires that bodyA be set.""")
__swig_destroy__ = _Box2D.delete_b2WheelJointDef
b2WheelJointDef.Initialize = new_instancemethod(_Box2D.b2WheelJointDef_Initialize, None, b2WheelJointDef)
b2WheelJointDef.__hash__ = new_instancemethod(_Box2D.b2WheelJointDef___hash__, None, b2WheelJointDef)
b2WheelJointDef_swigregister = _Box2D.b2WheelJointDef_swigregister
b2WheelJointDef_swigregister(b2WheelJointDef)
class b2WheelJoint(b2Joint):
"""A line joint. This joint provides two degrees of freedom: translation along an axis fixed in body1 and rotation in the plane. You can use a joint limit to restrict the range of motion and a joint motor to drive the rotation or to model rotational friction. This joint is designed for vehicle suspensions."""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def GetLocalAnchorA(self):
"""GetLocalAnchorA(b2WheelJoint self) -> b2Vec2"""
return _Box2D.b2WheelJoint_GetLocalAnchorA(self)
def GetLocalAnchorB(self):
"""GetLocalAnchorB(b2WheelJoint self) -> b2Vec2"""
return _Box2D.b2WheelJoint_GetLocalAnchorB(self)
def GetLocalAxisA(self):
"""GetLocalAxisA(b2WheelJoint self) -> b2Vec2"""
return _Box2D.b2WheelJoint_GetLocalAxisA(self)
def __GetJointTranslation(self):
"""
__GetJointTranslation(b2WheelJoint self) -> float32
Get the current joint translation, usually in meters.
"""
return _Box2D.b2WheelJoint___GetJointTranslation(self)
def __GetJointSpeed(self):
"""
__GetJointSpeed(b2WheelJoint self) -> float32
Get the current joint translation speed, usually in meters per second.
"""
return _Box2D.b2WheelJoint___GetJointSpeed(self)
def __IsMotorEnabled(self):
"""
__IsMotorEnabled(b2WheelJoint self) -> bool
Is the joint motor enabled?
"""
return _Box2D.b2WheelJoint___IsMotorEnabled(self)
def __EnableMotor(self, flag):
"""
__EnableMotor(b2WheelJoint self, bool flag)
Enable/disable the joint motor.
"""
return _Box2D.b2WheelJoint___EnableMotor(self, flag)
def __SetMotorSpeed(self, speed):
"""
__SetMotorSpeed(b2WheelJoint self, float32 speed)
Set the motor speed, usually in radians per second.
"""
return _Box2D.b2WheelJoint___SetMotorSpeed(self, speed)
def __GetMotorSpeed(self):
"""
__GetMotorSpeed(b2WheelJoint self) -> float32
Get the motor speed, usually in radians per second.
"""
return _Box2D.b2WheelJoint___GetMotorSpeed(self)
def __SetMaxMotorTorque(self, torque):
"""
__SetMaxMotorTorque(b2WheelJoint self, float32 torque)
Set/Get the maximum motor force, usually in N-m.
"""
return _Box2D.b2WheelJoint___SetMaxMotorTorque(self, torque)
def __GetMaxMotorTorque(self):
"""__GetMaxMotorTorque(b2WheelJoint self) -> float32"""
return _Box2D.b2WheelJoint___GetMaxMotorTorque(self)
def GetMotorTorque(self, inv_dt):
"""
GetMotorTorque(b2WheelJoint self, float32 inv_dt) -> float32
Get the current motor torque given the inverse time step, usually in N-m.
"""
return _Box2D.b2WheelJoint_GetMotorTorque(self, inv_dt)
def __SetSpringFrequencyHz(self, hz):
"""
__SetSpringFrequencyHz(b2WheelJoint self, float32 hz)
Set/Get the spring frequency in hertz. Setting the frequency to zero disables the spring.
"""
return _Box2D.b2WheelJoint___SetSpringFrequencyHz(self, hz)
def __GetSpringFrequencyHz(self):
"""__GetSpringFrequencyHz(b2WheelJoint self) -> float32"""
return _Box2D.b2WheelJoint___GetSpringFrequencyHz(self)
def __SetSpringDampingRatio(self, ratio):
"""
__SetSpringDampingRatio(b2WheelJoint self, float32 ratio)
Set/Get the spring damping ratio.
"""
return _Box2D.b2WheelJoint___SetSpringDampingRatio(self, ratio)
def __GetSpringDampingRatio(self):
"""__GetSpringDampingRatio(b2WheelJoint self) -> float32"""
return _Box2D.b2WheelJoint___GetSpringDampingRatio(self)
__dir__ = _dir_filter
def __hash__(self):
"""__hash__(b2WheelJoint self) -> long"""
return _Box2D.b2WheelJoint___hash__(self)
def __repr__(self):
return _format_repr(self)
# Read-write properties
motorSpeed = property(__GetMotorSpeed, __SetMotorSpeed)
motorEnabled = property(__IsMotorEnabled, __EnableMotor)
maxMotorTorque = property(__GetMaxMotorTorque, __SetMaxMotorTorque)
springFrequencyHz = property(__GetSpringFrequencyHz , __SetSpringFrequencyHz)
springDampingRatio = property(__GetSpringDampingRatio , __SetSpringDampingRatio)
# Read-only
speed = property(__GetJointSpeed, None)
translation = property(__GetJointTranslation, None)
__swig_destroy__ = _Box2D.delete_b2WheelJoint
b2WheelJoint.GetLocalAnchorA = new_instancemethod(_Box2D.b2WheelJoint_GetLocalAnchorA, None, b2WheelJoint)
b2WheelJoint.GetLocalAnchorB = new_instancemethod(_Box2D.b2WheelJoint_GetLocalAnchorB, None, b2WheelJoint)
b2WheelJoint.GetLocalAxisA = new_instancemethod(_Box2D.b2WheelJoint_GetLocalAxisA, None, b2WheelJoint)
b2WheelJoint.__GetJointTranslation = new_instancemethod(_Box2D.b2WheelJoint___GetJointTranslation, None, b2WheelJoint)
b2WheelJoint.__GetJointSpeed = new_instancemethod(_Box2D.b2WheelJoint___GetJointSpeed, None, b2WheelJoint)
b2WheelJoint.__IsMotorEnabled = new_instancemethod(_Box2D.b2WheelJoint___IsMotorEnabled, None, b2WheelJoint)
b2WheelJoint.__EnableMotor = new_instancemethod(_Box2D.b2WheelJoint___EnableMotor, None, b2WheelJoint)
b2WheelJoint.__SetMotorSpeed = new_instancemethod(_Box2D.b2WheelJoint___SetMotorSpeed, None, b2WheelJoint)
b2WheelJoint.__GetMotorSpeed = new_instancemethod(_Box2D.b2WheelJoint___GetMotorSpeed, None, b2WheelJoint)
b2WheelJoint.__SetMaxMotorTorque = new_instancemethod(_Box2D.b2WheelJoint___SetMaxMotorTorque, None, b2WheelJoint)
b2WheelJoint.__GetMaxMotorTorque = new_instancemethod(_Box2D.b2WheelJoint___GetMaxMotorTorque, None, b2WheelJoint)
b2WheelJoint.GetMotorTorque = new_instancemethod(_Box2D.b2WheelJoint_GetMotorTorque, None, b2WheelJoint)
b2WheelJoint.__SetSpringFrequencyHz = new_instancemethod(_Box2D.b2WheelJoint___SetSpringFrequencyHz, None, b2WheelJoint)
b2WheelJoint.__GetSpringFrequencyHz = new_instancemethod(_Box2D.b2WheelJoint___GetSpringFrequencyHz, None, b2WheelJoint)
b2WheelJoint.__SetSpringDampingRatio = new_instancemethod(_Box2D.b2WheelJoint___SetSpringDampingRatio, None, b2WheelJoint)
b2WheelJoint.__GetSpringDampingRatio = new_instancemethod(_Box2D.b2WheelJoint___GetSpringDampingRatio, None, b2WheelJoint)
b2WheelJoint.__hash__ = new_instancemethod(_Box2D.b2WheelJoint___hash__, None, b2WheelJoint)
b2WheelJoint_swigregister = _Box2D.b2WheelJoint_swigregister
b2WheelJoint_swigregister(b2WheelJoint)
# Backward-compatibility
b2LoopShape = b2ChainShape
# Initialize the alternative namespace b2.*, and clean-up the
# dir listing of Box2D by removing *_swigregister.
#
# To see what this is, try import Box2D; print(dir(Box2D.b2))
from . import b2
s=None
to_remove=[]
for s in locals():
if s.endswith('_swigregister'):
to_remove.append(s)
elif s!='b2' and s.startswith('b2'):
if s[2]=='_': # Covers b2_*
setattr(b2, s[3].lower() + s[4:], locals()[s])
else: # The other b2*
if s[3].isupper():
setattr(b2, s[2:], locals()[s])
else:
setattr(b2, s[2].lower() + s[3:], locals()[s])
for s in to_remove:
del locals()[s]
del s
del to_remove
|