summaryrefslogtreecommitdiff
path: root/graphics/sketch/Doc/sketch.html
blob: 59c51f46def34bfcd255df2714a8a532e2780b31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
<html lang="en">
<head>
<title>Sketch</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Sketch">
<meta name="generator" content="makeinfo 4.7">
<link title="Top" rel="top" href="#Top">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 2005, 2006, 2007, 2008 Eugene K. Ressler.

This manual is for `sketch', version 0.2 (build 131),
Saturday, August 09, 2008, a program that converts descriptions of simple
three-dimensional scenes into static drawings. This version generates
`PSTricks' or `PGF/TikZ' code suitable for use with the
TeX document processing system.

`Sketch' 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 3, or (at your option)
any later version.

Sketch 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 `sketch'; see the file COPYING.txt.  If not, see
http://www.gnu.org/copyleft.-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc { font-variant:small-caps }
  span.roman { font-family: serif; font-weight: normal; } 
--></style>
</head>
<body>
<h1 class="settitle">Sketch</h1>
   <div class="contents">
<h2>Table of Contents</h2>
<ul>
<li><a name="toc_Top" href="#Top">Sketch</a>
<li><a name="toc_About-sketch" href="#About-sketch">1 About sketch</a>
<ul>
<li><a href="#Reporting-bugs">1.1 Reporting bugs and recommending improvements.</a>
<li><a href="#Contributions">1.2 Contributions</a>
</li></ul>
<li><a name="toc_Introduction-by-example" href="#Introduction-by-example">2 Introduction by example</a>
<ul>
<li><a href="#Hello-world">2.1 Hello world</a>
<li><a href="#Drawing-options">2.2 Options</a>
<li><a href="#Drawing-a-solid">2.3 Drawing a solid</a>
<li><a href="#Special-objects">2.4 Special objects</a>
<li><a href="#Object-transforms">2.5 Transforms</a>
<li><a href="#Repeated-objects">2.6 Repeated objects</a>
<li><a href="#Swept-objects">2.7 Swept objects</a>
<ul>
<li><a href="#Point-sweeps">2.7.1 Point sweeps</a>
<li><a href="#Polyline-sweeps">2.7.2 Polyline sweeps</a>
<li><a href="#Nested-sweeps">2.7.3 Nested sweeps</a>
<li><a href="#Polygon-sweeps">2.7.4 Polygon sweeps</a>
<li><a href="#Polyline-sweeps-with-closure">2.7.5 Polyline sweeps with closure</a>
<li><a href="#Affine-arithmetic">2.7.6 Affine arithmetic</a>
<li><a href="#More-to-learn">2.7.7 More to learn</a>
</li></ul>
</li></ul>
<li><a name="toc_Input-language" href="#Input-language">3 Input language</a>
<ul>
<li><a href="#Language-basics">3.1 Basics</a>
<ul>
<li><a href="#Identifiers">3.1.1 Identifiers</a>
<li><a href="#Key-and-reserved-words">3.1.2 Key and reserved words</a>
<li><a href="#Literals">3.1.3 Literals</a>
<ul>
<li><a href="#Scalar-literals">3.1.3.1 Scalar literals</a>
<li><a href="#Point-and-vector-literals">3.1.3.2 Point and vector literals</a>
<li><a href="#Transform-literals">3.1.3.3 Transform literals</a>
</li></ul>
<li><a href="#Arithmetic">3.1.4 Arithmetic expressions</a>
<ul>
<li><a href="#Two_002doperand-_0028binary_0029-forms">3.1.4.1 Two-operand (binary) forms and precedence</a>
<li><a href="#Unary-forms">3.1.4.2 Unary forms</a>
</li></ul>
<li><a href="#Options">3.1.5 Options</a>
<ul>
<li><a href="#PSTricks-options">3.1.5.1 <code>PSTricks</code> options</a>
<li><a href="#TikZ_002fPGF-options">3.1.5.2 <code>TikZ/PGF</code> options</a>
<li><a href="#Dots-in-TikZ_002fPGF">3.1.5.3 Dots in <code>TikZ/PGF</code></a>
<li><a href="#TikZ_002fPGF-user_002ddefined-styles">3.1.5.4 <code>TikZ/PGF</code> user-defined styles</a>
<li><a href="#Transparency">3.1.5.5 Transparency</a>
<li><a href="#Internal-options">3.1.5.6 Internal options</a>
</li></ul>
<li><a href="#Internal-options">3.1.6 Point lists</a>
</li></ul>
<li><a href="#Drawables">3.2 Drawables</a>
<ul>
<li><a href="#Dots">3.2.1 Dots</a>
<li><a href="#Lines">3.2.2 Lines</a>
<li><a href="#Curves">3.2.3 Curves</a>
<li><a href="#Polygons">3.2.4 Polygons</a>
<li><a href="#Specials">3.2.5 Specials</a>
<li><a href="#Sweeps">3.2.6 Sweeps</a>
<ul>
<li><a href="#Swept-points">3.2.6.1 Swept points</a>
<li><a href="#Swept-lines">3.2.6.2 Swept lines</a>
<li><a href="#Swept-polygons">3.2.6.3 Swept polygons</a>
<li><a href="#Swept-blocks">3.2.6.4 Swept blocks</a>
<li><a href="#Sweep-face-splitting">3.2.6.5 Sweep face splitting</a>
</li></ul>
<li><a href="#Blocks">3.2.7 Blocks</a>
<li><a href="#Repeats">3.2.8 Repeats</a>
<li><a href="#Puts">3.2.9 Puts</a>
</li></ul>
<li><a href="#Definitions">3.3 Definitions</a>
<ul>
<li><a href="#Forms-of-definitions">3.3.1 Forms of definitions</a>
<li><a href="#Forms-of-references">3.3.2 Forms of references</a>
</li></ul>
<li><a href="#Global-environment">3.4 Global environment</a>
<ul>
<li><a href="#Global-options">3.4.1 Global options</a>
<li><a href="#Camera">3.4.2 Camera</a>
<li><a href="#Picture-box">3.4.3 Picture box</a>
<li><a href="#Frame">3.4.4 Frame</a>
<li><a href="#Language">3.4.5 Language</a>
</li></ul>
</li></ul>
<li><a name="toc_Building-a-drawing" href="#Building-a-drawing">4 Building a drawing</a>
<ul>
<li><a href="#Overview">4.1 Overview</a>
<li><a href="#A-technical-drawing">4.2 A technical drawing</a>
<li><a href="#A-hierarchical-model">4.3 A hierarchical model</a>
<li><a href="#Caveats">4.4 Caveats</a>
<ul>
<li><a href="#Limits-on-error-detection">4.4.1 Limits on <code>sketch</code> error detection</a>
<li><a href="#Clipping">4.4.2 Clipping</a>
<li><a href="#Hidden-surface-removal">4.4.3 Hidden surface removal and polygon splitting</a>
<ul>
<li><a href="#Statistics">4.4.3.1 Statistics</a>
<li><a href="#Bugs-and-anomalies">4.4.3.2 Bugs and anomalies</a>
</li></ul>
</li></ul>
</li></ul>
<li><a name="toc_Command-line" href="#Command-line">5 Command line</a>
<li><a name="toc_Installing-sketch" href="#Installing-sketch">6 Building and installing <code>sketch</code></a>
<li><a name="toc_Index-of-syntax" href="#Index-of-syntax">Index of syntax</a>
<li><a name="toc_Index" href="#Index">Index of concepts</a>
</li></ul>
</div>



<div class="node">
<p><hr>
<a name="Top"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#About-sketch">About sketch</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#dir">(dir)</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#dir">(dir)</a>
<br>
</div>

<h2 class="unnumbered">Sketch</h2>

<p>Copyright &copy; 2005, 2006, 2007, 2008 Eugene K. Ressler.

   <p>This manual is for <code>sketch</code>, version 0.2 (build 131),
Saturday, August 09, 2008, a program that converts descriptions of simple
three-dimensional scenes into static drawings. This version generates
<code>PSTricks</code> or <code>PGF/TikZ</code> code suitable for use with the
TeX document processing system.

   <p><code>Sketch</code> 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 3, or (at your option)
any later version.

   <p>Sketch 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.

   <p>You should have received a copy of the GNU General Public License
along with <code>sketch</code>; see the file COPYING.txt.  If not, see
<tt>http://www.gnu.org/copyleft</tt>.

<ul class="menu">
<li><a accesskey="1" href="#About-sketch">About sketch</a>:                 Why sketch exists and what it does. 
<li><a accesskey="2" href="#Introduction-by-example">Introduction by example</a>:      Most features shown as working code. 
<li><a accesskey="3" href="#Input-language">Input language</a>:               Syntax and semantics of <code>sketch</code> commands. 
<li><a accesskey="4" href="#Building-a-drawing">Building a drawing</a>:           How to use <code>sketch</code> productively. 
<li><a accesskey="5" href="#Command-line">Command line</a>:                 Options and their usage. 
<li><a accesskey="6" href="#Installing-sketch">Installing sketch</a>:            Building and installing from sources. 
<li><a accesskey="7" href="#Index-of-syntax">Index of syntax</a>
<li><a accesskey="8" href="#Index">Index</a>

</li></ul>
<p>--- The Detailed Node Listing ---

<p>About sketch

</p>
<ul class="menu">
<li><a accesskey="9" href="#Reporting-bugs">Reporting bugs</a>:               Let use know what's wrong! 
<li><a href="#Contributions">Contributions</a>:                How you can help....

</li></ul>
<p>Introduction by example

</p>
<ul class="menu">
<li><a href="#Hello-world">Hello world</a>:                  Simplest possible <code>sketch</code> program. 
<li><a href="#Drawing-options">Drawing options</a>:              Controlling object appearance. 
<li><a href="#Drawing-a-solid">Drawing a solid</a>:              Drawing an object with 3d appearance. 
<li><a href="#Special-objects">Special objects</a>:              Laying TeX over, in, or under drawings. 
<li><a href="#Object-transforms">Object transforms</a>:            Rotate, translate, scale, and others. 
<li><a href="#Repeated-objects">Repeated objects</a>:             Making transformed copies. 
<li><a href="#Swept-objects">Swept objects</a>:                Sweeping objects in space to make new shapes.

</li></ul>
<p>Swept objects

</p>
<ul class="menu">
<li><a href="#Point-sweeps">Point sweeps</a>:                 Swept points make lines and polygons. 
<li><a href="#Polyline-sweeps">Polyline sweeps</a>:              Swept lines make surfaces. 
<li><a href="#Nested-sweeps">Nested sweeps</a>:                Swept sweeps are useful! 
<li><a href="#Polygon-sweeps">Polygon sweeps</a>:               Swept polygons make solids... 
<li><a href="#Polyline-sweeps-with-closure">Polyline sweeps with closure</a>:   and so do closed polyline sweeps. 
<li><a href="#Affine-arithmetic">Affine arithmetic</a>:            Sketch useful math expression. 
<li><a href="#More-to-learn">More to learn</a>:                Check out the Mobius strip!

</li></ul>
<p>Input language

</p>
<ul class="menu">
<li><a href="#Language-basics">Language basics</a>:              Case, space, comments, include files. 
<li><a href="#Drawables">Drawables</a>:                    Things that can be drawn. 
<li><a href="#Definitions">Definitions</a>:                  Giving things names. 
<li><a href="#Global-environment">Global environment</a>:           Affect the entire drawing.

</li></ul>
<p>Basics

</p>
<ul class="menu">
<li><a href="#Identifiers">Identifiers</a>:                  Names for things. 
<li><a href="#Key-and-reserved-words">Key and reserved words</a>:       Names you shouldn't use. 
<li><a href="#Literals">Literals</a>:                     Constants and constructors. 
<li><a href="#Arithmetic">Arithmetic</a>:                   Rules for expressions. 
<li><a href="#Options">Options</a>:                      Modifying object appearance.

</li></ul>
<p>Literals

</p>
<ul class="menu">
<li><a href="#Scalar-literals">Scalar literals</a>:              Just the numbers. 
<li><a href="#Point-and-vector-literals">Point and vector literals</a>:    3d quantities. 
<li><a href="#Transform-literals">Transform literals</a>:           Matrix form.

</li></ul>
<p>Arithmetic expressions

</p>
<ul class="menu">
<li><a href="#Two_002doperand-_0028binary_0029-forms">Two-operand (binary) forms</a>:   A op B
<li><a href="#Unary-forms">Unary forms</a>:                  op A (and others)

</li></ul>
<p>Options

</p>
<ul class="menu">
<li><a href="#PSTricks-options">PSTricks options</a>:             Options inherited from <code>PSTricks</code>. 
<li><a href="#TikZ_002fPGF-options">TikZ/PGF options</a>:             Options inherited from <code>TikZ/PGF</code>. 
<li><a href="#Dots-in-TikZ_002fPGF">Dots in TikZ/PGF</a>:             Sketch uses <code>TikZ/PGF</code> circles for dots. 
<li><a href="#TikZ_002fPGF-user_002ddefined-styles">TikZ/PGF user-defined styles</a>:   Support for <code>TikZ/PGF</code> named, user-defined styles. 
<li><a href="#Transparency">Transparency</a>:                 See-through polygons. 
<li><a href="#Internal-options">Internal options</a>:             Options used by <code>sketch</code>.

</li></ul>
<p>Point lists

</p>
<ul class="menu">
<li><a href="#Drawables">Drawables</a>:                    Things that are drawn. 
<li><a href="#Definitions">Definitions</a>:                  Things with names.

</li></ul>
<p>Drawables

</p>
<ul class="menu">
<li><a href="#Dots">Dots</a>:                         Draw dots. 
<li><a href="#Lines">Lines</a>:                        Draw polylines. 
<li><a href="#Curves">Curves</a>:                       Draw curves. 
<li><a href="#Polygons">Polygons</a>:                     Draw polygons. 
<li><a href="#Specials">Specials</a>:                     Embed raw LaTeX and <code>PSTricks</code>. 
<li><a href="#Sweeps">Sweeps</a>:                       Draw sweeps of dots and polylines. 
<li><a href="#Blocks">Blocks</a>:                       Group other drawables. 
<li><a href="#Repeats">Repeats</a>:                      Draw transformed copies of objects. 
<li><a href="#Puts">Puts</a>:                         Draw one object transformed.

</li></ul>
<p>Sweeps

</p>
<ul class="menu">
<li><a href="#Swept-points">Swept points</a>:                 Swept points make lines or polygons. 
<li><a href="#Swept-lines">Swept lines</a>:                  Swept lines make open or closed surfaces. 
<li><a href="#Swept-polygons">Swept polygons</a>:               Swept polygons make closed surfaces. 
<li><a href="#Swept-blocks">Swept blocks</a>:                 Swept block == block of sweeps. 
<li><a href="#Sweep-face-splitting">Sweep face splitting</a>:         Fixing warped faces with triangles.

</li></ul>
<p>Definitions

</p>
<ul class="menu">
<li><a href="#Forms-of-definitions">Forms of definitions</a>:         Different defs for different purposes. 
<li><a href="#Forms-of-references">Forms of references</a>:          How references denote types.

</li></ul>
<p>Global environment

</p>
<ul class="menu">
<li><a href="#Global-options">Global options</a>:               Attributes of the entire drawing. 
<li><a href="#Camera">Camera</a>:                       A final camera transformation of the scene. 
<li><a href="#Picture-box">Picture box</a>:                  Setting the bounding box and 2d clipping. 
<li><a href="#Frame">Frame</a>:                        Adding a box around the drawing. 
<li><a href="#Language">Language</a>:                     Setting the output language.

</li></ul>
<p>Building a drawing

</p>
<ul class="menu">
<li><a href="#Overview">Overview</a>:                     Building a substantial drawing. 
<li><a href="#A-technical-drawing">A technical drawing</a>:          An example with fine placement. 
<li><a href="#A-hierarchical-model">A hierarchical model</a>:         An example with sweeps and puts. 
<li><a href="#Caveats">Caveats</a>:                      Where trouble can occur.

</li></ul>
<p>Caveats

</p>
<ul class="menu">
<li><a href="#Limits-on-error-detection">Limits on error detection</a>:    What sketch doesn't do. 
<li><a href="#Clipping">Clipping</a>:                     No clipping at present. 
<li><a href="#Hidden-surface-removal">Hidden surface removal</a>:       Imperfections to fix.

</li></ul>
<p>Hidden surface removal and polygon splitting

</p>
<ul class="menu">
<li><a href="#Statistics">Statistics</a>:                   Performance numbers on depth sort. 
<li><a href="#Bugs-and-anomalies">Bugs and anomalies</a>:           Imperfections in this implementation.

   </ul>

<div class="node">
<p><hr>
<a name="About-sketch"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Introduction-by-example">Introduction by example</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Top">Top</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h2 class="chapter">1 About sketch</h2>

<ul class="menu">
<li><a accesskey="1" href="#Reporting-bugs">Reporting bugs</a>:               Let use know what's wrong! 
<li><a accesskey="2" href="#Contributions">Contributions</a>:                How you can help.... 
</ul>

<p><code>Sketch</code> is a small, simple system for producing line drawings of
two- or three-dimensional objects and scenes.  It began as a way to
make illustrations for a textbook after we could find no suitable
tool for this purpose.  Existing scene processors emphasized GUIs
and/or photo-realism, both un-useful to us.  We wanted to produce
finely wrought, mathematically-based illustrations with no extraneous
detail.

   <p><code>Sketch</code> accepts a tiny scene description language and generates
<code>PSTricks</code> or <code>TikZ/PGF</code> code for LaTeX.  The
<code>sketch</code> language is similar to <code>PSTricks</code>, making it easy
to learn for current <code>PSTricks</code> users.  See
<a name="index-PSTricks-1"></a><tt>www.pstricks.de</tt> for information on <code>PSTricks</code>. 
<code>TikZ/PGF</code> are also very similar except for details of syntax. 
See
<a name="index-TikZ_002fPGF-2"></a><tt>http://sourceforge.net/projects/pgf</tt>.  One can easily lay raw
<code>PSTricks</code> or <code>TikZ/PGF</code> output over, in, or under
<code>sketch</code> drawings, providing the full power of LaTeX text and
mathematics formatting in a three-dimensional setting.

<div class="node">
<p><hr>
<a name="Reporting-bugs"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Contributions">Contributions</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#About-sketch">About sketch</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#About-sketch">About sketch</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h3 class="section">1.1 Reporting bugs and recommending improvements.</h3>

<p>Send bug reports and suggestions to <tt>sketch@frontiernet.net</tt>. 
We will try to respond, but can't promise.  In any event, don't be
offended if a reply is not forthcoming.  We're just busy and will get
to your suggestion eventually.

   <p>For bugs, attach a <code>sketch</code> input file that causes the bad
behavior.  Embed comments that explain what to look for in
the behavior of <code>sketch</code> or its output.

   <p>A recommendation for improvement from one unknown person counts as one
vote. We use overall vote tallies to decide what to do next as
resources permit.  We reserve the right to a assign any number of votes
to suggestions from people who have been helpful and supportive in the
past.

<div class="node">
<p><hr>
<a name="Contributions"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="#Reporting-bugs">Reporting bugs</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#About-sketch">About sketch</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h3 class="section">1.2 Contributions</h3>

<p>If you intend to implement an enhancement of your own, that's
terrific!  Consider collaborating with us first to see if we're
already working on your idea or if we can use your work in the
official release.

<div align="center"><img src="ex000.png" alt="ex000.png"></div>
   <p><a name="Solid-coil-example"></a>

<div class="node">
<p><hr>
<a name="Introduction-by-example"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Input-language">Input language</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#About-sketch">About sketch</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h2 class="chapter">2 Introduction by example</h2>

<p>The <code>sketch</code> input language will seem familiar to users of the
<code>PSTricks</code> package for LaTeX.  The following program draws a
triangular polygon pierced by a line.
<pre class="verbatim">
  polygon(0,0,1)(1,0,0)(0,1,0)
  line(-1,-1,-1)(2,2,2)
</pre>
The coordinate system
<a name="index-coordinate-system_002c-right_002dhanded-3"></a><a name="index-right_002dhand-coordinate-system-4"></a>is a standard right-handed Cartesian one.

<div align="center"><img src="ex010.png" alt="ex010.png"></div>

<ul class="menu">
<li><a accesskey="1" href="#Hello-world">Hello world</a>:                  Simplest possible <code>sketch</code> program. 
<li><a accesskey="2" href="#Drawing-options">Drawing options</a>:              Controlling object appearance. 
<li><a accesskey="3" href="#Drawing-a-solid">Drawing a solid</a>:              Drawing an object with 3d appearance. 
<li><a accesskey="4" href="#Special-objects">Special objects</a>:              Laying TeX over, in, or under drawings. 
<li><a accesskey="5" href="#Object-transforms">Object transforms</a>:            Rotate, translate, scale, and others. 
<li><a accesskey="6" href="#Repeated-objects">Repeated objects</a>:             Making transformed copies. 
<li><a accesskey="7" href="#Swept-objects">Swept objects</a>:                Sweeping objects in space to make new shapes. 
</ul>

<div class="node">
<p><hr>
<a name="Hello-world"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Drawing-options">Drawing options</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Introduction-by-example">Introduction by example</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Introduction-by-example">Introduction by example</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h3 class="section">2.1 Hello world</h3>

<p>The <code>sketch</code> program above is nearly the simplest one possible,
the equivalent of a &ldquo;hello world&rdquo;
<a name="index-hello-world-5"></a><a name="index-program_002c-hello-world-6"></a>program you might find at the start of a programming language text. 
If it is saved in the file <span class="file">simple.sk</span>, then the command
<a name="index-command-line_002c-_0040code_007bsketch_007d-7"></a><a name="index-running-_0040code_007bsketch_007d-8"></a>
<pre class="verbatim">
  sketch simple.sk -o simple.tex
</pre>
creates a file <span class="file">simple.tex</span> containing <code>PSTricks</code> commands to
draw these objects on paper.  The contents of <span class="file">simple.tex</span>
look like this.
<pre class="verbatim">
  \begin{pspicture}(-1,-1)(2,2)
  \pstVerb{1 setlinejoin}
  \psline(-1,-1)(.333,.333)
  \pspolygon[fillstyle=solid,fillcolor=white](0,0)(1,0)(0,1)
  \psline(.333,.333)(2,2)
  \end{pspicture}
</pre>
The hidden surface algorithm
<a name="index-hidden-surface-algorithm-9"></a>of <code>sketch</code> has split
<a name="index-splitting_002c-line-and-surface-10"></a>the line into
two pieces and ordered the three resulting objects so that the correct
portion of the line is hidden.

   <p>If you've noticed that the projection we are using seems equivalent to
erasing the z-coordinate of the three-dimensional input points,
pat yourself on the back.  You are correct.  This is called a
<dfn>parallel projection</dfn>. 
<a name="index-parallel-projection-11"></a><a name="index-projection_002c-parallel-12"></a>The z-coordinate axis is pointing straight out of the paper at
us, while the x- and y-axes point to the right and up as
usual.

   <p>The resulting picture file can be included in a LaTeX document with
<tt>\input{simple}</tt>.  Alternately, adding the command line option
<span class="option">-T</span><a rel="footnote" href="#fn-1" name="fnd-1"><sup>1</sup></a>
<a name="index-command-line-option-13"></a><a name="index-option_002c-command-line-14"></a>causes the <code>pspicture</code> to be wrapped in a short
but complete document, ready to run though LaTeX. 
<a name="index-document-template-15"></a><a name="index-template_002c-document-16"></a>In a finished, typeset document, the picture looks like this.  (The
axes have been added in light gray.)

<div align="center"><img src="ex020.png" alt="ex020.png"></div>

<p class="noindent">It is important to know that only the &ldquo;outside&rdquo;
<a name="index-outside-of-a-polygon-17"></a><a name="index-polygon_002c-outside-of-18"></a>of a polygon is
normally drawn.  The <dfn>outside</dfn> is where the vertices given in the
<code>polygon</code>
<a name="index-polygon-19"></a>command appear in <em>counter-clockwise</em>
<a name="index-counter_002dclockwise-polygon-vertex-order-20"></a><a name="index-polygon-vertex-order-21"></a><a name="index-order_002c-polygon-vertex-22"></a>order.  Thus, if the command above had been
<pre class="verbatim">
  polygon(0,1,0)(1,0,0)(0,0,1)
</pre>
the polygon would not appear in the picture at all.  It would have
been <dfn>culled</dfn>
<a name="index-culling-23"></a>from the scene.  This culling behavior may seem
strange, but stay tuned.

<div class="node">
<p><hr>
<a name="Drawing-options"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Drawing-a-solid">Drawing a solid</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Hello-world">Hello world</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Introduction-by-example">Introduction by example</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h3 class="section">2.2 Options</h3>

<p>Many <code>PSTricks</code> and <code>TikZ/PGF</code> options
<a name="index-option-24"></a>work just fine in <code>sketch</code>. If generating <code>PSTricks</code>, the code
<a name="index-line-25"></a>
<pre class="verbatim">
  polygon[fillcolor=lightgray,linewidth=3pt](0,0,1)(1,0,0)(0,1,0)
  line[linestyle=dotted](-1,-1,-1)(2,2,2)
</pre>
produces

<div align="center"><img src="ex030.png" alt="ex030.png"></div>

   <p>To produce <code>TikZ/PGF</code>, the corresponding code is
<pre class="verbatim">
  polygon[fill=lightgray,line width=3pt](0,0,1)(1,0,0)(0,1,0)
  line[style=dotted](-1,-1,-1)(2,2,2)
  global { language tikz }
</pre>
The final <code>global</code>
<a name="index-options_002c-global-26"></a><a name="index-global-options-27"></a>instructs <code>sketch</code> to produce <code>TikZ/PGF</code> code as output
rather than the default, <code>PSTricks</code>.  Note that <code>polygon</code>
fill color and <code>line</code> style options both conform to <code>TikZ</code>
syntax rules.  The remaining examples of this manual are in PSTricks
style.

<div class="node">
<p><hr>
<a name="Drawing-a-solid"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Special-objects">Special objects</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Drawing-options">Drawing options</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Introduction-by-example">Introduction by example</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h3 class="section">2.3 Drawing a solid</h3>

<p>Let's try something more exciting.  <code>Sketch</code> has no notion of a
solid,
<a name="index-solid-28"></a>but polygonal <dfn>faces</dfn>
<a name="index-faces-29"></a>can be used to represent the
boundary of a solid.  To the previous example, let's add three more
triangular polygons to make the faces of an irregular tetrahedron. 
<a name="index-tetrahedron-30"></a><a name="index-def-31"></a><a name="index-polygon-32"></a>
<pre class="verbatim">
  % vertices of the tetrahedron
  def p1 (0,0,1) def p2 (1,0,0)
  def p3 (0,1,0) def p4 (-.3,-.5,-.8)

  % faces of the tetrahedron.
  polygon(p1)(p2)(p3) % original front polygon
  polygon(p1)(p4)(p2) % bottom
  polygon(p1)(p3)(p4) % left
  polygon(p3)(p2)(p4) % rear

  % line to pierce the tetrahedron
  line[linecolor=red](-1,-1,-1)(2,2,2)
</pre>
This example uses <dfn>definitions</dfn>,
<a name="index-definition-33"></a>which begin with
<code>def</code>. 
<a name="index-def-34"></a>These <dfn>define</dfn> or give names to points,
<a name="index-definition_002c-point-35"></a><a name="index-point-definition-36"></a>which are then available
as <dfn>references</dfn>
<a name="index-reference_002c-point-37"></a>by enclosing the names in parentheses,
e.g. <tt>(foo)</tt>. 
<a name="index-_0028foo_0029_0040r_007b_002c-point-reference_007d-38"></a>The parentheses denote that the names refer to points; they are
required.  There can be no
<a name="index-white-space-39"></a>white space between them and the name.

   <p>As you can see, comments
