/usr/include/epix.h is in epix 1.2.14-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 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
* epix.h -- Automatically created on Fri May 16 05:14:00 UTC 2014 *
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <string>
#include <sstream>
#include <cstdlib>
#include <cmath>
#ifndef EPIX_H
#define EPIX_H
/*
* enums.h -- ePiX's user-visible enumeration types
*
* This file is part of ePiX, a C++ library for creating high-quality
* figures in LaTeX
*
* Version 1.0.23
* Last Change: January 10, 2007
*/
/*
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
* Andrew D. Hwang <rot 13 nujnat at zngupf dot ubylpebff dot rqh>
* Department of Mathematics and Computer Science
* College of the Holy Cross
* Worcester, MA, 01610-2395, USA
*/
/*
* ePiX is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ePiX is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ePiX; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef EPIX_ENUMS
#define EPIX_ENUMS
namespace ePiX {
enum epix_mark_type {PATH, CIRC, SPOT, RING, DOT, DDOT, PLUS, OPLUS,
TIMES, OTIMES, DIAMOND, UP, DOWN, BOX, BBOX,
HTICK, VTICK, TEXT};
enum epix_label_posn {none, c, r, tr, rt, t, tl, lt, l, bl, lb, b, br, rb};
enum epix_integral_type {LEFT, RIGHT, UPPER, LOWER, TRAP, MIDPT};
enum epix_field_type {SLOPE, DART, VECTOR};
} // end of namespace
#endif /* EPIX_ENUMS */
/*
* length.h -- ePiX true and LaTeX length manipulation
*
* This file is part of ePiX, a C++ library for creating high-quality
* figures in LaTeX
*
* Version 1.2.0
* Last Change: September 22, 2007
*/
/*
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
* Andrew D. Hwang <rot 13 nujnat at zngupf dot ubylpebff dot rqh>
* Department of Mathematics and Computer Science
* College of the Holy Cross
* Worcester, MA, 01610-2395, USA
*/
/*
* ePiX is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ePiX is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ePiX; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* This file provides the length class from ePiX2:
*
* - length(std::string) assumes argument is "double [space(s)] unit"
* Recognized units are pt (points), in, cm, mm, pc (picas = 1/12 in),
* bp (big points = 1/72 in)
*
* Malformed strings are handled as follows:
* Missing doubles are assumed to be 0, units are assumed to be pt
*
* - length(double) sets length to specified number of pt
*
* - operator += Increments a length, returning answer in LHS units, e.g.
* 1cm+=2in is 6.08cm
* 2in+=1cm is 2.3937in
*
* - operator *= scales a length by a double
* - to(string) converts a length to specified units
* - operator< compares true lengths
* - get_lengths(string, length, length) parses a string into ht and width
*
* A length can be negative.
*/
#ifndef EPIX_LENGTH
#define EPIX_LENGTH
namespace ePiX {
class length {
public:
length(std::string); // not const std::string&
explicit length(double = 0);
length& operator+= (const length&); // increment by another length
length& operator*= (double); // scale
length& to(std::string); // convert to specified units
// compare, with units conversion
bool operator== (const length&) const;
bool operator!= (const length& len) const { return !((*this) == len); }
// for output
double magnitude() const;
std::string units() const;
std::string name() const;
private:
double m_mag;
double pts_per_unit; // constants defined in length.cc
std::string m_units;
}; // end of class length
// value-returning operators
length operator+ (length, const length&);
length operator* (double, length len);
// Compare true size; must pass by value...
bool operator< (length arg1, length arg2);
/*
* Parse a string into two lengths (width and height).
*
* The "sz" argument is expected to look like "4in x 10cm" or "4 x 6 in",
* specifically a double, an optional two-letter unitlength, an "x", a
* double, and a two-letter unitlength (defaults to pt). Spaces are
* unimportant, as is initial or trailing garbage. Badly malformed input
* (e.g., "4,6 in") may confuse the parsing code on some platforms.
*/
void get_lengths(std::string sz, length& length1, length& length2);
} // end of namespace
#endif /* EPIX_LENGTH */
/*
* interval.h -- ePiX::interval class and operations
*
* This file is part of ePiX, a C++ library for creating high-quality
* figures in LaTeX
*
* Version 1.0.25
* Last Change: May 20, 2007
*
*
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
* Andrew D. Hwang <rot 13 nujnat at zngupf dot ubylpebff dot rqh>
* Department of Mathematics and Computer Science
* College of the Holy Cross
* Worcester, MA, 01610-2395, USA
*
*
* ePiX is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ePiX is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ePiX; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* This file provides the interval class:
*
* - Minkowski sum, intersection
*/
#ifndef EPIX_INTERVAL
#define EPIX_INTERVAL
namespace ePiX {
class interval {
public:
interval(std::string); // allow implicit conversion, must mangle argument
interval(double, double); // closed interval
static interval emptyset;
double min() const;
double max() const;
double avg() const;
bool contains(double) const;
// Minkowski sum
interval& operator +=(const interval&);
// intersection
interval& operator *=(const interval&);
bool operator== (const interval&) const;
bool operator!= (const interval&) const;
bool is_empty() const;
private:
double m_rmin, m_rmax;
bool m_closed_l, m_closed_r;
static interval literal(double a, double b); // can force b<a
}; // end of interval class
interval operator+ (interval I1, const interval& I2);
interval operator* (interval I1, const interval& I2);
} // end of namespace
#endif /* EPIX_INTERVAL */
/*
* triples.h -- ePiX::P class
*
* This file is part of ePiX, a C++ library for creating high-quality
* figures in LaTeX
*
* Version 1.1.10
* Last Change: August 04, 2007
*/
/*
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
* Andrew D. Hwang <rot 13 nujnat at zngupf dot ubylpebff dot rqh>
* Department of Mathematics and Computer Science
* College of the Holy Cross
* Worcester, MA, 01610-2395, USA
*/
/*
* ePiX is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ePiX is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ePiX; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* This file provides:
*
* The P class (ordered triple of <double>s) and operators
*
* - P(), P() (default to origin), E_1, E_2, E_3 (standard basis)
* - Vector space operators
* - Other vector operators, operands (a,b,c), (x,y,z)
* | dot product ax + by + cz
* norm(p) = sqrt(p|p)
* & componentwise product (ax, by, cz)
* * cross product (bz-cy, cx-az, ay-bx)
* J rotate (x1,x2,0)-plane 1/4 turn (-b,a,0)
* % orthogonalization u%v = u - ((u|v)/(v|v))*v
*/
#ifndef EPIX_TRIPLES
#define EPIX_TRIPLES
namespace ePiX {
class P {
public:
P(double arg1=0, double arg2=0, double arg3=0);
double x1() const;
double x2() const;
double x3() const;
bool is_valid() const; // coords not inf or nan
// increment operators
P& operator += (const P&);
P& operator -= (const P&);
P& operator *= (double); // scalar multipication
// cross product
P& operator *= (const P&);
// componentwise product
P& operator &= (const P&);
// orthogonalization: u %= v is the vector of the form u-k*v perp to v
P& operator %= (const P&);
private:
double m_x1, m_x2, m_x3;
}; // end of class P
// standard basis in global namespace
const P E_1(1,0,0);
const P E_2(0,1,0);
const P E_3(0,0,1);
// vector space operations
P operator- (P u); // unary negation
P operator+ (P u, const P& v);
P operator- (P u, const P& v);
// scalar multiplication
P operator* (double c, P v);
// cross product
P operator* (P, const P&);
P J(P); // quarter turn about E_3-axis
// dot product
double operator | (const P&, const P&);
double norm(const P&);
// componentwise product (a,b,c)&(x,y,z)=(ax,by,cz)
P operator& (P, const P&);
// orthogonalization
P operator% (P, const P&);
// (in)equality
bool operator == (const P&, const P&);
bool operator != (const P&, const P&);
} // end of namespace
#endif /* EPIX_TRIPLES */
/*
* functions.h -- ePiX auxiliary functions; Deriv, Integral classes
*
* This file is part of ePiX, a C++ library for creating high-quality
* figures in LaTeX
*
* Version 1.1.22
* Last Change: September 24, 2007
*/
/*
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
* Andrew D. Hwang <rot 13 nujnat at zngupf dot ubylpebff dot rqh>
* Department of Mathematics and Computer Science
* College of the Holy Cross
* Worcester, MA, 01610-2395, USA
*/
/*
* ePiX is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ePiX is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ePiX; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef EPIX_FUNCTIONS
#define EPIX_FUNCTIONS
namespace ePiX {
class P;
// sensitive to angle units
double Cos(double t);
double Sin(double t);
double Tan(double t);
double Sec(double t);
double Csc(double t);
double Cot(double t);
double Acos(double t);
double Asin(double t);
double Atan(double t);
double Atan2(double y, double x);
// additional hyperbolic functions and inverses
double sech(double);
double csch(double);
double coth(double);
double asech(double);
double acsch(double);
double acoth(double);
// zero functions
double zero(double);
double zero(double, double);
double zero(double, double, double);
double zero(const P&);
// P constructors
P xyz(double x, double y, double z=0);
P cyl(double r, double t, double z);
P sph(double r, double t, double phi);
// for log data plotting
P log_log(double x, double y, double z=0);
P log_lin(double x, double y, double z=0);
P lin_log(double x, double y, double z=0);
P cylindrical(P); // not const P&
P spherical(P);
P polar(double r, double t);
P cis(double t);
// utility functions
double recip (double);
double sinx (double); // discontinuity removed
double sgn (double);
// period-2 extension of absolute value on [-1,1]: \/\/\/
double cb (double);
int gcd (int, int);
double min(double, double);
double max(double, double);
double snip_to(double var, double arg1, double arg2);
double inf (double f(double), double, double);
double sup (double f(double), double, double);
// derivative class
class Deriv {
private:
double (*f)(double);
double dt;
public:
Deriv(double func(double));
Deriv(double func(double), double eps);
P operator() (const P&) const; // for plotting
// numerical values
double eval(double t) const;
// one-sided derivatives
double right(double t) const;
double left(double t) const;
}; // end of class Deriv
// definite integral class
class Integral {
private:
double (*f)(double);
double x0; // lower limit
public:
Integral(double func(double), double a=0);
P operator() (const P&) const;
double eval(double) const;
}; // end of class Integral
double newton (double f(double), double g(double), double start);
double newton (double f(double), double start);
} // end of namespace
#endif /* EPIX_FUNCTIONS */
/*
* pairs.h -- ePiX pair:: class and mathematical operators
*
* This file is part of ePiX, a C++ library for creating high-quality
* figures in LaTeX
*
* Version 1.1.10
* Last Change: August 04, 2007
*/
/*
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
* Andrew D. Hwang <rot 13 nujnat at zngupf dot ubylpebff dot rqh>
* Department of Mathematics and Computer Science
* College of the Holy Cross
* Worcester, MA, 01610-2395, USA
*/
/*
* ePiX is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ePiX is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ePiX; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef EPIX_PAIRS
#define EPIX_PAIRS
namespace ePiX {
class P;
class pair {
public:
pair(double arg1=0, double arg2=0)
: m_x1(arg1), m_x2(arg2) { }
pair(const P& arg); // take first two coordinates
double x1() const { return m_x1; }
double x2() const { return m_x2; }
// unary increment operators
pair& operator += (const pair& arg);
pair& operator -= (const pair& arg);
pair& operator *= (double c);
// complex multiplication and division
pair& operator *= (const pair& arg);
pair& operator /= (const pair& arg);
bool operator== (const pair& u) const;
bool operator!= (const pair& u) const;
private:
double m_x1;
double m_x2;
}; // end of class pair
pair operator- (pair u);
pair operator+ (pair u, const pair& v);
pair operator- (pair u, const pair& v);
pair operator* (double c, pair u);
// complex arithmetic
pair J(pair p);
pair operator* (pair u, const pair& v);
pair operator/ (pair u, const pair& v);
// dot product
double operator| (const pair& u, const pair& v);
double norm (const pair& u);
// componentwise product (a,b)&(x,y)=(ax,by)
pair operator& (const pair& u, const pair& v);
} // end of namespace
#endif /* EPIX_PAIRS */
/*
* affine.h -- ePiX::affine class (affine screen maps)
*
* This file is part of ePiX, a C++ library for creating high-quality
* figures in LaTeX
*
* Version 1.1.21
* Last Change: September 23, 2007
*
*
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
* Andrew D. Hwang <rot 13 nujnat at zngupf dot ubylpebff dot rqh>
* Department of Mathematics and Computer Science
* College of the Holy Cross
* Worcester, MA, 01610-2395, USA
*
*
* ePiX is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ePiX is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ePiX; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* An affine map is constructed from the images of the "standard
* triple" (0,0), (1,0), and (0,1).
*
* An affine map may be (post)-composed with translation, rotation,
* reflection, scaling along either or both coordinate axes, shearing,
* and may be inverted. An optional pair argument, defaulting to
* (0,0), gives the center of the operation (if appropriate).
*
* An affine map may be post-composed via member function, and
* pre-composed with operator syntax. The evaluation operator
* returns the image of the argument.
*/
#ifndef EPIX_AFFINE
#define EPIX_AFFINE
namespace ePiX {
class affine {
public:
// the identity map
affine();
// images of (1,0), (0,1), (0,0)
affine(const pair&, const pair&, const pair& loc=pair(0,0));
affine(const P&, const P&, const P& loc=P(0,0));
// post-operations
// translate by arg
affine& shift(const pair& arg);
affine& shift(const P& arg);
// rotate by theta about ctr
affine& rotate(double theta, const pair& ctr = pair(0,0));
affine& rotate(double theta, const P& ctr);
// reflect in angle-theta line through ctr
affine& reflect(double theta, const pair& ctr = pair(0,0));
affine& reflect(double theta, const P& ctr);
// scale coord direction(s) fixing ctr
affine& h_scale(double, const pair& ctr=pair(0,0));
affine& v_scale(double, const pair& ctr=pair(0,0));
affine& scale(double, const pair& ctr=pair(0,0));
affine& h_scale(double, const P& ctr);
affine& v_scale(double, const P& ctr);
affine& scale(double, const P& ctr);
// shear, fixing ctr
affine& h_shear(double, const pair& ctr=pair(0,0));
affine& v_shear(double, const pair& ctr=pair(0,0));
affine& h_shear(double, const P& ctr);
affine& v_shear(double, const P& ctr);
// post-compose
affine& postcomp(const affine&);
affine& invert();
// evaluation
pair operator() (const pair&) const;
pair operator() (const P&) const;
// pre-compose
affine operator() (const affine&) const;
bool reverses_orientation() const;
private:
pair m_00;
pair m_10;
pair m_01;
};
} // end of ePiX namespace
#endif /* EPIX_AFFINE */
/*
* Color.h -- ePiX::Color class and helpers
*
* This file is part of ePiX, a C++ library for creating high-quality
* figures in LaTeX
*
* Version 1.2.2
* Last Change: November 12, 2007
*
*
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
* Andrew D. Hwang <rot 13 nujnat at zngupf dot ubylpebff dot rqh>
* Department of Mathematics and Computer Science
* College of the Holy Cross
* Worcester, MA, 01610-2395, USA
*
*
* ePiX is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ePiX is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ePiX; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* This file defines the ePiX Color user interface:
* operator*= Modify intensity
* blend(Color, double) Color mixing
* filter(Color) Apply us as a filter
* superpose(Color) Add colors, clip intensities
* invert() Color negative
*
* - Named primary constructors
*
* Scaling and filtering are implemented by converting to the filter's
* color model. Color model conversions come from the LaTeX xcolor
* package documentation, V 1.11 (2044/05/09) by Uwe Kern.
*/
#ifndef EPIX_COLOR
#define EPIX_COLOR
namespace ePiX {
class Color_Base;
class Color {
public:
Color();
Color(const Color_Base*);
Color(const Color_Base&);
Color(const Color&);
Color& operator= (const Color&);
~Color();
const Color_Base* operator->() const;
double alpha() const;
bool is_unset() const;
Color filter(const Color&) const;
Color& operator*= (double c); // scale the intensity
Color& blend(const Color&, double);
Color& superpose(const Color&);
Color& invert();
Color& alpha(double);
std::string model() const;
std::string name() const;
std::vector<double> densities() const;
private:
Color_Base* m_color;
double m_alpha;
}; // end of class Color
Color operator* (double, const Color&);
const bool operator== (const Color&, const Color&);
const bool operator!= (const Color&, const Color&);
// for palette ordering
const bool operator< (const Color&, const Color&);
/*
* * * Primary color functions in the global namespace * * *
*
* A primary color constructor accepts a numerical argument, which is
* reduced mod 4, then interpreted as a color density as follows:
* d = -2 or 2 : white
* d = -1: full anti-saturation
* d = 0: black
* d = 1: full saturation (default)
*
* The primary changes continuously, and linearly on each interval
* [-2,-1], [-1,0], [0,1], and [1,2].
*
* Example:
* Red(0.3) = rgb(0.3, 0, 0) = Red(-3.7)
* Red(1.3) = rgb(1,0.3,0.3) = Red(-2.7)
* Red(2.3) = rgb(0.7, 1, 1) = Red(-1.7)
* Red(3.3) = rgb(0,0.7,0.7) = Red(-0.7)
*/
Color RGB(double r=0, double g=0, double b=0);
Color CMY(double c=1, double m=1, double y=1);
Color CMYK(double c=1, double m=1, double y=1,
double k=0); // void same as CMYK(0,0,0,1);
Color Gray(double d=0);
Color Red(double d=1);
Color Green(double d=1);
Color Blue(double d=1);
Color White(double d=1);
Color Black(double d=1);
Color Cyan(double d=1);
Color Magenta(double d=1);
Color Yellow(double d=1);
Color CMY_White(double d=1);
Color CMY_Black(double d=1);
Color CyanK(double d=1);
Color MagentaK(double d=1);
Color YellowK(double d=1);
Color CMYK_White(double d=1);
Color CMYK_Black(double d=1);
// color separation
Color C_Process(double d=1);
Color M_Process(double d=1);
Color Y_Process(double d=1);
Color K_Process(double d=1);
// "conversion filters"
Color Neutral();
Color RGB_Neutral();
Color CMY_Neutral();
Color CMYK_Neutral();
Color Gray_Neutral();
} // end of namespace
#endif /* EPIX_COLOR */
/*
* state.h -- ePiX global functions to control current drawing state
*
* This file is part of ePiX, a C++ library for creating high-quality
* figures in LaTeX
*
* Version 1.1.22
* Last Change: September 24, 2007
*/
/*
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
* Andrew D. Hwang <rot 13 nujnat at zngupf dot ubylpebff dot rqh>
* Department of Mathematics and Computer Science
* College of the Holy Cross
* Worcester, MA, 01610-2395, USA
*/
/*
* ePiX is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ePiX is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ePiX; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* This file contains the (old) user interface governing:
*
* [] Angular mode
* [] Clipping and cropping
* [] Font size and face, label angle, mask color
* [] Gray depth, path filling, fill color
* [] Whether to use PSTricks macros
* [] Arrowhead parameters
* [] Line style, dash length, dot size
* [] Line width
* [] Line/text color
*/
#ifndef EPIX_STATE
#define EPIX_STATE
namespace ePiX {
class Color;
class P;
// set camera position
void viewpoint(const P&);
void viewpoint(double, double, double);
// Set angular mode
void radians();
void degrees();
void revolutions();
// number of current angle units in one full turn
double full_turn();
// set clip box
void clip(bool arg=true); // no effect
void clip_box(); // default (very large)
void clip_box(const P& arg1, const P& arg2);
void clip_to(const P& arg);
void clip_box(const P& arg);
// add a clip face; perp points inward
void clip_face(const P& loc, const P& perp);
// add parallel clip planes
void clip_slice(const P& loc, const P& perp);
void clip_slice(const P& loc, const P& perp, double thickness);
// loc = origin
void clip_slice(const P& perp);
void clip_slice(const P& perp, double thickness);
// remove user-specified clip planes, preserve clip box settings
void clip_restore();
// set flag on active screen; contents unchanged
void set_crop(bool arg=true);
// crop contents of active screen
void crop();
//// New cropping functions ////
// set crop mask of active screen
void crop_rectangle(const P&, const P&);
void crop_ellipse(const P&, const P&);
void crop_diamond(const P&, const P&);
void crop_rectangle();
void crop_ellipse();
void crop_diamond();
void crop_box(const P&, const P&);
void crop_box(); // (re)set crop box to bounding box
// Set label attributes
void font_size(const std::string& arg="nsz");
void font_face(const std::string& arg="rm");
void label_color(const Color&);
void label_angle(double t=0);
void label_mask(const Color& col);
void label_mask();
void label_pad(std::string);
void label_border(const Color&, double);
void label_border(const Color&, std::string);
void label_border(const Color&);
void label_border(double);
void label_border(std::string);
void no_label_border();
// Gray depth, path filling, [fill color]
void gray(double depth=0.3);
void fill(const Color&); // set fill color
void fill(bool arg=true); // set fill flag
void nofill();
// void fill_color(const std::string& arg);
// Arrowhead parameters
void arrow_width(double w=3);
void arrow_ratio(double r=5.5);
void arrow_inset(double arg=0);
void arrow_fill(bool arg=true);
// Dash pattern length
void dash_size(double len=0);
void dot_sep(double len=0);
// Dot and box marker size
void dot_size(double diam=0);
// Tick length
void tick_size(double len=0);
// Line style
void line_style(std::string style="-"); // solid by default
void solid();
void dashed();
void dotted();
// Line width
void pen(const std::string&);
void pen(double);
void bbold();
void bold();
void plain();
// Line width and color
void bbold(const Color&);
void bold(const Color&);
void plain(const Color&);
void pen(const Color&);
void pen(const Color&, double);
void pen(const Color&, std::string);
void base(const Color&);
void base(const Color&, double);
void base(const Color&, std::string);
// Line and text color
// ePiX provides rgb/cmyk colors via xcolor. The following are equivalent:
// red();
// rgb(1,0,0);
//
// cmyk(0,1,1,0); is visually equivalent but not the same.
//
// Densities outside the unit interval [0,1] are truncated, e.g.,
// rgb(2, -1, 0.3) = rgb(1, 0, 0.3).
// red-green-blue
void rgb(double r, double g, double b); // must pass args by value
// cyan-magenta-yellow-black
void cmyk(double c, double m, double y, double k);
// P arguments, for easy function control
void rgb(const P&);
void cmyk(const P&);
// primary colors
void red(double d=1);
void green(double d=1);
void blue(double d=1);
void white(double d=1);
void black(double d=1);
void cyan(double d=1);
void magenta(double d=1);
void yellow(double d=1);
} // end of namespace
#endif /* EPIX_STATE */
/*
* frame.h -- Orthonormal basis
*
* This file is part of ePiX, a preprocessor for creating high-quality
* line figures in LaTeX
*
* Version 1.0.15
* Last Change: October 10, 2006
*/
/*
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006
* Andrew D. Hwang <rot 13 nujnat at zngupf dot ubylpebff dot rqh>
* Department of Mathematics and Computer Science
* College of the Holy Cross
* Worcester, MA, 01610-2395, USA
*/
/*
* ePiX is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ePiX is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ePiX; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* In geometry, a "frame" is a right-handed orthonormal basis, that is,
* an ordered set of three mututally perpendicular unit vectors, oriented
* according to the right-hand rule. A frame has nothing to do with
* picture frames.
*
*
* This file provides:
* - the frame class, and routines for rotating a frame about the axes
* determined by its elements. (Note that there are no methods for
* rotating about fixed coordinate axes, and that rotations in R^3 do
* not generally commute.
*/
#ifndef EPIX_FRAME
#define EPIX_FRAME
namespace ePiX {
class frame {
public:
// standard basis
frame();
// Gram-Schmidt
frame(P arg1, P arg2, P arg3); // need args by value
// frame elements
P sea() const;
P sky() const;
P eye() const;
// rotations about frame elements
frame& rot1(double angle);
frame& rot2(double angle);
frame& rot3(double angle);
private:
P m_e1; // sea
P m_e2; // sky
P m_e3; // eye
}; // end of class frame
} // end of namespace
#endif /* EPIX_FRAME */
/*
* domain.h -- ePiX mesh and domain classes
*
* This file is part of ePiX, a preprocessor for creating high-quality
* line figures in LaTeX
*
* Version 1.1.6
* Last Change: July 04, 2007
*/
/*
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
* Andrew D. Hwang <rot 13 nujnat at zngupf dot ubylpebff dot rqh>
* Department of Mathematics and Computer Science
* College of the Holy Cross
* Worcester, MA, 01610-2395, USA
*/
/*
* ePiX is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ePiX is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ePiX; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef EPIX_DOMAIN
#define EPIX_DOMAIN
namespace ePiX {
class mesh {
public:
mesh(int n1, int n2, int n3=1);
mesh(int n); // mesh(n, n, n);
mesh(); // mesh(1, 1, 1);
int n1() const { return n_1; }
int n2() const { return n_2; }
int n3() const { return n_3; }
private:
int n_1;
int n_2;
int n_3;
}; // end of class mesh
// A domain is a gridded coordinate box with specified corners
// and coarse/fine meshes, used for plotting. The "coarse" step
// sizes are step1, etc., and the "fine" step sizes are dx1, etc.
// Steps may be negative.
//
// A domain may be "sliced" by setting one of its coordinates to
// a specified constant.
//
// Data members are public for convenience; each member ensures
// its own well-constructedness.
//
class domain {
public:
domain(const P& arg1, const P& arg2, const mesh& c, const mesh& f);
domain(const P& arg1, const P& arg2, const mesh& c);
// 1-dim'l domain
domain(double t_min, double t_max, int num_pts);
int dim() const; // dimension
// big and small steps
double step1() const;
double step2() const;
double step3() const;
double dx1() const;
double dx2() const;
double dx3() const;
// resizing attempts to preserve real resolution
domain resize1(double a1, double b1) const;
domain resize2(double a2, double b2) const;
domain resize3(double a3, double b3) const;
// coordinate slices
domain slice1(double a1) const;
domain slice2(double a2) const;
domain slice3(double a3) const;
// "n=0": use number from coarse mesh
std::list<domain> slices1(const unsigned int n=0) const;
std::list<domain> slices2(const unsigned int n=0) const;
std::list<domain> slices3(const unsigned int n=0) const;
// state functions for internal use
P corner1() const;
P corner2() const;
double corner1_x1() const;
double corner1_x2() const;
double corner1_x3() const;
double corner2_x1() const;
double corner2_x2() const;
double corner2_x3() const;
int coarse_n1() const;
int coarse_n2() const;
int coarse_n3() const;
int fine_n1() const;
int fine_n2() const;
int fine_n3() const;
private:
P m_corner1;
P m_corner2;
mesh m_coarse;
mesh m_fine;
}; // end of class domain
class domain_list {
public:
domain_list(std::list<domain>); // implicitly converts "slices" output
domain_list& add(const domain&);
domain_list& add(const domain_list&);
std::list<domain> m_list; // public: we're a simple wrapper
}; // end of class domain_list
} // end of namespace
#endif /* EPIX_DOMAIN */
/*
* camera.h -- ePiX::Camera
*
* This file is part of ePiX, a C++ library for creating high-quality
* figures in LaTeX
*
* Version 1.1.21
* Last Change: September 22, 2007
*
*
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
* Andrew D. Hwang <rot 13 nujnat at zngupf dot ubylpebff dot rqh>
* Department of Mathematics and Computer Science
* College of the Holy Cross
* Worcester, MA, 01610-2395, USA
*
*
* ePiX is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ePiX is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ePiX; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* A Camera has a location, orientation, lens, and color filter. The
* viewer sits at given <distance> from the <target>, in the direction
* of the <eye>. The vectors <sea> and <sky> point horizontally to the
* right and vertically upward on the screen. The viewing angle is
* controlled by changing the viewer, target, and/or the distance
* between them.
*
* The implementation data comprise:
* - a frame ({sea, sky, eye}, with the intuitive meanings:)
* - a viewpoint
* - a target (at the center of the field of view)
* - the distance from the viewpoint to the target
* - a "filter" color, Neutral by default, for color separation, etc.
* - a Lens
*
* A Lens is a mapping P -> pair. In the implementation, the Camera
* ("body") passes the orientation, target, and distance to the Lens
* operator.
*/
#ifndef EPIX_CAMERA
#define EPIX_CAMERA
namespace ePiX {
class halfspace;
class Lens;
class pair;
class Camera {
public:
Camera();
Camera(const P& vpt);
Camera(const Camera&);
Camera& operator= (const Camera&);
~Camera();
// rotate
Camera& tilt(double angle); // up/down (pitch)
Camera& pan(double angle); // left/right (yaw)
Camera& roll(double angle); // about viewing axis
// fix target, move viewpt radially along eye()
Camera& range(double);
// fix viewpt, move target radially along eye()
Camera& focus(double);
// set clip distance
Camera& clip_range(double);
Camera& at(const P& arg); // fix target, set viewpt
Camera& look_at(const P& arg); // fix viewpt, set target
// alternative syntax
Camera& at(double, double, double);
Camera& look_at(double, double, double);
Camera& filter(const Color&);
// set lens
Camera& perspective(); // default
Camera& orthog(); // faster
Camera& fisheye();
Camera& bubble();
// Functions for internal use
// Camera maps
Color operator() (const Color&) const; // filter
pair operator() (const P&) const; // lens map
bool is_linear() const; // lens preserves lines?
bool needs_clip() const; // lens needs scene pre-clipping
halfspace clip_plane() const;
// situation
P eye() const;
P viewpt() const;
private:
P the_viewpt; // center of projection
P the_target; // mapped to Screen origin
frame the_orient; // our {sea, sky, eye}
double the_distance;
double the_clip_range;
Color the_filter;
void adjust(); // re-orient according to target, viewpt
Lens* the_lens;
}; // end of class Camera
// global Camera
Camera& cam();
extern Camera& camera;
} // end of namespace
#endif /* EPIX_CAMERA */
/*
* screen.h -- ePiX::screen class
*
* This file is part of ePiX, a C++ library for creating high-quality
* figures in LaTeX
*
* Version 1.1.18
* Last Change: September 15, 2007
*/
/*
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
* Andrew D. Hwang <rot 13 nujnat at zngupf dot ubylpebff dot rqh>
* Department of Mathematics and Computer Science
* College of the Holy Cross
* Worcester, MA, 01610-2395, USA
*/
/*
* ePiX is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ePiX is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ePiX; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* This file defines the screen class interface, a Cartesian rectangle
* into which objects are drawn. Object-creating commands add to the
* the "global" screen the_picture(). Users may create and activate
* additional screens, then import their content to the_picture().
*
* Constructor:
* screen(P(a,c), P(b,d)); // corners of bounding box
*
* Markup functions:
* crop(); // remove elements outside bounding box
* crop_to(mask); // or specified mask
* paste(screen); // overlay contents of screen
* paste(screen, P(a,c), P(b,d)); // or inset into specified rectangle
*
* Decorations:
* border(Color, "1pt"); // set border color/width
* backing(Color); // and backing color
*
* This file wraps the implementation, which is hidden from the user.
*/
#ifndef EPIX_SCREEN
#define EPIX_SCREEN
namespace ePiX {
class Color;
class affine;
class screen_data;
class P;
// global function
void write(const std::string&);
class screen {
// There's no user-visible form for screen contents, so
// we give these classes access to our implementation.
friend class arrow_data;
friend class label_data;
friend class legend;
friend class path_data;
friend class picture_data;
friend void write(const std::string&);
public:
screen();
screen(const P&, const P&);
screen(const screen&);
screen& operator= (const screen&);
~screen();
// Set mask; one named function for each type of screen_mask
screen& crop_mask_rectangle(const P&, const P&);
screen& crop_mask_ellipse(const P&, const P&);
screen& crop_mask_diamond(const P&, const P&);
screen& crop_mask_rectangle();
screen& crop_mask_ellipse();
screen& crop_mask_diamond();
// return selected region
screen extract(const P&, const P&) const;
screen extract_diamond(const P&, const P&) const;
screen extract_ellipse(const P&, const P&) const;
// set flag only
screen& set_crop(bool arg=true);
// crop contents to current mask
screen& crop();
// inset and import
screen& paste(const screen& child, const P& inset_sw, const P& inset_ne);
screen& paste(const screen& child);
screen& clear();
// border(Color, length)?
screen& border(const Color&, double);
screen& border(const Color&, const std::string&);
screen& backing(const Color&);
screen& border();
screen& backing();
//// pass-through functions ////
// affine operations on contents (not border, backing)
screen& apply(const affine& f);
// convenience operators for single affine ops
screen& shift(const P& arg);
// rotate by theta about ctr
screen& rotate(double theta, const P& ctr = P(0,0));
// reflect in angle-theta line through ctr
screen& reflect(double theta, const P& ctr = P(0,0));
// scale coord direction(s) fixing ctr
screen& h_scale(double, const P& ctr=P(0,0));
screen& v_scale(double, const P& ctr=P(0,0));
screen& scale(double, const P& ctr=P(0,0));
// shear, fixing ctr, e.g. h_shear(sc) : (x,y) -> (x+sc*y, y)
screen& h_shear(double sc, const P& ctr=P(0,0));
screen& v_shear(double sc, const P& ctr=P(0,0));
P tr() const;
P tl() const;
P bl() const;
P br() const;
P t() const;
P b() const;
P l() const;
P r() const;
P c() const;
double h_min() const;
double h_max() const;
double h_size() const;
double h_avg() const;
double v_min() const;
double v_max() const;
double v_size() const;
double v_avg() const;
private:
screen_data* m_screen;
}; // end of class screen
} // end of namespace
#endif /* EPIX_SCREEN */
/*
* picture.h -- ePiX globals functions for picture interface
*
* This file is part of ePiX, a C++ library for creating high-quality
* figures in LaTeX
*
* Version 1.1.16
* Last Change: September 11, 2007
*/
/*
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
* Andrew D. Hwang <rot 13 nujnat at zngupf dot ubylpebff dot rqh>
* Department of Mathematics and Computer Science
* College of the Holy Cross
* Worcester, MA, 01610-2395, USA
*/
/*
* ePiX is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ePiX is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ePiX; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef EPIX_PICTURE
#define EPIX_PICTURE
namespace ePiX {
class Color;
class P;
class picture_data;
class screen;
// "global" references
picture_data& the_picture();
double& xmin();
double& xmax();
double& xsize();
double& ymin();
double& ymax();
double& ysize();
double& tix();
// preferred initialization functions
// corners and dimensions, e.g. "4in x 15cm" or "4 x 6in"
// (width units take precedence, dimension string must be passed by value)
void picture(const P& arg1, const P& arg2, std::string);
// same syntax as for picture dimensions
void offset(std::string);
//// Old global functions for manipulating the page markup region ////
void bounding_box(const P&, const P&);
void picture(double, double);
void picture(const P&);
void offset(double hoff, double voff);
void offset(const P& arg);
void unitlength(const std::string& units);
// activate default screen
void begin();
// write the output file
void end_picture();
//// New global functions ////
// the_picture().the_canvas
screen& canvas();
// specify active screen; pass non-const ref only to assign/compare pointer
void activate(screen&);
void deactivate(screen&);
// add active or specified screen to the_picture
void import();
void inset(const P& sw, const P& ne);
void import(const screen& child);
void inset(const screen& child, const P& sw, const P& ne);
void inset(const screen& child); // use child's corners
// interpret child's coordinates as true pt on the page,
// place origin at P
void inlay(const screen& child, const P& loc);
// interpret stated coord as true pt, the other as Cartesian
void inlay_vertical(const screen& child, const P& loc);
void inlay_horizontal(const screen& child, const P& loc);
// set decorations on active screen
void backing(const Color&);
void border(const Color&, double); // width in pt
void border(const Color&, const std::string&);
void backing(); // use current fill style
void border(); // use current line pen
// write verbatim string to output file
void write(const std::string&);
void pre_write(const std::string&); // before picture header
void post_write(const std::string&); // after picture footer
// set output format
void eepic_format();
// void mp_format();
void tikz_format();
void pst_format();
// write in specified format to named output file
void print_eepic(const std::string& filename);
// void print_mp(const std::string& filename);
void print_tikz(const std::string& filename);
void print_pst(const std::string& filename);
// allow user to override in-file format request on the command line
inline void end()
{
#ifdef EPIX_FMT_PSTRICKS
pst_format();
#else
#ifdef EPIX_FMT_TIKZ
tikz_format();
#else
#ifdef EPIX_FMT_EEPIC
eepic_format();
#endif /* EPIX_FMT_EEPIC */
#endif /* EPIX_FMT_TIKZ */
#endif /* EPIX_FMT_PSTRICKS */
end_picture();
}
// for implementors of true-size elements
double pic_units_per_pt(); // exact
double units_per_pic_unit(); // approximate, exact at true aspect ratio
double pt_to_screen(double); // true length to screen length
////////////////////////////////////////////////////////////////
//// ////
//// DEPRECATED global variables required for backward ////
//// compatibility. Will be removed in a future release. ////
//// Use reference functions xmin() et. al. ////
//// ////
////////////////////////////////////////////////////////////////
// bounding_box corners and dimensions
extern double x_min, x_max, x_size, y_min, y_max, y_size;
} // end of namespace
#endif /* EPIX_PICTURE */
/*
* markers.h -- ePiX markers and labels
*
* This file is part of ePiX, a C++ library for creating high-quality
* figures in LaTeX
*
* Version 1.1.16
* Last Change: September 09, 2007
*/
/*
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
* Andrew D. Hwang <rot 13 nujnat at zngupf dot ubylpebff dot rqh>
* Department of Mathematics and Computer Science
* College of the Holy Cross
* Worcester, MA, 01610-2395, USA
*/
/*
* ePiX is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ePiX is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ePiX; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* label -- put string constant <label_text> at Cartesian position <base>
* translated by (offset.x1, offset.x2) true points (i.e., 3rd component
* of <offset> is discarded).
*
* Accepts an optional LaTeX-style positioning argument.
* If no offset is specified, the label is centered at the given Cartesian
* location.
* masklabel requires the "color" package, and places the text in
* a white box that masks whatever is underneath and earlier in the file.
*/
#ifndef EPIX_MARKERS
#define EPIX_MARKERS
namespace ePiX {
class P;
// position, [offset], label text, [alignment]
void label(const P&, const P&, const std::string&);
void label(const P&, const std::string&);
void label(const P&, const P&, const std::string&, epix_label_posn);
void masklabel(const P&, const P&, const std::string&);
void masklabel(const P&, const std::string&);
void masklabel(const P&, const P&, const std::string&, epix_label_posn);
// Empty and filled LaTeX circles of diameter get_dotsize() true pt
void marker (const P&, epix_mark_type);
void circ(const P& posn, const P& offset=P(0,0),
const std::string& label_text="",
epix_label_posn align=none); // filled white circ
void ring(const P& posn, const P& offset=P(0,0),
const std::string& label_text="",
epix_label_posn align=none); // unfilled circ
void spot(const P& posn, const P& offset=P(0,0),
const std::string& label_text="",
epix_label_posn align=none);
void dot(const P& posn, const P& offset=P(0,0),
const std::string& label_text="",
epix_label_posn align=none);
void ddot(const P& posn, const P& offset=P(0,0),
const std::string& label_text="",
epix_label_posn align=none);
void box(const P& posn, const P& offset=P(0,0),
const std::string& label_text="",
epix_label_posn align=none);
void bbox(const P& posn, const P& offset=P(0,0),
const std::string& label_text="",
epix_label_posn align=none);
void h_axis_tick(const P& location, epix_label_posn align=c);
void v_axis_tick(const P& location, epix_label_posn align=c);
// Arrow with aligned label at tail
void arrow(const P& tail, const P& head, const P& offset,
const std::string& label_text,
epix_label_posn align, double scale=1);
//// Path-like glyphs ////
// angle indicators; default args are true sizes in pt
void right_angle(const P& loc, P leg1, P leg2, double scale=8);
void arc_measure(const P& loc, P leg1, P leg2,
const P& offset, const std::string&, epix_label_posn,
double scale=8);
void arc_measure(const P& loc, P leg1, P leg2, double scale=8);
void axis_break(const P& tail, const P& head, double scale=12);
void h_error_bar(const P& loc, double err, epix_mark_type mk, double ht=6);
void v_error_bar(const P& loc, double err, epix_mark_type mk, double wd=6);
} // end of namespace
#endif /* EPIX_MARKERS */
/*
* axis.h -- Decorable coordinate axis class
*
* This file is part of ePiX, a C++ library for creating high-quality
* figures in LaTeX
*
* Version 1.1.13
* Last Change: August 23, 2007
*/
/*
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
* Andrew D. Hwang <rot 13 nujnat at zngupf dot ubylpebff dot rqh>
* Department of Mathematics and Computer Science
* College of the Holy Cross
* Worcester, MA, 01610-2395, USA
*/
/*
* ePiX is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ePiX is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ePiX; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef EPIX_AXIS
#define EPIX_AXIS
namespace ePiX {
class axis {
public:
axis(const P&, const P&, unsigned int n,
const P& offset = P(0,0), epix_label_posn POSN=none);
// attribute-setting
axis& dec(); // default
axis& frac(); // fractional labels
axis& trig(); // fractions times pi
axis& sci(); // scientific notation
// f(x, precision, base) returns a string representing x
axis& label_rep(std::string f(double, unsigned int, unsigned int));
// unmark selected location (non-log labels only)
axis& unmark(double arg=0);
// add or remove logarithmic tags ("sublabels")
axis& log(unsigned int base=10); // log ticks and labels
axis& tag(double); // put label at arg in log mode
axis& tag235(); // tags at 2, 3, 5 in log10 mode
axis& tags(); // tags at 2, ..., b-1 in logb mode
axis& untag(); // remove all log tags
axis& untag(double); // remove selected tag
axis& align_labels(epix_label_posn);
axis& align(epix_label_posn); // align tick marks
// number of minor ticks per segment
axis& subdivide(unsigned int);
// set length of minor ticks
axis& tick_ratio(double);
// set precision for axis labels
axis& precision(unsigned int digits=0); // 0: reset to default
void draw_ticks() const;
void draw_labels() const;
void draw() const;
private:
P m_tail;
P m_head;
unsigned int m_major_segs;
unsigned int m_minor_segs;
double m_tick_ratio;
epix_label_posn m_align_ticks;
P m_offset;
epix_label_posn m_align_labels;
unsigned int m_log_base;
bool m_log;
unsigned int m_precision;
double (*m_coord)(const P&); // value to place at arg
// represent arg as string
std::string (*m_rep)(double arg, unsigned int prec, unsigned int base);
std::set<double> m_omitted;
std::set<double> m_log_tags;
}; // end of axis class
// axes along sides of bounding box, ticks automatically aligned
axis top_axis(unsigned int n, const P& offset=P(0,0),
epix_label_posn POSN=t);
axis bottom_axis(unsigned int n, const P& offset=P(0,0),
epix_label_posn POSN=b);
axis left_axis(unsigned int n, const P& offset=P(0,0),
epix_label_posn POSN=l);
axis right_axis(unsigned int n, const P& offset=P(0,0),
epix_label_posn POSN=r);
// Global functions from Version 1.0
void h_axis_labels(const P& tail, const P& head, unsigned int n,
const P& offset, epix_label_posn POSN=none);
void v_axis_labels(const P& tail, const P& head, unsigned int n,
const P& offset, epix_label_posn POSN=none);
void h_axis_masklabels(const P& tail, const P& head, unsigned int n,
const P& offset, epix_label_posn POSN=none);
void v_axis_masklabels(const P& tail, const P& head, unsigned int n,
const P& offset, epix_label_posn POSN=none);
// Axis labels with default endpoints
void h_axis_labels(unsigned int n, const P& offset,
epix_label_posn POSN=none);
void h_axis_masklabels(unsigned int n, const P& offset,
epix_label_posn POSN=none);
void v_axis_labels(unsigned int n, const P& offset,
epix_label_posn POSN=none);
void v_axis_masklabels(unsigned int n, const P& offset,
epix_label_posn POSN=none);
//// logarithmic labels ////
// labels written $k x base^i$ at i + log_b(k)
void h_axis_log_labels(const P& tail, const P& head, unsigned int n,
const P& offset, epix_label_posn POSN=none,
unsigned int base=10);
void v_axis_log_labels(const P& tail, const P& head, unsigned int n,
const P& offset, epix_label_posn POSN=none,
unsigned int base=10);
// labels written $base^i$ at coord i
void h_axis_log_labels(const P& tail, const P& head,
const P& offset, epix_label_posn POSN=none,
unsigned int base=10);
void v_axis_log_labels(const P& tail, const P& head,
const P& offset, epix_label_posn POSN=none,
unsigned int base=10);
void h_axis_log_masklabels(const P& tail, const P& head, unsigned int n,
const P& offset, epix_label_posn POSN=none,
unsigned int base=10);
void v_axis_log_masklabels(const P& tail, const P& head, unsigned int n,
const P& offset, epix_label_posn POSN=none,
unsigned int base=10);
void h_axis_log_masklabels(const P& tail, const P& head,
const P& offset, epix_label_posn POSN=none,
unsigned int base=10);
void v_axis_log_masklabels(const P& tail, const P& head,
const P& offset, epix_label_posn POSN=none,
unsigned int base=10);
// Coordinate axes, specified by initial and final points, number of
// tick marks. h/v_axis are identical except for style of tick marks.
// n subintervals
void h_axis(const P& tail, const P& head, unsigned int n,
epix_label_posn align=c);
void v_axis(const P& tail, const P& head, unsigned int n,
epix_label_posn align=c);
// Default endpoints (xmin(), 0), xmax(), 0), etc.
void h_axis(unsigned int n = xsize(), epix_label_posn align=c);
void v_axis(unsigned int n = ysize(), epix_label_posn align=c);
void h_log_axis(const P& tail, const P& head, unsigned int segs,
epix_label_posn align=c, unsigned int base=10);
void v_log_axis(const P& tail, const P& head, unsigned int segs,
epix_label_posn align=c, unsigned int base=10);
} // end of namespace
#endif /* EPIX_AXIS */
/*
* legend.h -- Plot/figure legend class
*
* This file is part of ePiX, a C++ library for creating high-quality
* figures in LaTeX
*
* Version 1.1.11
* Last Change: August 16, 2007
*/
/*
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
* Andrew D. Hwang <rot 13 nujnat at zngupf dot ubylpebff dot rqh>
* Department of Mathematics and Computer Science
* College of the Holy Cross
* Worcester, MA, 01610-2395, USA
*/
/*
* ePiX is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ePiX is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ePiX; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef EPIX_LEGEND
#define EPIX_LEGEND
namespace ePiX {
class legend_item;
class P;
class legend {
public:
legend();
legend(const legend&);
legend& operator=(const legend&);
~legend();
// add items; get key style from drawing state
legend& fill_item(const std::string&); // solid color
legend& path_item(const std::string&); // line
legend& mark_item(epix_mark_type, const std::string&); // marker
// decorations
legend& backing(const Color&);
legend& border(const Color&, double);
legend& border(double); // line width in pt
// item attributes
legend& item_border(const Color&, double);
legend& item_border(double);
legend& label_skip(double); //
legend& key_size(double); // size of legend keys in pt
void draw(const P& loc, const P& offset=P(0,0),
epix_label_posn align=tr) const;
private:
Color m_backing;
Color m_bord;
double m_bord_width;
Color m_item_bord;
double m_item_bord_width;
double m_key_size;
double m_label_skip;
std::list<legend_item*> m_items;
}; // end of legend class
} // end of namespace
#endif /* EPIX_LEGEND */
/*
* path.h -- ePiX user class for polygons and paths
*
* This file is part of ePiX, a C++ library for creating high-quality
* figures in LaTeX
*
* Version 1.2.5
* Last Change: May 04, 2008
*/
/*
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
* Andrew D. Hwang <rot 13 nujnat at zngupf dot ubylpebff dot rqh>
* Department of Mathematics and Computer Science
* College of the Holy Cross
* Worcester, MA, 01610-2395, USA
*/
/*
* ePiX is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ePiX is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ePiX; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef EPIX_PATHS
#define EPIX_PATHS
namespace ePiX {
class Camera;
class Color;
class P;
class path_data;
class pen_data;
class screen;
class Sphere;
class path {
friend class facet;
public:
// path was visible to users, but is now implemented as a p_impl.
path(const path&);
path& operator= (const path&);
~path();
// Interface dictated by backward compatibility
path(const std::vector<P>& data, bool closed, bool filled);
path();
// line constructors
path(const P& tail, const P& head, double expand=0);
path(const P&, const P&, double expand, unsigned int num_pts);
// Constructors that specify the number of points have two prototypes
// rather than accepting a default argument. This hides the global
// (but user-inaccessible) default number of points (see constants.h).
// ellipse
path(const P& center, const P& axis1, const P& axis2,
double t_min, double t_max,
unsigned int num_pts);
path(const P& center, const P& axis1, const P& axis2,
double t_min, double t_max);
// spline
path(const P& p1, const P& p2, const P& p3, unsigned int n);
path(const P& p1, const P& p2, const P& p3);
path(const P& p1, const P& p2, const P& p3, const P& p4, unsigned int n);
path(const P& p1, const P& p2, const P& p3, const P& p4);
// parametric path
path(P f(double), double t_min, double t_max, unsigned int num_pts);
path(P f(double), double t_min, double t_max);
// function graph
path(double f(double), double t_min, double t_max, unsigned int num_pts);
path(double f(double), double t_min, double t_max);
// append a point
path& pt(double, double, double=0);
path& pt(const P&);
// concatenate path segments
path& operator+= (const path&);
// concatenate, reversing second sequence
path& operator-= (const path&);
bool is_closed() const;
bool is_filled() const;
// set attributes
path& close();
path& fill(const bool arg=true);
void clip();
// assumes path lies on sphere
void clip_to(const Sphere&, const P& viewpt, bool back=false);
std::vector<P> data() const;
void draw() const;
void draw(const Color&, const pen_data&) const;
private:
path_data* m_segments;
}; // end of class path
/*
Slated for removal
// polygon/polyline with variable number of vertices
path polygon(unsigned int num_pts ...);
path polyline(unsigned int num_pts ...);
*/
} // end of namespace
#endif /* EPIX_PATHS */
/*
* curves.h -- Ellipses, arcs, splines, coordinate grids
*
* This file is part of ePiX, a C++ library for creating high-quality
* figures in LaTeX
*
* Version 1.1.10
* Last Change: August 08, 2007
*/
/*
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
* Andrew D. Hwang <rot 13 nujnat at zngupf dot ubylpebff dot rqh>
* Department of Mathematics and Computer Science
* College of the Holy Cross
* Worcester, MA, 01610-2395, USA
*/
/*
* ePiX is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ePiX is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ePiX; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef EPIX_CURVES
#define EPIX_CURVES
namespace ePiX {
class P;
class mesh;
// lines can be "stretched" by double parameter
void line(const P& tail, const P& head, double expand=0);
void line(const P& tail, const P& head, double expand,
unsigned int num_pts);
// "Visible" portion of the line through p1, p2
void Line(const P& tail, const P& head);
// point-slope form
void Line(const P&, double);
void triangle(const P&, const P&, const P&);
void quad(const P&, const P&, const P&, const P&);
void rect(const P&, const P&);
void rect(const P&, const P&, bool solid);
// arrows
void arrow(const P& tail, const P& head, double scale=1);
void dart(const P& tail, const P& head);
// double-tipped
void aarrow(const P& tail, const P& head, double scale=1);
// arbitrary elliptical arc
void arrow(const P& center, const P& axis1, const P& axis2,
double t_min, double t_max, double scale=1);
// Algebraic curves (elliptical and circular arcs, splines)
void ellipse(const P& center, const P& axis1, const P& axis2); // full turn
void ellipse(const P& center, const P& axis1, const P& axis2,
double t_min, double t_max); // angle range
void ellipse(const P& center, const P& axis1, const P& axis2,
double t_min, double t_max, unsigned int num_pts);
// for backward compatibility
void ellipse_arc(const P& center, const P& axis1, const P& axis2,
double t_min, double t_max);
// old style "center and polyradius"
void ellipse (const P& center, const P& radius);
// Standard half-ellipse functions
void ellipse_left (const P&, const P&);
void ellipse_right (const P&, const P&);
void ellipse_top (const P&, const P&);
void ellipse_bottom (const P&, const P&);
// Circular arcs parallel to (x,y)-plane
void arc(const P& center, double r,
double start, double finish);
void arc_arrow (const P& center, double r,
double start, double finish,
double scale=1);
// Quadratic and cubic splines/spline arrows
void spline(const P& p1, const P& p2, const P& p3, unsigned int num_pts);
void spline(const P& p1, const P& p2, const P& p3);
void arrow(const P& p1, const P& p2, const P& p3, double scale=1);
void spline (const P& p1, const P& p2, const P& p3, const P& p4,
unsigned int num_pts);
void spline (const P& p1, const P& p2, const P& p3, const P& p4);
void arrow(const P&, const P&, const P&, const P&, double scale=1);
// natural spline
void spline(const std::vector<P>&, unsigned int num_pts);
// A "mesh" is an ordered pair of positive integers, and is used to
// specify the "fineness" of a grid. Grids, like parametric surface
// meshes, have a "coarse mesh" -- the numbers of grid intervals in
// each direction, and a "fine mesh" -- the numbers of points used
// to render the grid lines. Since an ePiX camera does not always
// map lines in object space to lines on the screen, grid lines cannot
// generally be drawn using only two points.
// A grid may look strange unless each component of fine is a multiple
// of the corresponding entry of coarse, of course. :)
// Cartesian grid of specified size, mesh, and resolution
void grid(const P& arg1, const P& arg2, mesh coarse, mesh fine);
// coarse = fine = (n1,n2)
void grid(const P& arg1, const P& arg2,
unsigned int n1=1, unsigned int n2=1);
void grid(unsigned int n1=1, unsigned int n2=1);
// polar grid of specified radius, mesh (rings and sectors), and resolution
void polar_grid(double r, mesh coarse, mesh fine);
// polar grid with n1 rings and n2 sectors
void polar_grid(double r, unsigned int n1, unsigned int n2);
// (semi-)logarithmic grids specified by corners and numbers of orders of
// magnitude or grid divisions in each direction. Optional arguments
// specify the log base (10 by default). If corners are omitted, the grid
// fills the bounding box.
void log_grid(const P& arg1, const P& arg2,
unsigned int segs1, unsigned int segs2,
unsigned int base1=10, unsigned int base2=10);
void log1_grid(const P& arg1, const P& arg2,
unsigned int segs1, unsigned int segs2,
unsigned int base1=10);
void log2_grid(const P& arg1, const P& arg2,
unsigned int segs1, unsigned int segs2,
unsigned int base2=10);
void log_grid(unsigned int segs1, unsigned int segs2,
unsigned int base1=10, unsigned int base2=10);
void log1_grid(unsigned int segs1, unsigned int segs2,
unsigned int base1=10);
void log2_grid(unsigned int segs1, unsigned int segs2,
unsigned int base2=10);
// fractal generation
//
// The basic "level-1" recursion unit is a piecewise-linear path whose
// segments are parallel to spokes on a wheel, labelled modulo <spokes>.
// Recursively up to <depth>, each segment is replaced by a copy of the
// recursion unit.
//
// Sample data for _/\_ standard Koch snowflake:
// const int pre_seed[] = {6, 4, 0, 1, -1, 0};
// pre_seed[0] = spokes, pre_seed[1] = seed_length;
void fractal (const P& p, const P& q, const int depth, const int *pre_seed);
} // end of namespace
#endif /* EPIX_CURVES */
/*
* circle.h -- ePiX::Circle class
*
* This file is part of ePiX, a C++ library for creating high-quality
* figures in LaTeX
*
* Version 1.1.9
* Last Change: July 30, 2007
*/
/*
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
* Andrew D. Hwang <rot 13 nujnat at zngupf dot ubylpebff dot rqh>
* Department of Mathematics and Computer Science
* College of the Holy Cross
* Worcester, MA, 01610-2395, USA
*/
/*
* ePiX is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ePiX is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ePiX; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* This file provides:
*
* The Circle class (center, radius, unit normal).
*
* - Circle() (defaults to origin, unit radius, in (x1,x2,0)-plane
* - Circle(ctr, pt) (parallel to (x1,x2,0)-plane, center ctr, through pt)
* - Circle(pt1, pt2, pt3) (arbitrary non-collinear points)
* - center(), radius(), perp()
* - affine operations: shift(P), move_to(P), scale(double)
* - draw() (ePiX ellipse)
*/
#ifndef EPIX_CIRCLE
#define EPIX_CIRCLE
namespace ePiX {
class Circle {
public:
// defaults to unit circle in (x1,x2,0) plane
Circle(const P& ctr=P(0,0,0), double rad=1, const P& perp=E_3);
Circle(const P& ctr, const P& pt); // center, and point, normal = E_3
Circle(const P& pt1, const P& pt2, const P& pt3); // three points
Circle(bool); // malformed Circle for intersection operators
P center() const;
double radius() const;
P perp() const;
bool malformed() const;
// translate
Circle& shift(const P&);
Circle& move_to(const P&);
// scale radius by c
Circle& scale(double c);
void draw() const;
private:
P m_center;
double m_radius;
P m_perp; // unit normal, even if rad = 0
bool m_malformed;
}; // end of Circle class
// global object-drawing commands
void circle(const P& ctr=P(0,0,0), double rad=1, const P& perp=E_3);
void circle(const P& ctr, const P& pt); // center, and point, normal = E_3
void circle(const P& pt1, const P& pt2, const P& pt3); // three points
} // end of namespace
#endif /* EPIX_CIRCLE */
/*
* plane.h -- ePiX::Plane class
*
* This file is part of ePiX, a C++ library for creating high-quality
* figures in LaTeX
*
* Version 1.1.17
* Last Change: September 13, 2007
*/
/*
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
* Andrew D. Hwang <rot 13 nujnat at zngupf dot ubylpebff dot rqh>
* Department of Mathematics and Computer Science
* College of the Holy Cross
* Worcester, MA, 01610-2395, USA
*/
/*
* ePiX is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ePiX is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ePiX; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef EPIX_PLANE
#define EPIX_PLANE
namespace ePiX {
class Circle;
class Plane;
class Segment;
class Sphere;
class Plane {
public:
Plane(const P& pt=P(0,0,0), const P& perp=E_3);
Plane(const P&, const P&, const P&);
P pt() const;
P perp() const;
bool malformed() const;
// affine operations
Plane& shift(const P&);
Plane& move_to(const P&);
void draw() const;
private:
P m_pt;
P m_perp; // unit normal
bool m_malformed;
}; // end of Plane class
void plane(const P& pt=P(0,0,0), const P& perp=E_3);
void plane(const P&, const P&, const P&);
} // end of namespace
#endif /* EPIX_PLANE */
/*
* segment.h -- ePiX::Segment class
*
* This file is part of ePiX, a C++ library for creating high-quality
* figures in LaTeX
*
* Version 1.2.5
* Last Change: May 04, 2008
*/
/*
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
* Andrew D. Hwang <rot 13 nujnat at zngupf dot ubylpebff dot rqh>
* Department of Mathematics and Computer Science
* College of the Holy Cross
* Worcester, MA, 01610-2395, USA
*/
/*
* ePiX is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ePiX is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ePiX; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* This file provides:
*
* The Segment class (unordered pair of points), and operators:
* - end1(), end2() (no guaranteed order)
* - Translation operators shift(P), move_to(P)
* - Stretch about midpoint: scale(double)
* - draw(double) (ePiX line)
* - midpoint();
*/
#ifndef EPIX_SEGMENT
#define EPIX_SEGMENT
namespace ePiX {
class Segment {
public:
Segment(const P&, const P&); // endpoints
Segment(bool); // malformed Segment for intersection operators
// Segment ends are not distinguished geometrically,
// so these functions should normally be used in tandem.
P end1() const;
P end2() const;
bool malformed() const;
// translate
Segment& shift(const P&);
Segment& move_to(const P&);
Segment& scale(double);
P midpoint(double t=0.5) const;
void draw(double stretch=0) const;
private:
P m_endpt1;
P m_endpt2;
bool m_malformed;
}; // end of Segment class
} // end of namespace
#endif /* EPIX_SEGMENT */
/*
* sphere.h -- ePiX::Sphere class
*
* This file is part of ePiX, a C++ library for creating high-quality
* figures in LaTeX
*
* Version 1.1.9
* Last Change: July 30, 2007
*/
/*
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
* Andrew D. Hwang <rot 13 nujnat at zngupf dot ubylpebff dot rqh>
* Department of Mathematics and Computer Science
* College of the Holy Cross
* Worcester, MA, 01610-2395, USA
*/
/*
* ePiX is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ePiX is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ePiX; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* This file provides:
*
* The Sphere class (center, radius), and operators:
* - Sphere += P (translate by <P>)
* - Sphere *= double (scale about center)
* - draw() (ePiX line)
* - center();
* - radius();
*
* Hiding test, latitude and longitudes on a sphere.
*/
#ifndef EPIX_SPHERE
#define EPIX_SPHERE
namespace ePiX {
class Sphere {
public:
Sphere(const P& ctr=P(0,0,0), double rad=1);
Sphere(const P& ctr, const P& pt);
P center() const;
double radius() const;
bool malformed() const; // always returns false, currently
// translation
Sphere& shift(const P&);
Sphere& move_to(const P&);
// scale radius
Sphere& scale(double&);
void draw() const;
private:
P m_ctr;
double m_rad;
bool m_malformed;
}; // end of Sphere class
// global horizon-drawing functions
void sphere(const P& ctr=P(0,0,0), double rad=1);
void sphere(const P& ctr, const P& pt);
} // end of namespace
#endif /* EPIX_SPHERE */
/*
* intersections.h -- Circle, Plane, Segment, Sphere intersection operators
*
* This file is part of ePiX, a C++ library for creating high-quality
* figures in LaTeX
*
* Version 1.1.9
* Last Change: July 30, 2007
*/
/*
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
* Andrew D. Hwang <rot 13 nujnat at zngupf dot ubylpebff dot rqh>
* Department of Mathematics and Computer Science
* College of the Holy Cross
* Worcester, MA, 01610-2395, USA
*/
/*
* ePiX is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ePiX is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ePiX; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef EPIX_INTERSECTIONS
#define EPIX_INTERSECTIONS
namespace ePiX {
class Circle;
class Plane;
class Segment;
class Sphere;
Segment operator* (const Circle&, const Circle&);
Segment operator* (const Circle&, const Plane&);
Segment operator* (const Circle&, const Segment&);
Segment operator* (const Circle&, const Sphere&);
Segment operator* (const Plane&, const Plane&);
P operator* (const Plane&, const Segment&);
Circle operator* (const Plane&, const Sphere&);
P operator* (const Segment&, const Segment&);
Segment operator* (const Segment&, const Sphere&);
Circle operator* (const Sphere&, const Sphere&);
// derived operators with reversed argument order
Segment operator* (const Plane&, const Circle&);
Segment operator* (const Segment&, const Circle&);
Segment operator* (const Sphere&, const Circle&);
P operator* (const Segment&, const Plane&);
Circle operator* (const Sphere&, const Plane&);
Segment operator* (const Sphere&, const Segment&);
} // end of namespace
#endif /* EPIX_INTERSECTIONS */
/*
* plots.h -- parametrized plotting algorithms
*
* This file is part of ePiX, a C++ library for creating high-quality
* figures in LaTeX
*
* Andrew D. Hwang <rot 13 nujnat at zngupf dot ubylpebff dot rqh>
*
* Version 1.0.23
* Last Change: January 13, 2007
*/
/*
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
* Andrew D. Hwang <rot 13 nujnat at zngupf dot ubylpebff dot rqh>
* Department of Mathematics and Computer Science
* College of the Holy Cross
* Worcester, MA, 01610-2395, USA
*/
/*
* ePiX is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ePiX is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ePiX; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef EPIX_PLOTS
#define EPIX_PLOTS
namespace ePiX {
class domain;
class domain_list;
class Deriv;
class Integral;
class P;
//// paths ////
// f:R -> R^3
void plot (P f(double), double t_min, double t_max, unsigned int n);
// f:R -> R x R x R
void plot (double f1(double), double f2(double), double f3(double),
double t_min, double t_max, unsigned int n);
// f:R -> R
void plot (double f(double), double t_min, double t_max, unsigned int n);
void plot (const Deriv&, double t_min, double t_max, unsigned int n);
void plot (const Integral&, double t_min, double t_max, unsigned int n);
// f: R -> R x R
void plot (double f1(double), double f2(double),
double t_min, double t_max, unsigned int n);
void polarplot (double f(double), double t_min, double t_max, unsigned int);
//// surfaces ////
// f:R^2 -> R x R x R
void plot(double f1(double u1, double u2),
double f2(double u1, double u2),
double f3(double u1, double u2),
const P& min, const P& max, const mesh& coarse, const mesh& fine);
void plot(double f1(double u1, double u2),
double f2(double u1, double u2),
double f3(double u1, double u2),
const domain& R);
// f:R^2 -> R
void plot(double f(double u1, double u2),
const P& p1, const P& p2, const mesh& coarse, const mesh& fine);
// f:R^2 -> R^3
void plot(P f(double, double), const domain&);
void plot(P f(double, double), const domain_list&);
// f:R^3 -> R^3
void plot(P f(double, double, double), const domain&);
void plot(P f(double, double, double), const domain_list&);
// Derivatives and integrals
void plot_deriv(double f(double), double a, double b, unsigned int n);
void plot_int(double f(double), double a, double b, unsigned int n);
void plot_int(double f(double), double x0, double a, double b, unsigned int);
void tan_line(double f1(double), double f2(double), double t0);
void tan_line(double f(double), double t0);
void tan_line(P f(double), double t0);
void envelope(double f1(double), double f2(double),
double, double, unsigned int);
void envelope(double f(double), double, double, unsigned int);
void envelope(P f(double), double, double, unsigned int);
void tan_field(double f1(double), double f2(double), double, double,
unsigned int);
void tan_field(P f(double), double, double, unsigned int);
// Slope, dart, and vector fields
// For slope and dart fields, the optional scale argument affects the
// (constant) drawn length of field elements. For vector fields, elements
// are drawn at true length, and "scale" affects the arrowhead size.
// planar fields
void slope_field(P F(double, double), const P& p, const P& q,
unsigned int, unsigned int, double scale=1.0);
void dart_field(P F(double, double), const P& p, const P& q,
unsigned int, unsigned int, double scale=1.0);
void vector_field(P F(double, double), const P& p, const P& q,
unsigned int, unsigned int, double scale=1.0);
void slope_field(P F(double, double), const domain& R,
double scale=1.0);
void dart_field(P F(double, double), const domain& R,
double scale=1.0);
void vector_field(P F(double, double), const domain& R,
double scale=1.0);
// spatial fields
void slope_field(P F(double, double, double), const P&, const P&,
unsigned int, unsigned int, double scale=1.0);
void dart_field(P F(double, double, double), const P&, const P&,
unsigned int, unsigned int, double scale=1.0);
void vector_field(P F(double, double, double), const P&, const P&,
unsigned int, unsigned int, double scale=1.0);
// spatial fields over a (3-D) domain
void slope_field(P F(double, double, double), const domain&,
double scale=1.0);
void dart_field(P F(double, double, double), const domain&,
double scale=1.0);
void vector_field(P F(double, double, double), const domain&,
double scale=1.0);
// Solutions of ODE systems
// start at time 0
void ode_plot (P F(double, double),
const P& start, double t_max, unsigned int);
void ode_plot (P F(double, double, double),
const P& start, double t_max, unsigned int);
// arbitrary start time
void ode_plot (P F(double, double),
const P& start, double t_min, double t_max, unsigned int);
void ode_plot (P F(double, double, double),
const P& start, double t_min, double t_max, unsigned int);
// flow x0 under field for specified time
P flow (P F(double, double), const P& start, double t_max, unsigned int n=0);
P flow (P F(double, double, double),
const P& start, double t_max, unsigned int n = 0);
void riemann_sum(double f(double), double a, double b,
unsigned int n, epix_integral_type TYPE);
// Jay Belanger's shaded plot functions -- December 1, 2002
void shadeplot(double f1(double), double f2(double), double, double,
unsigned int);
void shadeplot(double f(double), double t_min, double t_max, unsigned int);
void blackplot(double f1(double), double f2(double),
double t_min, double t_max, unsigned int);
void blackplot(double f(double), double t_min, double t_max, unsigned int);
void whiteplot(double f1(double), double f2(double),
double t_min, double t_max, unsigned int);
void whiteplot(double f(double), double t_min, double t_max, unsigned int);
// wiremesh surface plotting
void plot(P Phi(double, double),
const P&, const P&, const mesh& N, const mesh& num_pts);
/*
void clipplot(P Phi(double, double),
const P&, const P&, const mesh& N, const mesh& num_pts);
void cropplot(P Phi(double, double),
const P&, const P&, const mesh& N, const mesh& num_pts);
*/
} // end of namespace
#endif /* EPIX_PLOTS */
/*
* surface.h -- Shaded surface plotting
*
* This file is part of ePiX, a C++ library for creating high-quality
* figures in LaTeX
*
* Version 1.1.7
* Last Change: July 08, 2007
*/
/*
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
* Andrew D. Hwang <rot 13 nujnat at zngupf dot ubylpebff dot rqh>
* Department of Mathematics and Computer Science
* College of the Holy Cross
* Worcester, MA, 01610-2395, USA
*/
/*
* ePiX is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ePiX is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ePiX; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace ePiX
{
class domain;
class domain_list;
class facet;
// manipulable collection of surface-like objects
class scenery {
public:
scenery();
scenery(P F(double, double), const domain& R);
scenery(P F(double, double, double), const domain& R);
// third arg is RGB-valued function of position
scenery(P F(double, double), const domain& R,
P color(double, double, double));
scenery(P F(double, double, double), const domain& R,
P color(double, double, double));
// third arg is RGB-valued function of domain location
scenery(P F(double, double), const domain& R,
P color(double, double));
scenery(P F(double, double, double), const domain& R,
P color(double, double));
scenery(const scenery&);
scenery& operator= (const scenery&);
~scenery();
scenery& add(P F(double, double), const domain& R);
scenery& add(P F(double, double, double), const domain& R);
scenery& add(P F(double, double), const domain_list&);
scenery& add(P F(double, double, double), const domain_list&);
// color-dependent
// location-colored
scenery& add(P F(double, double), const domain& R,
P color(double, double, double));
scenery& add(P F(double, double, double), const domain& R,
P color(double, double, double));
scenery& add(P F(double, double), const domain_list&,
P color(double, double, double));
scenery& add(P F(double, double, double), const domain_list&,
P color(double, double, double));
// domain-colored
scenery& add(P F(double, double), const domain& R,
P color(double, double));
scenery& add(P F(double, double, double), const domain& R,
P color(double, double));
scenery& add(P F(double, double), const domain_list&,
P color(double, double));
scenery& add(P F(double, double, double), const domain_list&,
P color(double, double));
// remove backward-pointing faces? 0=no, -1=front, 1=back
scenery& cull(int);
void draw(int cull=0) const;
private:
int m_cull;
std::list<facet*> m_data;
}; // end of class scenery
//// global functions ////
// except as noted, dim(R) must be 2
// cosine-shaded surface with fake z-buffered hidden object removal
void surface(P F(double, double), const domain& R, int cull=0);
// for slices of maps R^3 -> R^3
void surface(P F(double, double, double), const domain& R, int cull=0);
// plot multiple slices
void surface(P F(double, double, double), const domain_list& R, int cull=0);
// Surface from revolving the curve (f(t),g(t)) about the x-axis...
void surface_rev(double f(double), double g(double),
double t_min, double t_max,
int latitudes, int longitudes=24, int cull=0);
void surface_rev(double f(double),
double t_min, double t_max,
int latitudes, int longitudes=24, int cull=0);
// or about the specified axis, with specified angle range
void surface_rev(double f(double), double g(double),
const domain& R, const frame& coords=frame(), int cull=0);
//// location-colored versions ////
void surface(P F(double, double), const domain& R,
P color(double, double, double), int cull=0);
// for slices of maps R^3 -> R^3
void surface(P F(double, double, double), const domain& R,
P color(double, double, double), int cull=0);
// plot multiple slices
void surface(P F(double, double, double), const domain_list& R,
P color(double, double, double), int cull=0);
// Surface from revolving the curve (f(t),g(t)) about the x-axis...
void surface_rev(double f(double), double g(double),
double t_min, double t_max,
int latitudes, int longitudes,
P color(double, double, double), int cull=0);
void surface_rev(double f(double),
double t_min, double t_max,
int latitudes, int longitudes,
P color(double, double, double), int cull=0);
// or about the specified axis, with specified angle range
void surface_rev(double f(double), double g(double),
const domain& R, P color(double, double, double),
const frame& coords=frame(), int cull=0);
//// domain-colored versions ////
void surface(P F(double, double), const domain& R,
P color(double, double), int cull=0);
// for slices of maps R^3 -> R^3
void surface(P F(double, double, double), const domain& R,
P color(double, double), int cull=0);
// plot multiple slices
void surface(P F(double, double), const domain_list& R,
P color(double, double, double), int cull=0);
// Surface from revolving the curve (f(t),g(t)) about the x-axis...
void surface_rev(double f(double), double g(double),
double t_min, double t_max,
int latitudes, int longitudes,
P color(double, double), int cull=0);
void surface_rev(double f(double),
double t_min, double t_max,
int latitudes, int longitudes,
P color(double, double), int cull=0);
// or about the specified axis, with specified angle range
void surface_rev(double f(double), double g(double),
const domain& R, P color(double, double),
const frame& coords=frame(), int cull=0);
} // end of namespace ePiX
/*
* data_mask.h -- ePiX::data_mask, for selective row removal from data_file
*
* This file is part of ePiX, a C++ library for creating high-quality
* figures in LaTeX
*
* Version 1.1.6
* Last Change: July 3, 2007
*/
/*
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
* Andrew D. Hwang <rot 13 nujnat at zngupf dot ubylpebff dot rqh>
* Department of Mathematics and Computer Science
* College of the Holy Cross
* Worcester, MA, 01610-2395, USA
*/
/*
* ePiX is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ePiX is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ePiX; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef EPIX_DATA_MASK
#define EPIX_DATA_MASK
namespace ePiX {
class data_mask {
public:
data_mask(std::string);
data_mask(std::string, double f(double));
data_mask(const interval& range);
data_mask(const interval& range, double f(double));
data_mask(double range_min, double range_max);
data_mask(double range_min, double range_max,
double f(double));
data_mask& reverse(); // negate mask criterion
bool masks(double) const; // true if we mask arg
private:
interval m_range;
double (*m_filter)(double); // filter criterion
bool m_reverse;
}; // end of data_mask
} // end of namespace
#endif /* EPIX_DATA_MASK */
/*
* data_file.h -- ePiX::data_file class
*
* This file is part of ePiX, a C++ library for creating high-quality
* figures in LaTeX
*
* Version 1.1.6
* Last Change: July 04, 2007
*/
/*
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
* Andrew D. Hwang <rot 13 nujnat at zngupf dot ubylpebff dot rqh>
* Department of Mathematics and Computer Science
* College of the Holy Cross
* Worcester, MA, 01610-2395, USA
*/
/*
* ePiX is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ePiX is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ePiX; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef EPIX_DATA_FILE
#define EPIX_DATA_FILE
namespace ePiX {
class data_bins;
class data_mask;
class interval;
class data_file {
public:
explicit data_file(unsigned int n=2);
// get size from first line of file;
// provide two versions to avoid exposing default delim/commt strings
data_file(const char* filename,
const std::string& delim, const std::string& commt);
explicit data_file(const char* filename);
// file made from components
data_file(double f(double),
double t_min, double t_max, unsigned int num_pts);
data_file(double f1(double), double f2(double),
double t_min, double t_max, unsigned int num_pts);
data_file(double f1(double), double f2(double), double f3(double),
double t_min, double t_max, unsigned int num_pts);
// input
data_file& read(const char*);
// transform column(s)
data_file& transform(double f(double), unsigned int col=0);
// apply f to selected columns; components of image go back to columns
data_file& transform(P f(double, double),
unsigned int col1=1, unsigned int col2=2);
data_file& transform(P f(double, double, double),
unsigned int col1, unsigned int col2);
data_file& transform(P f(double, double, double),
unsigned int col1,
unsigned int col2,
unsigned int col3);
// remove rows where specified entry is masked or outside interval/range
data_file& prune(const data_mask&, const unsigned int col);
data_file& prune(const interval&, const unsigned int col);
data_file& prune(double, double, const unsigned int col);
// basic statistical operations on columns
double dot(unsigned int col1, unsigned int col2) const; // dot product
double avg(unsigned int col1) const; // mean
double var(unsigned int col1) const; // |x|^2 - n*avg^2
double covar(unsigned int col1, unsigned int col2) const;
void regression(unsigned int col1, unsigned int col2) const;
// output functions
// extract column
std::vector<double> column(unsigned int) const;
// apply f to values
std::vector<double> column(double f(double), unsigned int) const;
// set C++ output precision for write
void precision(unsigned int n=6) const;
// Setters and getters for delimiter and comment character
void delimiter(const char* delim) { m_delim = delim; }
std::string delimiter() const { return m_delim; }
void comment(const char* commt) { m_commt = commt; }
std::string comment() const { return m_commt; }
// write raw data to file
void write(const char* filename) const;
// write selected columns formatted by string-valued function
void write(const char* filename, std::string pt_out(double, double),
unsigned int col1=1, unsigned int col2=2) const;
// LaTeX tabular environment
void tabular(const char* filename,
const std::string& alignment,
const std::string& legend="") const;
/*
// (un)set cropping criterion for plotting
void select(bool Fsel(P));
void select(const selection&); // e.g. select(all());
*/
// scatter plots; f applied to selected columns
void plot(epix_mark_type TYPE,
unsigned int col1=1, unsigned int col2=2, unsigned int col3=0,
P f(double, double, double) = xyz) const;
void plot(epix_mark_type TYPE, P f(double, double, double),
unsigned int col1=1, unsigned int col2=2,
unsigned int col3=0) const;
private:
std::vector<double> tokenise(std::string line);
unsigned int entries(const char* filename);
mutable unsigned int m_precision;
// selection m_select;
std::vector<std::vector<double> > m_data;
std::string m_delim; // Field delimiter
std::string m_commt; // Comment character
}; // end of class data_file
//// Global functions that use file_data, data_bins ////
void plot(const char* filename, epix_mark_type TYPE,
unsigned int col1=1, unsigned int col2=2, unsigned int col3=0,
P f(double, double, double) = xyz);
void plot(const char* filename, epix_mark_type TYPE,
P f(double, double, double),
unsigned int col1=1, unsigned int col2=2, unsigned int col3=0);
// pass 3rd arg by value
void histogram(const char* filename, unsigned int col, data_bins,
double scale=1);
void bar_chart(const char* filename, unsigned int col, data_bins,
double scale=1);
} // end of namespace
#endif /* EPIX_DATA_FILE */
/*
* data_bins.h -- ePiX::data_bins class for histogram data
*
* This file is part of ePiX, a C++ library for creating high-quality
* figures in LaTeX
*
* Version 1.1.19
* Last Change: September 17, 2007
*/
/*
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
* Andrew D. Hwang <rot 13 nujnat at zngupf dot ubylpebff dot rqh>
* Department of Mathematics and Computer Science
* College of the Holy Cross
* Worcester, MA, 01610-2395, USA
*/
/*
* ePiX is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ePiX is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ePiX; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* This file provides the "data_bins" class.
*
* An object of type data_bins models a closed interval [lo, hi]
* divided into subintervals (not necessarily of equal length). Each
* subinterval is a "d_bin", whose endpoints are "cuts". A data_bins
* can read and sort numerical data, count how many numbers lie in
* each bin, and print the result as a bar chart (rectangle height
* proportional to population), histogram (area proportional to
* population), or as a spline interpolation.
*
* Ideally no data lies outside (lo, hi) or on a cut. Data on an end
* cut is "out of range", data on an interior cut contributes 1/2 to
* the population of each adjacent bin. A summary statistic warning is
* printed if any points are out of range or lie on a cut.
*/
#ifndef EPIX_DATA_BINS
#define EPIX_DATA_BINS
namespace ePiX {
class d_bin;
class data_bins {
public:
data_bins(double lo, double hi, unsigned int n=1);
data_bins(const data_bins&);
data_bins& operator= (const data_bins&);
~data_bins();
data_bins& cut(double); // add a cut
data_bins& read(const std::vector<double>&);
unsigned int pop() const; // current population
// draw rectangles
void histogram(double scale=1) const; // area prop to pop
void bar_chart(double scale=1) const; // height prop to pop
void plot(double scale=1) const; // smooth interpolation
private:
double m_lo_val;
double m_hi_val;
unsigned int m_lo_ct; // population smaller than m_lo_val
unsigned int m_hi_ct; // population larger than m_hi_val
unsigned int m_pop; // current total population
unsigned int m_cut_hits; // number of data on a cut
bool m_cuts_locked; // true once we read data
std::list<double> m_cuts;
std::list<d_bin*> m_bins;
// bookkeeping
void initialize(); // convert cuts to bins and lock
void insert(double); // add data point
}; // end of class data_bins
} // end of namespace
#endif /* EPIX_DATA_BINS */
/*
* geometry.h
*
* This file is part of ePiX, a preprocessor for creating high-quality
* line figures in LaTeX
*
* Version 1.1.6
* Last Change: June 28, 2007
*/
/*
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
* Andrew D. Hwang <rot 13 nujnat at zngupf dot ubylpebff dot rqh>
* Department of Mathematics and Computer Science
* College of the Holy Cross
* Worcester, MA, 01610-2395, USA
*/
/*
* ePiX is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ePiX is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ePiX; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef EPIX_GEOMETRY
#define EPIX_GEOMETRY
namespace ePiX {
class P;
// latitude, longitude lines with hiding
void latitude(double lat, double long_min, double long_max,
const Sphere& S=Sphere(), const frame& coords=frame());
void longitude(double lngtd, double lat_min, double lat_max,
const Sphere& S=Sphere(), const frame& coords=frame());
void back_latitude(double lat, double long_min, double long_max,
const Sphere& S=Sphere(), const frame& coords=frame());
void back_longitude(double lngtd, double lat_min, double lat_max,
const Sphere& S=Sphere(), const frame& coords=frame());
// stereographic projection; path first projected vertically
void frontplot_N(double f1(double), double f2(double),
double t_min, double t_max, int num_pts,
const Sphere& S = Sphere());
void backplot_N(double f1(double), double f2(double),
double t_min, double t_max, int num_pts,
const Sphere& S = Sphere());
void frontplot_S(double f1(double), double f2(double),
double t_min, double t_max, int num_pts,
const Sphere& S = Sphere());
void backplot_S(double f1(double), double f2(double),
double t_min, double t_max, int num_pts,
const Sphere& S = Sphere());
// Radial projection from center
void frontplot_R(P phi(double), double t_min, double t_max,
int num_pts, const Sphere& S = Sphere());
void backplot_R(P phi(double), double t_min, double t_max,
int num_pts, const Sphere& S = Sphere());
// All sphere line functions treat point arguments as unscaled
// displacements from the center of the sphere, not as absolute
// spatial locations. If the center or radius of the sphere
// changes, the line automatically adjusts as expected.
// front portion of spherical segment joining p1 to p2
void front_arc(const P& p1, const P& p2, const Sphere& S = Sphere());
void back_arc(const P& p1, const P& p2, const Sphere& S = Sphere());
// half-line joining p1 to -p1 through p2
void front_arc2(const P&, const P&, const Sphere& S=Sphere());
void back_arc2(const P&, const P&, const Sphere& S=Sphere());
// great circle through p1 and p2
void front_line(const P&, const P&, const Sphere& S=Sphere());
void back_line(const P&, const P&, const Sphere& S=Sphere());
void front_triangle(const P&, const P&, const P&, const Sphere& S=Sphere());
void back_triangle(const P&, const P&, const P&, const Sphere& S=Sphere());
// spherical polyhedra
void front_tetra(const Sphere& S=Sphere(), const frame& coords=frame());
void back_tetra(const Sphere& S=Sphere(), const frame& coords=frame());
void front_cube(const Sphere& S=Sphere(), const frame& coords=frame());
void back_cube(const Sphere& S=Sphere(), const frame& coords=frame());
void front_octa(const Sphere& S=Sphere(), const frame& coords=frame());
void back_octa(const Sphere& S=Sphere(), const frame& coords=frame());
void front_dodeca(const Sphere& S=Sphere(), const frame& coords=frame());
void back_dodeca(const Sphere& S=Sphere(), const frame& coords=frame());
void front_icosa(const Sphere& S=Sphere(), const frame& coords=frame());
void back_icosa(const Sphere& S=Sphere(), const frame& coords=frame());
// Hyperbolic lines
void hyperbolic_line (const P&, const P&);
void disk_line (const P&, const P&);
} // end of namespace
#endif /* EPIX_GEOMETRY */
#endif /* EPIX_H */
|