<a name="index-comments-40"></a>start with <tt>%</tt> as in TeX and extend
to the end of the line (though <tt>#</tt> will work as well).  White
space,
<a name="index-white-space-41"></a>including spaces, tabs and blank lines, has no effect in the <code>sketch</code>
language.

<div align="center"><img src="ex040.png" alt="ex040.png"></div>

<p class="noindent">If we look inside the TeX file produced by <code>sketch</code>, there
will be only three polygons.  The fourth has been
<a name="index-culling-42"></a>culled because it is
a &ldquo;back face&rdquo;
<a name="index-back-face-43"></a>of the tetrahedron, invisible to our view.  It is
unnecessary, and so it is removed.

   <p>In some drawings, polygons act as zero-thickness solid surfaces with
both sides visible rather than as the faces of solid objects, where
back faces can be culled.  For zero-thickness solids, culling
<a name="index-culling-44"></a>is a
problem.  One solution is to use a pair of <code>sketch</code> polygons for
each zero-thickness face, identical except with opposite vertex
orders.  This is unwieldy and expensive.  A better way is to
set the <code>sketch</code> internal option <code>cull</code> to <code>false</code> in
the usual <code>PSTricks</code> manner. 
<a name="index-cull-45"></a>
<pre class="verbatim">
  polygon[cull=false](p1)(p2)(p3)
</pre>
The following shows the same helix
<a name="index-helix-46"></a>shape drawn first with
<tt>cull=true</tt> (the default) and then <tt>cull=false</tt>.

<div align="center"><img src="ex045.png" alt="ex045.png"> <a name="Helix-with-cull-set-false-then-true"></a></div>

<p class="noindent">We'll soon see how to produce these helixes with a few lines
of <code>sketch</code> language code.

   <p>It may be tempting to turn culling off gratuitously so that vertex order
can be ignored.  This is not a good idea because output file size and
TeX and Postscript processing time both depend on the number of
output polygons.  Culling usually improves performance by a factor of
two.  On the other hand, globally setting <code>cull=false</code> is
reasonable while debugging.  See <a href="#Global-options">Global options</a> and
<a href="#Limits-on-error-detection">Limits on error detection</a>.

<div class="node">
<p><hr>
<a name="Special-objects"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Object-transforms">Object transforms</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Drawing-a-solid">Drawing a solid</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Introduction-by-example">Introduction by example</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h3 class="section">2.4 Special objects</h3>

<p>We can add labels
<a name="index-labels-47"></a>to a drawing by using <tt>special</tt>
<a name="index-special-48"></a><a name="index-special-object-49"></a>objects, which provide a way to embed raw LaTeX and <code>PSTricks</code>
code.  Adding this to the tetrahedron does the trick.
<pre class="verbatim">
  special |\footnotesize
           \uput{2pt}[ur]#1{$P1$}
           \uput[r]#2{$P2$}
           \uput[u]#3{$P3$}
           \uput[d]#4{$P4$}|
    (p1)(p2)(p3)(p4)
</pre>
Here is the result.

<div align="center"><img src="ex042.png" alt="ex042.png"></div>

   <p>There are several details to note here.  First, the quoting convention
<a name="index-quoting_002c-special-50"></a>for the raw code is similar to the LaTeX <tt>\verb</tt> command.  The
first non-white space character following <tt>special</tt> is
understood to be the quote character,
in this case <span class="samp">|</span>.  The raw
text continues until this character recurs.

   <p>Second, the argument references
<a name="index-argument_002c-special-51"></a><tt>#1</tt>, <tt>#2</tt>, <tt>#3</tt>,
and <tt>#4</tt> refer to points in the list that follow.  This is
similar to TeX macro syntax.  The transformed and two-dimensional
projections of these three-dimensional points are substituted
<a name="index-substitution_002c-special-52"></a><a name="index-special-argument-substitution-53"></a>in the final output.  An argument reference of the form <tt>#1-2</tt>
is replaced with the angle in degrees of the two-dimensional vector
that connects the projections of the two respective argument points,
here <tt>#1</tt> and <tt>#2</tt>.  The substituted angle is enclosed
in curly braces <code>{ }</code>

   <p>By default, <code>special</code> objects are printed last, overlaying all
other objects in the scene.  If you specify the internal option
<a name="index-internal-option-54"></a><a name="index-option_002c-internal-55"></a><code>lay=in</code>, the hidden surface algorithm
<a name="index-lay-56"></a><a name="index-hidden-surface-algorithm-57"></a>considers the entire special object to be the first point
(<tt>#1</tt>) in the argument list.  If that point is behind (of
smaller z-component than) any drawable, then the entire special
object is drawn before that drawable, so the drawable obscures parts of
the special object that overlaps it.  In our example, <tt>p1</tt> is
the front-most point in the scene (has the largest
z-component), so adding <code>lay=in</code> has no effect.

   <p>With option <code>lay=under</code>, a special is drawn <em>before</em>, hence
appears <em>under</em> any of the objects handled by the hidden surface
algorithm.  This is how the light gray axes were added to the &ldquo;hello
world&rdquo; example <a href="#Hello-world">Hello world</a>.

   <p><tt>Special</tt> objects are powerful, with many possible uses.

<div class="node">
<p><hr>
<a name="Object-transforms"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Repeated-objects">Repeated objects</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Special-objects">Special objects</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Introduction-by-example">Introduction by example</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h3 class="section">2.5 Transforms</h3>

<p><a name="index-transform-58"></a>Now let's add a second copy of the pierced tetrahedron.  We'll rotate
the copy 90 degrees about the x-axis with the origin as
<dfn>center of rotation</dfn>
<a name="index-center-of-rotation-59"></a><a name="index-rotation_002c-center-of-60"></a>so we can see the back,
then translate it to the right&mdash;in the positive
x-direction&mdash;so it doesn't collide with the original. To help
us see what's going on, make the back side gray. 
<a name="index-def-61"></a><a name="index-put-62"></a><a name="index-line-63"></a><a name="index-polygon-64"></a><a name="index-linecolor-65"></a><a name="index-fillcolor-66"></a><a name="index-rotate-67"></a><a name="index-translate-68"></a><a name="index-then-69"></a>
<pre class="verbatim">
  def pierced_tetrahedron {
    def p1 (0,0,1) def p2 (1,0,0)
    def p3 (0,1,0) def p4 (-.3,-.5,-.8)
    polygon(p1)(p2)(p3)                      % original
    polygon(p1)(p4)(p2)                      % bottom
    polygon(p1)(p3)(p4)                      % left
    polygon[fillcolor=lightgray](p3)(p2)(p4) % rear
    line[linecolor=red](-1,-1,-1)(2,2,2)
  }
  {pierced_tetrahedron}  % tetrahedron in original position
  put { rotate(90, (0,0,0), [1,0,0]) % copy in new position
        then translate([2.5,0,0]) } {pierced_tetrahedron}
</pre>
Here the entire code of the previous example has been wrapped in a
definition by forming a <dfn>block</dfn>
<a name="index-block-70"></a><a name="index-_0040_007b-_0040_007d_0040r_007b_002c-block-drawable_007d-71"></a>with braces (a single item would not need them).  The point
definitions nested inside the braces are <dfn>lexically scoped</dfn>. 
<a name="index-lexical-scope-72"></a><a name="index-scope_002c-identifier-73"></a>Their meaning extends only to the end of the block.  The outer
<tt>def</tt> is called a <dfn>drawable</dfn>
<a name="index-drawable-74"></a>definition
<a name="index-definition_002c-drawable-75"></a><a name="index-drawable-definition-76"></a>because it describes something that can be drawn.

   <p>A drawable definition by itself causes nothing to happen until its
name is referenced.  Drawable references must be enclosed in curly
braces, e.g. <tt>{foo}</tt>, with no intervening
<a name="index-white-space-77"></a>white space.  In the code
above, the first reference
<a name="index-reference_002c-drawable-78"></a><tt>{pierced_tetrahedron}</tt>
<a name="index-_0040_007bfoo_0040_007d_0040r_007b_002c-drawable-reference_007d-79"></a>is a plain
one. Its effect is merely to duplicate the earlier drawing.  Almost
any series of <code>sketch</code> commands <tt>stuff</tt> may be replaced
with <tt>def foo { stuff } {foo}</tt> without changing its meaning.

   <p>The <tt>put</tt> command supplies a second reference, this time with
a <dfn>transform</dfn> applied first.  The <tt>rotate</tt>
<a name="index-rotate-80"></a><a name="index-rotation-81"></a>transform turns the tetrahedron 90 degrees about the origin.  The
axis of rotation
<a name="index-axis_002c-rotation-82"></a>is the vector [1,0,0].  By the <dfn>right
hand rule</dfn>,
<a name="index-right-hand-rule-83"></a>this causes the top of the tetrahedron to rotate toward
the viewer and the bottom away.  The rule receives its name from the
following definition:
<blockquote>
<a name="Right-hand-rule"></a>
<strong>Right hand rule.</strong>  If the right hand is wrapped around any
axis with the thumb pointing in the axis direction, then the fingers
curl in the direction of positive rotation about that axis. 
</blockquote>
   The <tt>translate</tt>
<a name="index-translate-84"></a><a name="index-translation-transform-85"></a><a name="index-transform_002c-translation-86"></a>transform moves the pyramid laterally to
the right by adding the vector
<a name="index-vector-87"></a>[2.5,0,0] to each vertex
coordinate.  The result is shown here.

<div align="center"><img src="ex050.png" alt="ex050.png"></div>

<div class="node">
<p><hr>
<a name="Repeated-objects"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Swept-objects">Swept objects</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Object-transforms">Object transforms</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Introduction-by-example">Introduction by example</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h3 class="section">2.6 Repeated objects</h3>

<p>To draw seven instances of the tetrahedron, each differing from the
last by the same transform, replace the last two commands of the
previous example with
<a name="index-repeat-88"></a><a name="index-rotate-89"></a><a name="index-translate-90"></a>
<pre class="verbatim">
  repeat { 7, rotate(15, (0,0,0), [1,0,0]) % copy in new position
              then translate([2,0,0]) } {pierced_tetrahedron}
</pre>
And the result<small class="enddots">....</small>

<div align="center"><img src="ex060.png" alt="ex060.png"></div>

<div class="node">
<p><hr>
<a name="Swept-objects"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="#Repeated-objects">Repeated objects</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Introduction-by-example">Introduction by example</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h3 class="section">2.7 Swept objects</h3>

<p><a name="index-swept-object-91"></a><a name="index-sweep-92"></a>Many familiar shapes can be generated by sweeping simpler ones through
space and considering the resulting path, surface, or volume. 
<code>Sketch</code> implements this idea in the <tt>sweep</tt> command. 
<a name="index-sweep-93"></a><a name="index-rotate-94"></a>
<pre class="verbatim">
  def n_segs 8
  sweep { n_segs, rotate(180 / n_segs, (0,0,0), [0,0,1]) } (1,0,0)
</pre>
This code sweeps the point (1,0,0)
<a name="index-point-sweep-95"></a><a name="index-swept-point-96"></a>eight times by rotating it
180/8 = 22.5 degrees each time and connecting the resulting
points with line segments.  The <tt>def</tt> used here is a
<dfn>scalar</dfn> definition. 
<a name="index-definition_002c-scalar-97"></a><a name="index-scalar-definition-98"></a>References to
<a name="index-reference_002c-scalar-99"></a>scalars have no enclosing brackets at all.

<ul class="menu">
<li><a accesskey="1" href="#Point-sweeps">Point sweeps</a>:                 Swept points make lines and polygons. 
<li><a accesskey="2" href="#Polyline-sweeps">Polyline sweeps</a>:              Swept lines make surfaces. 
<li><a accesskey="3" href="#Nested-sweeps">Nested sweeps</a>:                Swept sweeps are useful! 
<li><a accesskey="4" href="#Polygon-sweeps">Polygon sweeps</a>:               Swept polygons make solids... 
<li><a accesskey="5" href="#Polyline-sweeps-with-closure">Polyline sweeps with closure</a>:   and so do closed polyline sweeps. 
<li><a accesskey="6" href="#Affine-arithmetic">Affine arithmetic</a>:            Sketch useful math expression. 
<li><a accesskey="7" href="#More-to-learn">More to learn</a>:                Check out the Mobius strip! 
</ul>

<div class="node">
<p><hr>
<a name="Point-sweeps"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Polyline-sweeps">Polyline sweeps</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Swept-objects">Swept objects</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Swept-objects">Swept objects</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h4 class="subsection">2.7.1 Point sweeps</h4>

<p>Sweeping a point makes a one-dimensional path, which is a polyline. 
Since we have swept with a rotation, the result is a circular arc. 
Here is what it looks like.

<div align="center"><img src="ex070.png" alt="ex070.png"></div>

   <p>This is the first example we have seen of <code>sketch</code> arithmetic. 
The expression <tt>180 / n_segs</tt> causes the eight rotations to add
to 180.  If you're paying attention, you'll have already noted that
there are <em>nine</em> points, producing eight line segments.

   <p>You can cause the swept point to generate a single polygon rather than
a polyline by using the <dfn>closure tag</dfn> <tt>&lt;></tt>
<a name="index-_003c_003e_0040r_007b_002c-closure-tag_007d-100"></a><a name="index-closure-tag_002c-_0040code_007b_003c_003e_007d-101"></a>after the number
of swept objects. Code and result follow
<a name="index-def-102"></a><a name="index-rotate-103"></a><a name="index-sweep-104"></a>
<pre class="verbatim">
  def n_segs 8
  sweep { n_segs&lt;>, rotate(180 / n_segs, (0,0,0), [0,0,1]) } (1,0,0)
</pre>
<div align="center"><img src="ex080.png" alt="ex080.png"></div>

<div class="node">
<p><hr>
<a name="Polyline-sweeps"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Nested-sweeps">Nested sweeps</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Point-sweeps">Point sweeps</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Swept-objects">Swept objects</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h4 class="subsection">2.7.2 Polyline sweeps</h4>

<p>Sweeping a polyline produces a
<a name="index-line-sweep-105"></a><a name="index-swept-line-106"></a><a name="index-surface-107"></a>surface composed of many faces. 
<a name="index-faces-108"></a>The unbroken helix in the
example <a href="#Helix-with-cull-set-false-then-true">Helix with cull set false then true</a> is produced by this
code (plus a surrounding <tt>put</tt> rotation to make an interesting
view; this has been omitted). 
<a name="index-def-109"></a><a name="index-sweep-110"></a><a name="index-rotate-111"></a><a name="index-translate-112"></a><a name="index-cull-113"></a><a name="index-linewidth-114"></a>
<pre class="verbatim">
  def K [0,0,1]
  sweep[cull=false] {
    60, 
    rotate(10, (0,0,0), [K]) then translate(1/6 * [K]) 
  } line[linewidth=2pt](-1,0)(1,0)
</pre>
Again, 60 segments of the helix
<a name="index-helix-115"></a>are produced by connecting 61
instances of the swept line.  Options
<a name="index-options_002c-sweep-116"></a>applied to the sweep, here
<tt>cull=false</tt>, are treated as options for the generated polygon
or polyline.  Options of the swept line itself, here
<tt>linewidth=2pt</tt>, are ignored, though with a warning. This
<tt>def</tt> is a <dfn>vector</dfn> definition,
<a name="index-definition_002c-vector-117"></a><a name="index-vector-definition-118"></a>which must be referenced
with square brackets, e.g. <tt>[foo]</tt>. 
<a name="index-reference_002c-vector-119"></a><a name="index-_005bfoo_005d_0040r_007b_002c-vector-reference_007d-120"></a>
<div class="node">
<p><hr>
<a name="Nested-sweeps"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Polygon-sweeps">Polygon sweeps</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Polyline-sweeps">Polyline sweeps</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Swept-objects">Swept objects</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h4 class="subsection">2.7.3 Nested sweeps</h4>

<p>When the center point of rotation is omitted,
<a name="index-center-of-rotation-121"></a><a name="index-rotation_002c-center-of-122"></a>the origin is assumed. 
When a point has only two coordinates, they are taken as
x&nbsp;<!-- /@w -->and y,&nbsp;<!-- /@w -->with z=0 assumed.  A toroid
<a name="index-toroid-123"></a>is therefore obtained with this code. 
<a name="index-def-124"></a><a name="index-sweep-125"></a><a name="index-rotate-126"></a>
<pre class="verbatim">
  def n_toroid_segs 20   def n_circle_segs 16
  def r_minor 1          def r_major 1.5
  sweep { n_toroid_segs, rotate(360 / n_toroid_segs, [0,1,0]) }
    sweep { n_circle_segs, rotate(360 / n_circle_segs, (r_major,0,0)) } 
      (r_major + r_minor, 0)
</pre>

   For intuition, the idea of the code is to sketch a circle to the right
of the origin in the xy-plane, then rotate that circle &ldquo;out of
the plane&rdquo; about the y-axis to make the final figure.  This
produces the following.  (A view rotation and some axes have been
added.)

<div align="center"><img src="ex090.png" alt="ex090.png"></div>

   <p>This example also shows that the swept object may itself be another
<code>sweep</code>. 
<a name="index-sweep-127"></a><a name="index-nesting_002c-swept-object-128"></a>In fact, it may be <em>any</em> <code>sketch</code> expression that results in
a list of one or more points or, alternately, a list of one or more
polylines and polygons.  The latter kind of list can be created with a
<tt>{ }</tt>-enclosed block, perhaps following a
<a name="index-put-129"></a><tt>put</tt> or
<a name="index-repeat-130"></a><tt>repeat</tt>. 
<a name="index-_0040_007b-_0040_007d_0040r_007b_002c-block-drawable_007d-131"></a>
<div class="node">
<p><hr>
<a name="Polygon-sweeps"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Polyline-sweeps-with-closure">Polyline sweeps with closure</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Nested-sweeps">Nested sweeps</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Swept-objects">Swept objects</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h4 class="subsection">2.7.4 Polygon sweeps</h4>

<p>Sweeping a polygon
<a name="index-polygon-sweep-132"></a><a name="index-swept-polygon-133"></a>creates a closed surface with polygons at the ends,
which are just copies of the original, appropriately
positioned.  See <a href="#Solid-coil-example">Solid coil example</a>. 
<a name="index-options_002c-swept-object-134"></a>Options on the swept polygon,
if they exist, are applied to the ends.  Otherwise the sweep options
<a name="index-options_002c-sweep-135"></a>are used throughout.

<div class="node">
<p><hr>
<a name="Polyline-sweeps-with-closure"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Affine-arithmetic">Affine arithmetic</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Polygon-sweeps">Polygon sweeps</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Swept-objects">Swept objects</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h4 class="subsection">2.7.5 Polyline sweeps with closure</h4>

<p>A polyline sweep with a closure tag
<a name="index-_003c_003e_0040r_007b_002c-closure-tag_007d-136"></a><a name="index-closure-tag_002c-_0040code_007b_003c_003e_007d-137"></a>creates another kind of closed
surface.  First, the polyline segments are connected by faces, just as
without the closure tag.  Then, each set of end points is joined to
make a polygon, one for each end.  A code for several views of a
cylindrical prism follows. 
<a name="index-def-138"></a><a name="index-repeat-139"></a><a name="index-rotate-140"></a><a name="index-then-141"></a><a name="index-translate-142"></a><a name="index-sweep-143"></a><a name="index-line-144"></a><a name="index-fillcolor-145"></a>
<pre class="verbatim">
  def n_cyl_segs 20  def n_views 5  def I [1,0,0]
  def endopts [fillcolor=lightgray]
  repeat { n_views, rotate(180/n_views, [I]) then translate([I] * 2.1) } 
    sweep[endopts]{ n_cyl_segs&lt;>, rotate(360/n_cyl_segs, [0,1,0]) } 
      line[fillcolor=white](1,-1)(1,1)
</pre>
It produces this drawing.

<div align="center"><img src="ex110.png" alt="ex110.png"></div>

<p class="noindent">The options of the swept line, if any, are applied to the faces
produced by sweeping the line, but not the end polygons.  Otherwise,
the sweep options are applied throughout. 
<a name="index-options_002c-swept-object-146"></a>The <tt>def</tt> in this example is an <dfn>option</dfn> definition. 
<a name="index-definition_002c-options-147"></a><a name="index-options-definition-148"></a>References to options must be enclosed in square brackets, e.g.&nbsp;<!-- /@w -->
<tt>[foo]</tt>. 
<a name="index-reference_002c-options-149"></a><a name="index-_005bfoo_005d_0040r_007b_002c-options-reference_007d-150"></a>Happily, the syntax of <code>sketch</code> is such that
options references can never be confused with vector references.  While
not apparent in this example, options references are useful when
defining many objects with a similar appearance.

<div class="node">
<p><hr>
<a name="Affine-arithmetic"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#More-to-learn">More to learn</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Polyline-sweeps-with-closure">Polyline sweeps with closure</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Swept-objects">Swept objects</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h4 class="subsection">2.7.6 Affine arithmetic</h4>

<p>The arithmetic <tt>[I] * 2.1</tt> above hints at a larger truth. 
<code>Sketch</code> operators work on scalars, vectors, points, and
transforms according to the general rules of <dfn>affine algebra</dfn>. 
<a name="index-affine-arithmetic-151"></a>This can be helpful for setting up diagrams with computed geometry. 
For example, if you have triangle vertices <tt>(p1)</tt> through
<tt>(p3)</tt> and need to draw a unit normal vector pointing out of
the center of the triangle, this code does the trick. 
<a name="index-def-152"></a><a name="index-polygon-153"></a><a name="index-line-154"></a><a name="index-arrows-155"></a>
<pre class="verbatim">
  def p1 (1,0,0)  def p2 (0,0.5,0)  def p3 (-0.5,-1,2)
  def O (0,0,0)
  def N unit( ((p3) - (p2)) * ((p1) - (p2)) )
  def n1 ((p1)-(O) + (p2)-(O) + (p3)-(O)) / 3 + (O)
  def n2 (n1)+[N]
  polygon(p1)(p2)(p3)
  line[arrows=*->](n1)(n2)
</pre>
The first line computes the cross product of two edge vectors of the
triangle and scales it to unit length.  The second computes the
average of the vertices.  Note that subtraction and addition of the
origin effectively convert vectors to points and <em>vice versa</em>. 
The line command draws the normal at the correct spot.

<div align="center"><img src="ex100.png" alt="ex100.png"></div>

   <p>Two caveats regarding this example remain.  First, the only way to use
<code>PSTricks</code>-style arrows is with <tt>arrows=</tt>. 
<a name="index-arrows-156"></a>The alternative syntax for <code>PSTricks</code> arrows is not allowed in
<tt>sketch</tt>. Second, you might like to eliminate the third
<tt>def</tt> and write instead the following.
<pre class="verbatim">
  line[arrows=*->](n1) (n1)+[N]
</pre>
This is not allowed.  The point lists in drawables may consist only of
explicit points or point references.  You may, however, use arithmetic
to calculate point components.  The following works, though it's
a little cumbersome.
<pre class="verbatim">
  line[arrows=*->](n1)((n1)'x+(N)'x, (n1)'y+(N)'y, (n1)'z+(N)'z)
</pre>
Obviously, the <dfn>tick operator</dfn>
<a name="index-tick-operator-_0028_0040code_007b_0027_007d_0029-157"></a><a name="index-_0027x_0040r_007b_002c_007d-_0027y_0040r_007b_002c-and-_007d_0027z-158"></a><span class="samp">'x</span> extracts components of points and
vectors.

<div class="node">
<p><hr>
<a name="More-to-learn"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="#Affine-arithmetic">Affine arithmetic</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Swept-objects">Swept objects</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h4 class="subsection">2.7.7 More to learn</h4>

<p>This is not the end of the story on sweeps!  We invite the reader into
the main body of this documentation <a href="#Sweeps">Sweeps</a> to learn more.

<div align="center"><img src="ex120.png" alt="ex120.png"></div>

<p class="noindent">Who knows where you'll finish?

<div class="node">
<p><hr>
<a name="Input-language"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Building-a-drawing">Building a drawing</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Introduction-by-example">Introduction by example</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h2 class="chapter">3 Input language</h2>

<p>This chapter describes the <code>sketch</code> input language in detail.

<ul class="menu">
<li><a accesskey="1" href="#Language-basics">Language basics</a>:              Case, space, comments, include files. 
<li><a accesskey="2" href="#Drawables">Drawables</a>:                    Things that can be drawn. 
<li><a accesskey="3" href="#Definitions">Definitions</a>:                  Giving things names. 
<li><a accesskey="4" href="#Global-environment">Global environment</a>:           Affect the entire drawing. 
</ul>

<div class="node">
<p><hr>
<a name="Language-basics"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Drawables">Drawables</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Input-language">Input language</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Input-language">Input language</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h3 class="section">3.1 Basics</h3>

<p><code>Sketch</code> input is plain ASCII text, usually stored in an input
file. 
<a name="index-input-file-159"></a><a name="index-file_002c-input-160"></a>It describes a <dfn>scene</dfn>,
so the sketch language is a <dfn>scene description
language</dfn>. 
<a name="index-scene-description-language-161"></a><a name="index-language_002c-scene-description-162"></a><code>Sketch</code> input is also <dfn>declarative</dfn>. 
<a name="index-declarative-language-163"></a><a name="index-language_002c-declarative-164"></a>It merely
declares what the scene ought to look like when drawing is complete
and says very little about how <code>sketch</code> should do its work. 
<code>Sketch</code> commands are not executed sequentially as in the usual
programming language.  They merely contribute to that declaration.

   <p>A few syntactic details are important.  Case is significant in the
<code>sketch</code> language.  With a few exceptions, white space is not. 
This includes line breaks. 
<a name="index-white-space-165"></a>Comments begin with <code>%</code> or <code>#</code> and extend to the end of the
line.  You can disable a chunk of syntactically correct <code>sketch</code>
code by enclosing it in a <code>def</code>. 
<a name="index-comments-166"></a>There is a simple &ldquo;include file&rdquo; mechanism. 
<a name="index-include-file-167"></a><a name="index-file_002c-include-168"></a>The command
<a name="index-input-169"></a>
<pre class="verbatim">
  input{otherfile.sk}
</pre>
causes the contents of <span class="file">otherfile.sk</span> to be inserted as though
they were part of the current file.

<ul class="menu">
<li><a accesskey="1" href="#Identifiers">Identifiers</a>:                  Names for things. 
<li><a accesskey="2" href="#Key-and-reserved-words">Key and reserved words</a>:       Names you shouldn't use. 
<li><a accesskey="3" href="#Literals">Literals</a>:                     Constants and constructors. 
<li><a accesskey="4" href="#Arithmetic">Arithmetic</a>:                   Rules for expressions. 
<li><a accesskey="5" href="#Options">Options</a>:                      Modifying object appearance. 
</ul>

<div class="node">
<p><hr>
<a name="Identifiers"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Key-and-reserved-words">Key and reserved words</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Language-basics">Language basics</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Language-basics">Language basics</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h4 class="subsection">3.1.1 Identifiers</h4>

<p>Identifiers in <code>sketch</code> are references to earlier-defined
options, scalars, points, vectors, transforms, drawables, and tags. 
<a name="index-identifiers-170"></a>Definitions are explained in <a href="#Definitions">Definitions</a>.

   <p>An identifier consists of a leading letter followed by letters,
numbers and underscores.  The last character may <em>not</em> be an
underscore.  Keywords cannot be used as identifiers, and reserved
words ought to be avoided. See <a href="#Key-and-reserved-words">Key and reserved words</a>.

<div class="node">
<p><hr>
<a name="Key-and-reserved-words"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Literals">Literals</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Identifiers">Identifiers</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Language-basics">Language basics</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h4 class="subsection">3.1.2 Key and reserved words</h4>

<p><a name="index-keywords-171"></a>The keywords of <code>sketch</code> are <code>picturebox</code> <code>curve</code>
<code>def</code> <code>dots</code> <code>frame</code> <code>global</code> <code>input</code>
<code>line</code> <code>polygon</code> <code>put</code> <code>repeat</code> <code>set</code>
<code>sweep</code> and <code>then</code>.  The <code>sketch</code> parser will note a
syntax error if any of these are used in place of a proper identifier.

   <p>In addition, there are reserved words
<a name="index-reserved-words-172"></a>that can currently be defined by the user, but with the risk that
future versions of <code>sketch</code> will reject those definitions.  The
reserved words are <code>atan2</code> <code>cos</code> <code>inverse</code>
<code>perspective</code> <code>project</code> <code>rotate</code> <code>scale</code>
<code>sin</code> <code>special</code> <code>sqrt</code> <code>translate</code> <code>unit</code> and
<code>view</code>.

<div class="node">
<p><hr>
<a name="Literals"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Arithmetic">Arithmetic</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Key-and-reserved-words">Key and reserved words</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Language-basics">Language basics</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h4 class="subsection">3.1.3 Literals</h4>

<p>Literals in <code>sketch</code> include scalars, points, vectors, and
transforms.  Literals, along with defined object references,
are used in arithmetic expressions.  See <a href="#Arithmetic">Arithmetic</a>.

<ul class="menu">
<li><a accesskey="1" href="#Scalar-literals">Scalar literals</a>:              Just the numbers. 
<li><a accesskey="2" href="#Point-and-vector-literals">Point and vector literals</a>:    3d quantities. 
<li><a accesskey="3" href="#Transform-literals">Transform literals</a>:           Matrix form. 
</ul>

<div class="node">
<p><hr>
<a name="Scalar-literals"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Point-and-vector-literals">Point and vector literals</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Literals">Literals</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Literals">Literals</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h5 class="subsubsection">3.1.3.1 Scalar literals</h5>

<p><a name="index-scalar-literal-173"></a><a name="index-literal_002c-scalar-174"></a>Scalar literals are positive floating point numbers with syntax
according to C conventions.  The following are some examples.
<pre class="example">     0 1004 .001 8.3143 3. 1.60E-19 6.02e+23
</pre>
   <p class="noindent">Scalar literals may not contain embedded spaces.

<div class="node">
<p><hr>
<a name="Point-and-vector-literals"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Transform-literals">Transform literals</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Scalar-literals">Scalar literals</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Literals">Literals</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h5 class="subsubsection">3.1.3.2 Point and vector literals</h5>

<p><a name="index-point-literal-175"></a><a name="index-literal_002c-point-176"></a><a name="index-vector-literal-177"></a><a name="index-literal_002c-vector-178"></a>Points and vector literals have these forms respectively.
<pre class="example">     (<i>X</i>,<i>Y</i>,<i>Z</i>)  [<i>X</i>,<i>Y</i>,<i>Z</i>]
</pre>
   <p class="noindent">Each of the components is itself a scalar expression.  The
z-components are optional and default to zero.

<div class="node">
<p><hr>
<a name="Transform-literals"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="#Point-and-vector-literals">Point and vector literals</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Literals">Literals</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h5 class="subsubsection">3.1.3.3 Transform literals</h5>

<p><a name="index-transform-literal-179"></a><a name="index-literal_002c-transform-180"></a>Most transform literals are formed by <dfn>constructors</dfn>. 
<a name="index-constructor-181"></a>These are summarized in the following table.
   <p><table summary=""><tr align="left"><th valign="top">Constructor </th><th valign="top">Param types </th><th valign="top">Description
<br></th></tr><tr align="left"><td valign="top"><code>rotate(A,P,X)</code>
 <a name="index-rotate-182"></a> <a name="index-rotation-transform-183"></a> <a name="index-transform_002c-rotation-184"></a> </td><td valign="top">scalar,point,vector
 </td><td valign="top">Rotate <code>A</code> degrees about point <code>P</code> with axis <code>X</code>
   according to the right hand rule. See <a href="#Right-hand-rule">Right hand rule</a>. 
   <code>P</code> and <code>X</code> are both optional and default to the origin and
   the z-axis respectively. 
<br></td></tr><tr align="left"><td valign="top"><code>translate(X)</code>
 <a name="index-translate-185"></a> <a name="index-translation-transform-186"></a> <a name="index-transform_002c-translation-187"></a> </td><td valign="top">vector
 </td><td valign="top">Translate by <code>X</code>. 
<br></td></tr><tr align="left"><td valign="top"><code>scale(S)</code>
 <a name="index-scale-188"></a> <a name="index-scale-transform-189"></a> <a name="index-transform_002c-scale-190"></a> </td><td valign="top">scalar
 </td><td valign="top">Scale uniformly by factor <code>S</code>. 
<br></td></tr><tr align="left"><td valign="top"><code>scale(V)</code>
 <a name="index-scale-191"></a> <a name="index-scale-transform-192"></a> <a name="index-transform_002c-scale-193"></a> </td><td valign="top">vector
 </td><td valign="top">Scale along each axis by components of <code>V</code>. 
<br></td></tr><tr align="left"><td valign="top"><code>project()</code>
 <a name="index-project-194"></a> <a name="index-parallel-projection-195"></a> <a name="index-projection_002c-parallel-196"></a> </td><td valign="top">&mdash;
 </td><td valign="top">Same as <code>scale([1,1,0])</code>. 
<br></td></tr><tr align="left"><td valign="top"><code>project(S)</code>
 <a name="index-project-197"></a> <a name="index-perspective-projection-198"></a> <a name="index-projection_002c-perspective-199"></a> </td><td valign="top">scalar
 </td><td valign="top">Perspective projection with view center at origin and projection
 plane z=-<code>S</code>. 
<br></td></tr><tr align="left"><td valign="top"><code>perspective(S)</code>
 <a name="index-perspective-200"></a> <a name="index-perspective-projection-201"></a> <a name="index-projection_002c-perspective-202"></a> </td><td valign="top">scalar
 </td><td valign="top">Perspective <em>transform</em> identical to <code>project(S)</code>
 except that the z-coordinate of the transformed result is
 <dfn>pseudodepth</dfn>, usable by the hidden surface algorithm. 
 <a name="index-hidden-surface-algorithm-203"></a><br></td></tr><tr align="left"><td valign="top"><code>view(E,D,U)</code>
 <a name="index-view-204"></a> <a name="index-view-transform-205"></a> <a name="index-transform_002c-view-206"></a> </td><td valign="top">point,vector,vector
 </td><td valign="top">View transform similar to that of <code>OpenGL</code>'s.  The
<em>eye point</em> <code>E</code> is translated to the origin while a rotation
is also applied that makes the <em>view direction vector</em> <code>D</code>
and the <em>view &ldquo;up&rdquo; vector</em> <code>U</code> point in the negative
z- and the y-directions respectively.  If <code>U</code> is
omitted, it defaults to [0,1,0]. When <code>U</code> is omitted,
<code>D</code> may be also; it defaults to <code>(0,0,0)-(E)</code>, a vector
pointing from the eye toward the origin. 
<br></td></tr><tr align="left"><td valign="top"><code>view(E,L,U)</code>
 <a name="index-view-207"></a> <a name="index-view-transform-208"></a> <a name="index-transform_002c-view-209"></a> </td><td valign="top">point,point,vector
 </td><td valign="top">An alternate form of <code>view(E,D,U)</code> above where
 the view direction parameter <code>D</code> is replaced with a
&ldquo;look at&rdquo; point <code>L</code>, i.e., a point where the viewer is focusing
her attention.  This form of view is equivalent to
<code>view(E, (L)-(E), U)</code>, where <code>(L)-(E)</code> is a direction
vector. <code>U</code> is optional and defaults to [0,1,0]. 
<br></td></tr><tr align="left"><td valign="top"><code>[[a_11,a_12,a_13,a_14]</code><br>
<code>&nbsp;<!-- /@w -->[a_21,a_22,a_23,a_24]</code><br>
<code>&nbsp;<!-- /@w -->[a_31,a_32,a_33,a_34]</code><br>
<code>&nbsp;<!-- /@w -->[a_41,a_42,a_43,a_44]]</code><br>
  <a name="index-_005b_005b-_005d_005b-_005d_005b-_005d_005b-_005d_005d_0040r_007b_002c-transform-literal_007d-210"></a>  </td><td valign="top">16 scalars
  </td><td valign="top">Direct transform matrix definition. Each
  of the a_ij is a scalar expression.  If you don't know what
  this is about, you don't need it.
   <br></td></tr></table>
The <code>project</code>
<a name="index-project-211"></a>constructor is not generally useful because it
defeats hidden surface removal by collapsing the scene onto a single
plane.  It is a special purpose transform for drawing pictures of
scenes where three-dimensional objects are being projected onto
planes.  See, for example, <a href="#Overview">Overview</a>.

<div class="node">
<p><hr>
<a name="Arithmetic"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Options">Options</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Literals">Literals</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Language-basics">Language basics</a>
<br>
</div>

<h4 class="subsection">3.1.4 Arithmetic expressions</h4>

<p>Arithmetic expressions over <code>sketch</code> literals and
defined identifiers are summarized in the following tables.

<ul class="menu">
<li><a accesskey="1" href="#Two_002doperand-_0028binary_0029-forms">Two-operand (binary) forms</a>:   A op B
<li><a accesskey="2" href="#Unary-forms">Unary forms</a>:                  op A (and others)
</ul>

<div class="node">
<p><hr>
<a name="Two_002doperand-_0028binary_0029-forms"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Unary-forms">Unary forms</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Arithmetic">Arithmetic</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Arithmetic">Arithmetic</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h5 class="subsubsection">3.1.4.1 Two-operand (binary) forms and precedence</h5>

<p>Most two-operand binary
<a name="index-binary-form-212"></a><a name="index-two_002doperand-form-213"></a>forms have meanings dependent on the types of
their arguments.  An exhaustive summary of the possibilities is given
in the following table.
   <p><table summary=""><tr align="left"><th valign="top">Left </th><th valign="top">Op </th><th valign="top">Right </th><th valign="top">Result </th><th valign="top">Description
<br></th></tr><tr align="left"><td valign="top">scalar </td><td valign="top"><code>+</code> </td><td valign="top">scalar
<a name="index-_002b_0040r_007b_002c-plus-operator_007d-214"></a></td><td valign="top">scalar </td><td valign="top">Scalar sum. 
<br></td></tr><tr align="left"><td valign="top">vector </td><td valign="top"><code>+</code> </td><td valign="top">vector
</td><td valign="top">vector </td><td valign="top">Vector sum. 
<br></td></tr><tr align="left"><td valign="top">point  </td><td valign="top"><code>+</code> </td><td valign="top">vector
</td><td valign="top">point  </td><td valign="top">Point-vector affine sum. 
<br></td></tr><tr align="left"><td valign="top">vector </td><td valign="top"><code>+</code> </td><td valign="top">point
</td><td valign="top">"         </td><td valign="top">"
<br></td></tr><tr align="left"><td valign="top">scalar    </td><td valign="top"><code>-</code> </td><td valign="top">scalar
<a name="index-_002d_0040r_007b_002c-minus-operator_007d-215"></a></td><td valign="top">scalar    </td><td valign="top">Scalar difference. 
<br></td></tr><tr align="left"><td valign="top">vector    </td><td valign="top"><code>-</code> </td><td valign="top">vector
</td><td valign="top">vector    </td><td valign="top">Vector difference. 
<br></td></tr><tr align="left"><td valign="top">point     </td><td valign="top"><code>-</code> </td><td valign="top">point
</td><td valign="top">vector    </td><td valign="top">Point-point affine difference. 
<br></td></tr><tr align="left"><td valign="top">point     </td><td valign="top"><code>-</code> </td><td valign="top">vector
</td><td valign="top">point     </td><td valign="top">Point-vector affine difference. 
<br></td></tr><tr align="left"><td valign="top">scalar    </td><td valign="top"><code>*</code> or
                     <code>.</code> </td><td valign="top">scalar
<a name="index-_002a_0040r_007b_002c-multiplication-operator_007d-216"></a><a name="index-_002e_0040r_007b_002c-dot-operator_007d-217"></a></td><td valign="top">scalar    </td><td valign="top">Scalar product. 
<br></td></tr><tr align="left"><td valign="top">scalar    </td><td valign="top"><code>*</code> or
                     <code>.</code> </td><td valign="top">vector
</td><td valign="top">vector    </td><td valign="top">Scalar-vector product. 
<br></td></tr><tr align="left"><td valign="top">vector    </td><td valign="top"><code>*</code> or
                     <code>.</code> </td><td valign="top">scalar
</td><td valign="top">"         </td><td valign="top">"
<br></td></tr><tr align="left"><td valign="top">vector    </td><td valign="top"><code>*</code> </td><td valign="top">vector
</td><td valign="top">vector    </td><td valign="top">Vector cross-product. 
<br></td></tr><tr align="left"><td valign="top">vector    </td><td valign="top"><code>.</code> </td><td valign="top">vector
</td><td valign="top">scalar    </td><td valign="top">Vector dot product. 
<br></td></tr><tr align="left"><td valign="top">scalar    </td><td valign="top"><code>^</code> </td><td valign="top">scalar
<a name="index-_005e_0040r_007b_002c-exponentiation-operator_007d-218"></a></td><td valign="top">scalar    </td><td valign="top">Raise scalar to scalar power. 
<br></td></tr><tr align="left"><td valign="top">transform </td><td valign="top"><code>^</code> </td><td valign="top">integer
</td><td valign="top">transform </td><td valign="top">Raise transform or integer power. 
<a name="index-transform-219"></a><br></td></tr><tr align="left"><td valign="top">transform </td><td valign="top"><code>*</code> or
                     <code>.</code> </td><td valign="top">point
</td><td valign="top">point     </td><td valign="top">Affine point transform (right-to-left). 
<br></td></tr><tr align="left"><td valign="top">transform </td><td valign="top"><code>*</code> or
                     <code>.</code> </td><td valign="top">vector
</td><td valign="top">vector    </td><td valign="top">Affine vector transform (right-to-left). 
<br></td></tr><tr align="left"><td valign="top">transform </td><td valign="top"><code>*</code> or
                     <code>.</code> </td><td valign="top">transform
</td><td valign="top">transform </td><td valign="top">Transform composition (right-to-left). 
<br></td></tr><tr align="left"><td valign="top">point     </td><td valign="top"><code>then</code> </td><td valign="top">transform
<a name="index-then-220"></a></td><td valign="top">point     </td><td valign="top">Affine point transform (left-to-right). 
<br></td></tr><tr align="left"><td valign="top">vector    </td><td valign="top"><code>then</code> </td><td valign="top">transform
</td><td valign="top">vector    </td><td valign="top">Affine vector transform (left-to-right). 
<br></td></tr><tr align="left"><td valign="top">transform </td><td valign="top"><code>then</code> </td><td valign="top">transform
</td><td valign="top">transform </td><td valign="top">Transform composition (left-to-right). 
<br></td></tr><tr align="left"><td valign="top">scalar    </td><td valign="top"><code>/</code> </td><td valign="top">scalar
<a name="index-_002f_0040r_007b_002c-division-operator_007d-221"></a></td><td valign="top">scalar    </td><td valign="top">Scalar division. 
<br></td></tr><tr align="left"><td valign="top">vector    </td><td valign="top"><code>/</code> </td><td valign="top">scalar
</td><td valign="top">vector    </td><td valign="top">Vector component-wise division by scalar. 
<br></td></tr><tr align="left"><td valign="top">point     </td><td valign="top"><code>'</code> </td><td valign="top"><code>x</code>, <code>y</code>, or <code>z</code>
<a name="index-tick-operator-_0028_0040code_007b_0027_007d_0029-222"></a><a name="index-_0027x_0040r_007b_002c_007d-_0027y_0040r_007b_002c-and-_007d_0027z-223"></a></td><td valign="top">scalar    </td><td valign="top">Point component extraction. 
<br></td></tr><tr align="left"><td valign="top">vector    </td><td valign="top"><code>'</code> </td><td valign="top"><code>x</code>, <code>y</code>, or <code>z</code>
</td><td valign="top">scalar    </td><td valign="top">Vector component extraction.
   <br></td></tr></table>
   <pre class="sp">

</pre>
Operator precedence
<a name="index-precedence_002c-operator-224"></a><a name="index-operator-precedence-225"></a>is shown in this table.
   <p><table summary=""><tr align="left"><th valign="top">Op        </th><th valign="top">Precedence
<br></th></tr><tr align="left"><td valign="top"><code>'</code>      </td><td valign="top">highest (most tightly binding)
<br></td></tr><tr align="left"><td valign="top"><code>^</code>      </td><td valign="top">
<br></td></tr><tr align="left"><td valign="top"><code>-</code>      </td><td valign="top">(unary negation)
<br></td></tr><tr align="left"><td valign="top"><code>*</code>
      <code>.</code>
      <code>/</code>      </td><td valign="top">
<br></td></tr><tr align="left"><td valign="top"><code>+</code>
      <code>-</code>      </td><td valign="top">
<br></td></tr><tr align="left"><td valign="top"><code>then</code>   </td><td valign="top">lowest (least tightly binding)
   <br></td></tr></table>
   <pre class="sp">

</pre>
All operations are left-associative
<a name="index-operator-associativity-226"></a><a name="index-associativity_002c-operator-227"></a>except for <span class="samp">^</span>. 
Parentheses <span class="samp">( )</span>
<a name="index-parentheses-228"></a><a name="index-_0028-_0029_0040r_007b_002c-grouping_007d-229"></a>are used for grouping to override precedence in the usual way.

   <p>As you can see, the dot operator <span class="samp">.</span>
<a name="index-_002e_0040r_007b_002c-dot-operator_007d-230"></a>is usually a synonym for run-of-the-mill multiplication, <span class="samp">*</span>. 
The meanings differ only for vector operands.  The <code>then</code>
operator
<a name="index-then-231"></a>merely reverses the operand
order with respect to normal multiplication <span class="samp">*</span>.  The intent
here is to make compositions read more naturally. The code
<pre class="example">     (1,2,3) then scale(2) then rotate(30) then translate([1,3,0])
</pre>
   <p class="noindent">expresses a series of successive modifications to the point,
whereas the equivalent form
<a name="index-_002a_0040r_007b_002c-multiplication-operator_007d-232"></a>
<pre class="example">     translate([1,3,0]) * rotate(30) * scale(2) * (1,2,3)
</pre>
   <p class="noindent">will be intuitive only to mathematicians (and perhaps Arabic
language readers).

<div class="node">
<p><hr>
<a name="Unary-forms"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="#Two_002doperand-_0028binary_0029-forms">Two-operand (binary) forms</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Arithmetic">Arithmetic</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h5 class="subsubsection">3.1.4.2 Unary forms</h5>

<p>Unary or one-operand forms
<a name="index-unary-form-233"></a><a name="index-one_002doperand-form-234"></a>are summarized in the following table, where <code>X</code>
stands for the operand.
   <p><table summary=""><tr align="left"><th valign="top">Op         </th><th valign="top">Operand
 </th><th valign="top">Result </th><th valign="top">Description
<br></th></tr><tr align="left"><td valign="top"><code>-X</code>      </td><td valign="top">scalar
<a name="index-_002d_0040r_007b_002c-unary-minus-operator_007d-235"></a> </td><td valign="top">scalar </td><td valign="top">Unary scalar negation. 
<br></td></tr><tr align="left"><td valign="top"><code>-X</code>      </td><td valign="top">vector
 </td><td valign="top">vector </td><td valign="top">Unary vector negation. 
<br></td></tr><tr align="left"><td valign="top"><code>|X|</code>     </td><td valign="top">vector
 <a name="index-_007c_0040math_007bX_007d_007c_0040r_007b_002c-magnitude-operator_007d-236"></a> </td><td valign="top">scalar </td><td valign="top">Vector length. 
<br></td></tr><tr align="left"><td valign="top"><code>unit(X)</code> </td><td valign="top">vector
 <a name="index-unit-237"></a> </td><td valign="top">vector </td><td valign="top">Unit vector with same direction. 
<br></td></tr><tr align="left"><td valign="top"><code>sqrt(X)</code> </td><td valign="top">scalar
 <a name="index-sqrt-238"></a> </td><td valign="top">scalar </td><td valign="top">Scalar square root. 
<br></td></tr><tr align="left"><td valign="top"><code>sin(X)</code> </td><td valign="top">scalar
 <a name="index-sin-239"></a> </td><td valign="top">scalar </td><td valign="top">Trigonometric sine (<code>X</code> in degrees). 
<br></td></tr><tr align="left"><td valign="top"><code>cos(X)</code> </td><td valign="top">scalar
 <a name="index-cos-240"></a> </td><td valign="top">scalar </td><td valign="top">Trigonometric cosine (<code>X</code> in degrees). 
<br></td></tr><tr align="left"><td valign="top"><code>atan2(X,Y)</code> </td><td valign="top">scalar
 <a name="index-atan2-241"></a> </td><td valign="top">scalar </td><td valign="top">Polar angle in degrees of vector [X,Y]. 
<br></td></tr><tr align="left"><td valign="top"><code>inverse(X)</code> </td><td valign="top">transform
 <a name="index-inverse-242"></a> </td><td valign="top">transform </td><td valign="top">Inverse transform.
   <br></td></tr></table>
   <pre class="sp">

</pre>
Errors are reported when <code>|X|</code>, <code>unit</code>, <code>sqrt</code>,
<code>atan2</code>, and <code>inverse</code> fail due to bad parameters.

<div class="node">
<p><hr>
<a name="Options"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="#Arithmetic">Arithmetic</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Language-basics">Language basics</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h4 class="subsection">3.1.5 Options</h4>

<p><a name="index-options-243"></a><strong>Syntax:</strong>
<pre class="example">     [<var>key1</var>=<var>val1</var>,<var>key2</var>=<var>val2</var>,...]
</pre>
   <p class="noindent">Options are used to specify details of the appearance of drawables. 
As shown above, they are given as comma-separated key-value
pairs.

<ul class="menu">
<li><a accesskey="1" href="#PSTricks-options">PSTricks options</a>:             Options inherited from <code>PSTricks</code>. 
<li><a accesskey="2" href="#TikZ_002fPGF-options">TikZ/PGF options</a>:             Options inherited from <code>TikZ/PGF</code>. 
<li><a accesskey="3" href="#Dots-in-TikZ_002fPGF">Dots in TikZ/PGF</a>:             Sketch uses <code>TikZ/PGF</code> circles for dots. 
<li><a accesskey="4" href="#TikZ_002fPGF-user_002ddefined-styles">TikZ/PGF user-defined styles</a>:   Support for <code>TikZ/PGF</code> named, user-defined styles. 
<li><a accesskey="5" href="#Transparency">Transparency</a>:                 See-through polygons. 
<li><a accesskey="6" href="#Internal-options">Internal options</a>:             Options used by <code>sketch</code>. 
</ul>

<div class="node">
<p><hr>
<a name="PSTricks-options"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#TikZ_002fPGF-options">TikZ/PGF options</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Options">Options</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Options">Options</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h5 class="subsubsection">3.1.5.1 <code>PSTricks</code> options</h5>

<p>When <code>language pstricks</code> is selected (the default), permissible
key-value pairs include all those for similar <code>PSTricks</code> objects. 
For example, a polygon might have the options
<pre class="verbatim">
  [linewidth=1pt,linecolor=blue,fillcolor=cyan]
</pre>
<code>Sketch</code> merely passes these on to <code>PSTricks</code> without
checking or modification.  Option lists are always optional.  A
missing options list is equivalent to an empty one <span class="samp">[]</span>.

   <p>When a <code>polygon</code> has options for both its face and its edges, and
the polygon is split by the hidden surface algorithm, <code>sketch</code>
must copy the edge options to <code>psline</code>s for the edge segments and
the face options to <code>pspolygon</code>s.  Options known to <code>sketch</code>
for purposes of this splitting operation include <code>arrows</code>,
<code>dash</code>, <code>dotsep</code>, <code>fillcolor</code>, <code>fillstyle</code>,
<code>linecolor</code>, <code>linestyle</code>, <code>linewidth</code>, <code>opacity</code>,
<code>showpoints</code>, <code>strokeopacity</code>, and <code>transpalpha</code>.

<div class="node">
<p><hr>
<a name="TikZ_002fPGF-options"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Dots-in-TikZ_002fPGF">Dots in TikZ/PGF</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#PSTricks-options">PSTricks options</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Options">Options</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h5 class="subsubsection">3.1.5.2 <code>TikZ/PGF</code> options</h5>

<p><code>TikZ/PGF</code> options are handled much as for <code>PSTricks</code>. 
Though <code>TikZ/PGF</code> often allows colors and styles to be given
without corresponding keys, for example,
<pre class="verbatim">
  \draw[red,ultra thick](0,0)--(1,1);
</pre>
this is not permitted in <code>sketch</code>.  To draw a red, ultra-thick
line in <code>sketch</code>, the form is
<pre class="verbatim">
  line[draw=red,style=ultra thick](0,0)(1,1)
</pre>

   <p>Just as for <code>PSTricks</code>, when a <code>polygon</code> has options for
both its face and its edges, and the polygon is split by the hidden
surface algorithm, <code>sketch</code> must copy the edge options to
<code>psline</code>s for the edge segments and the face options to
<code>pspolygon</code>s.  <code>TikZ/PGF</code> options known to <code>sketch</code> for
purposes of this splitting operation include <code>arrows</code>,
<code>cap</code>, <code>color</code>, <code>dash pattern</code>, <code>dash phase</code>,
<code>double distance, draw</code>, <code>draw opacity</code>, <code>fill</code>,
<code>fill opacity</code>, <code>join</code>, <code>line width</code>, <code>miter
limit</code>, <code>pattern</code>, <code>pattern color</code>, and <code>style</code>.

   <p>The <code>style</code> option can contain both face and edge information, so
<code>sketch</code> must check the style value.  Values known to
<code>sketch</code> include <code>dashed</code>, <code>densely dashed</code>,
<code>densely dotted</code>, <code>dotted</code>, <code>double</code>, <code>loosely
dashed</code>, <code>loosely dotted</code>, <code>nearly opaque</code>, <code>nearly
transparent</code>, <code>semithick</code>, <code>semitransparent</code>, <code>solid</code>,
<code>thick</code>, <code>thin</code>, <code>transparent</code>,
<code>ultra nearly transparent</code>, <code>ultra thick</code>, <code>ultra thin</code>,
<code>very nearly transparent</code>, <code>very thick</code>, and <code>very thin</code>.

<div class="node">
<p><hr>
<a name="Dots-in-TikZ_002fPGF"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#TikZ_002fPGF-user_002ddefined-styles">TikZ/PGF user-defined styles</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#TikZ_002fPGF-options">TikZ/PGF options</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Options">Options</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h5 class="subsubsection">3.1.5.3 Dots in <code>TikZ/PGF</code></h5>

<p><code>TikZ/PGF</code> does not have a <code>dots</code> command as does PSTricks. 
Instead, <code>Sketch</code> emits dots as <code>filldraw</code> circles.  The
diameter may be set using the option <code>dotsize</code> borrowed from
PSTricks.  The <code>dotsize</code> option will be removed from the option
list in the output <code>filldraw</code> command.  Other options work in the
expected way.  For example, <code>fill</code> sets fill color and
<code>color</code> sets line color of the circles.

<div class="node">
<p><hr>
<a name="TikZ_002fPGF-user_002ddefined-styles"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Transparency">Transparency</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Dots-in-TikZ_002fPGF">Dots in TikZ/PGF</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Options">Options</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h5 class="subsubsection">3.1.5.4 <code>TikZ/PGF</code> user-defined styles</h5>

<p><code>TikZ/PGF</code> allows named styles defined by the user, for
example
<pre class="verbatim">
  \tikzstyle{mypolygonstyle} = [fill=blue!20,fill opacity=0.8]  
  \tikzstyle{mylinestyle} = [red!20,dashed]
</pre>
Since <code>sketch</code> has no information on the contents of such styles,
it omits them entirely from lines, polygons, and their edges during
option splitting.  For example,
<pre class="verbatim">
  polygon[style=mypolygonstyle,style=thick](0,0,1)(1,0,0)(0,1,0)
  line[style=mylinestyle](-1,-1,-1)(2,2,2)
</pre>
produces the <code>TikZ</code> output
<pre class="verbatim">
  \draw(-1,-1)--(.333,.333);
  \filldraw[thick,fill=white](0,0)--(1,0)--(0,1)--cycle;
  \draw(.333,.333)--(2,2);
</pre>
Note that the user-defined styles are not present.  Sketch also issues
warnings:
<pre class="verbatim">
  warning, unknown polygon option style=mypolygonstyle will be ignored
  warning, unknown line option style=mylinestyle will be ignored
</pre>

   <p>The remedy is to state explicitly whether a user-defined style should
be attched to polygons or lines in the <code>TikZ</code> output using
<em>pseudo-options</em> <code>fill style</code> and <code>line style</code>,
<a name="index-pseudo_002doptions-244"></a><a name="index-fill-style-245"></a><a name="index-line-style-246"></a>
<pre class="verbatim">
  polygon[fill style=mypolygonstyle,style=thick](0,0,1)(1,0,0)(0,1,0)
  line[line style=mylinestyle](-1,-1,-1)(2,2,2)
</pre>
Now, the output is
<pre class="verbatim">
  \draw[mylinestyle](-1,-1)--(.333,.333);
  \filldraw[mypolygonstyle,thick](0,0)--(1,0)--(0,1)--cycle;
  \draw[mylinestyle](.333,.333)--(2,2);
</pre>

   <p>A useful technique is to include user-defined style definitions in
<code>sketch</code> code as <code>special</code>s with option <code>[lay=under]</code>
to ensure that the styles are emitted first in the output, before
any uses of the style names. 
<a rel="footnote" href="#fn-2" name="fnd-2"><sup>2</sup></a>  For
example,
<pre class="verbatim">
  special|\tikzstyle{mypolygonstyle} = [fill=blue!20,fill opacity=0.8]|[lay=under]
  special|\tikzstyle{mylinestyle} = [red!20,dashed]|[lay=under]
</pre>
The author is responsible for using the key, <code>line style</code>
or <code>fill style</code>, that matches the content of the style
definition.

<div class="node">
<p><hr>
<a name="Transparency"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Internal-options">Internal options</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#TikZ_002fPGF-user_002ddefined-styles">TikZ/PGF user-defined styles</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Options">Options</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h5 class="subsubsection">3.1.5.5 Transparency</h5>

<p><a name="index-transparency-247"></a>Both <code>PSTricks</code> and <code>TikZ/PGF</code> support polygon options that
have the effect of making the polygon appear transparent.  For
<code>PSTricks</code>, keywords <code>opacity</code> and <code>transpalpha</code> have
both been used, with the correct one depending on version. 
<code>TikZ/PGF</code> uses <code>opacity</code> only. 
<a name="index-transpalpha-248"></a><a name="index-opacity-249"></a><a name="index-fill-opacity-250"></a>When transparent polygons are in the foreground, objects behind them
(drawn earlier) are visible with color subdued and tinted.  The hidden
surface algorithm of <code>sketch</code> works well with such transparent
polygons.

   <p>Note that <tt>cull=false</tt>
<a name="index-cull-251"></a>must be used for rear-facing polygons to be visible when positioned
behind other transparent surfaces.

<div class="node">
<p><hr>
<a name="Internal-options"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="#Transparency">Transparency</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Options">Options</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h5 class="subsubsection">3.1.5.6 Internal options</h5>

<p>There are also <em>internal</em> options
<a name="index-options_002c-internal-252"></a><a name="index-internal-options-253"></a>used only by <code>sketch</code> and not
passed on to <code>PSTricks</code>.  These are summarized in the following
table. 
<a name="index-cull-254"></a><a name="index-lay-255"></a><a name="index-split-256"></a>
   <p><table summary=""><tr align="left"><th valign="top">Key </th><th valign="top">Possible values </th><th valign="top">Description
<br></th></tr><tr align="left"><td valign="top"><code>cull</code>
</td><td valign="top"><code>true</code>, <code>false</code>
</td><td valign="top">Turn culling of backfaces on and off respectively for this object. 
The default value is <code>true</code>. 
<br></td></tr><tr align="left"><td valign="top"><code>lay</code>
</td><td valign="top"><code>over</code>, <code>in</code>, <code>under</code>
</td><td valign="top">Force this object to be <code>under</code> or
<code>over</code> all other objects in the depth sort
<a name="index-depth-sort-257"></a>order created by the hidden surface algorithm.  The default value
<code>over</code> guarantees that output due to the <code>special</code> will be
visible. 
<br></td></tr><tr align="left"><td valign="top"><code>split</code>
</td><td valign="top"><code>true</code>, <code>false</code>
</td><td valign="top">Turn splitting of sweep-generated body polygons
<a name="index-body-polygon-258"></a><a name="index-polygon_002c-body-259"></a>on and off respectively. See <a href="#Sweeps">Sweeps</a>.  The default value <code>true</code>
causes &ldquo;warped&rdquo; polygons to be split into triangles, which avoids
mistakes by the hidden surface algorithm.
   <br></td></tr></table>

<h4 class="subsection">3.1.6 Point lists</h4>

<p><a name="index-point-list-260"></a><strong>Syntax:</strong>
<pre class="example">     (<var>x1</var>,<var>y1</var>,<var>z1</var>)(<var>x2</var>,<var>y2</var>,<var>z2</var>)...
</pre>
   <p class="noindent">A sequence of one or more points makes a point list, a feature
common to all drawables.  Each of the point components is a scalar
arithmetic expression.  Any point may have the z-component
omitted; it will default to z=0.

<ul class="menu">
<li><a accesskey="1" href="#Drawables">Drawables</a>:                    Things that are drawn. 
<li><a accesskey="2" href="#Definitions">Definitions</a>:                  Things with names. 
</ul>

<div class="node">
<p><hr>
<a name="Drawables"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Definitions">Definitions</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Language-basics">Language basics</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Input-language">Input language</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h3 class="section">3.2 Drawables</h3>

<p><a name="index-drawable-261"></a>Drawables are simply <code>sketch</code> objects that might appear in the
drawing.  They include dots, polylines, curves, polygons, and more
complex objects that are built up from simpler ones in various ways. 
Finally, <dfn>special</dfn> objects are those composed of LaTeX or
<code>PSTricks</code> code, perhaps including coordinates and angles
computed by <code>sketch</code>.

<ul class="menu">
<li><a accesskey="1" href="#Dots">Dots</a>:                         Draw dots. 
<li><a accesskey="2" href="#Lines">Lines</a>:                        Draw polylines. 
<li><a accesskey="3" href="#Curves">Curves</a>:                       Draw curves. 
<li><a accesskey="4" href="#Polygons">Polygons</a>:                     Draw polygons. 
<li><a accesskey="5" href="#Specials">Specials</a>:                     Embed raw LaTeX and <code>PSTricks</code>. 
<li><a accesskey="6" href="#Sweeps">Sweeps</a>:                       Draw sweeps of dots and polylines. 
<li><a accesskey="7" href="#Blocks">Blocks</a>:                       Group other drawables. 
<li><a accesskey="8" href="#Repeats">Repeats</a>:                      Draw transformed copies of objects. 
<li><a accesskey="9" href="#Puts">Puts</a>:                         Draw one object transformed. 
</ul>

<div class="node">
<p><hr>
<a name="Dots"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Lines">Lines</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Drawables">Drawables</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Drawables">Drawables</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h4 class="subsection">3.2.1 Dots</h4>

<p><a name="index-dots-262"></a><strong>Syntax:</strong>
<pre class="example">     dots[<var>options</var>] <var>point_list</var>
</pre>
   <p class="noindent">This command is the three-dimensional equivalent of the
<code>PSTricks</code> command <code>\psdots</code>.

<div class="node">
<p><hr>
<a name="Lines"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Curves">Curves</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Dots">Dots</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Drawables">Drawables</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h4 class="subsection">3.2.2 Lines</h4>

<p><a name="index-line-263"></a><strong>Syntax:</strong>
<pre class="example">     line[<var>options</var>] <var>point_list</var>
</pre>
   <p class="noindent">This command is the three-dimensional equivalent of the
<code>PSTricks</code> command <code>\psline</code>.

<div class="node">
<p><hr>
<a name="Curves"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Polygons">Polygons</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Lines">Lines</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Drawables">Drawables</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h4 class="subsection">3.2.3 Curves</h4>

<p><a name="index-curve-264"></a><strong>Syntax:</strong>
<pre class="example">     curve[<var>options</var>] <var>point_list</var>
</pre>
   <p class="noindent">This command is the three-dimensional equivalent of the
<code>PSTricks</code> command <code>\pscurve</code>. <b>It is not
implemented in the current version of </b><code>sketch</code>.

<div class="node">
<p><hr>
<a name="Polygons"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Specials">Specials</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Curves">Curves</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Drawables">Drawables</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h4 class="subsection">3.2.4 Polygons</h4>

<p><a name="index-polygon-265"></a><strong>Syntax:</strong>
<pre class="example">     polygon[<var>options</var>] <var>point_list</var>
</pre>
   <p class="noindent">This command is the three-dimensional equivalent of the
<code>PSTricks</code> command <code>\pspolygon</code>.  The <code>sketch</code> hidden
surface algorithm assumes that polygons are convex and planar. 
<a name="index-polygon_002c-planar-266"></a><a name="index-planarity-of-polygons-267"></a>In practice, drawings may well turn out correctly even if these
assumptions are violated.

<div class="node">
<p><hr>
<a name="Specials"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Sweeps">Sweeps</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Polygons">Polygons</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Drawables">Drawables</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h4 class="subsection">3.2.5 Specials</h4>

<p><a name="index-special-268"></a><strong>Syntax:</strong>
<pre class="example">     special $<var>raw_text</var>$[lay=<var>lay_value</var>] <var>point_list</var>
</pre>
   <p class="noindent">Here <code>$</code>
<a name="index-quoting_002c-special-269"></a>can be any character and is used to delimit the start
and end of <var>raw_text</var>.  The command embeds <var>raw_text</var> in the
<code>sketch</code> output after performing substitutions as follows. 
<a name="index-special-argument-substitution-270"></a><a name="index-argument_002c-special-271"></a>
     <ul>
<li><code>#</code><var>i</var> where <var>i</var> is a positive integer is replaced by
the <var>i</var>'th point in <var>point_list</var>. 
<li><code>#{</code><var>i</var><code>}</code> is also replaced as above. 
<li><code>#</code><var>i</var><code>-</code><var>j</var> where <var>i</var> and <var>j</var> are positive
integers is replaced by a string <code>{</code><var>angle</var><code>}</code> where
<var>angle</var> is the polar angle of a vector from the <var>i</var>'th point
in <var>point_list</var> to the <var>j</var>'th. 
<li><code>#{</code><var>i</var><code>-</code><var>j</var><code>}</code> is also replaced as above. 
<li><code>##</code> is replaced with <code>#</code>. 
</ul>
   The forms with braces <span class="samp">{ }</span> are useful when the argument is
immediately followed by a digit that is part of the TeX code.

   <p>The only useful option of <code>special</code> is <code>lay</code>. 
<a name="index-lay-272"></a>See <a href="#Internal-options">Internal options</a>.

<div class="node">
<p><hr>
<a name="Sweeps"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Blocks">Blocks</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Specials">Specials</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Drawables">Drawables</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h4 class="subsection">3.2.6 Sweeps</h4>

<p><a name="index-sweep-273"></a><strong>Syntax:</strong>
<pre class="example">     sweep { <var>n</var>, <var>T_1</var>, <var>T_2</var>, ..., <var>T_r</var> }[<var>options</var>] <var>swept_object</var>
     sweep { <var>n</var>&lt;&gt;, <var>T_1</var>, <var>T_2</var>, ..., <var>T_r</var> }[<var>options</var>] <var>swept_object</var>
</pre>
   <p class="noindent">The sweep connects <var>n</var> (or perhaps <var>n</var>+1) copies of
<var>swept_object</var>
<a name="index-swept-object-274"></a>in order to create a new object of higher
dimension.  The <var>T_i</var> (for i between 1 and
r) are transforms. 
<a name="index-transform-275"></a>The k'th copy of <var>swept_object</var> is produced by applying the
following transform to the original.
<pre class="example">     <var>T_1</var>^k then <var>T_2</var>^k then ... then <var>T_r</var>^k
</pre>
   <p class="noindent">Here <var>T</var>^k means &ldquo;transform <var>T</var> applied k
times.&rdquo;  The original object is the zero'th copy, with k=0 and
effectively no transform applied (T^0=I, the identity
transform).

   <p>The method of connecting the copies depends on the type of
<var>swept_object</var> and on whether the closure tag
<a name="index-_003c_003e_0040r_007b_002c-closure-tag_007d-276"></a><a name="index-closure-tag_002c-_0040code_007b_003c_003e_007d-277"></a><span class="samp">&lt;&gt;</span> is present
or not.

   <p>An example of a sweep where r=2 is the Mobius figure at
<a href="#More-to-learn">More to learn</a>.

<ul class="menu">
<li><a accesskey="1" href="#Swept-points">Swept points</a>:                 Swept points make lines or polygons. 
<li><a accesskey="2" href="#Swept-lines">Swept lines</a>:                  Swept lines make open or closed surfaces. 
<li><a accesskey="3" href="#Swept-polygons">Swept polygons</a>:               Swept polygons make closed surfaces. 
<li><a accesskey="4" href="#Swept-blocks">Swept blocks</a>:                 Swept block == block of sweeps. 
<li><a accesskey="5" href="#Sweep-face-splitting">Sweep face splitting</a>:         Fixing warped faces with triangles. 
</ul>

<div class="node">
<p><hr>
<a name="Swept-points"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Swept-lines">Swept lines</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Sweeps">Sweeps</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Sweeps">Sweeps</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h5 class="subsubsection">3.2.6.1 Swept points</h5>

<p><a name="index-swept-point-278"></a><a name="index-point-sweep-279"></a>If <var>swept_object</var> is a point list and there is no closure tag,
<a name="index-_003c_003e_0040r_007b_002c-closure-tag_007d-280"></a><a name="index-closure-tag_002c-_0040code_007b_003c_003e_007d-281"></a>then <code>sweep</code> connects <var>n</var>+1 successive copies of each
point (including the original) with straight line segments to form a
polyline.  If there are m points in the original point list,
<a name="index-point-list-282"></a>then m polylines with <var>n</var> segments each are formed by the
sweep.  In this manner, <code>sweep</code> forms a set of one-dimensional
objects (polylines) from zero-dimensional ones (points).

   <p>When there <em>is</em> a closure tag,
<a name="index-_003c_003e_0040r_007b_002c-closure-tag_007d-283"></a><a name="index-closure-tag_002c-_0040code_007b_003c_003e_007d-284"></a><code>sweep</code> connects <var>n</var>
successive copies of each point (including the original) with straight
line segments and finally connects the last copy back to the original
to form a polygon with <var>n</var> sides.  If there are m points in
the original point list, then m polygons with <var>n</var> sides
each are formed by the sweep.  In this manner, <code>sweep</code> forms a
set of two-dimensional objects (polygons) from zero-dimensional ones
(points).

   <p>Options
<a name="index-options_002c-sweep-285"></a>of the <code>sweep</code> are copied directly to the resulting
polyline(s).

<div class="node">
<p><hr>
<a name="Swept-lines"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Swept-polygons">Swept polygons</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Swept-points">Swept points</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Sweeps">Sweeps</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h5 class="subsubsection">3.2.6.2 Swept lines</h5>

<p><a name="index-swept-line-286"></a><a name="index-line-sweep-287"></a>If <var>swept_object</var> is a polyline and there is no closure tag,
<a name="index-_003c_003e_0040r_007b_002c-closure-tag_007d-288"></a><a name="index-closure-tag_002c-_0040code_007b_003c_003e_007d-289"></a>then
<code>sweep</code> connects <var>n</var>+1 successive copies of the
polyline (including the original) with four-sided polygons, each pair
of copies giving rise to a &ldquo;polygon strip.&rdquo;  If there are m
points in the original polyline, then (m-1)<var>n</var> polygons are
formed by the sweep.  We call these <dfn>body polygons</dfn>. 
<a name="index-body-polygon-290"></a><a name="index-polygon_002c-body-291"></a>In this manner, <code>sweep</code> forms a
two-dimensional surface from from a one-dimensional polyline.

   <p>The order of vertices
<a name="index-polygon-vertex-order-292"></a><a name="index-order_002c-polygon-vertex-293"></a>produced by <code>sweep</code> is important.  If a
polygon's vertices do not appear in counter-clockwise order in the
final image, the polygon will be culled
<a name="index-culling-294"></a>(unless <code>cull=false</code> is
set).  If the points in the k'th copy of the polyline are
P_1, P_2, <small class="dots">...</small>, P_m, and the points in the
next copy, the (k+1)st, are P_1', P_2', <small class="dots">...</small>,
P_m', then the vertex order of the generated polygons is
<pre class="display">     Body polygon 1: P_2 P_1 P_1' P_2'
     Body polygon 2: P_3 P_2 P_2' P_3'
     <small class="dots">...</small>
     Body polygon m-1: P_m P_m-1 P_m-1' P_m'
</pre>
   <p>Options of unclosed line sweeps
<a name="index-options_002c-sweep-295"></a>are copied to each output polygon. 
Options of the swept line are ignored. 
<a name="index-options_002c-swept-object-296"></a>
When there <em>is</em> a closure tag,
<a name="index-_003c_003e_0040r_007b_002c-closure-tag_007d-297"></a><a name="index-closure-tag_002c-_0040code_007b_003c_003e_007d-298"></a>then <code>sweep</code> connects <var>n</var>
successive copies of the polyline (including the original) with
four-sided body polygons just as the case with no closure tag.  It then
connects the last copy back to the original to form a ribbon-shaped
surface that closes on itself with two holes remaining.

   <p>Finally, the sweep adds two more polygons to seal the holes and form a
closed surface that, depending on the sweep transforms, may
represent the boundary of a solid.  In this manner, <code>sweep</code> forms
the boundary of a three-dimensional object from a one-dimensional
polyline.  We call these hole-filling polygons <dfn>ends</dfn>. 
<a name="index-end-polygon-299"></a><a name="index-polygon_002c-end-300"></a>
The order of vertices of end polygons
<a name="index-polygon-vertex-order-301"></a><a name="index-order_002c-polygon-vertex-302"></a>is important for correct culling
as described above.  If P_1^1, P_1^2, <small class="dots">...</small>,
P_1^n are the <var>n</var> copies of the first polyline point and
P_m^1, P_m^2, <small class="dots">...</small> ,P_m^n are the <var>n</var>
copies of the last polyline point, then the end polygon vertex order
is
<pre class="display">     End polygon 1: P_1^n, P_1^n-1, <small class="dots">...</small> ,P_1^1
     End polygon 2: P_m^1, P_m^2, <small class="dots">...</small> ,P_m^n
</pre>
   <p>If there are no options on the swept line,
<a name="index-options_002c-swept-object-303"></a>then the <span class="samp">sweep</span>
options
<a name="index-options_002c-sweep-304"></a>are copied to each output polygon.  If the swept line does
have options, these are copied to corresponding body polygons; the
sweep options are copied to the end polygons.  In this manner, body
and ends may be drawn with different characteristics such as
<code>fillcolor</code>.

<div class="node">
<p><hr>
<a name="Swept-polygons"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Swept-blocks">Swept blocks</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Swept-lines">Swept lines</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Sweeps">Sweeps</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h5 class="subsubsection">3.2.6.3 Swept polygons</h5>

<p><a name="index-polygon-sweep-305"></a>If <var>swept_object</var> is a polygon, the <code>sweep</code> connects
<var>n</var>+1 successive copies of the closed polyline border of
the polygon to form body polygons exactly as though the border were a
swept polyline as described in <a href="#Swept-lines">Swept lines</a>. 
<a name="index-body-polygon-306"></a><a name="index-polygon_002c-body-307"></a>If there are m points in the
original polygon, then m<var>n</var> body polygons are formed by
this sweep.  The body polygons form an <dfn>extrusion</dfn> of the boundary of the
original polygon with two holes at the open ends.

   <p>Finally, the sweep adds two copies of the original polygon to cover
the holes.  We call these hole-filling polygons <dfn>ends</dfn>. 
<a name="index-end-polygon-308"></a><a name="index-polygon_002c-end-309"></a>In this manner, <code>sweep</code> forms the boundary of a three-dimensional
object from a two-dimensional polygon.

   <p>The order of vertices
<a name="index-polygon-vertex-order-310"></a><a name="index-order_002c-polygon-vertex-311"></a>of end polygons is important for correct culling as described above. 
An exact copy of the original polygon with vertex order intact forms
the first end polygon.  The other end polygon results from
transforming and the reversing the order of vertices in the original. 
The transform places the original polygon at the uncovered hole;
it is
<pre class="example">     <var>T_1</var>^n then <var>T_2</var>^n then ... then <var>T_r</var>^n.
</pre>
   <p class="noindent">If there are no options on the swept polygon, then the <span class="samp">sweep</span>
options are copied to each output polygon.  If the swept polygon does
have options, these are copied to the ends; the sweep options are
copied to the body polygons.  In this manner, body and ends may be
drawn with different characteristics such as <code>fillcolor</code>.

<div class="node">
<p><hr>
<a name="Swept-blocks"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Sweep-face-splitting">Sweep face splitting</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Swept-polygons">Swept polygons</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Sweeps">Sweeps</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h5 class="subsubsection">3.2.6.4 Swept blocks</h5>

<p><a name="index-swept-bock-312"></a><a name="index-block-sweep-313"></a>The swept object <var>swept_object</var> may also be any collection of
polylines and polygons.  This may be a block
<a name="index-block-314"></a><a name="index-_0040_007b-_0040_007d_0040r_007b_002c-block-drawable_007d-315"></a>composed of <code>line</code>
<a name="index-line-316"></a>and/or <code>polygon</code>
<a name="index-polygon-317"></a>commands in braces
<span class="samp">{ }</span>, or it may be the result of a <code>repeat</code>, another
<code>sweep</code>, etc.  The sweep acts independently on each object in the
block exactly as if it were a single swept object described above in
<a href="#Swept-lines">Swept lines</a> and <a href="#Swept-polygons">Swept polygons</a>.

<div class="node">
<p><hr>
<a name="Sweep-face-splitting"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="#Swept-blocks">Swept blocks</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Sweeps">Sweeps</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h5 class="subsubsection">3.2.6.5 Sweep face splitting</h5>

<p>Before sending each four-sided body polygon of a <code>sweep</code>
to the output, <code>sketch</code> tests to see if it is roughly planar. 
<a name="index-polygon_002c-planar-318"></a><a name="index-planarity-of-polygons-319"></a>Since planarity is necessary for proper functioning of the hidden
surface algorithm, &ldquo;warped&rdquo; polygons are automatically split into
two triangles.

   <p>Hole-filling polygons produced by closure-tagged
<a name="index-_003c_003e_0040r_007b_002c-closure-tag_007d-320"></a><a name="index-closure-tag_002c-_0040code_007b_003c_003e_007d-321"></a>line sweeps are not
split.  Nor are original polygons in polygon sweeps.  It is the user's
responsibility to ensure these are planar.

<div class="node">
<p><hr>
<a name="Blocks"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Repeats">Repeats</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Sweeps">Sweeps</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Drawables">Drawables</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h4 class="subsection">3.2.7 Blocks</h4>

<p><a name="index-block-322"></a><a name="index-_0040_007b-_0040_007d_0040r_007b_002c-block-drawable_007d-323"></a>Any sequence of drawables may be grouped in a <dfn>block</dfn> merely by
enclosing them in braces <span class="samp">{ }</span>.  A block is itself drawable.  A
key use of blocks is to extend the effect of a single <code>def</code>,
<a href="#Definitions">Definitions</a>, <code>put</code> <a href="#Puts">Puts</a>, <code>sweep</code> <a href="#Sweeps">Sweeps</a>,
or <code>repeat</code> <a href="#Repeats">Repeats</a> to include several objects rather than
one.

   <p>Definitions (See <a href="#Definitions">Definitions</a>.) inside a block have <dfn>lexical
scope</dfn>
<a name="index-lexical-scope-324"></a><a name="index-scope_002c-identifier-325"></a>extending from the place of definition to the end of the block.

<div class="node">
<p><hr>
<a name="Repeats"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Puts">Puts</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Blocks">Blocks</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Drawables">Drawables</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h4 class="subsection">3.2.8 Repeats</h4>

<p><a name="index-repeat-326"></a><a name="index-repeated-object-327"></a><strong>Syntax:</strong>
<pre class="example">     repeat { <var>n</var>, <var>T_1</var>, <var>T_2</var>, ..., <var>T_r</var> } <var>repeated_object</var>
</pre>
   <p class="noindent">The repeat makes <var>n</var> transformed copies of <var>repeated_object</var>
(including the original).  The <var>T_i</var> are transforms. 
<a name="index-transform-328"></a>The k'th copy of the <var>repeated_object</var> (for
k=0,1,...,n-1) is produced in the
same manner as for <code>sweep</code>s described in <a href="#Sweeps">Sweeps</a>.  This is
repeated here (no pun intended) for convenience.  To make the
k'th copy, the following transform is applied to the
original object.
<pre class="example">     <var>T_1</var>^k then <var>T_2</var>^k then ... then <var>T_r</var>^k
</pre>
   <p class="noindent">Here <var>T</var>^k means &ldquo;transform <var>T</var> applied k
times.&rdquo;

<div class="node">
<p><hr>
<a name="Puts"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="#Repeats">Repeats</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Drawables">Drawables</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h4 class="subsection">3.2.9 Puts</h4>

<p><a name="index-put-329"></a><strong>Syntax:</strong>
<pre class="example">     put { <var>T</var> } <var>put_object</var>
</pre>
   <p class="noindent">Put merely applies transform <var>T</var> to the drawable <var>put_object</var>.

<div class="node">
<p><hr>
<a name="Definitions"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Global-environment">Global environment</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Drawables">Drawables</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Input-language">Input language</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h3 class="section">3.3 Definitions</h3>

<p><a name="index-definition-330"></a>Definitions give names to <code>sketch</code> objects.  Definitions alone
are benign.  A <code>sketch</code> input file consisting entirely of
definitions will generate no drawing.  Only when definitions are
<dfn>referenced</dfn> do they potentially lead to ink on the drawing.

   <p>The intent of definitions is to make <code>sketch</code> code more concise
and readable.  There is no input file employing definitions
that could not be re-written without them.

   <p>Definable objects include any result of an affine arithmetic
expression (scalar, point, vector, or transform), any drawable
object (dots, line, curve, polygon, block, sweep, put, repeat, or
special), and option strings.  In addition, <dfn>tag definitions</dfn>,
<a name="index-definition_002c-tag-331"></a><a name="index-tag-definition-332"></a>which have no associated object at all, allow the meaning of other
definitions to be selected from a set of alternatives. Since tags may
be defined (and undefined) in the command line of <code>sketch</code>, they
can be an aid in the script-driven preparation of documents.

<ul class="menu">
<li><a accesskey="1" href="#Forms-of-definitions">Forms of definitions</a>:         Different defs for different purposes. 
<li><a accesskey="2" href="#Forms-of-references">Forms of references</a>:          How references denote types. 
</ul>

<div class="node">
<p><hr>
<a name="Forms-of-definitions"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Forms-of-references">Forms of references</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Definitions">Definitions</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Definitions">Definitions</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h4 class="subsection">3.3.1 Forms of definitions</h4>

<p>Definitions have three possible forms, <dfn>simple</dfn>,
<a name="index-simple-definition-333"></a><a name="index-definition_002c-simple-334"></a><dfn>with alternatives</dfn>,
<a name="index-definition-with-alternatives-335"></a><a name="index-alternatives_002c-definition-336"></a>and <dfn>tag</dfn>
<a name="index-tag-definition-337"></a><a name="index-definition_002c-tag-338"></a>as shown here in order.

<p class="noindent"><strong>Syntax:</strong>
<pre class="example">     def <var>id</var> <var>object</var>  % simple def
     def <var>id</var> &lt;<var>tag_1</var>&gt; <var>object_1</var>  % def with alternatives
            &lt;<var>tag_2</var>&gt; <var>object_2</var>
            ...
            &lt;&gt; <var>default_object</var>
     def <var>id</var> &lt;&gt;  % tag def
</pre>
   <p class="noindent">The simple definition merely associates <var>object</var> with the
identifier <var>id</var>.

   <p>The definition with alternatives associates
<var>object_i</var> with <var>id</var>, where <var>tag_i</var> is the
first defined tag in the list of alternative tag references. 
<a name="index-tag-reference-339"></a><a name="index-reference_002c-tag-340"></a><a name="index-_003cfoo_003e_0040r_007b_002c-tag-reference_007d-341"></a>If no tag in the list is defined, then <var>default_object</var> is
associated with identifier <var>id</var>.

   <p>The final form defines <var>id</var> as a tag.  Another way to define a tag
is with the <span class="option">-D</span> command line option. See <a href="#Command-line">Command line</a>.

<div class="node">
<p><hr>
<a name="Forms-of-references"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="#Forms-of-definitions">Forms of definitions</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Definitions">Definitions</a>
<br>
</div>

<h4 class="subsection">3.3.2 Forms of references</h4>

<p>References to defined names are enclosed in bracketing delimiters. 
The delimiter characters imply the type of the associated value as
shown in the table below.  A type error is raised if the type of a
reference does not match the type of the defined value.  The intent of
this mechanism is, again, to make <code>sketch</code> input files more
readable.
   <p><table summary=""><tr align="left"><th valign="top">Type  </th><th valign="top">Reference
<br></th></tr><tr align="left"><td valign="top">scalar    </td><td valign="top"><var>id</var>
<a name="index-scalar-reference-342"></a><a name="index-reference_002c-scalar-343"></a><br></td></tr><tr align="left"><td valign="top">point     </td><td valign="top"><code>(</code><var>id</var><code>)</code>
<a name="index-point-reference-344"></a><a name="index-reference_002c-point-345"></a><a name="index-_0028foo_0029_0040r_007b_002c-point-reference_007d-346"></a><br></td></tr><tr align="left"><td valign="top">vector    </td><td valign="top"><code>[</code><var>id</var><code>]</code>
<a name="index-vector-reference-347"></a><a name="index-reference_002c-vector-348"></a><a name="index-_005bfoo_005d_0040r_007b_002c-vector-reference_007d-349"></a><br></td></tr><tr align="left"><td valign="top">transform </td><td valign="top"><code>[[</code><var>id</var><code>]]</code>
<a name="index-transform-reference-350"></a><a name="index-reference_002c-transform-351"></a><a name="index-_005b_005bfoo_005d_005d_0040r_007b_002c-transform-reference_007d-352"></a><br></td></tr><tr align="left"><td valign="top">drawable  </td><td valign="top"><code>{</code><var>id</var><code>}</code>
<a name="index-drawable-reference-353"></a><a name="index-reference_002c-drawable-354"></a><a name="index-_0040_007bfoo_0040_007d_0040r_007b_002c-drawable-reference_007d-355"></a><br></td></tr><tr align="left"><td valign="top">options   </td><td valign="top"><code>[</code><var>id</var><code>]</code> or <code>[</code><var>id1</var><code>,...,</code><var>idN</var><code>]</code>
<a name="index-options-reference-356"></a><a name="index-reference_002c-options-357"></a><a name="index-_005bfoo_005d_0040r_007b_002c-options-reference_007d-358"></a><a name="index-options-multiple-reference-359"></a><a name="index-reference_002c-multiple-options-360"></a><a name="index-_005bfoo_002c_002e_002e_002e_002cbar_005d_0040r_007b_002c-multiple-options-reference_007d-361"></a><br></td></tr><tr align="left"><td valign="top">tag       </td><td valign="top"><code>&lt;</code><var>id</var><code>&gt;</code>
<a name="index-tag-reference-362"></a><a name="index-reference_002c-tag-363"></a><a name="index-_003cfoo_003e_0040r_007b_002c-tag-reference_007d-364"></a>
   <br></td></tr></table>
   <pre class="sp">

</pre>
Note that square brackets <span class="samp">[ ]</span> are used both for vector and for
options references.  Details of <code>sketch</code> syntax make it
impossible for these two reference types to be confused.  The
special multiple reference <code>[</code><var>id1</var><code>,</code><var>id2</var><code>,...,</code><var>idN</var><code>]</code>
acts as if the respective lists of options were concatenated.

<div class="node">
<p><hr>
<a name="Global-environment"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="#Definitions">Definitions</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Input-language">Input language</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h3 class="section">3.4 Global environment</h3>

<p>An optional global environment block provides a few ways to affect the
entire scene.  The block must appear as the last text in the
<code>sketch</code> input file.  It may include definitions, but note
that previous definitions at the top level (not nested inside
blocks) are also available.

<p class="noindent"><strong>Syntax:</strong>
<a name="index-global-365"></a>
<pre class="example">     global { <var>environment_settings</var> }
</pre>
   <p class="noindent">The contents of <var>environment_settings</var> are discussed in the
sections that follow.

<ul class="menu">
<li><a accesskey="1" href="#Global-options">Global options</a>:               Attributes of the entire drawing. 
<li><a accesskey="2" href="#Camera">Camera</a>:                       A final camera transformation of the scene. 
<li><a accesskey="3" href="#Picture-box">Picture box</a>:                  Setting the bounding box and 2d clipping. 
<li><a accesskey="4" href="#Frame">Frame</a>:                        Adding a box around the drawing. 
<li><a accesskey="5" href="#Language">Language</a>:                     Setting the output language. 
</ul>

<div class="node">
<p><hr>
<a name="Global-options"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Camera">Camera</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Global-environment">Global environment</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Global-environment">Global environment</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h4 class="subsection">3.4.1 Global options</h4>

<p><a name="index-options_002c-global-366"></a><a name="index-global-options-367"></a><a name="index-set-368"></a><strong>Syntax:</strong>
<pre class="example">     set [ <var>options</var> ]
</pre>
   <p class="noindent">The contents of <var>options</var>, except for <code>sketch</code> internal
options, are copied as-is to a <tt>\psset</tt> that appears before
anything else in the output file.  This is a good place to set
<code>unit</code>, a default <code>linewidth</code>, etc.

   <p>Internal options
<a name="index-options_002c-internal-369"></a><a name="index-internal-options-370"></a>work on all objects where they make sense. 
This includes
<a name="index-cull-371"></a><a name="index-split-372"></a><a name="index-lay-373"></a><code>cull</code> and <code>split</code> (but not <code>lay</code>). 
See <a href="#Internal-options">Internal options</a>.

<div class="node">
<p><hr>
<a name="Camera"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Picture-box">Picture box</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Global-options">Global options</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Global-environment">Global environment</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h4 class="subsection">3.4.2 Camera</h4>

<p><a name="index-camera-374"></a><strong>Syntax:</strong>
<a name="index-camera-375"></a>
<pre class="example">     camera <var>transform_expression</var>
</pre>
   <p>The <var>transform_expression</var> is applied after all other
transformations of the scene.  This is currently only useful for
transforming the bounding box.  See <a href="#Picture-box">Picture box</a>.  It will play a
role in any future implementation of clipping.

<div class="node">
<p><hr>
<a name="Picture-box"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Frame">Frame</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Camera">Camera</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Global-environment">Global environment</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h4 class="subsection">3.4.3 Picture box</h4>

<p><a name="index-picture-box-376"></a><strong>Syntax:</strong>
<a name="index-picturebox-377"></a>
<pre class="example">     picturebox[<var>baseline</var>]
     picturebox[<var>baseline</var>] (<var>p1</var>)(<var>p2</var>)
</pre>
   <p class="noindent">The first form of <code>picturebox</code> causes a scalar <var>baseline</var>
fraction to be emitted in the <code>pspicture</code>
<a name="index-_0040code_007bpspicture_007d-378"></a><a name="index-baseline-fraction-379"></a>environment of the output.  See
<code>PSTricks</code> documentation for <code>pspicture</code>.

   <p>In the second form, the <var>baseline</var> fraction is optional, and the
two points that follow define the diagonal of a three-dimensional
bounding box
<a name="index-bounding-box-380"></a>for the completed scene.  The parallel projection
<a name="index-parallel-projection-381"></a><a name="index-projection_002c-parallel-382"></a>of the bounding box
determines the corners of the drawing's <code>pspicture*</code> environment,
which is used in place of <code>pspicture</code>.  This causes PostScript to
clip
<a name="index-clipping-383"></a>the final drawing to the bounding box in 2d.  If there is a
<code>camera</code> specified, the camera tranformation is applied to the
bounding box, and the <code>pspicture</code> is set just large
enough to include the transformed box.

   <p>When no bounding box is given, <code>sketch</code> computes one
automatically.

<div class="node">
<p><hr>
<a name="Frame"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Language">Language</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Picture-box">Picture box</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Global-environment">Global environment</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h4 class="subsection">3.4.4 Frame</h4>

<p><a name="index-frame-box-384"></a><strong>Syntax:</strong>
<a name="index-frame-385"></a>
<pre class="example">     frame [<var>options</var>]
</pre>
   <p class="noindent">Causes a <tt>\psframebox</tt>
<a name="index-_0040code_007bpsframebox_007d-386"></a>to surround the <code>pspicture</code>
environment in the output.  If <var>options</var> are present, they are
copied as-is.  Normally one would want to set
<a name="index-linewidth-387"></a><code>linewidth</code>,
<a name="index-linestyle-388"></a><code>linestyle</code>,
<a name="index-linecolor-389"></a><code>linecolor</code>, etc. 
If omitted, then
<a name="index-framesep-390"></a><code>framesep=0pt</code> is
added so that the frame tightly hugs the <code>pspicture</code>.

<div class="node">
<p><hr>
<a name="Language"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="#Frame">Frame</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Global-environment">Global environment</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h4 class="subsection">3.4.5 Language</h4>

<p><a name="index-language_002c-output-391"></a><a name="index-output-language-392"></a><a name="index-language-393"></a>
<pre class="example">     language tikz
     language tikz, context
     language pstricks
     language pstricks, latex
</pre>
   <p class="noindent">Sets the output language generated by <code>sketch</code>. 
<a name="index-pstricks-394"></a><a name="index-tikz-395"></a>The set of options understood by sketch also changes.  For example,
the <code>PSTricks</code> option <code>linewidth</code> will not be properly
handled if <code>language</code> is set to <code>tikz</code>.  Similarly, the
<code>TikZ</code> option <code>line style</code> (note the space) will not be
properly handled if <code>language</code> is set to <code>pstricks</code>.  If no
language is specified, the default <code>pstricks</code> is used.

   <p>An optional comma followed by
<code>latex</code>
<a name="index-latex-396"></a>or
<code>context</code>
<a name="index-context-397"></a>specifies the macro package that the output should assume.  This
affects the <code>picture</code> environment commands emitted and the
document template used with the <span class="option">-T</span> option. See <a href="#Command-line">Command line</a>.  Note that at the time this manual was generated,
<code>PSTricks</code> was not supported by LaTeX or by <code>ConTeXt</code>.

<div class="node">
<p><hr>
<a name="Building-a-drawing"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Command-line">Command line</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Input-language">Input language</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h2 class="chapter">4 Building a drawing</h2>

<p>Successful drawings with <code>sketch</code> and with any scene description
language
<a name="index-scene-description-language-398"></a>require that the user develop an accurate mental picture of her code
and its meaning.  This image is best built in small pieces. 
Therefore, <code>sketch</code> inputs are best created in small increments
with frequent pauses to compile and view the results.  Careful
comments in the input often help as a scene grows in complexity.

<ul class="menu">
<li><a accesskey="1" href="#Overview">Overview</a>:                     Building a substantial drawing. 
<li><a accesskey="2" href="#A-technical-drawing">A technical drawing</a>:          An example with fine placement. 
<li><a accesskey="3" href="#A-hierarchical-model">A hierarchical model</a>:         An example with sweeps and puts. 
<li><a accesskey="4" href="#Caveats">Caveats</a>:                      Where trouble can occur. 
</ul>

<div class="node">
<p><hr>
<a name="Overview"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#A-technical-drawing">A technical drawing</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Building-a-drawing">Building a drawing</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Building-a-drawing">Building a drawing</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h3 class="section">4.1 Overview</h3>

<p>As an overview, let's develop a diagram that shows how a perspective
projection transform
<a name="index-perspective-projection-399"></a><a name="index-transform-400"></a><a name="index-projection_002c-perspective-401"></a>works.  We'll start with the traditional reference object
used in computer graphics textbooks, a house-shaped prism.  Begin
by defining the points of the house.  Rather than defining the faces
of the house as polygons and transforming those, we are going to
transform the points themselves with <code>sketch</code> arithmetic so that
we have names for the transformed points later. 
<a name="index-def-402"></a>
<pre class="verbatim">
  % right side (outside to right)
  def R1 (1,1,1) def R2 (1,-1,1) def R3 (1,-1,-1) def R4 (1,1,-1)
  def R5 (1,1.5,0)

  % left side (outside to right--backward)
  def W  [2,0,0]
  def L1 (R1)-[W] def L2 (R2)-[W] def L3 (R3)-[W] def L4 (R4)-[W]
  def L5 (R5)-[W]
</pre>
To add a door to the house, we use a polygon slightly in
front of the foremost face of the house.
<pre class="verbatim">
  % door
  def e .01
  def D1 (0,-1,1+e) def D2 (.5,-1,1+e) def D3 (.5,0,1+e) def D4 (0,0,1+e)
</pre>
Now let's create a new set of points that are a to-be-determined
transform of the originals.
<pre class="verbatim">
  def hp scale(1) % house positioner
  def pR1 [[hp]]*(R1) def pR2 [[hp]]*(R2) def pR3 [[hp]]*(R3)
  def pR4 [[hp]]*(R4) def pR5 [[hp]]*(R5)
  def pL1 [[hp]]*(L1) def pL2 [[hp]]*(L2) def pL3 [[hp]]*(L3)
  def pL4 [[hp]]*(L4) def pL5 [[hp]]*(L5)
  def pD1 [[hp]]*(D1) def pD2 [[hp]]*(D2) def pD3 [[hp]]*(D3)
  def pD4 [[hp]]*(D4) 
</pre>
Note the use of a <dfn>transform definition</dfn>
<a name="index-transform-definition-403"></a><a name="index-definition_002c-transform-404"></a><a name="index-_005b_005bfoo_005d_005d_0040r_007b_002c-transform-reference_007d-405"></a>and
<dfn>transform references</dfn>. 
<a name="index-transform-reference-406"></a><a name="index-reference_002c-transform-407"></a><a name="index-_005b_005bfoo_005d_005d_0040r_007b_002c-transform-reference_007d-408"></a>Now define the seven polygonal faces of the house and the door using
the transformed points as vertices.  Be careful with vertex order! 
<a name="index-polygon-vertex-order-409"></a><a name="index-order_002c-polygon-vertex-410"></a><a name="index-fillcolor-411"></a><a name="index-def-412"></a><a name="index-polygon-413"></a><a name="index-_0040_007b-_0040_007d_0040r_007b_002c-block-drawable_007d-414"></a>
<pre class="verbatim">
  def rgt polygon (pR1)(pR2)(pR3)(pR4)(pR5)
  def lft polygon (pL5)(pL4)(pL3)(pL2)(pL1)
  def frt polygon (pR2)(pR1)(pL1)(pL2)
  def bck polygon (pR4)(pR3)(pL3)(pL4)
  def tfr polygon (pR1)(pR5)(pL5)(pL1)
  def tbk polygon (pR5)(pR4)(pL4)(pL5)
  def bot polygon (pR2)(pL2)(pL3)(pR3)
  def door polygon[fillcolor=brown] (pD1)(pD2)(pD3)(pD4)
  def house { {rgt}{lft}{frt}{bck}{tfr}{tbk}{bot}{door} }
</pre>
Time for a sanity check.  Add the line
<a name="index-_0040_007bfoo_0040_007d_0040r_007b_002c-drawable-reference_007d-415"></a><a name="index-reference_002c-drawable-416"></a>
<pre class="verbatim">
  {house}
</pre>
and this is what we get.

<div align="center"><img src="ex130.png" alt="ex130.png"></div>

<p class="noindent">This is correct, but does not reveal very much.  Common errors are
misplaced vertices and polygons missing entirely due to incorrect
vertex order. 
<a name="index-polygon-vertex-order-417"></a><a name="index-order_002c-polygon-vertex-418"></a>To rule these out, let's inspect all sides of the
house. This is not hard. Merely replace the reference
<tt>{house}</tt> with a <code>repeat</code>. See <a href="#Repeats">Repeats</a>. 
<a name="index-_0040_007bfoo_0040_007d_0040r_007b_002c-drawable-reference_007d-419"></a><a name="index-reference_002c-drawable-420"></a><a name="index-repeat-421"></a><a name="index-rotate-422"></a><a name="index-translate-423"></a>
<pre class="verbatim">
  repeat { 13, rotate(30, [1,2,3]), translate([3,0,0]) } {house}
</pre>
<div align="center"><img src="ex140.png" alt="ex140.png"></div>

<p class="noindent">Again things look correct.  Note that the hidden surface algorithm
handles intersecting polygons correctly where some copies of the house
overlap.

   <p>Let's lay out the geometry of perspective projection of the house onto
a plane with rays passing through the origin.  Begin by positioning the
house twelve units back on the negative z-axis and adding a set
of coordinate axes.  To move the house we need only change the &ldquo;house
positioning&rdquo; transform defined earlier. 
<a name="index-def-424"></a><a name="index-rotate-425"></a><a name="index-translate-426"></a><a name="index-arrows-427"></a><a name="index-linewidth-428"></a><a name="index-linecolor-429"></a><a name="index-linestyle-430"></a><a name="index-special-431"></a><a name="index-line-432"></a>
<pre class="verbatim">
  def hp rotate(-40, [0,1,0]) then translate([0,0,-12])
  def axes {
    def sz 1
    line [arrows=&lt;->] (sz,0,0)(O)(0,sz,0)
    line [arrows=->]  (O)(0,0,sz)
    line [linewidth=.2pt,linecolor=blue,linestyle=dashed] (O)(0,0,-10)
    special |\uput[r]#1{$x$}\uput[u]#2{$y$}\uput[l]#3{$z$}|
      (sz,0,0)(0,sz,0)(0,0,sz)
  }
</pre>

   <p>Time for another test.  Let's build a real view transform,
creating a <dfn>virtual camera</dfn>
<a name="index-virtual-camera-433"></a>to look at the scene we are constructing.  Replace the <code>repeat</code>
with
<pre class="verbatim">
  def eye (10,4,10)
  def look_at (0,0,-5)
  put { view((eye), (look_at)) } { {house}{axes} }
</pre>
The <dfn>view transform</dfn> repositions the scene so that the point
<code>eye</code> is at the origin and the direction from <code>eye</code> to
<code>look_at</code> is the negative z-axis.  This requires a
rotation and a translation that are all packed into the constructor
<code>view</code>.

<div align="center"><img src="ex150.png" alt="ex150.png"></div>

<p class="noindent">This is starting to look good!  Add the projection plane half way
between the origin and the house at z=-5.  We'll try
the angle argument feature of <code>special</code> to position a label.
<pre class="verbatim">
  def p 5 % projection distance (plane at z=-p)
  def projection_plane {
    def sz 1.5
    polygon (-sz,-sz,-p)(sz,-sz,-p)(sz,sz,-p)(-sz,sz,-p)
    special |\rput[b]#1-2#3{\footnotesize\sf projection plane}| 
      (-sz,-sz,-p)(sz,-sz,-p)(0,-sz+.1,-p)
  }
</pre>
Add <tt>{projection_plane}</tt> to the list of objects in the
<code>put</code> above.

<div align="center"><img src="ex160.png" alt="ex160.png"></div>

   <p class="indent">The way we constructed the points of the house now makes it easy to
draw rays of projection.  We'll cast one ray from every visible vertex
of the house and define options so the appearance of
all rays can be changed at the same time.
<pre class="verbatim">
  def projection_rays {
    def rayopt [linewidth=.3pt,linecolor=lightgray]
    line [rayopt](O)(pR1) line [rayopt](O)(pR2) line[rayopt](O)(pR3)
    line [rayopt](O)(pR4) line [rayopt](O)(pR5)
    line [rayopt](O)(pL1) line [rayopt](O)(pL2) line[rayopt](O)(pL5)
    line [rayopt](O)(pD1) line [rayopt](O)(pD2) 
    line [rayopt](O)(pD3) line [rayopt](O)(pD4) 
  }
</pre>
The result is shown here.

<div align="center"><img src="ex170.png" alt="ex170.png"></div>

<p class="noindent">The rays pierce the projection plane at the corresponding points on
the perspective image we are trying to draw.  Albrecht D&uuml;rer and his
Renaissance contemporaries had the same idea in the early 1500's.

<div align="center"><img src="duerer.png" alt="duerer.png"></div>

   <p>All that's left is to find a way to connect the points of the house
on the projection plane.  We could pull out a good computer graphics
text, find the necessary matrix, and enter it ourselves as a
transform literal.  See <a href="#Transform-literals">Transform literals</a>. That work is
already done, however.  We can use the <code>project(p)</code> constructor.

   <p>There are still some details that require care.  Projection will
flatten whatever is transformed onto the plane z=-p.  Therefore
any part of the house could disappear behind the projection plane (the
hidden surface algorithm orders objects at the same depth
arbitrarily).  The door may also disappear behind the front of the
house.  To make sure everything remains visible, we'll place the house
a tiny bit in front of the projection plane and a second copy of the
door in front of the house.
<pre class="verbatim">
  def projection {
    % e is a small number defined above
    put { project(p) then translate([0,0,1*e]) } {house}
    put { project(p) then translate([0,0,2*e]) } {door}
  }
</pre>

<div align="center"><img src="ex180.png" alt="ex180.png"></div>

   <p>If you have studied and understand all this, you are well on the way
to success with <code>sketch</code>.  Not shown are the 20 or so iterations
that were required to find a reasonable viewing angle and house
position, etc.  Nonetheless, this drawing was completed in about an
hour.  While a GUI tool may have been a little faster, it is unlikely
that a new drawing, itself a perspective projection of the scene,
could be generated with two more minutes' work!  Just change the view
transform to
<pre class="verbatim">
  put { view((eye), (look_at)) then perspective(9) } { ...
</pre>
and produce this.

<div align="center"><img src="ex190.png" alt="ex190.png"></div>

<div class="node">
<p><hr>
<a name="A-technical-drawing"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#A-hierarchical-model">A hierarchical model</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Overview">Overview</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Building-a-drawing">Building a drawing</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h3 class="section">4.2 A technical drawing</h3>

<p>Let's look at a drawing that represents the kind of problem
<code>sketch</code> was meant to solve&mdash;a pair of textbook figures
regarding a polygonal approximation of a truncated cone.  Here are the
pictures we will produce.

<div align="center"><img src="ex250.png" alt="ex250.png">     <img src="ex260.png" alt="ex260.png"></div>

   <p>The cone shape is just a swept line with no closure tag and culling
turned off.  Begin by setting up some useful constants. 
<a name="index-def-434"></a><a name="index-rotate-435"></a>
<pre class="verbatim">
  def O (0,0,0) def I [1,0,0] def J [0,1,0] def K [0,0,1]
  def p0 (1,2) def p1 (1.5,0) def N 8
  def seg_rot rotate(360 / N, [J])
</pre>
The points <code>p0</code> and <code>p1</code> are the end points of the line to
be swept.  The definition <code>seg_rot</code> is the sweep transformation. 
With these, the cone itself is simple. 
<a name="index-sweep-436"></a><a name="index-cull-437"></a><a name="index-line-438"></a><a name="index-swept-line-439"></a><a name="index-line-sweep-440"></a>
<pre class="verbatim">
  sweep[cull=false] { N, [[seg_rot]] } line(p0)(p1)
</pre>

   <p>The axes are next and include an interesing trick that shows the
hidden parts as dotted lines.  The secret is draw the axes
twice&mdash;solid lines with the normal
<a name="index-hidden-surface-algorithm-441"></a>hidden surface algorithm in effect, and then dotted with the
option
<a name="index-lay-442"></a><code>lay=over</code> so that no polygons can hide them. 
<a name="index-def-443"></a><a name="index-line-444"></a><a name="index-arrows-445"></a><a name="index-linewidth-446"></a><a name="index-lay-447"></a><a name="index-linestyle-448"></a><a name="index-special-449"></a>
<pre class="verbatim">
  def ax (dx,0,0) % tips of the axes
  def ay (0,dy,0)
  def az (0,0,dz)
  line[arrows=&lt;->,linewidth=.4pt](ax)(O)(ay)
  line[arrows=->,linewidth=.4pt](O)(az)
  % repeat dotted as an overlay to hint at the hidden lines
  line[lay=over,linestyle=dotted,linewidth=.4pt](ax)(O)(ay)
  line[lay=over,linestyle=dotted,linewidth=.4pt](O)(az)
  special|\footnotesize
          \uput[d]#1{$x$}\uput[u]#2{$y$}\uput[l]#3{$z$}|
    (ax)(ay)(az)
</pre>
The labels are applied with <code>PSTricks</code> special objects
<a name="index-special-objects-450"></a>as usual.

   <p>For the height dimension mark, the power of affine
<a name="index-affine-arithmetic-451"></a>arithetic is very helpful. 
<a name="index-def-452"></a><a name="index-unit-453"></a><a name="index-scale-454"></a><a name="index-line-455"></a><a name="index-special-456"></a>
<pre class="verbatim">
  def hdim_ref unit((p1) - (O)) then [[seg_rot]]^2
  def c0 (p0) then scale([J])
  def h00 (c0) + 1.1 * [hdim_ref]
  def h01 (c0) + 1.9 * [hdim_ref]
  def h02 (c0) + 1.8 * [hdim_ref]
  line(h00)(h01)
  def h10 (O) + 1.6 * [hdim_ref]
  def h11 (O) + 1.9 * [hdim_ref]
  def h12 (O) + 1.8 * [hdim_ref]
  line(h10)(h11)
  line[arrows=&lt;->](h02)(h12)
  def hm2 ((h02) - (O) + (h12) - (O)) / 2 + (O)
  special|\footnotesize\rput*#1{$h$}|(hm2)
</pre>
The general idea employed here is to compute a unit &ldquo;reference
vector&rdquo; parallel to the xz-plane in the desired direction of
the dimension from the origin.  The transformation
<code>[[seg_rot]]^2</code> rotates two segments about the y-axis. 
When applied to <code>(p1) - (O)</code>, the resulting vector points to the
right as shown.  In this manner, we can pick any vertex as the
location of the height dimension lines by varying the exponent of
<code>[[seg_rot]]</code>.  This is only one of many possible strategies.

   <p>The computation of <code>hm2</code> is a useful idiom for finding the
<a name="index-centroid-457"></a>centroid of a set of points.

   <p>The two radius marks are done similarly, so we present the code
without comment. 
<a name="index-def-458"></a><a name="index-line-459"></a><a name="index-special-460"></a><a name="index-scale-461"></a><a name="index-arrows-462"></a>
<pre class="verbatim">
  % radius measurement marks
  def gap [0,.2,0]  % used to create small vertical gaps

  % first r1
  def up1 [0,3.1,0] % tick rises above dimension a little
  def r1 ((p1) then [[seg_rot]]^-2) + [up1]
  def r1c (r1) then scale([J])
  def r1t (r1) + [gap]
  def r1b ((r1t) then scale([1,0,1])) + [gap]
  line[arrows=&lt;->](r1c)(r1)  % dimension line
  line(r1b)(r1t)             % tick
  def r1m ((r1) - (O) + (r1c) - (O)) / 2 + (O) % label position
  special |\footnotesize\rput*#1{$r_1$}|(r1m)  % label

  % same drill for r0, but must project down first
  def up0 [0,2.7,0]
  def r0 ((p0) then scale([1,0,1]) then [[seg_rot]]^-2) + [up0]
  def r0c (r0) then scale([J])
  def r0t (r0) + [gap]
  def r0b ((p0) then [[seg_rot]]^-2) + [gap]
  line[arrows=&lt;->](r0c)(r0)
  line(r0b)(r0t)
  def r0m ((r0) - (O) + (r0c) - (O)) / 2 + (O)
  special |\footnotesize\rput*#1{$r_0$}|(r0m)
</pre>

   <p>The second drawing uses the same techniques.  Only the method for
drawing the elliptical arc is new.  Here is the code. 
<a name="index-def-463"></a><a name="index-special-464"></a><a name="index-lay-465"></a>
<pre class="verbatim">
  def mid ((p00)-(O)+(p10)-(O)+(p11)-(O)+(p01)-(O))/4+(O)
  special|\rput#1{\pscustom{
    \scale{1 1.3}
    \psarc[arrowlength=.5]{->}{.25}{-60}{240}}}|
    [lay=over](mid)
</pre>
We could have swept a point to make the arc with <code>sketch</code>, but
using a <code>PSTricks</code> custom graphic was simpler.  Again we computed
the
<a name="index-centroid-466"></a>centroid of the quadrilateral by averaging points.  Note that scaling
in Postscript distorts the arrowhead, but in this case the distortion
actually looks better in the projection of the slanted face.  A
<code>sketch</code> arrowhead would not have been distorted.

   <p>The complete code for this example, which draws either figure
depending on the definition of the tag <code>&lt;labeled&gt;</code>, is included
in the <code>sketch</code> distribution in the file <span class="file">truncatedcone.sk</span>.

<div class="node">
<p><hr>
<a name="A-hierarchical-model"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Caveats">Caveats</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#A-technical-drawing">A technical drawing</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Building-a-drawing">Building a drawing</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h3 class="section">4.3 A hierarchical model</h3>

<p><a name="index-hierarchical-model-467"></a>While <code>sketch</code> was never meant to be a geometric modeling
language, it comes fairly close.  The following example puts all we
have seen to work in a very simple model of the human hand.  Start by
sweeping a line to make a truncated cone, which will be copied over
and over again to make the segments of fingers. 
<a name="index-def-468"></a><a name="index-sweep-469"></a><a name="index-rotate-470"></a><a name="index-line-471"></a>
<pre class="verbatim">
  def O (0,0,0) % origin
  def I [1,0,0] def J [0,1,0] def K [0,0,1] % canonical unit vectors
  def segment {
    def n_faces 8
    sweep { n_faces&lt;>, rotate(360 / n_faces, [J]) } 
      line(proximal_rad, 0)(distal_rad, distal_len)
  }
</pre>
In hand anatomy, <em>distal</em> is &ldquo;at the tip&rdquo; and <em>proximal</em>
is &ldquo;in the area of the palm.&rdquo;  We have omitted all the scalar
constants.  You can find them in <span class="file">hand.sk</span>, which is provided
in the <code>sketch</code> distribution.

   <p>We also need a prototypical sphere to use for the joints themselves. 
<a name="index-def-472"></a><a name="index-sweep-473"></a><a name="index-rotate-474"></a>
<pre class="verbatim">
  def joint_sphere {
    def n_joint_faces 8
    sweep [fillcolor=red] { n_joint_faces, rotate(360 / n_joint_faces, [J]) }
      sweep { n_joint_faces, rotate(180 / n_joint_faces) } 
        (0, -joint_rad)
  }
</pre>

   <p>We'll now design the index finger (number&nbsp;<!-- /@w -->1 in our notational
convention; finger&nbsp;<!-- /@w -->0 is the thumb).  The distal rotation for the
finger applies only to the tip, so we define the following. 
<a name="index-def-475"></a><a name="index-put-476"></a><a name="index-translate-477"></a><a name="index-rotate-478"></a><a name="index-scale-479"></a>
<pre class="verbatim">
  def distal_1 {
    put { translate(joint_gap * joint_rad * [J]) 
          then rotate(distal_1_rot, [I]) 
          then translate((distal_len + joint_gap * joint_rad) * [J]) }
      {segment}
    put { rotate(distal_1_rot / 2, [I])
          then translate((distal_len + joint_gap * joint_rad) * [J]) } 
      {joint_sphere}
    put { scale( [J] + proximal_distal_ratio * ([I]+[K]) ) }
      {segment}
  }  
</pre>
The identifiers here are for size and location constants. The
exception is <code>distal_rot_1</code>.  This rotation parameter models the
flexing of the finger tip.  The first <code>put</code> makes a copy of the
finger segment that is translated upward
<a name="index-translation-transform-480"></a><a name="index-transform_002c-translation-481"></a>just far enough to make room
for the spherical joint.  Then it applies the distal rotation. 
<a name="index-rotation-transform-482"></a><a name="index-transform_002c-rotation-483"></a>Finally it translates the whole assembly upward again to make room for
the middle phlanges (the next bone toward the palm).  The second
<code>put</code> positions the sphere.  There is a rotation to place the
grid on the sphere surface at an nice angle, then a translation to the
base of the distal phlanges, which is also center of its rotation. 
Finally, the last <code>put</code> positions the middle segment itself.

   <p>The middle joint is the next one down, with rotation angle
<code>middle_rot_1</code>.  When this angle changes, we need all the objects
in <code>distal_1</code> to rotate as a unit. 
<a name="index-rotation-transform-484"></a><a name="index-transform_002c-rotation-485"></a>This is the reasoning behind
the next definition.
<pre class="verbatim">
  def finger_1 {
    put { translate(joint_gap * joint_rad * [J])
          then rotate(middle_1_rot, [I])
          then translate((middle_ratio * distal_len + 
                          joint_gap * joint_rad) * [J]) }
      {distal_1}
    put { scale(proximal_distal_ratio)
          then rotate(middle_1_rot / 2, [I])
          then translate((middle_ratio * distal_len + 
                          joint_gap * joint_rad) * [J]) } 
      {joint_sphere}
    put { scale( middle_ratio * [J] + 
                 proximal_distal_ratio^2 * ([I]+[K]) ) }
      {segment}
  }
</pre>
This looks very similar to the previous definition, and it is.  The
important difference is that rather than positioning and rotating a
single segment, we position and rotate the entire &ldquo;assembly&rdquo; defined
as <code>distal_1</code>. 
<a name="index-rotation-transform-486"></a><a name="index-transform_002c-rotation-487"></a>The rest is just arithmetic to compute sizes and
positions that look nice.  The last <code>put</code> places an appropriately
shaped segment that is the <em>proximal phlanges</em>, the bone that
joins the palm of the hand.  This completes the finger itself.

   <p>All the other fingers are described identically to this one.  We
account for the fact that real fingers are different sizes in the next
step, which is to build the entire hand.

   <p>The <code>hand</code> definition that follows includes a section for each
finger.  We'll continue with finger&nbsp;<!-- /@w -->1 and omit all the others. 
(Of note is that the thumb needs slightly special treatment&mdash;an extra
rotation to account for its opposing angle. This is clear in the full
source code.) Not surprisingly, the <code>hand</code> definition looks very
much like the previous two.  It should be no surprise that when the
rotation parameter <code>meta_1_rot</code> changes, the entire finger
rotates! 
<a name="index-rotation-transform-488"></a><a name="index-transform_002c-rotation-489"></a>There is an additional rotation that allows the fingers to spread
laterally.  We say these joints of the proximal phlanges have two
<em>degrees of freedom</em>. The joints higher on the finger have only
one. Finally, each finger is scaled by a factor to lend it proportion.
<pre class="verbatim">
  def hand {
    % finger 1 [all other fingers omitted]
    def scale_1 .85
    put { scale(scale_1) 
          then translate((joint_gap * joint_rad) * [J])
	  then rotate(meta_1_rot, [I])
          then rotate(-spread_rot, [K])
          then translate((proximal_1_loc) - (O)) } 
      {finger_1}
    put { scale(scale_1 * proximal_distal_ratio^2)
          then rotate(meta_1_rot / 2, [I])
          then rotate(-spread_rot, [K])
          then translate((proximal_1_loc) - (O)) } 
      {joint_sphere}

    % palm
    sweep { 1, rotate(6, (0,15,0), [I]) }
      put { rotate(-3, (0,15,0), [I]) } {
        polygon(proximal_1_loc)(proximal_2_loc)
               (proximal_3_loc)(proximal_4_loc)
               (h5)(h6)(h6a)(h9)(h10)
        polygon(h6a)(h7)(h8)(h9)
   }  }
</pre>
The last section of the definition creates the polytope for the palm
of the hand by <code>sweep</code>ing
<a name="index-swept-polygon-490"></a><a name="index-polygon-sweep-491"></a>a 10-sided polygon through a very short
arc (9&nbsp;<!-- /@w -->degrees).  This provides a wedge-shaped profile when viewed
from the side. The thick end of the wedge is the wrist.  Because the
polygon is concave, it is split into into two convex shapes with nine
and four vertices.

   <p>We can now have fun positioning the hand by adjusting the various
rotation angles.  The complete source includes definitions with
alternatives that include the following views and more.

<div align="center"><img src="ex210.png" alt="ex210.png"><img src="ex220.png" alt="ex220.png"><img src="ex230.png" alt="ex230.png"><img src="ex240.png" alt="ex240.png"></div>

<div class="node">
<p><hr>
<a name="Caveats"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="#A-hierarchical-model">A hierarchical model</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Building-a-drawing">Building a drawing</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h3 class="section">4.4 Caveats</h3>

<p><code>Sketch</code> is a fairly powerful tool for drawing, but, just as with
TeX, the power to create beautiful results comes along with the
power to make mistakes.  The following are some points where care is
necessary and where the current version of <code>sketch</code> is limited or
has known bugs.

<ul class="menu">
<li><a accesskey="1" href="#Limits-on-error-detection">Limits on error detection</a>:    What sketch doesn't do. 
<li><a accesskey="2" href="#Clipping">Clipping</a>:                     No clipping at present. 
<li><a accesskey="3" href="#Hidden-surface-removal">Hidden surface removal</a>:       Imperfections to fix. 
</ul>

<div class="node">
<p><hr>
<a name="Limits-on-error-detection"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Clipping">Clipping</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Caveats">Caveats</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Caveats">Caveats</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h4 class="subsection">4.4.1 Limits on <code>sketch</code> error detection</h4>

<p><code>Sketch</code> catches many kinds of errors, but not all. For example,
options that sketch does not recognize, even incorrect ones, are
quietly copied to <code>PSTricks</code> commands in the output.  It is also
unfortunately easy to produce <code>sketch</code> inputs that lead to no
picture at all (improper vertex ordering causes everything to be
culled), to pictures that are too big or too small for <code>PSTricks</code>
to draw (due to limits of TeX math), and pictures that look nothing
like what was intended.  A picture with one of these problems can be
difficult to &ldquo;debug.&rdquo;  We offer the following suggestions.
     <ul>
<li>Follow the suggested incremental development method described in
<a href="#Overview">Overview</a>. 
<li>Always maintain one or two back-versions of a drawing so that it is
easy to fall back to a known-good increment. 
<li>When using <code>perspective</code>, ensure all finally transformed objects
satisfy z&lt;0 and, in fact, do not come very close to the origin
at all. 
<li>Temporarily use <code>cull=false</code> to see where vertex ordering
problems lie. 
<li>Use temporary changes of color of one or more objects to ensure that
your understanding of the scene geometry is correct. 
<li>If <code>PSTricks</code> complains about something, inspect the output
directly for clues. 
</ul>

<div class="node">
<p><hr>
<a name="Clipping"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Hidden-surface-removal">Hidden surface removal</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Limits-on-error-detection">Limits on error detection</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Caveats">Caveats</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h4 class="subsection">4.4.2 Clipping</h4>

<p>The current version of <code>sketch</code> has no clipping
<a name="index-clipping-492"></a>operations.  The entire scene is always drawn.  This means that when a
perspective transform is employed, it is the user's responsibility to
make sure the entire scene remains in front of the viewer, the region
z&lt;0.

<div class="node">
<p><hr>
<a name="Hidden-surface-removal"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="#Clipping">Clipping</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Caveats">Caveats</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h4 class="subsection">4.4.3 Hidden surface removal and polygon splitting</h4>

<p><code>Sketch</code> uses the <dfn>depth sort algorithm</dfn>
<a name="index-depth-sort-493"></a><a name="index-hidden-surface-algorithm-494"></a>for hidden surface removal.  This is a very old technique due to
Newell.<a rel="footnote" href="#fn-3" name="fnd-3"><sup>3</sup></a>  It is
generally regarded as too slow for real time graphics, but it is
ideal for our purpose where speed is not very important.<a rel="footnote" href="#fn-4" name="fnd-4"><sup>4</sup></a>

   <p>The depth sort algorithm merely sorts objects on a key of increasing
z-coordinate, equivalent to decreasing depth.  Objects are then
drawn in the sorted sequence so that those at the rear of the scene
are overwritten by those closer to the viewer. Since this is also
how oil painters practice their art, depth sort is sometimes called
&ldquo;the painter's algorithm.&rdquo;

   <p>In some cases it is impossible to strictly order polygons according to
depth.  Moreover, even if a correct depth ordering exists, the
computation needed to find it may be too complex and slow.  In these
cases, <code>sketch</code> splits
<a name="index-splitting_002c-line-and-surface-495"></a>one or more polygons into pieces.  The
expectation is that the new, smaller polygons will be simpler to
order.  <code>Sketch</code> uses a <acronym title="binary space partition">BSP</acronym> (binary space partition)
<a name="index-binary-space-partition-496"></a><a name="index-BSP_002c-binary-space-partition-497"></a>to handle the splitting operation.

<ul class="menu">
<li><a accesskey="1" href="#Statistics">Statistics</a>:                   Performance numbers on depth sort. 
<li><a accesskey="2" href="#Bugs-and-anomalies">Bugs and anomalies</a>:           Imperfections in this implementation. 
</ul>

<div class="node">
<p><hr>
<a name="Statistics"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Bugs-and-anomalies">Bugs and anomalies</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Hidden-surface-removal">Hidden surface removal</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Hidden-surface-removal">Hidden surface removal</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h5 class="subsubsection">4.4.3.1 Statistics</h5>

<p>For the curious, <code>sketch</code> writes one line of depth sort
statistics.  Here is an example for a large collection of triangles.
<pre class="verbatim">
  remark, node=34824 probe=581.9 swap=5 split=2 (in=4 out=6) ols=24851/0
</pre>
It means that 34,824 objects were depth sorted after culling. 
For each, an average of 581.9 others had to be checked to
ensure that the initial, approximate ordering was correct.  Among all
these checks, only 5 resulted in swaps to reorder the initial
sort.  In two cases, a correct ordering could not be determined, so
binary space partitions
<a name="index-binary-space-partition-498"></a>were constructed for splitting.  A total of 4
objects (triangles in this case) were inserted in the partitions, and
6 polygons were produced.  Finally, 24,851 &ldquo;last
resort&rdquo; polygon overlap checks were performed after simpler, faster
checks failed to yield conclusive results.  The final /0 is for
line-polygon overlap checks.  For comparison, the statistics for the
last figure in <a href="#Overview">Overview</a> follow.
<pre class="verbatim">
  remark, node=27 probe=14.6 swap=36 split=15 (in=30 out=45) ols=0/69
</pre>
Note that there was proportionally much more swapping and splitting
activity in this highly connected scene.

<div class="node">
<p><hr>
<a name="Bugs-and-anomalies"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="#Statistics">Statistics</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Hidden-surface-removal">Hidden surface removal</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h5 class="subsubsection">4.4.3.2 Bugs and anomalies</h5>

<p>Polygon and line splitting can both cause anomalies in the output. 
<code>PSTricks</code> dash patterns, specified with <code>linestyle=dashed</code>,
<a name="index-linestyle-499"></a>can be disrupted by splitting.  This occurs when the depth sort
<a name="index-depth-sort-500"></a>gives up too early and splits a line where it is not really
necessary. 
A workaround is to use gray or finely dotted
lines instead.  If your drawing is small, you can also edit the
<code>sketch</code> output by hand to merge the pieces of the offending
line.

   <p>Another anomaly is tiny (or in degenerate cases not-so-tiny) notches
in the lines that border split polygons.  These derive from the way
each polygon is painted: first, all pixels within the boundary are
<dfn>filled</dfn> with color (perhaps white), then the same boundary is
<dfn>stroked</dfn> (a Postscript term) with a line.  The result is that
half the line lies inside the boundary and half outside, while the
Painter's algorithm assumes the polygon lies entirely within its
boundary.  The notches are due to one polygon fill operation
overwriting the already-drawn inside of the border of another
polygon.<a rel="footnote" href="#fn-5" name="fnd-5"><sup>5</sup></a>  One workaround is to make
border lines very thin.  In fact <code>linewidth=0pt</code> is guaranteed to
eliminate this problem, though this results in the thinnest line your
output device can draw, which is usually too thin.  You might get
lucky by merely reordering things in the input file, which is likely
to move the splits to different places.  The only sure-fire solution
is pretty terrible: custom fit <code>special</code> overlay lines (with
<code>\psline</code>) to cover the notches.

   <p>Polygon splitting also breaks <code>PSTricks</code> hatch patterns.  The
only known workaround is to substitute a solid fill for the hatch.

<div class="node">
<p><hr>
<a name="Command-line"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Installing-sketch">Installing sketch</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Building-a-drawing">Building a drawing</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h2 class="chapter">5 Command line</h2>

<p><a name="index-command-line_002c-_0040code_007bsketch_007d-501"></a><strong>Synopsis:</strong>
<pre class="example">     sketch [-h][-V x.y][-v][-b][-d][t doctmp][-T[u|e][p[P|T][L|C]]][-o output.tex]
       [-D <var>tag</var> ...] input1.sk [-U <var>tag</var> ...] input2.sk ...
</pre>
   <p class="noindent"><strong>Description</strong>
Processes the <code>sketch</code> input files in order to produce
<code>PSTricks</code> output code suitable for inclusion in a TeX or
LaTeX document.

<p class="noindent"><strong>Options:</strong>
<a name="index-options_002c-command-line-502"></a><a name="index-command-line-options-503"></a>
     <dl>
<dt><code>-h</code><dd>Print a short catalog of options. 
<br><dt><code>-V</code><dd>Set the <code>PSTricks</code> version assumed for output purposes to
<code>x.y</code>, for example 1.19.  Usually needed only if your
<code>PSTricks</code> is old compared to your <code>sketch</code>.  Use
<code>-v</code> to see what <code>sketch</code> assumes by default. 
<br><dt><code>-v</code><dd>Print version information to standard output, including the version
of <code>PSTricks</code> assumed for output (can be changed with <code>-V</code> above). 
<br><dt><code>-b</code><dd>Use a BSP
<a name="index-binary-space-partition-504"></a><a name="index-BSP_002c-binary-space-partition-505"></a>(See <a href="#Hidden-surface-removal">Hidden surface removal</a>.) for
<em>all</em> hidden surface removal rather than the default, which is
the depth sort algorithm with BSPs used only for cycle resolution. 
This may produce correct output in certain degenerate cases where the
depth sort cannot, but it also leads to many gratuitous splits, hence
more anomalies <a href="#Bugs-and-anomalies">Bugs and anomalies</a> and big output files. 
<br><dt><code>-d</code><dd>Run <code>sketch</code>'s parser in debugging mode.  This is primarily for
development. 
<br><dt><code>-t</code><dd>Use contents of file <span class="file">doctmp</span> as a document template
<a name="index-document-template-506"></a><a name="index-template_002c-document-507"></a>in which to enclose <code>PSTricks</code> output code.  The code is inserted
in place of the first instance of the escape string
<tt>%%SKETCH_OUTPUT%%</tt>. 
<br><dt><code>-T</code><dd>Causes <code>PSTricks</code> output to be enclosed in default US document
template text.  Option <span class="option">-Tu</span> is a synonym.  Option <span class="option">-Te</span>
causes the Euro standard document template to be used.  A <span class="option">p</span>
appended to any of these options causes the respective default
<code>PSTricks</code> document template to be printed to standard output. An
appended <span class="option">P</span> is a synonym.  An appended <span class="option">T</span> causes the
the <code>TikZ/PGF</code> template to be printed.  An appended <span class="option">L</span>
prints the LaTeX version of the document template, a synonym for
the default.  A <span class="option">C</span> prints the <code>ConTeXt</code> template. 
<br><dt><code>-o</code><dd>Use <span class="file">output.tex</span> as the output file.  The default is standard output. 
<br><dt><code>-D</code><dd>Define a tag
<a name="index-tag-definition-508"></a><a name="index-definition_002c-tag-509"></a>for purposes of selecting definition alternatives. 
See <a href="#Definitions">Definitions</a>.  The definition applies for all input files that
follow unless the tag is undefined with <span class="option">-U</span>. 
<br><dt><code>inputi.sk</code><dd>Input files, read in the sequence they are given. 
<br><dt><code>-U</code><dd>Un-define a tag for purposes of selecting definition alternatives. 
</dl>

<div class="node">
<p><hr>
<a name="Installing-sketch"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Index-of-syntax">Index of syntax</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Command-line">Command line</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h2 class="chapter">6 Building and installing <code>sketch</code></h2>

<p><code>Sketch</code> is so small that compiling by brute force is probably
best.  The following command ought to do the trick on any
systems where <code>gcc</code> is installed.  Make sure to first change
current directories to the place where you have unpacked the sources.
<pre class="example">     gcc *.c -o sketch.exe -lm
</pre>
   <p class="noindent">The <span class="samp">.exe</span> at the end is necessary for Windows systems.  Drop it
if your system is some version of Unix.  Other C compilers ought
to work as just as well.  For example,
<pre class="example">     cl *.c -o sketch.exe
</pre>
   <p class="noindent">is the correct command for many versions of MS Visual C.  In the
latest versions, Microsoft has deprecated the <code>-o</code> option and, by
default, does not define the <code>__STDC__</code> macro.  This causes
problems with some versions of <code>flex</code>, <code>bison</code>, <code>lex</code>,
and <code>yacc</code>, which are used to create the <code>sketch</code> scanner
and parser.  It's nearly always possible to find a set of options that
compiles with no errors or warnings, and this means <code>sketch</code> is
<em>very</em> likely to work correctly.  For example, the Visual C++
2005 Express Edition compiler (available free of charge from the
Microsoft web site), <code>flex</code> version 2.5.4, and <code>bison</code>
version 2.1 build error-free with
<pre class="example">     cl -DYY_NEVER_INTERACTIVE=1 -Za -Ox -Fesketch.exe *.c
</pre>
   <p>For purists, there is also a <code>makefile</code> compatible with GNU
<code>make</code> and <code>gcc</code>. The command
<pre class="example">     make
</pre>
   <p class="noindent">will build the executable, including the rebuilding of the scanner and
parser with <code>flex</code> and <code>bison</code> if you have changed
<span class="file">sketch.l</span> or <code>sketch.y</code> respectively.

   <p>To build this document in all its myriad forms (assuming you have the
necessary conversion programs on your system), use
<pre class="example">     make docs
</pre>
   <p class="noindent">The possibilities are listed in this following table.
   <p><table summary=""><tr align="left"><th valign="top">Format </th><th valign="top">Converter </th><th valign="top">Pictures </th><th valign="top">Description
<br></th></tr><tr align="left"><td valign="top">manual.info
  </td><td valign="top">makeinfo       </td><td valign="top"><span class="file">.txt</span> </td><td valign="top"><acronym>GNU</acronym> Info. 
<br></td></tr><tr align="left"><td valign="top">manual.dvi
  </td><td valign="top">texi2dvi       </td><td valign="top"><span class="file">.eps</span> </td><td valign="top">TeX typeset output. 
<br></td></tr><tr align="left"><td valign="top">manual.ps
  </td><td valign="top">texi2dvi,dvips </td><td valign="top"><span class="file">.eps</span> </td><td valign="top">Postscript. 
<br></td></tr><tr align="left"><td valign="top">manual.pdf
  </td><td valign="top">texi2dvi       </td><td valign="top"><span class="file">.pdf</span> </td><td valign="top">Adobe PDF. 
<br></td></tr><tr align="left"><td valign="top">manual.html
  </td><td valign="top">makeinfo       </td><td valign="top"><span class="file">.png</span> </td><td valign="top">A single web page. 
<br></td></tr><tr align="left"><td valign="top">manual/index.html
  </td><td valign="top">makeinfo       </td><td valign="top"><span class="file">.png</span> </td><td valign="top">Linked web pages, one per node.
   <br></td></tr></table>

<div class="node">
<p><hr>
<a name="Index-of-syntax"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Index">Index</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Installing-sketch">Installing sketch</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h2 class="unnumbered">Index of syntax</h2>

<ul class="index-sx" compact>
<li><a href="#index-_0027x_0040r_007b_002c_007d-_0027y_0040r_007b_002c-and-_007d_0027z-223"><code>'x</code><span class="roman">,</span><code> 'y</code><span class="roman">, and </span><code>'z</code></a>: <a href="#Two_002doperand-_0028binary_0029-forms">Two-operand (binary) forms</a></li>
<li><a href="#index-_0027x_0040r_007b_002c_007d-_0027y_0040r_007b_002c-and-_007d_0027z-158"><code>'x</code><span class="roman">,</span><code> 'y</code><span class="roman">, and </span><code>'z</code></a>: <a href="#Affine-arithmetic">Affine arithmetic</a></li>
<li><a href="#index-_0028-_0029_0040r_007b_002c-grouping_007d-229"><code>( )</code><span class="roman">, grouping</span></a>: <a href="#Two_002doperand-_0028binary_0029-forms">Two-operand (binary) forms</a></li>
<li><a href="#index-_0028foo_0029_0040r_007b_002c-point-reference_007d-346"><code>(foo)</code><span class="roman">, point reference</span></a>: <a href="#Forms-of-references">Forms of references</a></li>
<li><a href="#index-_0028foo_0029_0040r_007b_002c-point-reference_007d-38"><code>(foo)</code><span class="roman">, point reference</span></a>: <a href="#Drawing-a-solid">Drawing a solid</a></li>
<li><a href="#index-_002a_0040r_007b_002c-multiplication-operator_007d-232"><code>*</code><span class="roman">, multiplication operator</span></a>: <a href="#Two_002doperand-_0028binary_0029-forms">Two-operand (binary) forms</a></li>
<li><a href="#index-_002b_0040r_007b_002c-plus-operator_007d-214"><code>+</code><span class="roman">, plus operator</span></a>: <a href="#Two_002doperand-_0028binary_0029-forms">Two-operand (binary) forms</a></li>
<li><a href="#index-_002d_0040r_007b_002c-minus-operator_007d-215"><code>-</code><span class="roman">, minus operator</span></a>: <a href="#Two_002doperand-_0028binary_0029-forms">Two-operand (binary) forms</a></li>
<li><a href="#index-_002d_0040r_007b_002c-unary-minus-operator_007d-235"><code>-</code><span class="roman">, unary minus operator</span></a>: <a href="#Unary-forms">Unary forms</a></li>
<li><a href="#index-_002e_0040r_007b_002c-dot-operator_007d-217"><code>.</code><span class="roman">, dot operator</span></a>: <a href="#Two_002doperand-_0028binary_0029-forms">Two-operand (binary) forms</a></li>
<li><a href="#index-_002f_0040r_007b_002c-division-operator_007d-221"><code>/</code><span class="roman">, division operator</span></a>: <a href="#Two_002doperand-_0028binary_0029-forms">Two-operand (binary) forms</a></li>
<li><a href="#index-_003c_003e_0040r_007b_002c-closure-tag_007d-288"><code>&lt;&gt;</code><span class="roman">, closure tag</span></a>: <a href="#Swept-lines">Swept lines</a></li>
<li><a href="#index-_003c_003e_0040r_007b_002c-closure-tag_007d-320"><code>&lt;&gt;</code><span class="roman">, closure tag</span></a>: <a href="#Sweep-face-splitting">Sweep face splitting</a></li>
<li><a href="#index-_003c_003e_0040r_007b_002c-closure-tag_007d-297"><code>&lt;&gt;</code><span class="roman">, closure tag</span></a>: <a href="#Swept-lines">Swept lines</a></li>
<li><a href="#index-_003c_003e_0040r_007b_002c-closure-tag_007d-136"><code>&lt;&gt;</code><span class="roman">, closure tag</span></a>: <a href="#Polyline-sweeps-with-closure">Polyline sweeps with closure</a></li>
<li><a href="#index-_003c_003e_0040r_007b_002c-closure-tag_007d-100"><code>&lt;&gt;</code><span class="roman">, closure tag</span></a>: <a href="#Point-sweeps">Point sweeps</a></li>
<li><a href="#index-_003c_003e_0040r_007b_002c-closure-tag_007d-276"><code>&lt;&gt;</code><span class="roman">, closure tag</span></a>: <a href="#Sweeps">Sweeps</a></li>
<li><a href="#index-_003c_003e_0040r_007b_002c-closure-tag_007d-280"><code>&lt;&gt;</code><span class="roman">, closure tag</span></a>: <a href="#Swept-points">Swept points</a></li>
<li><a href="#index-_003cfoo_003e_0040r_007b_002c-tag-reference_007d-341"><code>&lt;foo&gt;</code><span class="roman">, tag reference</span></a>: <a href="#Forms-of-definitions">Forms of definitions</a></li>
<li><a href="#index-_003cfoo_003e_0040r_007b_002c-tag-reference_007d-364"><code>&lt;foo&gt;</code><span class="roman">, tag reference</span></a>: <a href="#Forms-of-references">Forms of references</a></li>
<li><a href="#index-_005b_005b-_005d_005b-_005d_005b-_005d_005b-_005d_005d_0040r_007b_002c-transform-literal_007d-210"><code>[[ ][ ][ ][ ]]</code><span class="roman">, transform literal</span></a>: <a href="#Transform-literals">Transform literals</a></li>
<li><a href="#index-_005b_005bfoo_005d_005d_0040r_007b_002c-transform-reference_007d-405"><code>[[foo]]</code><span class="roman">, transform reference</span></a>: <a href="#Overview">Overview</a></li>
<li><a href="#index-_005b_005bfoo_005d_005d_0040r_007b_002c-transform-reference_007d-352"><code>[[foo]]</code><span class="roman">, transform reference</span></a>: <a href="#Forms-of-references">Forms of references</a></li>
<li><a href="#index-_005b_005bfoo_005d_005d_0040r_007b_002c-transform-reference_007d-408"><code>[[foo]]</code><span class="roman">, transform reference</span></a>: <a href="#Overview">Overview</a></li>
<li><a href="#index-_005bfoo_002c_002e_002e_002e_002cbar_005d_0040r_007b_002c-multiple-options-reference_007d-361"><code>[foo,...,bar]</code><span class="roman">, multiple options reference</span></a>: <a href="#Forms-of-references">Forms of references</a></li>
<li><a href="#index-_005bfoo_005d_0040r_007b_002c-options-reference_007d-358"><code>[foo]</code><span class="roman">, options reference</span></a>: <a href="#Forms-of-references">Forms of references</a></li>
<li><a href="#index-_005bfoo_005d_0040r_007b_002c-options-reference_007d-150"><code>[foo]</code><span class="roman">, options reference</span></a>: <a href="#Polyline-sweeps-with-closure">Polyline sweeps with closure</a></li>
<li><a href="#index-_005bfoo_005d_0040r_007b_002c-vector-reference_007d-349"><code>[foo]</code><span class="roman">, vector reference</span></a>: <a href="#Forms-of-references">Forms of references</a></li>
<li><a href="#index-_005bfoo_005d_0040r_007b_002c-vector-reference_007d-120"><code>[foo]</code><span class="roman">, vector reference</span></a>: <a href="#Polyline-sweeps">Polyline sweeps</a></li>
<li><a href="#index-_005e_0040r_007b_002c-exponentiation-operator_007d-218"><code>^</code><span class="roman">, exponentiation operator</span></a>: <a href="#Two_002doperand-_0028binary_0029-forms">Two-operand (binary) forms</a></li>
<li><a href="#index-arrows-155"><code>arrows</code></a>: <a href="#Affine-arithmetic">Affine arithmetic</a></li>
<li><a href="#index-arrows-462"><code>arrows</code></a>: <a href="#A-technical-drawing">A technical drawing</a></li>
<li><a href="#index-arrows-427"><code>arrows</code></a>: <a href="#Overview">Overview</a></li>
<li><a href="#index-arrows-445"><code>arrows</code></a>: <a href="#A-technical-drawing">A technical drawing</a></li>
<li><a href="#index-atan2-241"><code>atan2</code></a>: <a href="#Unary-forms">Unary forms</a></li>
<li><a href="#index-camera-375"><code>camera</code></a>: <a href="#Camera">Camera</a></li>
<li><a href="#index-context-397"><code>context</code></a>: <a href="#Language">Language</a></li>
<li><a href="#index-cos-240"><code>cos</code></a>: <a href="#Unary-forms">Unary forms</a></li>
<li><a href="#index-cull-254"><code>cull</code></a>: <a href="#Internal-options">Internal options</a></li>
<li><a href="#index-cull-437"><code>cull</code></a>: <a href="#A-technical-drawing">A technical drawing</a></li>
<li><a href="#index-cull-45"><code>cull</code></a>: <a href="#Drawing-a-solid">Drawing a solid</a></li>
<li><a href="#index-cull-251"><code>cull</code></a>: <a href="#Transparency">Transparency</a></li>
<li><a href="#index-cull-113"><code>cull</code></a>: <a href="#Polyline-sweeps">Polyline sweeps</a></li>
<li><a href="#index-cull-371"><code>cull</code></a>: <a href="#Global-options">Global options</a></li>
<li><a href="#index-curve-264"><code>curve</code></a>: <a href="#Curves">Curves</a></li>
<li><a href="#index-def-152"><code>def</code></a>: <a href="#Affine-arithmetic">Affine arithmetic</a></li>
<li><a href="#index-def-424"><code>def</code></a>: <a href="#Overview">Overview</a></li>
<li><a href="#index-def-109"><code>def</code></a>: <a href="#Polyline-sweeps">Polyline sweeps</a></li>
<li><a href="#index-def-34"><code>def</code></a>: <a href="#Drawing-a-solid">Drawing a solid</a></li>
<li><a href="#index-def-475"><code>def</code></a>: <a href="#A-hierarchical-model">A hierarchical model</a></li>
<li><a href="#index-def-412"><code>def</code></a>: <a href="#Overview">Overview</a></li>
<li><a href="#index-def-472"><code>def</code></a>: <a href="#A-hierarchical-model">A hierarchical model</a></li>
<li><a href="#index-def-61"><code>def</code></a>: <a href="#Object-transforms">Object transforms</a></li>
<li><a href="#index-def-468"><code>def</code></a>: <a href="#A-hierarchical-model">A hierarchical model</a></li>
<li><a href="#index-def-402"><code>def</code></a>: <a href="#Overview">Overview</a></li>
<li><a href="#index-def-463"><code>def</code></a>: <a href="#A-technical-drawing">A technical drawing</a></li>
<li><a href="#index-def-138"><code>def</code></a>: <a href="#Polyline-sweeps-with-closure">Polyline sweeps with closure</a></li>
<li><a href="#index-def-458"><code>def</code></a>: <a href="#A-technical-drawing">A technical drawing</a></li>
<li><a href="#index-def-102"><code>def</code></a>: <a href="#Point-sweeps">Point sweeps</a></li>
<li><a href="#index-def-124"><code>def</code></a>: <a href="#Nested-sweeps">Nested sweeps</a></li>
<li><a href="#index-def-443"><code>def</code></a>: <a href="#A-technical-drawing">A technical drawing</a></li>
<li><a href="#index-dots-262"><code>dots</code></a>: <a href="#Dots">Dots</a></li>
<li><a href="#index-fill-opacity-250"><code>fill opacity</code></a>: <a href="#Transparency">Transparency</a></li>
<li><a href="#index-fill-style-245"><code>fill style</code></a>: <a href="#TikZ_002fPGF-user_002ddefined-styles">TikZ/PGF user-defined styles</a></li>
<li><a href="#index-fillcolor-66"><code>fillcolor</code></a>: <a href="#Object-transforms">Object transforms</a></li>
<li><a href="#index-fillcolor-411"><code>fillcolor</code></a>: <a href="#Overview">Overview</a></li>
<li><a href="#index-fillcolor-145"><code>fillcolor</code></a>: <a href="#Polyline-sweeps-with-closure">Polyline sweeps with closure</a></li>
<li><a href="#index-frame-385"><code>frame</code></a>: <a href="#Frame">Frame</a></li>
<li><a href="#index-framesep-390"><code>framesep</code></a>: <a href="#Frame">Frame</a></li>
<li><a href="#index-global-365"><code>global</code></a>: <a href="#Global-environment">Global environment</a></li>
<li><a href="#index-input-169"><code>input</code></a>: <a href="#Language-basics">Language basics</a></li>
<li><a href="#index-inverse-242"><code>inverse</code></a>: <a href="#Unary-forms">Unary forms</a></li>
<li><a href="#index-language-393"><code>language</code></a>: <a href="#Language">Language</a></li>
<li><a href="#index-latex-396"><code>latex</code></a>: <a href="#Language">Language</a></li>
<li><a href="#index-lay-272"><code>lay</code></a>: <a href="#Specials">Specials</a></li>
<li><a href="#index-lay-373"><code>lay</code></a>: <a href="#Global-options">Global options</a></li>
<li><a href="#index-lay-255"><code>lay</code></a>: <a href="#Internal-options">Internal options</a></li>
<li><a href="#index-lay-56"><code>lay</code></a>: <a href="#Special-objects">Special objects</a></li>
<li><a href="#index-lay-442"><code>lay</code></a>: <a href="#A-technical-drawing">A technical drawing</a></li>
<li><a href="#index-line-63"><code>line</code></a>: <a href="#Object-transforms">Object transforms</a></li>
<li><a href="#index-line-432"><code>line</code></a>: <a href="#Overview">Overview</a></li>
<li><a href="#index-line-316"><code>line</code></a>: <a href="#Swept-blocks">Swept blocks</a></li>
<li><a href="#index-line-471"><code>line</code></a>: <a href="#A-hierarchical-model">A hierarchical model</a></li>
<li><a href="#index-line-263"><code>line</code></a>: <a href="#Lines">Lines</a></li>
<li><a href="#index-line-25"><code>line</code></a>: <a href="#Drawing-options">Drawing options</a></li>
<li><a href="#index-line-444"><code>line</code></a>: <a href="#A-technical-drawing">A technical drawing</a></li>
<li><a href="#index-line-144"><code>line</code></a>: <a href="#Polyline-sweeps-with-closure">Polyline sweeps with closure</a></li>
<li><a href="#index-line-438"><code>line</code></a>: <a href="#A-technical-drawing">A technical drawing</a></li>
<li><a href="#index-line-154"><code>line</code></a>: <a href="#Affine-arithmetic">Affine arithmetic</a></li>
<li><a href="#index-line-style-246"><code>line style</code></a>: <a href="#TikZ_002fPGF-user_002ddefined-styles">TikZ/PGF user-defined styles</a></li>
<li><a href="#index-linecolor-389"><code>linecolor</code></a>: <a href="#Frame">Frame</a></li>
<li><a href="#index-linecolor-65"><code>linecolor</code></a>: <a href="#Object-transforms">Object transforms</a></li>
<li><a href="#index-linecolor-429"><code>linecolor</code></a>: <a href="#Overview">Overview</a></li>
<li><a href="#index-linestyle-448"><code>linestyle</code></a>: <a href="#A-technical-drawing">A technical drawing</a></li>
<li><a href="#index-linestyle-388"><code>linestyle</code></a>: <a href="#Frame">Frame</a></li>
<li><a href="#index-linestyle-499"><code>linestyle</code></a>: <a href="#Bugs-and-anomalies">Bugs and anomalies</a></li>
<li><a href="#index-linestyle-430"><code>linestyle</code></a>: <a href="#Overview">Overview</a></li>
<li><a href="#index-linewidth-387"><code>linewidth</code></a>: <a href="#Frame">Frame</a></li>
<li><a href="#index-linewidth-114"><code>linewidth</code></a>: <a href="#Polyline-sweeps">Polyline sweeps</a></li>
<li><a href="#index-linewidth-446"><code>linewidth</code></a>: <a href="#A-technical-drawing">A technical drawing</a></li>
<li><a href="#index-linewidth-428"><code>linewidth</code></a>: <a href="#Overview">Overview</a></li>
<li><a href="#index-opacity-249"><code>opacity</code></a>: <a href="#Transparency">Transparency</a></li>
<li><a href="#index-perspective-200"><code>perspective</code></a>: <a href="#Transform-literals">Transform literals</a></li>
<li><a href="#index-picturebox-377"><code>picturebox</code></a>: <a href="#Picture-box">Picture box</a></li>
<li><a href="#index-point-list-260"><code>point list</code></a>: <a href="#Internal-options">Internal options</a></li>
<li><a href="#index-polygon-265"><code>polygon</code></a>: <a href="#Polygons">Polygons</a></li>
<li><a href="#index-polygon-317"><code>polygon</code></a>: <a href="#Swept-blocks">Swept blocks</a></li>
<li><a href="#index-polygon-32"><code>polygon</code></a>: <a href="#Drawing-a-solid">Drawing a solid</a></li>
<li><a href="#index-polygon-19"><code>polygon</code></a>: <a href="#Hello-world">Hello world</a></li>
<li><a href="#index-polygon-413"><code>polygon</code></a>: <a href="#Overview">Overview</a></li>
<li><a href="#index-polygon-153"><code>polygon</code></a>: <a href="#Affine-arithmetic">Affine arithmetic</a></li>
<li><a href="#index-polygon-64"><code>polygon</code></a>: <a href="#Object-transforms">Object transforms</a></li>
<li><a href="#index-project-211"><code>project</code></a>: <a href="#Transform-literals">Transform literals</a></li>
<li><a href="#index-pstricks-394"><code>pstricks</code></a>: <a href="#Language">Language</a></li>
<li><a href="#index-put-129"><code>put</code></a>: <a href="#Nested-sweeps">Nested sweeps</a></li>
<li><a href="#index-put-329"><code>put</code></a>: <a href="#Puts">Puts</a></li>
<li><a href="#index-put-62"><code>put</code></a>: <a href="#Object-transforms">Object transforms</a></li>
<li><a href="#index-put-476"><code>put</code></a>: <a href="#A-hierarchical-model">A hierarchical model</a></li>
<li><a href="#index-repeat-130"><code>repeat</code></a>: <a href="#Nested-sweeps">Nested sweeps</a></li>
<li><a href="#index-repeat-326"><code>repeat</code></a>: <a href="#Repeats">Repeats</a></li>
<li><a href="#index-repeat-139"><code>repeat</code></a>: <a href="#Polyline-sweeps-with-closure">Polyline sweeps with closure</a></li>
<li><a href="#index-repeat-421"><code>repeat</code></a>: <a href="#Overview">Overview</a></li>
<li><a href="#index-repeat-88"><code>repeat</code></a>: <a href="#Repeated-objects">Repeated objects</a></li>
<li><a href="#index-rotate-67"><code>rotate</code></a>: <a href="#Object-transforms">Object transforms</a></li>
<li><a href="#index-rotate-478"><code>rotate</code></a>: <a href="#A-hierarchical-model">A hierarchical model</a></li>
<li><a href="#index-rotate-435"><code>rotate</code></a>: <a href="#A-technical-drawing">A technical drawing</a></li>
<li><a href="#index-rotate-474"><code>rotate</code></a>: <a href="#A-hierarchical-model">A hierarchical model</a></li>
<li><a href="#index-rotate-140"><code>rotate</code></a>: <a href="#Polyline-sweeps-with-closure">Polyline sweeps with closure</a></li>
<li><a href="#index-rotate-111"><code>rotate</code></a>: <a href="#Polyline-sweeps">Polyline sweeps</a></li>
<li><a href="#index-rotate-89"><code>rotate</code></a>: <a href="#Repeated-objects">Repeated objects</a></li>
<li><a href="#index-rotate-182"><code>rotate</code></a>: <a href="#Transform-literals">Transform literals</a></li>
<li><a href="#index-rotate-94"><code>rotate</code></a>: <a href="#Swept-objects">Swept objects</a></li>
<li><a href="#index-rotate-103"><code>rotate</code></a>: <a href="#Point-sweeps">Point sweeps</a></li>
<li><a href="#index-rotate-422"><code>rotate</code></a>: <a href="#Overview">Overview</a></li>
<li><a href="#index-rotate-470"><code>rotate</code></a>: <a href="#A-hierarchical-model">A hierarchical model</a></li>
<li><a href="#index-rotate-126"><code>rotate</code></a>: <a href="#Nested-sweeps">Nested sweeps</a></li>
<li><a href="#index-scale-479"><code>scale</code></a>: <a href="#A-hierarchical-model">A hierarchical model</a></li>
<li><a href="#index-scale-461"><code>scale</code></a>: <a href="#A-technical-drawing">A technical drawing</a></li>
<li><a href="#index-scale-188"><code>scale</code></a>: <a href="#Transform-literals">Transform literals</a></li>
<li><a href="#index-scale-454"><code>scale</code></a>: <a href="#A-technical-drawing">A technical drawing</a></li>
<li><a href="#index-set-368"><code>set</code></a>: <a href="#Global-options">Global options</a></li>
<li><a href="#index-sin-239"><code>sin</code></a>: <a href="#Unary-forms">Unary forms</a></li>
<li><a href="#index-special-48"><code>special</code></a>: <a href="#Special-objects">Special objects</a></li>
<li><a href="#index-special-268"><code>special</code></a>: <a href="#Specials">Specials</a></li>
<li><a href="#index-special-464"><code>special</code></a>: <a href="#A-technical-drawing">A technical drawing</a></li>
<li><a href="#index-special-431"><code>special</code></a>: <a href="#Overview">Overview</a></li>
<li><a href="#index-special-456"><code>special</code></a>: <a href="#A-technical-drawing">A technical drawing</a></li>
<li><a href="#index-split-256"><code>split</code></a>: <a href="#Internal-options">Internal options</a></li>
<li><a href="#index-split-372"><code>split</code></a>: <a href="#Global-options">Global options</a></li>
<li><a href="#index-sqrt-238"><code>sqrt</code></a>: <a href="#Unary-forms">Unary forms</a></li>
<li><a href="#index-sweep-273"><code>sweep</code></a>: <a href="#Sweeps">Sweeps</a></li>
<li><a href="#index-sweep-436"><code>sweep</code></a>: <a href="#A-technical-drawing">A technical drawing</a></li>
<li><a href="#index-sweep-125"><code>sweep</code></a>: <a href="#Nested-sweeps">Nested sweeps</a></li>
<li><a href="#index-sweep-469"><code>sweep</code></a>: <a href="#A-hierarchical-model">A hierarchical model</a></li>
<li><a href="#index-sweep-110"><code>sweep</code></a>: <a href="#Polyline-sweeps">Polyline sweeps</a></li>
<li><a href="#index-sweep-143"><code>sweep</code></a>: <a href="#Polyline-sweeps-with-closure">Polyline sweeps with closure</a></li>
<li><a href="#index-sweep-104"><code>sweep</code></a>: <a href="#Point-sweeps">Point sweeps</a></li>
<li><a href="#index-sweep-93"><code>sweep</code></a>: <a href="#Swept-objects">Swept objects</a></li>
<li><a href="#index-then-69"><code>then</code></a>: <a href="#Object-transforms">Object transforms</a></li>
<li><a href="#index-then-141"><code>then</code></a>: <a href="#Polyline-sweeps-with-closure">Polyline sweeps with closure</a></li>
<li><a href="#index-then-231"><code>then</code></a>: <a href="#Two_002doperand-_0028binary_0029-forms">Two-operand (binary) forms</a></li>
<li><a href="#index-tikz-395"><code>tikz</code></a>: <a href="#Language">Language</a></li>
<li><a href="#index-translate-185"><code>translate</code></a>: <a href="#Transform-literals">Transform literals</a></li>
<li><a href="#index-translate-477"><code>translate</code></a>: <a href="#A-hierarchical-model">A hierarchical model</a></li>
<li><a href="#index-translate-84"><code>translate</code></a>: <a href="#Object-transforms">Object transforms</a></li>
<li><a href="#index-translate-112"><code>translate</code></a>: <a href="#Polyline-sweeps">Polyline sweeps</a></li>
<li><a href="#index-translate-142"><code>translate</code></a>: <a href="#Polyline-sweeps-with-closure">Polyline sweeps with closure</a></li>
<li><a href="#index-translate-423"><code>translate</code></a>: <a href="#Overview">Overview</a></li>
<li><a href="#index-translate-68"><code>translate</code></a>: <a href="#Object-transforms">Object transforms</a></li>
<li><a href="#index-translate-90"><code>translate</code></a>: <a href="#Repeated-objects">Repeated objects</a></li>
<li><a href="#index-transpalpha-248"><code>transpalpha</code></a>: <a href="#Transparency">Transparency</a></li>
<li><a href="#index-unit-453"><code>unit</code></a>: <a href="#A-technical-drawing">A technical drawing</a></li>
<li><a href="#index-unit-237"><code>unit</code></a>: <a href="#Unary-forms">Unary forms</a></li>
<li><a href="#index-view-207"><code>view</code></a>: <a href="#Transform-literals">Transform literals</a></li>
<li><a href="#index-_0040_007b-_0040_007d_0040r_007b_002c-block-drawable_007d-414"><code>{ }</code><span class="roman">, block drawable</span></a>: <a href="#Overview">Overview</a></li>
<li><a href="#index-_0040_007b-_0040_007d_0040r_007b_002c-block-drawable_007d-315"><code>{ }</code><span class="roman">, block drawable</span></a>: <a href="#Swept-blocks">Swept blocks</a></li>
<li><a href="#index-_0040_007b-_0040_007d_0040r_007b_002c-block-drawable_007d-323"><code>{ }</code><span class="roman">, block drawable</span></a>: <a href="#Blocks">Blocks</a></li>
<li><a href="#index-_0040_007b-_0040_007d_0040r_007b_002c-block-drawable_007d-71"><code>{ }</code><span class="roman">, block drawable</span></a>: <a href="#Object-transforms">Object transforms</a></li>
<li><a href="#index-_0040_007b-_0040_007d_0040r_007b_002c-block-drawable_007d-131"><code>{ }</code><span class="roman">, block drawable</span></a>: <a href="#Nested-sweeps">Nested sweeps</a></li>
<li><a href="#index-_0040_007bfoo_0040_007d_0040r_007b_002c-drawable-reference_007d-419"><code>{foo}</code><span class="roman">, drawable reference</span></a>: <a href="#Overview">Overview</a></li>
<li><a href="#index-_0040_007bfoo_0040_007d_0040r_007b_002c-drawable-reference_007d-355"><code>{foo}</code><span class="roman">, drawable reference</span></a>: <a href="#Forms-of-references">Forms of references</a></li>
<li><a href="#index-_0040_007bfoo_0040_007d_0040r_007b_002c-drawable-reference_007d-415"><code>{foo}</code><span class="roman">, drawable reference</span></a>: <a href="#Overview">Overview</a></li>
<li><a href="#index-_0040_007bfoo_0040_007d_0040r_007b_002c-drawable-reference_007d-79"><code>{foo}</code><span class="roman">, drawable reference</span></a>: <a href="#Object-transforms">Object transforms</a></li>
<li><a href="#index-_007c_0040math_007bX_007d_007c_0040r_007b_002c-magnitude-operator_007d-236"><code>|X|</code><span class="roman">, magnitude operator</span></a>: <a href="#Unary-forms">Unary forms</a></li>
   </ul><div class="node">
<p><hr>
<a name="Index"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="#Index-of-syntax">Index of syntax</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>
<br>
</div>

<!-- node-name,  next,  previous,  up -->
<h2 class="unnumbered">Index of concepts</h2>



<ul class="index-cp" compact>
<li><a href="#index-affine-arithmetic-151">affine arithmetic</a>: <a href="#Affine-arithmetic">Affine arithmetic</a></li>
<li><a href="#index-affine-arithmetic-451">affine arithmetic</a>: <a href="#A-technical-drawing">A technical drawing</a></li>
<li><a href="#index-alternatives_002c-definition-336">alternatives, definition</a>: <a href="#Forms-of-definitions">Forms of definitions</a></li>
<li><a href="#index-argument_002c-special-51">argument, special</a>: <a href="#Special-objects">Special objects</a></li>
<li><a href="#index-argument_002c-special-271">argument, special</a>: <a href="#Specials">Specials</a></li>
<li><a href="#index-associativity_002c-operator-227">associativity, operator</a>: <a href="#Two_002doperand-_0028binary_0029-forms">Two-operand (binary) forms</a></li>
<li><a href="#index-axis_002c-rotation-82">axis, rotation</a>: <a href="#Object-transforms">Object transforms</a></li>
<li><a href="#index-back-face-43">back face</a>: <a href="#Drawing-a-solid">Drawing a solid</a></li>
<li><a href="#index-baseline-fraction-379">baseline fraction</a>: <a href="#Picture-box">Picture box</a></li>
<li><a href="#index-binary-form-212">binary form</a>: <a href="#Two_002doperand-_0028binary_0029-forms">Two-operand (binary) forms</a></li>
<li><a href="#index-binary-space-partition-504">binary space partition</a>: <a href="#Command-line">Command line</a></li>
<li><a href="#index-binary-space-partition-496">binary space partition</a>: <a href="#Hidden-surface-removal">Hidden surface removal</a></li>
<li><a href="#index-binary-space-partition-498">binary space partition</a>: <a href="#Statistics">Statistics</a></li>
<li><a href="#index-block-314">block</a>: <a href="#Swept-blocks">Swept blocks</a></li>
<li><a href="#index-block-322">block</a>: <a href="#Blocks">Blocks</a></li>
<li><a href="#index-block-70">block</a>: <a href="#Object-transforms">Object transforms</a></li>
<li><a href="#index-block-sweep-313">block sweep</a>: <a href="#Swept-blocks">Swept blocks</a></li>
<li><a href="#index-body-polygon-290">body polygon</a>: <a href="#Swept-lines">Swept lines</a></li>
<li><a href="#index-body-polygon-306">body polygon</a>: <a href="#Swept-polygons">Swept polygons</a></li>
<li><a href="#index-body-polygon-258">body polygon</a>: <a href="#Internal-options">Internal options</a></li>
<li><a href="#index-bounding-box-380">bounding box</a>: <a href="#Picture-box">Picture box</a></li>
<li><a href="#index-BSP_002c-binary-space-partition-505">BSP, binary space partition</a>: <a href="#Command-line">Command line</a></li>
<li><a href="#index-BSP_002c-binary-space-partition-497">BSP, binary space partition</a>: <a href="#Hidden-surface-removal">Hidden surface removal</a></li>
<li><a href="#index-camera-374">camera</a>: <a href="#Camera">Camera</a></li>
<li><a href="#index-center-of-rotation-121">center of rotation</a>: <a href="#Nested-sweeps">Nested sweeps</a></li>
<li><a href="#index-center-of-rotation-59">center of rotation</a>: <a href="#Object-transforms">Object transforms</a></li>
<li><a href="#index-centroid-457">centroid</a>: <a href="#A-technical-drawing">A technical drawing</a></li>
<li><a href="#index-clipping-492">clipping</a>: <a href="#Clipping">Clipping</a></li>
<li><a href="#index-clipping-383">clipping</a>: <a href="#Picture-box">Picture box</a></li>
<li><a href="#index-closure-tag_002c-_0040code_007b_003c_003e_007d-284">closure tag, <code>&lt;&gt;</code></a>: <a href="#Swept-points">Swept points</a></li>
<li><a href="#index-closure-tag_002c-_0040code_007b_003c_003e_007d-101">closure tag, <code>&lt;&gt;</code></a>: <a href="#Point-sweeps">Point sweeps</a></li>
<li><a href="#index-closure-tag_002c-_0040code_007b_003c_003e_007d-298">closure tag, <code>&lt;&gt;</code></a>: <a href="#Swept-lines">Swept lines</a></li>
<li><a href="#index-closure-tag_002c-_0040code_007b_003c_003e_007d-137">closure tag, <code>&lt;&gt;</code></a>: <a href="#Polyline-sweeps-with-closure">Polyline sweeps with closure</a></li>
<li><a href="#index-closure-tag_002c-_0040code_007b_003c_003e_007d-277">closure tag, <code>&lt;&gt;</code></a>: <a href="#Sweeps">Sweeps</a></li>
<li><a href="#index-closure-tag_002c-_0040code_007b_003c_003e_007d-281">closure tag, <code>&lt;&gt;</code></a>: <a href="#Swept-points">Swept points</a></li>
<li><a href="#index-closure-tag_002c-_0040code_007b_003c_003e_007d-289">closure tag, <code>&lt;&gt;</code></a>: <a href="#Swept-lines">Swept lines</a></li>
<li><a href="#index-closure-tag_002c-_0040code_007b_003c_003e_007d-321">closure tag, <code>&lt;&gt;</code></a>: <a href="#Sweep-face-splitting">Sweep face splitting</a></li>
<li><a href="#index-command-line-option-13">command line option</a>: <a href="#Hello-world">Hello world</a></li>
<li><a href="#index-command-line-options-503">command line options</a>: <a href="#Command-line">Command line</a></li>
<li><a href="#index-command-line_002c-_0040code_007bsketch_007d-7">command line, <code>sketch</code></a>: <a href="#Hello-world">Hello world</a></li>
<li><a href="#index-command-line_002c-_0040code_007bsketch_007d-501">command line, <code>sketch</code></a>: <a href="#Command-line">Command line</a></li>
<li><a href="#index-comments-166">comments</a>: <a href="#Language-basics">Language basics</a></li>
<li><a href="#index-comments-40">comments</a>: <a href="#Drawing-a-solid">Drawing a solid</a></li>
<li><a href="#index-constructor-181">constructor</a>: <a href="#Transform-literals">Transform literals</a></li>
<li><a href="#index-coordinate-system_002c-right_002dhanded-3">coordinate system, right-handed</a>: <a href="#Introduction-by-example">Introduction by example</a></li>
<li><a href="#index-counter_002dclockwise-polygon-vertex-order-20">counter-clockwise polygon vertex order</a>: <a href="#Hello-world">Hello world</a></li>
<li><a href="#index-culling-42">culling</a>: <a href="#Drawing-a-solid">Drawing a solid</a></li>
<li><a href="#index-culling-23">culling</a>: <a href="#Hello-world">Hello world</a></li>
<li><a href="#index-culling-294">culling</a>: <a href="#Swept-lines">Swept lines</a></li>
<li><a href="#index-culling-44">culling</a>: <a href="#Drawing-a-solid">Drawing a solid</a></li>
<li><a href="#index-declarative-language-163">declarative language</a>: <a href="#Language-basics">Language basics</a></li>
<li><a href="#index-definition-330">definition</a>: <a href="#Definitions">Definitions</a></li>
<li><a href="#index-definition-33">definition</a>: <a href="#Drawing-a-solid">Drawing a solid</a></li>
<li><a href="#index-definition-with-alternatives-335">definition with alternatives</a>: <a href="#Forms-of-definitions">Forms of definitions</a></li>
<li><a href="#index-definition_002c-drawable-75">definition, drawable</a>: <a href="#Object-transforms">Object transforms</a></li>
<li><a href="#index-definition_002c-options-147">definition, options</a>: <a href="#Polyline-sweeps-with-closure">Polyline sweeps with closure</a></li>
<li><a href="#index-definition_002c-point-35">definition, point</a>: <a href="#Drawing-a-solid">Drawing a solid</a></li>
<li><a href="#index-definition_002c-scalar-97">definition, scalar</a>: <a href="#Swept-objects">Swept objects</a></li>
<li><a href="#index-definition_002c-simple-334">definition, simple</a>: <a href="#Forms-of-definitions">Forms of definitions</a></li>
<li><a href="#index-definition_002c-tag-331">definition, tag</a>: <a href="#Definitions">Definitions</a></li>
<li><a href="#index-definition_002c-tag-509">definition, tag</a>: <a href="#Command-line">Command line</a></li>
<li><a href="#index-definition_002c-tag-338">definition, tag</a>: <a href="#Forms-of-definitions">Forms of definitions</a></li>
<li><a href="#index-definition_002c-transform-404">definition, transform</a>: <a href="#Overview">Overview</a></li>
<li><a href="#index-definition_002c-vector-117">definition, vector</a>: <a href="#Polyline-sweeps">Polyline sweeps</a></li>
<li><a href="#index-depth-sort-257">depth sort</a>: <a href="#Internal-options">Internal options</a></li>
<li><a href="#index-depth-sort-500">depth sort</a>: <a href="#Bugs-and-anomalies">Bugs and anomalies</a></li>
<li><a href="#index-depth-sort-493">depth sort</a>: <a href="#Hidden-surface-removal">Hidden surface removal</a></li>
<li><a href="#index-document-template-15">document template</a>: <a href="#Hello-world">Hello world</a></li>
<li><a href="#index-document-template-506">document template</a>: <a href="#Command-line">Command line</a></li>
<li><a href="#index-drawable-261">drawable</a>: <a href="#Drawables">Drawables</a></li>
<li><a href="#index-drawable-74">drawable</a>: <a href="#Object-transforms">Object transforms</a></li>
<li><a href="#index-drawable-definition-76">drawable definition</a>: <a href="#Object-transforms">Object transforms</a></li>
<li><a href="#index-drawable-reference-353">drawable reference</a>: <a href="#Forms-of-references">Forms of references</a></li>
<li><a href="#index-end-polygon-308">end polygon</a>: <a href="#Swept-polygons">Swept polygons</a></li>
<li><a href="#index-end-polygon-299">end polygon</a>: <a href="#Swept-lines">Swept lines</a></li>
<li><a href="#index-faces-29">faces</a>: <a href="#Drawing-a-solid">Drawing a solid</a></li>
<li><a href="#index-faces-108">faces</a>: <a href="#Polyline-sweeps">Polyline sweeps</a></li>
<li><a href="#index-file_002c-include-168">file, include</a>: <a href="#Language-basics">Language basics</a></li>
<li><a href="#index-file_002c-input-160">file, input</a>: <a href="#Language-basics">Language basics</a></li>
<li><a href="#index-frame-box-384">frame box</a>: <a href="#Frame">Frame</a></li>
<li><a href="#index-global-options-367">global options</a>: <a href="#Global-options">Global options</a></li>
<li><a href="#index-global-options-27">global options</a>: <a href="#Drawing-options">Drawing options</a></li>
<li><a href="#index-helix-115">helix</a>: <a href="#Polyline-sweeps">Polyline sweeps</a></li>
<li><a href="#index-helix-46">helix</a>: <a href="#Drawing-a-solid">Drawing a solid</a></li>
<li><a href="#index-hello-world-5">hello world</a>: <a href="#Hello-world">Hello world</a></li>
<li><a href="#index-hidden-surface-algorithm-441">hidden surface algorithm</a>: <a href="#A-technical-drawing">A technical drawing</a></li>
<li><a href="#index-hidden-surface-algorithm-9">hidden surface algorithm</a>: <a href="#Hello-world">Hello world</a></li>
<li><a href="#index-hidden-surface-algorithm-57">hidden surface algorithm</a>: <a href="#Special-objects">Special objects</a></li>
<li><a href="#index-hidden-surface-algorithm-494">hidden surface algorithm</a>: <a href="#Hidden-surface-removal">Hidden surface removal</a></li>
<li><a href="#index-hidden-surface-algorithm-203">hidden surface algorithm</a>: <a href="#Transform-literals">Transform literals</a></li>
<li><a href="#index-hierarchical-model-467">hierarchical model</a>: <a href="#A-hierarchical-model">A hierarchical model</a></li>
<li><a href="#index-identifiers-170">identifiers</a>: <a href="#Identifiers">Identifiers</a></li>
<li><a href="#index-include-file-167">include file</a>: <a href="#Language-basics">Language basics</a></li>
<li><a href="#index-input-file-159">input file</a>: <a href="#Language-basics">Language basics</a></li>
<li><a href="#index-internal-option-54">internal option</a>: <a href="#Special-objects">Special objects</a></li>
<li><a href="#index-internal-options-253">internal options</a>: <a href="#Internal-options">Internal options</a></li>
<li><a href="#index-internal-options-370">internal options</a>: <a href="#Global-options">Global options</a></li>
<li><a href="#index-keywords-171">keywords</a>: <a href="#Key-and-reserved-words">Key and reserved words</a></li>
<li><a href="#index-labels-47">labels</a>: <a href="#Special-objects">Special objects</a></li>
<li><a href="#index-language_002c-declarative-164">language, declarative</a>: <a href="#Language-basics">Language basics</a></li>
<li><a href="#index-language_002c-output-391">language, output</a>: <a href="#Language">Language</a></li>
<li><a href="#index-language_002c-scene-description-162">language, scene description</a>: <a href="#Language-basics">Language basics</a></li>
<li><a href="#index-lexical-scope-324">lexical scope</a>: <a href="#Blocks">Blocks</a></li>
<li><a href="#index-lexical-scope-72">lexical scope</a>: <a href="#Object-transforms">Object transforms</a></li>
<li><a href="#index-line-sweep-287">line sweep</a>: <a href="#Swept-lines">Swept lines</a></li>
<li><a href="#index-line-sweep-105">line sweep</a>: <a href="#Polyline-sweeps">Polyline sweeps</a></li>
<li><a href="#index-line-sweep-440">line sweep</a>: <a href="#A-technical-drawing">A technical drawing</a></li>
<li><a href="#index-literal_002c-point-176">literal, point</a>: <a href="#Point-and-vector-literals">Point and vector literals</a></li>
<li><a href="#index-literal_002c-scalar-174">literal, scalar</a>: <a href="#Scalar-literals">Scalar literals</a></li>
<li><a href="#index-literal_002c-transform-180">literal, transform</a>: <a href="#Transform-literals">Transform literals</a></li>
<li><a href="#index-literal_002c-vector-178">literal, vector</a>: <a href="#Point-and-vector-literals">Point and vector literals</a></li>
<li><a href="#index-nesting_002c-swept-object-128">nesting, swept object</a>: <a href="#Nested-sweeps">Nested sweeps</a></li>
<li><a href="#index-one_002doperand-form-234">one-operand form</a>: <a href="#Unary-forms">Unary forms</a></li>
<li><a href="#index-operator-associativity-226">operator associativity</a>: <a href="#Two_002doperand-_0028binary_0029-forms">Two-operand (binary) forms</a></li>
<li><a href="#index-operator-precedence-225">operator precedence</a>: <a href="#Two_002doperand-_0028binary_0029-forms">Two-operand (binary) forms</a></li>
<li><a href="#index-option-24">option</a>: <a href="#Drawing-options">Drawing options</a></li>
<li><a href="#index-option_002c-command-line-14">option, command line</a>: <a href="#Hello-world">Hello world</a></li>
<li><a href="#index-option_002c-internal-55">option, internal</a>: <a href="#Special-objects">Special objects</a></li>
<li><a href="#index-options-243">options</a>: <a href="#Options">Options</a></li>
<li><a href="#index-options-definition-148">options definition</a>: <a href="#Polyline-sweeps-with-closure">Polyline sweeps with closure</a></li>
<li><a href="#index-options-multiple-reference-359">options multiple reference</a>: <a href="#Forms-of-references">Forms of references</a></li>
<li><a href="#index-options-reference-356">options reference</a>: <a href="#Forms-of-references">Forms of references</a></li>
<li><a href="#index-options_002c-command-line-502">options, command line</a>: <a href="#Command-line">Command line</a></li>
<li><a href="#index-options_002c-global-366">options, global</a>: <a href="#Global-options">Global options</a></li>
<li><a href="#index-options_002c-global-26">options, global</a>: <a href="#Drawing-options">Drawing options</a></li>
<li><a href="#index-options_002c-internal-369">options, internal</a>: <a href="#Global-options">Global options</a></li>
<li><a href="#index-options_002c-internal-252">options, internal</a>: <a href="#Internal-options">Internal options</a></li>
<li><a href="#index-options_002c-sweep-295">options, sweep</a>: <a href="#Swept-lines">Swept lines</a></li>
<li><a href="#index-options_002c-sweep-285">options, sweep</a>: <a href="#Swept-points">Swept points</a></li>
<li><a href="#index-options_002c-sweep-304">options, sweep</a>: <a href="#Swept-lines">Swept lines</a></li>
<li><a href="#index-options_002c-sweep-135">options, sweep</a>: <a href="#Polygon-sweeps">Polygon sweeps</a></li>
<li><a href="#index-options_002c-sweep-116">options, sweep</a>: <a href="#Polyline-sweeps">Polyline sweeps</a></li>
<li><a href="#index-options_002c-swept-object-146">options, swept object</a>: <a href="#Polyline-sweeps-with-closure">Polyline sweeps with closure</a></li>
<li><a href="#index-options_002c-swept-object-134">options, swept object</a>: <a href="#Polygon-sweeps">Polygon sweeps</a></li>
<li><a href="#index-options_002c-swept-object-296">options, swept object</a>: <a href="#Swept-lines">Swept lines</a></li>
<li><a href="#index-order_002c-polygon-vertex-410">order, polygon vertex</a>: <a href="#Overview">Overview</a></li>
<li><a href="#index-order_002c-polygon-vertex-293">order, polygon vertex</a>: <a href="#Swept-lines">Swept lines</a></li>
<li><a href="#index-order_002c-polygon-vertex-311">order, polygon vertex</a>: <a href="#Swept-polygons">Swept polygons</a></li>
<li><a href="#index-order_002c-polygon-vertex-22">order, polygon vertex</a>: <a href="#Hello-world">Hello world</a></li>
<li><a href="#index-order_002c-polygon-vertex-302">order, polygon vertex</a>: <a href="#Swept-lines">Swept lines</a></li>
<li><a href="#index-output-language-392">output language</a>: <a href="#Language">Language</a></li>
<li><a href="#index-outside-of-a-polygon-17">outside of a polygon</a>: <a href="#Hello-world">Hello world</a></li>
<li><a href="#index-parallel-projection-195">parallel projection</a>: <a href="#Transform-literals">Transform literals</a></li>
<li><a href="#index-parallel-projection-11">parallel projection</a>: <a href="#Hello-world">Hello world</a></li>
<li><a href="#index-parallel-projection-381">parallel projection</a>: <a href="#Picture-box">Picture box</a></li>
<li><a href="#index-parentheses-228">parentheses</a>: <a href="#Two_002doperand-_0028binary_0029-forms">Two-operand (binary) forms</a></li>
<li><a href="#index-perspective-projection-399">perspective projection</a>: <a href="#Overview">Overview</a></li>
<li><a href="#index-perspective-projection-201">perspective projection</a>: <a href="#Transform-literals">Transform literals</a></li>
<li><a href="#index-picture-box-376">picture box</a>: <a href="#Picture-box">Picture box</a></li>
<li><a href="#index-planarity-of-polygons-267">planarity of polygons</a>: <a href="#Polygons">Polygons</a></li>
<li><a href="#index-planarity-of-polygons-319">planarity of polygons</a>: <a href="#Sweep-face-splitting">Sweep face splitting</a></li>
<li><a href="#index-point-definition-36">point definition</a>: <a href="#Drawing-a-solid">Drawing a solid</a></li>
<li><a href="#index-point-list-282">point list</a>: <a href="#Swept-points">Swept points</a></li>
<li><a href="#index-point-literal-175">point literal</a>: <a href="#Point-and-vector-literals">Point and vector literals</a></li>
<li><a href="#index-point-reference-344">point reference</a>: <a href="#Forms-of-references">Forms of references</a></li>
<li><a href="#index-point-sweep-95">point sweep</a>: <a href="#Swept-objects">Swept objects</a></li>
<li><a href="#index-point-sweep-279">point sweep</a>: <a href="#Swept-points">Swept points</a></li>
<li><a href="#index-polygon-sweep-305">polygon sweep</a>: <a href="#Swept-polygons">Swept polygons</a></li>
<li><a href="#index-polygon-sweep-132">polygon sweep</a>: <a href="#Polygon-sweeps">Polygon sweeps</a></li>
<li><a href="#index-polygon-sweep-491">polygon sweep</a>: <a href="#A-hierarchical-model">A hierarchical model</a></li>
<li><a href="#index-polygon-vertex-order-21">polygon vertex order</a>: <a href="#Hello-world">Hello world</a></li>
<li><a href="#index-polygon-vertex-order-292">polygon vertex order</a>: <a href="#Swept-lines">Swept lines</a></li>
<li><a href="#index-polygon-vertex-order-417">polygon vertex order</a>: <a href="#Overview">Overview</a></li>
<li><a href="#index-polygon-vertex-order-301">polygon vertex order</a>: <a href="#Swept-lines">Swept lines</a></li>
<li><a href="#index-polygon-vertex-order-310">polygon vertex order</a>: <a href="#Swept-polygons">Swept polygons</a></li>
<li><a href="#index-polygon-vertex-order-409">polygon vertex order</a>: <a href="#Overview">Overview</a></li>
<li><a href="#index-polygon_002c-body-291">polygon, body</a>: <a href="#Swept-lines">Swept lines</a></li>
<li><a href="#index-polygon_002c-body-259">polygon, body</a>: <a href="#Internal-options">Internal options</a></li>
<li><a href="#index-polygon_002c-body-307">polygon, body</a>: <a href="#Swept-polygons">Swept polygons</a></li>
<li><a href="#index-polygon_002c-end-309">polygon, end</a>: <a href="#Swept-polygons">Swept polygons</a></li>
<li><a href="#index-polygon_002c-end-300">polygon, end</a>: <a href="#Swept-lines">Swept lines</a></li>
<li><a href="#index-polygon_002c-outside-of-18">polygon, outside of</a>: <a href="#Hello-world">Hello world</a></li>
<li><a href="#index-polygon_002c-planar-318">polygon, planar</a>: <a href="#Sweep-face-splitting">Sweep face splitting</a></li>
<li><a href="#index-polygon_002c-planar-266">polygon, planar</a>: <a href="#Polygons">Polygons</a></li>
<li><a href="#index-precedence_002c-operator-224">precedence, operator</a>: <a href="#Two_002doperand-_0028binary_0029-forms">Two-operand (binary) forms</a></li>
<li><a href="#index-program_002c-hello-world-6">program, hello world</a>: <a href="#Hello-world">Hello world</a></li>
<li><a href="#index-projection_002c-parallel-12">projection, parallel</a>: <a href="#Hello-world">Hello world</a></li>
<li><a href="#index-projection_002c-parallel-196">projection, parallel</a>: <a href="#Transform-literals">Transform literals</a></li>
<li><a href="#index-projection_002c-parallel-382">projection, parallel</a>: <a href="#Picture-box">Picture box</a></li>
<li><a href="#index-projection_002c-perspective-202">projection, perspective</a>: <a href="#Transform-literals">Transform literals</a></li>
<li><a href="#index-projection_002c-perspective-401">projection, perspective</a>: <a href="#Overview">Overview</a></li>
<li><a href="#index-pseudo_002doptions-244">pseudo-options</a>: <a href="#TikZ_002fPGF-user_002ddefined-styles">TikZ/PGF user-defined styles</a></li>
<li><a href="#index-_0040code_007bpsframebox_007d-386"><code>psframebox</code></a>: <a href="#Frame">Frame</a></li>
<li><a href="#index-_0040code_007bpspicture_007d-378"><code>pspicture</code></a>: <a href="#Picture-box">Picture box</a></li>
<li><a href="#index-PSTricks-1">PSTricks</a>: <a href="#About-sketch">About sketch</a></li>
<li><a href="#index-quoting_002c-special-50">quoting, special</a>: <a href="#Special-objects">Special objects</a></li>
<li><a href="#index-quoting_002c-special-269">quoting, special</a>: <a href="#Specials">Specials</a></li>
<li><a href="#index-reference_002c-drawable-416">reference, drawable</a>: <a href="#Overview">Overview</a></li>
<li><a href="#index-reference_002c-drawable-78">reference, drawable</a>: <a href="#Object-transforms">Object transforms</a></li>
<li><a href="#index-reference_002c-drawable-354">reference, drawable</a>: <a href="#Forms-of-references">Forms of references</a></li>
<li><a href="#index-reference_002c-multiple-options-360">reference, multiple options</a>: <a href="#Forms-of-references">Forms of references</a></li>
<li><a href="#index-reference_002c-options-357">reference, options</a>: <a href="#Forms-of-references">Forms of references</a></li>
<li><a href="#index-reference_002c-options-149">reference, options</a>: <a href="#Polyline-sweeps-with-closure">Polyline sweeps with closure</a></li>
<li><a href="#index-reference_002c-point-37">reference, point</a>: <a href="#Drawing-a-solid">Drawing a solid</a></li>
<li><a href="#index-reference_002c-point-345">reference, point</a>: <a href="#Forms-of-references">Forms of references</a></li>
<li><a href="#index-reference_002c-scalar-343">reference, scalar</a>: <a href="#Forms-of-references">Forms of references</a></li>
<li><a href="#index-reference_002c-scalar-99">reference, scalar</a>: <a href="#Swept-objects">Swept objects</a></li>
<li><a href="#index-reference_002c-tag-340">reference, tag</a>: <a href="#Forms-of-definitions">Forms of definitions</a></li>
<li><a href="#index-reference_002c-tag-363">reference, tag</a>: <a href="#Forms-of-references">Forms of references</a></li>
<li><a href="#index-reference_002c-transform-407">reference, transform</a>: <a href="#Overview">Overview</a></li>
<li><a href="#index-reference_002c-transform-351">reference, transform</a>: <a href="#Forms-of-references">Forms of references</a></li>
<li><a href="#index-reference_002c-vector-119">reference, vector</a>: <a href="#Polyline-sweeps">Polyline sweeps</a></li>
<li><a href="#index-reference_002c-vector-348">reference, vector</a>: <a href="#Forms-of-references">Forms of references</a></li>
<li><a href="#index-repeated-object-327">repeated object</a>: <a href="#Repeats">Repeats</a></li>
<li><a href="#index-reserved-words-172">reserved words</a>: <a href="#Key-and-reserved-words">Key and reserved words</a></li>
<li><a href="#index-right-hand-rule-83">right hand rule</a>: <a href="#Object-transforms">Object transforms</a></li>
<li><a href="#index-right_002dhand-coordinate-system-4">right-hand coordinate system</a>: <a href="#Introduction-by-example">Introduction by example</a></li>
<li><a href="#index-rotation-81">rotation</a>: <a href="#Object-transforms">Object transforms</a></li>
<li><a href="#index-rotation-transform-482">rotation transform</a>: <a href="#A-hierarchical-model">A hierarchical model</a></li>
<li><a href="#index-rotation-transform-183">rotation transform</a>: <a href="#Transform-literals">Transform literals</a></li>
<li><a href="#index-rotation-transform-488">rotation transform</a>: <a href="#A-hierarchical-model">A hierarchical model</a></li>
<li><a href="#index-rotation_002c-center-of-60">rotation, center of</a>: <a href="#Object-transforms">Object transforms</a></li>
<li><a href="#index-rotation_002c-center-of-122">rotation, center of</a>: <a href="#Nested-sweeps">Nested sweeps</a></li>
<li><a href="#index-running-_0040code_007bsketch_007d-8">running <code>sketch</code></a>: <a href="#Hello-world">Hello world</a></li>
<li><a href="#index-scalar-definition-98">scalar definition</a>: <a href="#Swept-objects">Swept objects</a></li>
<li><a href="#index-scalar-literal-173">scalar literal</a>: <a href="#Scalar-literals">Scalar literals</a></li>
<li><a href="#index-scalar-reference-342">scalar reference</a>: <a href="#Forms-of-references">Forms of references</a></li>
<li><a href="#index-scale-transform-192">scale transform</a>: <a href="#Transform-literals">Transform literals</a></li>
<li><a href="#index-scene-description-language-398">scene description language</a>: <a href="#Building-a-drawing">Building a drawing</a></li>
<li><a href="#index-scene-description-language-161">scene description language</a>: <a href="#Language-basics">Language basics</a></li>
<li><a href="#index-scope_002c-identifier-73">scope, identifier</a>: <a href="#Object-transforms">Object transforms</a></li>
<li><a href="#index-scope_002c-identifier-325">scope, identifier</a>: <a href="#Blocks">Blocks</a></li>
<li><a href="#index-simple-definition-333">simple definition</a>: <a href="#Forms-of-definitions">Forms of definitions</a></li>
<li><a href="#index-solid-28">solid</a>: <a href="#Drawing-a-solid">Drawing a solid</a></li>
<li><a href="#index-special-argument-substitution-53">special argument substitution</a>: <a href="#Special-objects">Special objects</a></li>
<li><a href="#index-special-argument-substitution-270">special argument substitution</a>: <a href="#Specials">Specials</a></li>
<li><a href="#index-special-object-49">special object</a>: <a href="#Special-objects">Special objects</a></li>
<li><a href="#index-special-objects-450">special objects</a>: <a href="#A-technical-drawing">A technical drawing</a></li>
<li><a href="#index-splitting_002c-line-and-surface-495">splitting, line and surface</a>: <a href="#Hidden-surface-removal">Hidden surface removal</a></li>
<li><a href="#index-splitting_002c-line-and-surface-10">splitting, line and surface</a>: <a href="#Hello-world">Hello world</a></li>
<li><a href="#index-substitution_002c-special-52">substitution, special</a>: <a href="#Special-objects">Special objects</a></li>
<li><a href="#index-surface-107">surface</a>: <a href="#Polyline-sweeps">Polyline sweeps</a></li>
<li><a href="#index-sweep-92">sweep</a>: <a href="#Swept-objects">Swept objects</a></li>
<li><a href="#index-swept-bock-312">swept bock</a>: <a href="#Swept-blocks">Swept blocks</a></li>
<li><a href="#index-swept-line-439">swept line</a>: <a href="#A-technical-drawing">A technical drawing</a></li>
<li><a href="#index-swept-line-286">swept line</a>: <a href="#Swept-lines">Swept lines</a></li>
<li><a href="#index-swept-line-106">swept line</a>: <a href="#Polyline-sweeps">Polyline sweeps</a></li>
<li><a href="#index-swept-object-91">swept object</a>: <a href="#Swept-objects">Swept objects</a></li>
<li><a href="#index-swept-object-274">swept object</a>: <a href="#Sweeps">Sweeps</a></li>
<li><a href="#index-swept-point-96">swept point</a>: <a href="#Swept-objects">Swept objects</a></li>
<li><a href="#index-swept-point-278">swept point</a>: <a href="#Swept-points">Swept points</a></li>
<li><a href="#index-swept-polygon-133">swept polygon</a>: <a href="#Polygon-sweeps">Polygon sweeps</a></li>
<li><a href="#index-swept-polygon-490">swept polygon</a>: <a href="#A-hierarchical-model">A hierarchical model</a></li>
<li><a href="#index-tag-definition-332">tag definition</a>: <a href="#Definitions">Definitions</a></li>
<li><a href="#index-tag-definition-508">tag definition</a>: <a href="#Command-line">Command line</a></li>
<li><a href="#index-tag-definition-337">tag definition</a>: <a href="#Forms-of-definitions">Forms of definitions</a></li>
<li><a href="#index-tag-reference-339">tag reference</a>: <a href="#Forms-of-definitions">Forms of definitions</a></li>
<li><a href="#index-tag-reference-362">tag reference</a>: <a href="#Forms-of-references">Forms of references</a></li>
<li><a href="#index-template_002c-document-507">template, document</a>: <a href="#Command-line">Command line</a></li>
<li><a href="#index-template_002c-document-16">template, document</a>: <a href="#Hello-world">Hello world</a></li>
<li><a href="#index-tetrahedron-30">tetrahedron</a>: <a href="#Drawing-a-solid">Drawing a solid</a></li>
<li><a href="#index-tick-operator-_0028_0040code_007b_0027_007d_0029-157">tick operator (<code>'</code>)</a>: <a href="#Affine-arithmetic">Affine arithmetic</a></li>
<li><a href="#index-tick-operator-_0028_0040code_007b_0027_007d_0029-222">tick operator (<code>'</code>)</a>: <a href="#Two_002doperand-_0028binary_0029-forms">Two-operand (binary) forms</a></li>
<li><a href="#index-TikZ_002fPGF-2">TikZ/PGF</a>: <a href="#About-sketch">About sketch</a></li>
<li><a href="#index-toroid-123">toroid</a>: <a href="#Nested-sweeps">Nested sweeps</a></li>
<li><a href="#index-transform-328">transform</a>: <a href="#Repeats">Repeats</a></li>
<li><a href="#index-transform-58">transform</a>: <a href="#Object-transforms">Object transforms</a></li>
<li><a href="#index-transform-275">transform</a>: <a href="#Sweeps">Sweeps</a></li>
<li><a href="#index-transform-400">transform</a>: <a href="#Overview">Overview</a></li>
<li><a href="#index-transform-219">transform</a>: <a href="#Two_002doperand-_0028binary_0029-forms">Two-operand (binary) forms</a></li>
<li><a href="#index-transform-definition-403">transform definition</a>: <a href="#Overview">Overview</a></li>
<li><a href="#index-transform-literal-179">transform literal</a>: <a href="#Transform-literals">Transform literals</a></li>
<li><a href="#index-transform-reference-406">transform reference</a>: <a href="#Overview">Overview</a></li>
<li><a href="#index-transform-reference-350">transform reference</a>: <a href="#Forms-of-references">Forms of references</a></li>
<li><a href="#index-transform_002c-rotation-485">transform, rotation</a>: <a href="#A-hierarchical-model">A hierarchical model</a></li>
<li><a href="#index-transform_002c-rotation-184">transform, rotation</a>: <a href="#Transform-literals">Transform literals</a></li>
<li><a href="#index-transform_002c-rotation-489">transform, rotation</a>: <a href="#A-hierarchical-model">A hierarchical model</a></li>
<li><a href="#index-transform_002c-scale-193">transform, scale</a>: <a href="#Transform-literals">Transform literals</a></li>
<li><a href="#index-transform_002c-translation-187">transform, translation</a>: <a href="#Transform-literals">Transform literals</a></li>
<li><a href="#index-transform_002c-translation-481">transform, translation</a>: <a href="#A-hierarchical-model">A hierarchical model</a></li>
<li><a href="#index-transform_002c-translation-86">transform, translation</a>: <a href="#Object-transforms">Object transforms</a></li>
<li><a href="#index-transform_002c-view-209">transform, view</a>: <a href="#Transform-literals">Transform literals</a></li>
<li><a href="#index-translation-transform-480">translation transform</a>: <a href="#A-hierarchical-model">A hierarchical model</a></li>
<li><a href="#index-translation-transform-186">translation transform</a>: <a href="#Transform-literals">Transform literals</a></li>
<li><a href="#index-translation-transform-85">translation transform</a>: <a href="#Object-transforms">Object transforms</a></li>
<li><a href="#index-transparency-247">transparency</a>: <a href="#Transparency">Transparency</a></li>
<li><a href="#index-two_002doperand-form-213">two-operand form</a>: <a href="#Two_002doperand-_0028binary_0029-forms">Two-operand (binary) forms</a></li>
<li><a href="#index-unary-form-233">unary form</a>: <a href="#Unary-forms">Unary forms</a></li>
<li><a href="#index-vector-87">vector</a>: <a href="#Object-transforms">Object transforms</a></li>
<li><a href="#index-vector-definition-118">vector definition</a>: <a href="#Polyline-sweeps">Polyline sweeps</a></li>
<li><a href="#index-vector-literal-177">vector literal</a>: <a href="#Point-and-vector-literals">Point and vector literals</a></li>
<li><a href="#index-vector-reference-347">vector reference</a>: <a href="#Forms-of-references">Forms of references</a></li>
<li><a href="#index-view-transform-205">view transform</a>: <a href="#Transform-literals">Transform literals</a></li>
<li><a href="#index-virtual-camera-433">virtual camera</a>: <a href="#Overview">Overview</a></li>
<li><a href="#index-white-space-41">white space</a>: <a href="#Drawing-a-solid">Drawing a solid</a></li>
<li><a href="#index-white-space-165">white space</a>: <a href="#Language-basics">Language basics</a></li>
<li><a href="#index-white-space-77">white space</a>: <a href="#Object-transforms">Object transforms</a></li>
<li><a href="#index-white-space-39">white space</a>: <a href="#Drawing-a-solid">Drawing a solid</a></li>
   </ul><div class="footnote">
<hr>
<a name="texinfo-footnotes-in-document"></a><h4>Footnotes</h4><p class="footnote"><small>[<a name="fn-1" href="#fnd-1">1</a>]</small> Or for European users of A4 size paper,
<span class="option">-Te</span>.</p>

   <p class="footnote"><small>[<a name="fn-2" href="#fnd-2">2</a>]</small> This clever trick is due to Kjell Magne Fauske.</p>

   <p class="footnote"><small>[<a name="fn-3" href="#fnd-3">3</a>]</small> Newell, M.E., R.G. Newell, and T.L. Sancha, A
solution to the hidden surface problem. <i>Proceedings of the ACM
annual conference - Volume 1</i>, page 443&ndash;450, ACM Press, 1972.</p>

   <p class="footnote"><small>[<a name="fn-4" href="#fnd-4">4</a>]</small> We
have run <code>sketch</code> on the famous Stanford Bunny, which consists
of nearly 70,000 triangles.  Run time was about 6 seconds. 
Most of this was spent writing the output file rather than in the
hidden surface algorithm.  LaTeX took much longer to process the
resulting <code>PSTricks</code> code.  The obvious conclusion is that the
speed of the depth sort algorithm is not a worry.</p>

   <p class="footnote"><small>[<a name="fn-5" href="#fnd-5">5</a>]</small> I know how to fix this problem, but I don't like my
solution, and I'm interested in yours.</p>

   <p><hr></div>

</body></html>