/usr/share/doc/surf-alggeo-doc/surf-alggeo.html is in surf-alggeo-doc 1.0.6+ds-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.72">
<TITLE> surf version 1.0.1</TITLE>
</HEAD>
<BODY>
<H1> <EM>surf</EM> version 1.0.1</H1>
<H2>Stephan Endrass
<A HREF="mailto:endrass@mathematik.uni-mainz.de"><endrass@mathematik.uni-mainz.de></A></H2> May 28, 2000
<HR>
<EM>The aim was to have a tool to visualize some real algebraic geometry:
plane algebraic curves given as zero
locus of a polynomial in two variables,
algebraic surfaces given as zero locus of
a polynomial in three variables,
hyperplane sections of surfaces: algebraic space curves
given as zero locus of two polynomials in three variables:
a polynomial of arbitrary degree (the surface) and
a linear polynomial (the hyperplane),
and lines on surfaces given by two points on a surface.
The algorithms should be stable enough not to be confused by
curve/surface singularities in codimension greater than one and
the degree of the surface or curve.
This has been achieved quite a bit. We have drawn curves of degree up to 30
and surfaces of degree up to 20 successfully. However, there are examples
of curves/surfaces of lower degree where surf fails to produce perfect
images. This happens especially if the equation of the curve/surface is not
reduced. Best results are achieved using reduced equations. On the other
hand, surf displays the Fermat-curves accurately for degree up to 98.</EM>
<HR>
<P>
<H2><A NAME="toc1">1.</A> <A HREF="surf-alggeo.html#s1">Overview</A></H2>
<UL>
<LI><A NAME="toc1.1">1.1</A> <A HREF="surf-alggeo.html#ss1.1">Acknowledgements</A>
<LI><A NAME="toc1.2">1.2</A> <A HREF="surf-alggeo.html#ss1.2">Copyright</A>
<LI><A NAME="toc1.3">1.3</A> <A HREF="surf-alggeo.html#ss1.3">How to get <EM>surf</EM></A>
<LI><A NAME="toc1.4">1.4</A> <A HREF="surf-alggeo.html#ss1.4">System requirements</A>
<LI><A NAME="toc1.5">1.5</A> <A HREF="surf-alggeo.html#ss1.5">Starting <EM>surf</EM></A>
<LI><A NAME="toc1.6">1.6</A> <A HREF="surf-alggeo.html#ss1.6">Scripts versus graphical user interface</A>
<LI><A NAME="toc1.7">1.7</A> <A HREF="surf-alggeo.html#ss1.7">Scripts</A>
<LI><A NAME="toc1.8">1.8</A> <A HREF="surf-alggeo.html#ss1.8">Output</A>
<LI><A NAME="toc1.9">1.9</A> <A HREF="surf-alggeo.html#ss1.9">Sample scripts</A>
<LI><A NAME="toc1.10">1.10</A> <A HREF="surf-alggeo.html#ss1.10"><EM>surf</EM> and make</A>
<LI><A NAME="toc1.11">1.11</A> <A HREF="surf-alggeo.html#ss1.11">Oddities, bugs and bug reports</A>
</UL>
<P>
<H2><A NAME="toc2">2.</A> <A HREF="surf-alggeo.html#s2">Introduction to <EM>surf</EM>'s command language</A></H2>
<UL>
<LI><A NAME="toc2.1">2.1</A> <A HREF="surf-alggeo.html#ss2.1">Data types</A>
<LI><A NAME="toc2.2">2.2</A> <A HREF="surf-alggeo.html#ss2.2">Operators</A>
<LI><A NAME="toc2.3">2.3</A> <A HREF="surf-alggeo.html#ss2.3">Mathematical functions</A>
<LI><A NAME="toc2.4">2.4</A> <A HREF="surf-alggeo.html#ss2.4">String functions</A>
<LI><A NAME="toc2.5">2.5</A> <A HREF="surf-alggeo.html#ss2.5">Polynomial functions</A>
<LI><A NAME="toc2.6">2.6</A> <A HREF="surf-alggeo.html#ss2.6">First examples</A>
<LI><A NAME="toc2.7">2.7</A> <A HREF="surf-alggeo.html#ss2.7">Conditional statements</A>
</UL>
<P>
<H2><A NAME="toc3">3.</A> <A HREF="surf-alggeo.html#s3">Features</A></H2>
<UL>
<LI><A NAME="toc3.1">3.1</A> <A HREF="surf-alggeo.html#ss3.1">Plane curves</A>
<LI><A NAME="toc3.2">3.2</A> <A HREF="surf-alggeo.html#ss3.2">Surfaces</A>
<LI><A NAME="toc3.3">3.3</A> <A HREF="surf-alggeo.html#ss3.3">Hyperplane sections</A>
<LI><A NAME="toc3.4">3.4</A> <A HREF="surf-alggeo.html#ss3.4">Multiple curves/surfaces</A>
<LI><A NAME="toc3.5">3.5</A> <A HREF="surf-alggeo.html#ss3.5">Graphs and isolines</A>
<LI><A NAME="toc3.6">3.6</A> <A HREF="surf-alggeo.html#ss3.6">Interactive positioning</A>
<LI><A NAME="toc3.7">3.7</A> <A HREF="surf-alggeo.html#ss3.7">Preview</A>
<LI><A NAME="toc3.8">3.8</A> <A HREF="surf-alggeo.html#ss3.8">Anti aliasing surfaces</A>
<LI><A NAME="toc3.9">3.9</A> <A HREF="surf-alggeo.html#ss3.9">Animations</A>
<LI><A NAME="toc3.10">3.10</A> <A HREF="surf-alggeo.html#ss3.10">Stereo pictures</A>
<LI><A NAME="toc3.11">3.11</A> <A HREF="surf-alggeo.html#ss3.11">Black & white images</A>
<LI><A NAME="toc3.12">3.12</A> <A HREF="surf-alggeo.html#ss3.12">Algorithms</A>
<LI><A NAME="toc3.13">3.13</A> <A HREF="surf-alggeo.html#ss3.13">Output</A>
</UL>
<P>
<H2><A NAME="toc4">4.</A> <A HREF="surf-alggeo.html#s4">List of all reserved words</A></H2>
<UL>
<LI><A NAME="toc4.1">4.1</A> <A HREF="surf-alggeo.html#ss4.1">Reserved words corresponding to the main window</A>
<LI><A NAME="toc4.2">4.2</A> <A HREF="surf-alggeo.html#ss4.2">Reserved words corresponding to the position window</A>
<LI><A NAME="toc4.3">4.3</A> <A HREF="surf-alggeo.html#ss4.3">Reserved words corresponding to the display window</A>
<LI><A NAME="toc4.4">4.4</A> <A HREF="surf-alggeo.html#ss4.4">Reserved words corresponding to the light window</A>
<LI><A NAME="toc4.5">4.5</A> <A HREF="surf-alggeo.html#ss4.5">Reserved words corresponding to the clip window</A>
<LI><A NAME="toc4.6">4.6</A> <A HREF="surf-alggeo.html#ss4.6">Reserved words corresponding to the dither window</A>
<LI><A NAME="toc4.7">4.7</A> <A HREF="surf-alggeo.html#ss4.7">Reserved words corresponding to the save color image window</A>
<LI><A NAME="toc4.8">4.8</A> <A HREF="surf-alggeo.html#ss4.8">Reserved words corresponding to the save dithered image window</A>
<LI><A NAME="toc4.9">4.9</A> <A HREF="surf-alggeo.html#ss4.9">Reserved words corresponding to the numeric window</A>
<LI><A NAME="toc4.10">4.10</A> <A HREF="surf-alggeo.html#ss4.10">Reserved words corresponding to the curve window</A>
</UL>
<HR>
<H2><A NAME="s1">1.</A> <A HREF="#toc1">Overview</A></H2>
<H2><A NAME="ss1.1">1.1</A> <A HREF="#toc1.1">Acknowledgements</A>
</H2>
<P>I thank Prof. W. Barth (University Erlangen)
for (en)forcing me to start this project.
Hans Hülf, Rüdiger Örtel and Kai Schneider have
spent lots of time on coding parts of <EM>surf</EM>.
Some of the code has been copied from other places:
<UL>
<LI> Writing SUN rasterfiles
and XWD files has been copied from
Michael L. Mauldin's Fuzzy PixMap (fbm) library version 1.2.</LI>
<LI> Writing a TIFF file has been copied from John Cristy's
Image Magick version 3.0.</LI>
<LI> The octree color reduction algorithm is
copied from Ian Ashdown's article <EM>Octree Color Quantization</EM>
in the C/C++ Users Journal Vol. 13, Number 3, pp. 31-43.</LI>
</UL>
We thank all these people who made their code free so that
we could use it.</P>
<H2><A NAME="ss1.2">1.2</A> <A HREF="#toc1.2">Copyright</A>
</H2>
<P><EM>surf</EM> is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.</P>
<P>This program 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>
<H2><A NAME="ss1.3">1.3</A> <A HREF="#toc1.3">How to get <EM>surf</EM></A>
</H2>
<P><EM>surf</EM> is available via http/ftp at the surf home page
<A HREF="http://surf.sourceforge.net">http://surf.sourceforge.net</A>.</P>
<H2><A NAME="ss1.4">1.4</A> <A HREF="#toc1.4">System requirements</A>
</H2>
<P>To compile <EM>surf</EM>, the following software is needed:
<UL>
<LI><B>GNU gcc/g++</B> version 2.7.x or higher (any ISO C++ compiler should work..),</LI>
<LI><B>make</B>,</LI>
<LI>GNU <B>flex</B> version 2.5 or higher (minor versions should
work also, but lex does <EM>not</EM> suffice),</LI>
<LI>Berkeley <B>yacc</B> (GNU bison should work also),</LI>
<LI><B>GTK+</B> version 1.2.0 or later (only required if you want to
compile <B>surf</B> with GUI support),</LI>
<LI><B>POSIX threads</B> (If you have Linux make sure you use glibc2),</LI>
<LI><B>GNU MP (gmp)</B> version 2 or later,</LI>
</UL>
<B>Warning:</B> Be prepared, the memory consumption of <EM>surf</EM> is about
<UL>
<LI> 15 MB for a 1000x1000 pixel image,</LI>
<LI> 60 MB for a 2000x2000 pixel image and</LI>
<LI> 130 MB for a 3000x3000 pixel image (gobble!!).</LI>
</UL>
</P>
<H2><A NAME="ss1.5">1.5</A> <A HREF="#toc1.5">Starting <EM>surf</EM></A>
</H2>
<P><EM>surf</EM> is started by typing <CODE>surf</CODE> on the command line.
Optional arguments are <CODE>--no-gui</CODE> (or <CODE>-n</CODE>) for starting
<EM>surf</EM> without graphical user interface, <CODE>--exec</CODE> (or
<CODE>-x</CODE>) to immediately execute the first passed script file and -
when using surf <EM>with</EM> GUI - <CODE>--progress-dialog</CODE>
which tells surf to use a progress dialog
instead of a status bar, <CODE>--auto-resize</CODE> which forces the image
windows to get automatically resized to the size of the image, and the
usual GTK+ options. <CODE>--help</CODE> prints out the usage information:
<PRE>
surf -n | --no-gui FILE...
surf [GTK-OPTIONS] [-x | --exec] [--progress-dialog]
[--auto-resize] [FILE]...
surf --help
</PRE>
</P>
<H2><A NAME="ss1.6">1.6</A> <A HREF="#toc1.6">Scripts versus graphical user interface</A>
</H2>
<P><EM>surf</EM> is designed to visualize algebraic curves and surfaces.
This can be
done either by <EM>writing scripts</EM> in surf's command language
and executing them interactively or from another program
(for example make), or by <EM>using
surf's graphical user interface</EM>.
By using scripts one can draw series of pictures where each picture
consists of several surfaces/curves at a high resolution.</P>
<H2><A NAME="ss1.7">1.7</A> <A HREF="#toc1.7">Scripts</A>
</H2>
<P>Scripts in surf's command language are stored in files with the
suffix <CODE>.pic</CODE>. These files consist of descriptions of curves and/or
surfaces and some commands. They can be invoked in two ways:
<UL>
<LI>by loading a script and pressing the button <EM>execute script</EM> or</LI>
<LI>by starting <EM>surf</EM> with the name of a script file from the
command line. If you compiled/started <EM>surf</EM> without GUI
support, it automatically starts interpreting the script. Otherwise
you have to press the <EM>execute script</EM> button.</LI>
</UL>
</P>
<H2><A NAME="ss1.8">1.8</A> <A HREF="#toc1.8">Output</A>
</H2>
<P><EM>surf</EM> calculates both color and black & white images.
Color images can currently be
stored in the following formats:
<UL>
<LI><B>XWD</B>,</LI>
<LI><B>SUN rasterfile</B>,</LI>
<LI><B>PPM</B> and</LI>
<LI><B>JPEG</B></LI>
</UL>
Additionally one can choose a convenient colormap among
<UL>
<LI>Netscape 216 color cube (8 bit),</LI>
<LI>optimized by an octree algorithm (8 bit) and</LI>
<LI>true color (24 bit).</LI>
</UL>
Black & white images can be stored in the following formats:
<UL>
<LI><B>Postscript</B>,</LI>
<LI><B>Encapsulated Postscript</B>,</LI>
<LI><B>TIFF</B>,</LI>
<LI><B>XBM</B>,</LI>
<LI><B>PGM</B> and</LI>
<LI><B>PBM</B>.</LI>
</UL>
</P>
<H2><A NAME="ss1.9">1.9</A> <A HREF="#toc1.9">Sample scripts</A>
</H2>
<P>You will find some sample scripts together with <EM>surf</EM>'s
distribution. They are stored in the <CODE>examples</CODE> directory.</P>
<H2><A NAME="ss1.10">1.10</A> <A HREF="#toc1.10"><EM>surf</EM> and make</A>
</H2>
<P><EM>surf</EM> can be invoked from make. This comes in quite handy when
visualising a series of curves/surfaces. Suppose there are script
files s1.pic, s2.pic, ... , sn.pic which create during execution
images s1.xwd, s2.xwd, ... , sn.xwd. If for example gif is the
desired image file format, an appropriate makefile might look like:
<HR>
<PRE>
#!/bin/bash
#
SURF = surf
RM = /bin/rm -f
CONVERT = convert
#
OBJS = s1.gif s2.gif .... sn.gif
#
.SUFFIXES: .pic .gif
#
.pic.gif:
${SURF} -n $<
${CONVERT} $*.xwd $*.gif
${RM} $*.xwd
#
dummy:
@echo ' '
@echo 'usage:'
@echo ' '
@echo ' print this message:'
@echo ' make'
@echo ' '
@echo ' build images:'
@echo ' make all'
@echo ' '
@echo ' remove images:'
@echo ' make clean'
@echo ' '
#
all: ${OBJS}
#
clean:
${RM} *.gif
#
# end of makefile
</PRE>
<HR>
Here convert is the Image Magick image format converter.</P>
<H2><A NAME="ss1.11">1.11</A> <A HREF="#toc1.11">Oddities, bugs and bug reports</A>
</H2>
<P>In case you find any bug, please use the excellent
<A HREF="http://sourceforge.net/bugs/group_id=3275">Bug Tracking System</A> on <EM>surf</EM>'s project page at Sourceforge.</P>
<H2><A NAME="s2">2.</A> <A HREF="#toc2">Introduction to <EM>surf</EM>'s command language</A></H2>
<H2><A NAME="ss2.1">2.1</A> <A HREF="#toc2.1">Data types</A>
</H2>
<P>The language used in <EM>surf</EM>'s scripts is quite simple.
It has got a (very restricted) C-like syntax and provides the four data types
<UL>
<LI><CODE>int</CODE> (integer),</LI>
<LI><CODE>double</CODE> (double precision float value),</LI>
<LI><CODE>string</CODE> (any ""-quoted string) and</LI>
<LI><CODE>poly</CODE> (any polynomial in x, y and z).</LI>
</UL>
So a valid declaration/initialisation looks like:
<UL>
<LI><CODE>int a=3;</CODE> or <CODE>int a; a=3;</CODE></LI>
<LI><CODE>double b=3.3;</CODE> or <CODE>double b; b=3.3;</CODE></LI>
<LI><CODE>string c="test.xwd";</CODE>
or <CODE>string c; c="test.xwd";</CODE></LI>
<LI><CODE>poly d=(x-3)^3-y^2+z;</CODE>
or <CODE>poly d; d=(x-3)^3-y^2+z;</CODE></LI>
</UL>
There is no comma separator like in C. Declaring a name twice results in
an error. The scope of the name begins at the point of its declaration and
lasts until the end of the file. There is no method of undeclaring a name.</P>
<H2><A NAME="ss2.2">2.2</A> <A HREF="#toc2.2">Operators</A>
</H2>
<P>The following arithmetic operators are implemented:
<PRE>
operator | meaning | valid data types
-----------------------------------------------------------------------
+ | binary plus | {int,double,poly}+{int,double,poly}
+ | concatenation | {string}+{string}
+ | unary plus | +{int,double,poly}
- | binary minus | {int,double,poly}-{int,double,poly}
- | unary minus | -{int,double,poly}
* | multiplication | {int,double,poly}*{int,double,poly}
/ | division | {int,double,poly}/{int,double}
% | remainder | {int}%{int}
^ | power | {int,double}^{int,double}
| | {poly}^{int}
( ) | brackets | ({int,double,poly})
= | equals | {poly}={int,double,poly}
| | {double}={int,double}
| | {int}={int}
| | {string}={string}
== | equal | {int,double}=={int,double}
!= | not equal | {int,double}!={int,double}
< | smaller than | {int,double}<{int,double}
<= | smaller or equal | {int,double}<={int,double}
> | greater than | {int,double}>{int,double}
>= | greater or equal | {int,double}>={int,double}
</PRE>
The precedence of operators copied from C.</P>
<H2><A NAME="ss2.3">2.3</A> <A HREF="#toc2.3">Mathematical functions</A>
</H2>
<P>There are some built-in math functions:
<PRE>
function | meaning | valid arguments | returns
---------------------------------------------------------------
sqrt | square root | sqrt({int,double}) | double
pow | power | pow({int},{int,double}) | double
| | pow({double},{int,double}) | double
sin | sinus | sin({int,double}) | double
cos | cosinus | cos({int,double}) | double
arcsin | arcus sinus | arcsin({int,double}) | double
arccos | arcus cosinus | arccos({int,double}) | double
tan | tangens | tan({int,double}) | double
arctan | arcus tangens | arctan({int,double}) | double
</PRE>
They take int and double as argument.</P>
<H2><A NAME="ss2.4">2.4</A> <A HREF="#toc2.4">String functions</A>
</H2>
<P>There are also two functions returning strings:
<PRE>
function | meaning | valid arguments | returns
------------------------------------------------------------------------
itostr | int to string | itostr({int}) | string
itostrn | int to string | itostrn({int},{int}) | string of spec. length
</PRE>
itostr converts its argument to a string without blanks. For example
<CODE>itostr( 31 )</CODE> returns <CODE>"31"</CODE>.
itostrn allows to specify the length of the string.
For example:
<UL>
<LI><CODE>itostrn( 3,88 )</CODE> returns <CODE>"088"</CODE></LI>
<LI><CODE>itostrn( 4,88 )</CODE> returns <CODE>"0088"</CODE></LI>
</UL>
</P>
<H2><A NAME="ss2.5">2.5</A> <A HREF="#toc2.5">Polynomial functions</A>
</H2>
<P>Some functions work on polynomials:
<PRE>
function | meaning | valid arguments | returns
--------------------------------------------------------------
deg | degree | deg({poly}) | int
len | length | len({poly}) | int
diff | derivative | diff({poly},{x,y,z}) | poly
rotate | rotation | rotate({poly},{double} |
| | {xAxis,yAxis,zAxis}) | poly
hesse | hesse surface | hesse({poly}) | poly
</PRE>
This enables you to work out arbitrary polynomials. </P>
<H2><A NAME="ss2.6">2.6</A> <A HREF="#toc2.6">First examples</A>
</H2>
<P>Values can be passed to <EM>surf</EM> by setting global variables.
The most important two global variables are <CODE>curve</CODE> and
<CODE>surface</CODE>, which should be set to the
polynomial whose zero set should be visualized. So the
shortest effective script contains only three lines, for example:
<UL>
<LI>1st example: draw the newton knot
<HR>
<PRE>
clear_screen;
curve=y^2-x^2*(x+1);
draw_curve;
</PRE>
<HR>
</LI>
<LI>2nd example: draw a sphere
<HR>
<PRE>
clear_screen;
surface=x^2+y^2+z^2-80;
draw_surface;
</PRE>
<HR>
</LI>
</UL>
Both examples can be invoked by pressing the button <EM>execute script</EM>.
The command <CODE>draw_curve</CODE> is somehow equivalent to pressing the
button <EM>draw curve</EM>. The command <CODE>draw_surface</CODE> is somehow
equivalent to pressing the button <EM>draw surface</EM>.</P>
<H2><A NAME="ss2.7">2.7</A> <A HREF="#toc2.7">Conditional statements</A>
</H2>
<P><B>CAUTION</B>: There are no <CODE>for</CODE> and no <CODE>while</CODE> statements.
There is only the crude
<PRE>
if( INTEGER-EXPRESSION ) goto LABEL;
</PRE>
which you might remember from your early BASIC sessions.
Here <CODE>INTEGER-EXPRESSION</CODE> can be arbitrary complicated as long as it
results in an integer. <CODE>LABEL</CODE> is something like <CODE>NAME:</CODE>
which has occurred
before. Consider the example
<HR>
<PRE>
int i=0;
loop:
surface=x^2+y^2+z^2-(i+1.0)/2.0;
clear_screen;
draw_surface;
filename="sphere"+itostrn( 2,i )+".ras";
save_color_image;
i=i+1;
if( i<50 ) goto loop;
</PRE>
<HR>
which obviously draws fifty spheres of increasing radius
and saves them into the <B>SUN rasterfiles</B>:
<BLOCKQUOTE>
sphere00.ras ... sphere49.ras
</BLOCKQUOTE>
There exist some more commands explained briefly afterwards.
C++ comments are welcome.
<B>Warning:</B> Check if your loop terminates!</P>
<H2><A NAME="s3">3.</A> <A HREF="#toc3">Features</A></H2>
<P>In this section most features of <EM>surf</EM> are explained.
Many of these features
can be invoked from the graphical user interface. All features can be
invoked through <EM>surf</EM>'s command language. Command language features
are only explained if not accessible through the GUI. For a complete
reference to the command language, have a look at the next section.</P>
<H2><A NAME="ss3.1">3.1</A> <A HREF="#toc3.1">Plane curves</A>
</H2>
<P>To draw a plane curve, enter the equation into <EM>surf</EM>'s text
window preceded by <CODE>curve=</CODE> and followed by a semicolon.
Then press the button <EM>draw curve</EM>.
Some seconds later the curve will show up in the window titled
<EM>color image</EM>.
By default the curve is drawn inside the rectangle
<BLOCKQUOTE>
-10.0 <= x,y <= 10.0
</BLOCKQUOTE>
and is clipped at a circle with radius 10.0.
The x-axis is horizontal pointing to the right, the y-axis is vertical and
points upwards. By default the image size is 200 x 200 pixels.
The image size can be altered by setting
<EM>width</EM> and <EM>height</EM> in the main window.</P>
<P>The view can be altered in the <EM>position window</EM>:
A different origin can be specified by setting
<EM>origin x</EM> and <EM>origin x</EM>.
A rotation with center at (0,0) can be specified by setting
<EM>rotation about z-axis</EM>. The curve may be scaled by setting
<EM>scale factor x</EM> and <EM>scale factor y</EM>.
The appearance of the curve can be altered in the <EM>curve window</EM>.</P>
<P>The clipping area can be specified in the <EM>clip window</EM>.
For a curve the only reasonable values are
<EM>sphere</EM> and <EM>none</EM>.</P>
<P>An arbitrary color can be given to the curve by setting
<EM>curve red</EM>,<EM>curve green</EM> and <EM>curve blue</EM>
to appropriate values in the <EM>curve window</EM>.
The curve width can be set by changing <EM>curve width</EM>.
A high value of <EM>curve gamma</EM> sharpens the curve, whereas a low
value blurs the curve.</P>
<H2><A NAME="ss3.2">3.2</A> <A HREF="#toc3.2">Surfaces</A>
</H2>
<P>To draw a surface, enter its equation into <EM>surf</EM>'s text window
preceded by <CODE>surface=</CODE> and followed by a semicolon. Then press the button
<EM>draw surface</EM>.
Some more seconds later the surface will appear. By default, the surface
is calculated inside the cube
<BLOCKQUOTE>
-10.0 <= x,y,z <= 10.0
</BLOCKQUOTE>
and clipped at a sphere of radius 10.0.
The x-axis is horizontal pointing to the right, the y-axis is vertical and
points upwards. The z-axis points to you. The spectator
is located at (0,0,25) by default.</P>
<P>Changing the view can be done by altering the settings in the
<EM>position window</EM>. A different origin may be specified by setting
<EM>origin x</EM>, <EM>origin y</EM> and <EM>origin z</EM>.
To rotate the surface one can set <EM>rotation about x-axis</EM>,
<EM>rotation about y-axis</EM> and <EM>rotation about z-axis</EM>
to appropriate values.
Rotation is performed on the following order: y-axis, x-axis, z-axis.
To scale the surface set <EM>scale factor x</EM>, <EM>scale factor y</EM>
and <EM>scale factor z</EM> to desired
values. It is also possible to switch from central perspective to parallel
perspective.</P>
<P>Illumination and color can be altered in the <EM>light window</EM>.
The direction of the normal vector given by the gradient
of the surface equation defines one side of the surface which
is regarded as outside. You can specify a color for this
side by setting <EM>surface red</EM>, <EM>surface green</EM>
and <EM>surface blue</EM>. The other side of the surface
(inside) can be given a different color by specifying
<EM>inside red</EM>, <EM>inside green</EM> and <EM>inside blue</EM>.</P>
<P>Currently only the Phong illumination model is implemented.
Therefore the intensity of the surface in one point consists of
four components which are calculated separately:
<UL>
<LI> ambient light,</LI>
<LI> diffuse light,</LI>
<LI> reflected light and</LI>
<LI> transmitted light.</LI>
</UL>
Ambient light is a constant which represents the light a
point on the surface receives from the whole environment
(the sky, the floor, the lawn ...)
but not from the light sources. Diffuse light is the
light the point receives from the light sources and
which is reflected equally in every possible direction.
The amount of diffuse light is independent of the
spectator position, it is proportional to
the cosine of the angle between the normal vector and
the vector from the point to the light source.
Reflected light is the light from the light sources which is
reflected specular from the surface point.
Its amount is proportional to a power of the cosine of
the angle between the vector from the point to the
spectator and the specular reflection vector from the
light source. If a high power of the cosine is taken,
the surface will appear shiny, whereas a low power
of the cosine lets the surface look rough.
Therfore this power is labelled <EM>smoothness</EM>.
Transmitted light comes in if a surface is transparent.
A constant called <EM>transparence</EM> specifies the
percentage of light which passes through the surface.
Algebraic surfaces are infinitesimally thin. However our
eye is not used to such objects, so we pretend that
our surfaces have a constant <EM>thickness</EM>. Specifying
a positive thickness for a transparent surface results
in a loss of transparency in the places where the
surface normal does not point to the spectator.</P>
<P>These four light components are added with weights
<EM>ambient</EM>, <EM>diffuse</EM>, <EM>reflected</EM>
and <EM>transmitted</EM>.</P>
<P>The number of light sources is limited to nine. For every light
source, the position, the color and the intensity
can be specified.</P>
<P>The <EM>clip window</EM> allows to specify a different clipping area. Here the
center and radius of the clipping area may be specified. Additionally
a front and a back clipping plane may be specified.</P>
<H2><A NAME="ss3.3">3.3</A> <A HREF="#toc3.3">Hyperplane sections</A>
</H2>
<P>To draw one or more hyperplane sections of an algebraic surface,
just specify the hyperplane by setting the global variable
<CODE>plane</CODE> to its equation.
The section is drawn when the command <CODE>cut_with_plane</CODE> is interpreted.
For example:
<HR>
<PRE>
rot_x=0.3; // a nice rotation
rot_y=0.2;
surface=x^2*y^2+y^2*z^2+z^2*x^2-16*x*y*z;
clear_screen; // draw the steiner roman surface
draw_surface;
curve_red=0;
curve_green=255;
curve_blue=0;
curve_width=5;
curve_gamma=1.2;
plane=x+y+z; // draw a green hyperplane section
cut_with_plane;
plane=x+y+z+4.0; // draw another one
cut_with_plane;
</PRE>
<HR>
The color of the hyperplane section can be set by specifying
<CODE>curve_red</CODE>, <CODE>curve_green</CODE> and <CODE>curve_blue</CODE>.
The width of the section is altered by setting <CODE>curve_width</CODE>
to any suitable value. A high value of <CODE>curve_gamma</CODE>
(eg. 10.0) makes the curve
look very pixelized, whereas a small value (eg. 1.0) makes the section
look blurred.</P>
<H2><A NAME="ss3.4">3.4</A> <A HREF="#toc3.4">Multiple curves/surfaces</A>
</H2>
<P>Multiple curves can be drawn in script files just by <EM>NOT</EM> clearing
the screen. This works fine for plane curves.
Just consider the following example:
<HR>
<PRE>
do_background=yes;
clear_screen;
curve=y^2-x^2*(x-1);
draw_curve; // draw a cubic
do_background=no;
curve=x;
draw_curve; // draw y-axis
curve=y;
draw_curve; // draw y-axis
</PRE>
<HR>
Not that every curve will be drawn just over all curves that have been
draw so far.</P>
<P>Multiple surfaces can be drawn by specifying up to 9 surfaces
in the variables <CODE>surface</CODE>, <CODE>surface2</CODE> ...
<CODE>surface9</CODE>. Additionally it is possible to draw on every surface
any number of hyperplane sections.
<HR>
<PRE>
rot_x=0.69; // a nice rotation
rot_y=0.35;
illumination=ambient_light + // specify illumination
diffuse_light + // model
reflected_light +
transmitted_light;
transparence=35; // set transparence for surface no 1
transparence2=35; // set transparence for surface no 2
surface=x^2+y^2+z^2-30; // first surface: a sphere
surface2_red=255; // second surface: a red steiner surface
surface2_green=0;
surface2_blue=0;
surface2=x^2*y^2+x^2*z^2+y^2*z^2-16*x*y*z;
clear_screen;
draw_surface; // draw the surface
curve_width=5;
curve_red=0;
curve_green=255;
curve_blue=0;
plane=x+y+z-6.0; // draw a green hyperplane section
surf_nr=1; // on the sphere
cut_with_plane;
curve_red=0;
curve_green=255;
curve_blue=255;
plane=x+y+z+4.0; // draw a turquoise hyperplane section
surf_nr=2; // on the steiner surface
cut_with_plane;
</PRE>
<HR>
</P>
<H2><A NAME="ss3.5">3.5</A> <A HREF="#toc3.5">Graphs and isolines</A>
</H2>
<P>Given a polynomial function <CODE>f(x,y)</CODE> and a set of levels
<CODE>z1</CODE>, ... ,<CODE>zn</CODE>, <B>surf</B> can visualize the graph
<CODE>z=f(x,y)</CODE> and all isoline for the levels
<CODE>z1</CODE>, ... ,<CODE>zn</CODE> as follows:
<HR>
<PRE>
rot_x=-0.8;
clear_screen;
poly f=x^2+y^2; // graph of (x,y)->x^2+y^2
surface=z-f;
draw_surface; // draw the graph
curve_width=3; // width of isoline
plane=z-1;
cut_with_plane; // draw isoline f(x,y)=1
plane=z-2;
cut_with_plane; // draw isoline f(x,y)=2
plane=z-3;
cut_with_plane; // draw isoline f(x,y)=3
plane=z-4;
cut_with_plane; // draw isoline f(x,y)=4
plane=z-5;
cut_with_plane; // draw isoline f(x,y)=5
plane=z-6;
cut_with_plane; // draw isoline f(x,y)=6
plane=z-7;
cut_with_plane; // draw isoline f(x,y)=7
plane=z-8;
cut_with_plane; // draw isoline f(x,y)=8
plane=z-9;
cut_with_plane; // draw isoline f(x,y)=9
</PRE>
<HR>
If however your function <CODE>f</CODE> is not polynomial, try to expand
calculate its Taylor series. Since the new root algorithms work fine
with polynomials of degree up to 30, you might approximate <CODE>f</CODE>
by its Taylor series. If your function is piecewise defined, better
use another program.</P>
<H2><A NAME="ss3.6">3.6</A> <A HREF="#toc3.6">Interactive positioning</A>
</H2>
<P>The <EM>position</EM> window provides an interface to adjust the
curve/surface position. You can set the 9 buttons into the
three modes <EM>translate</EM>, <EM>rotate</EM> and
<EM>scale</EM>.</P>
<H2><A NAME="ss3.7">3.7</A> <A HREF="#toc3.7">Preview</A>
</H2>
<P>If you try to draw a surface and give the equation to <EM>surf</EM>,
the resulting image normally does not look nice at all.
You have to find the right scaling, rotation and so on.
Often you want to see immediately what happens if you change
some value. But it simply takes <EM>surf</EM> too long
to calculate one image. Here comes the preview in.
Setting the preview buttons in the <EM>main window</EM> to
<EM>3x3</EM> has the effect that only every 9th pixel
is calculated, setting it to <EM>9x9</EM> only every
81st pixel is calculated. But one can still get an impression
of what the image looks like, AND computation is speeded up
by the factor 9 resp. 81.</P>
<P>Up to two preview buttons can be pressed at one time.
If for example <EM>9x9</EM> and <EM>1x1</EM> are pressed,
then the image will be calculated in three steps.
First, every 81st pixel, after that every 9th pixel
and finally every pixel will be calculated.</P>
<H2><A NAME="ss3.8">3.8</A> <A HREF="#toc3.8">Anti aliasing surfaces</A>
</H2>
<P>Especially in animations aliasing is very disturbing. Therefore if
in the <EM>display window</EM>,
<EM>antialiasing level</EM> is set to a value n > 1,
then in a second pass all
pixels differing by a value of at least <EM>antialiasing threshold</EM>
from one of their neighbours are refined. Exactly n^2+1 intensity
values are calculated. In most cases an antialiasing level of
4 will remove aliasing.</P>
<H2><A NAME="ss3.9">3.9</A> <A HREF="#toc3.9">Animations</A>
</H2>
<P>On a nifty machine <EM>surf</EM> is fast enough to provide a real time
animation of an algebraic curve of degree < 5. For example
<HR>
<PRE>
// --------------------------
// animation of a cubic curve
// --------------------------
clear_screen;
double a=-10.0;
loop:
curve=y^2-(x^2-1)*(x-a);
clear_pixmap;
draw_curve;
a=a+0.1;
if( a <= 10.0 ) goto loop;
</PRE>
<HR>
calculates some 200 curves. In a 200x200 window, <EM>surf</EM> shows me about
five frames per second on a sparc 20.
However, real time animations of algebraic surfaces are still
beyond computation power (or do you call a 200-processor-machine your own?).
But you can calculate a series of images with <EM>surf</EM> and convert this
series of images to the movie format of your choice.
<HR>
<PRE>
// --------------------------
// the 4-nodal cubic rotating
// --------------------------
width=200;
height=200; // set image size
double sf=0.3;
scale_x=sf;
scale_y=sf;
scale_z=sf; // set scaling
double Pi=2*arccos(0);
double w2=sqrt(2); // define some constants
poly p=1-z-w2*x;
poly q=1-z+w2*x;
poly r=1+z+w2*y;
poly s=1+z-w2*y; // define tetrahedral coordinates
poly cubic=4*(p^3+q^3+r^3+s^3)-(p+q+r+s)^3; // the cubic
int i=0;
loop:
surface=rotate(cubic,2*Pi/100*i,zAxis); // rotate the cubic
clear_screen;
draw_surface; // draw the cubic
filename="cubic"+itostrn(3,i)+".ras";
save_color_image; // save the image
i=i+1;
if( i < 100 ) goto loop; // repeat 100 times
</PRE>
<HR>
Here some 100 SUN rasterfiles are created. Afterwards you could use
some tool to convert these single images to a movie.</P>
<H2><A NAME="ss3.10">3.10</A> <A HREF="#toc3.10">Stereo pictures</A>
</H2>
<P>Have you ever watched one of those films with that red and green
glasses? <EM>surf</EM> tries to accomplish exactly this effect
when you set <EM>eye distance</EM> in the
<EM>display window</EM> to a value greater than zero.
The following situation is simulated: The spectator is located
at (0,0,<EM>spectator z</EM>) and the distance between his
eyes is <EM>eye distance</EM>. The surface will appear at
the z-coordinate <EM>distance from screen</EM>.
Furthermore it is possible to adjust to specific
red-green or red-blue glasses by setting
<EM>left eye red value</EM>, <EM>right eye green value</EM> end
<EM>right eye blue value</EM>. In particular it is assumed that
the right eye wears the red glass.</P>
<H2><A NAME="ss3.11">3.11</A> <A HREF="#toc3.11">Black & white images</A>
</H2>
<P>If a color image of a surface/curve has been calculated, this image can
be mapped to a black and white image by pressing the button
<EM>dither surface</EM> or <EM>dither curve</EM>.
The second one is just designed for dithering curves.
The appearance of the black and white image can be altered/adjusted in several
ways in the <EM>dither window</EM>.
Since the mapping itself is done by dithering, the dithering algorithm
can be specified. Currently available are seven algorithms coming in three
groups:</P>
<H3>Dithering with blue noise</H3>
<P>
<UL>
<LI>Floyd-Steinberg filter</LI>
<LI>Jarvis, Judis and Ninke filter</LI>
<LI>Stucki filter</LI>
</UL>
All three filters are based on the same idea of error
distribution. Floyd Steinberg is the simplest one, whereas Stucki
differs from Jarvis only by its weights.
They tend to produce disturbing patterns if they process large
areas of intensity near 0.5. Therefore one can let them proceed
in a serpentine fashion, which reduces the patterns. Nearly all patterns
disappear if the weights are disturbed randomly.
The algorithms are best for use with low resolution printers,
typically 300 dpi. Some (most?) 600 dpi laser printers do not like these
algorithms, since they do not like isolated pixels.</P>
<H3>Dithering with ordered dither</H3>
<P>
<UL>
<LI>Clustered dot ordered dither</LI>
<LI>Dispersed dot ordered dither</LI>
</UL>
The clustered dot ordered dither is a fast method and produces
satisfying results in combination with high resolution printers
(600 dpi and more). The second algorithm is for use with low
resolution printers. Both perform no error distribution.
Depending on the printer resolution and the number of emulated
gray levels, one can choose the pattern size:
<UL>
<LI>4 x 4 pixels: 16 gray levels,</LI>
<LI>8 x 8 pixels: 64 gray levels or</LI>
<LI>16 x 16 pixels: 256 gray levels.</LI>
</UL>
</P>
<H3>Hybrid methods</H3>
<P>
<UL>
<LI>Knuth's dot diffusion</LI>
<LI>Knuth's smooth dot diffusion</LI>
</UL>
Both algorithms combine clustered dot ordered dither and error
distribution. Depending on the printer resolution on can choose
the number of barons in a 8x8 matrix to be
<UL>
<LI>1 for resolutions of 1200 dpi or above or</LI>
<LI>2 for resolutions of 600 dpi or above.</LI>
</UL>
The barons are the bad guys in a matrix which get all the
error left over from the good guys.</P>
<H3>The black & white problem</H3>
<P>The surfaces on black and white images often don't look very impressive;
often it is hard to detect the edges of a surface. An algorithm called
enhancing the edges avoids this drawback. This algorithm takes a value
<EM>alpha</EM> in [0,1] as input.
Best results are achieved with alpha around 0.9.</P>
<P>The intensity of the background on the black and white image can be
specified by altering the value <EM>background</EM> to any value
in [0.1]. Here 0 is black whereas 1 means white.</P>
<P>The <EM>tone scale adjustment</EM> maps intensity values
between 0 and 0.1 to 0, values between 0.1 and 0.9 linear to [0,1]
and values between 0.9 and 1 to 1.
This is used to enhance the contrast of an image. An additional gamma
correction can be also performed to correct the linearity of an output
device.</P>
<P>By specifying <EM>pixel size</EM> one can correct the printer pixel size:
A value of 50 means that the radius of a pixel is exactly
half the distance between two neighbouring pixels. A value of 100
says that the radius of a pixel is exactly the distance between two
neighbouring pixels.</P>
<H2><A NAME="ss3.12">3.12</A> <A HREF="#toc3.12">Algorithms</A>
</H2>
<P>The heart of <EM>surf</EM> is an algorithm which determines all
roots of a polynomial in one variable. Currently you can choose between
seven methods in the <EM>numeric window</EM>.
The first six methods use a chain of derivatives
to determine intervals where the polynomial has exactly one root.
They differ by the iteration method which is used to find the roots
in these intervals. Some of the iteration methods were just implemented
out of academic interest. However, they all work. The last method uses
Rockwoods all roots algorithm: the polynomial is converted into a
bezier function and the roots of the bezier function are approximated by
the roots of the control polygon.</P>
<P>For curves/surfaces of degree less than ten, all methods work.
When the degree gets higher, best results are achieved by
the bisection, the Newton and the bezier all roots method. At last, for
a degree higher than 30 only the bisection methods seems to work (up
to degree 50). If a curve has multiple components, the bisection
and the Newton method tend to produce the best results.</P>
<P>Moreover it is possible to specify a numerical precision
<EM>epsilon</EM> which is used in all root finders.
Additionally the maximal number of <EM>iterations</EM> of the
iteration methods can be specified.</P>
<H2><A NAME="ss3.13">3.13</A> <A HREF="#toc3.13">Output</A>
</H2>
<P><EM>surf</EM> can store color images in one of several
file formats. In the <EM>save color image window</EM>
you can choose between
<UL>
<LI><B>XWD</B> (X Window Dump),</LI>
<LI><B>SUN rasterfile</B>,</LI>
<LI><B>PPM</B> (Portable PixMap) and</LI>
<LI><B>JPEG</B>.</LI>
</UL>
Additionally the color space can be chosen among
<UL>
<LI>Netscape 216 color cube (8 bit),</LI>
<LI>optimized by an octree algorithm (8 bit) and</LI>
<LI>True color (24 bit).</LI>
</UL>
The first colormap is just the 6x6x6 colormap Netscape uses.
The second one results from an octree algorithm which chooses
the most used 216 colors among all colors of the image.
Storing an image in True color results in better quality,
but bigger file size.</P>
<P><EM>surf</EM> can store black and white images
in different file formats. We have implemented
<UL>
<LI><B>Postscript</B>,</LI>
<LI><B>EPS</B> (Encapsulated Postscript),</LI>
<LI><B>TIFF</B>,</LI>
<LI><B>XBM</B>,</LI>
<LI><B>PGM</B> and</LI>
<LI><B>PBM</B>.</LI>
</UL>
For postscript and encapsulated postscript also
the resolution may be specified among
<UL>
<LI>75 dpi,</LI>
<LI>100 dpi,</LI>
<LI>150 dpi,</LI>
<LI>300 dpi,</LI>
<LI>600 dpi and</LI>
<LI>1200 dpi.</LI>
</UL>
These settings may be chosen in the <EM>save dithered image window</EM>.
When using postscript, the image will (regardless its size)
appear centred on the side (which is assumed to be a4).</P>
<H2><A NAME="s4">4.</A> <A HREF="#toc4">List of all reserved words</A></H2>
<P>A reserved word in <EM>surf</EM>'s language is either a command or a global
variable. A command is invoked mostly without parameters. Global variables
are either constant or may be altered. The commands correspond to
pushbuttons of <EM>surf</EM>'s GUI, global variables correspond to other panel
items.</P>
<H2><A NAME="ss4.1">4.1</A> <A HREF="#toc4.1">Reserved words corresponding to the main window</A>
</H2>
<P>
<PRE>
res. word | type | description
--------------------------------------------------------------------------
clear_screen | command | erase the image
clear_pixmap | command | erase the image in memory (useful for
| | real-time-animations of algebraic curves)
draw_curve | command | draw the curve defined by the global
| | polynomial curve
draw_surface | command | draw the surfaces defined by the global
| | polynomials surface, surface2, ...
cut_with_plane | command | draw the hyperplane section defined
| | defined by the linear polynomial plane
dither_surface | command | convert color image to a dithered
| | black and white image
dither_curve | command | convert color image to a dithered
| | black and white image (for curves only)
save_color_image | command | save color image in file defined by the
| | global string filename
save_dithered_image | command | save dithered black and white image in
| | file defined by the global string filename
set_size | command | not needed any more (still there for
| | compatibility issues)
</PRE>
</P>
<P>
<PRE>
res. word | type | range | default | description
-------------------------------------------------------------------------
curve | poly | any | 0 | polynomial of curve
surface | poly | any | 0 | polynomial of surface
surface2 | poly | any | 0 | polynomial of surface2
... | ... | ... | ... | ...
surface9 | poly | any | 0 | polynomial of surface9
plane | poly | linear | 0 | equation of hyperplane
width | int | {64,...,3000} | 200 | width of surface image
height | int | {64,...,3000} | 200 | height of surface image
filename | string | any | "" | filename used in
| | | | save_color_image,
| | | | save_dithered_image
surf_nr | int | {1,...,9} | 1 | surface which is used
| | | | for cut_with_plane
</PRE>
</P>
<H3>Examples</H3>
<P>
<HR>
<PRE>
width=400; // Set image width
height=300; // and height
surface=x^2+y^2+z^2-81; // Set global variable surface to a sphere
draw_surface; // Draw the sphere onto the screen
plane=x+y+z; // Choose a hyperplane
cut_with_plane; // Draw the hyperplane section
filename="sphere.ras";
save_color_image; // Save the color image in file sphere.xwd
dither_surface; // Perform dithering on the color image
filename="sphere.ps";
save_dithered_image; // Save the dithered image in sphere.ps
</PRE>
<HR>
</P>
<H2><A NAME="ss4.2">4.2</A> <A HREF="#toc4.2">Reserved words corresponding to the position window</A>
</H2>
<P>
<PRE>
res. word | type | range | def. | description
-------------------------------------------------------------------------
origin_x | double | ]-9999,9999[ | 0 | \
origin_y | double | ]-9999,9999[ | 0 | > position of origin
origin_z | double | ]-9999,9999[ | 0 | /
spec_z | double | ]0,9999[ | 100 | spectator dist. from origin
rot_x | double | ]-9999,9999[ | 0 | rotation angle of surface
| | | | about the x-axis
rot_y | double | ]-9999,9999[ | 0 | rotation of surface
| | | | about the y-axis
rot_z | double | ]-9999,9999[ | 0 | rotation of surface
| | | | about the z-axis
scale_x | double | ]-9999,9999[ | 1 | ratio surface is scaled in
| | | | direction of the x-axis
scale_y | double | ]-9999,9999[ | 1 | ratio surface is scaled in
| | | | direction of the y-axis
scale_z | double | ]-9999,9999[ | 1 | ratio surface is scaled in
| | | | direction of the z-axis
perspective | int | {0,1} | 0 | perspective to use
parallel | int | 0 | 0 | constant
central | int | 1 | 1 | constant
first | int | {0,1,2} | 0 | first performed \
second | int | {0,1,2} | 1 | second performed > action
third | int | {0,1,2} | 2 | third performed /
translate | int | 0 | 0 | constant
rotate | int | 1 | 1 | constant
scale | int | 2 | 2 | constant
</PRE>
</P>
<H3>Examples</H3>
<P>
<HR>
<PRE>
double Pi=2*arccos(0);
origin_x = -3;
origin_y = -4; // Set origin to point (-3,-4,2)
origin_z = 2;
spec_z = 25; // Spectator is now at (-3,-4,27)
rot_x = Pi/2; // Rotate 90 degrees about x-axis
rot_y = Pi/4; // Rotate 45 degrees about y-axis
rot_z = Pi; // Rotate 180 degrees about z-axis
scale_x = 1.0; // Don't scale in x-direction
scale_y = 1.5; // Shrink surface in y-direction
scale_z = 1/2; // Oversize surface in z-direction
first = rotate; // rotate first
second = scale; // then scale
third = translate; // then translate
</PRE>
<HR>
</P>
<H2><A NAME="ss4.3">4.3</A> <A HREF="#toc4.3">Reserved words corresponding to the display window</A>
</H2>
<P>
<PRE>
res. word | type | range | def. | description
-------------------------------------------------------------------------
dither_colors | int | {yes,no} | yes | color dithering
dither_steps | double | [5,...,255] | 20.0 | steps of dithering
normalize | int | {yes,no} | no | normalize image
normalize_factor | double | ]0,...,5] | 1.0 | multiply with
antialiasing | int | {1,..,8} | 1 | level of
| | | | antialiasing
antialiasing_threshold | double | ]0,1[ | 0.1 | threshold
antialiasing_radius | double | [0.5,...,2] | 2.0 | radius
depth_cueing | int | {yes,no} | no | use depth cueing
depth_value | double | [-1000,10[ | -14.0 | depth of mist
stereo_eye | double | [-100,100] | 0.0 | eye distance
stereo_z | double | [-30,30] | 5.0 | dist. from screen
stereo_red | double | [0,1] | 1.0 | left eye red
stereo_green | double | [0,1] | 0.7 | right eye green
stereo_blue | double | [0,1] | 0.0 | right eye blue
</PRE>
</P>
<H3>Examples</H3>
<P>
<HR>
<PRE>
dither_colors = yes; // perform color dithering
dither_steps = 60.0; // use soft dithering
normalize = yes;
normalize_factor = 1.5; // light up image
antialiasing = 4; // do 4 fold antialiasing
antialiasing_threshold = 0.05; // with a low threshold
antialiasing_radius = 1.5; // and a small radius
depth_cueing = yes; // perform depth cueing
depth_value = -11.0;// from -11 on everythin is dark
stereo_eye = 5.0; // make a red-blue image
stereo_z = 2.0; // object 2 units before screen
stereo_red = 1.0;
stereo_green = 0.0;
stereo_blue = 1.0;
</PRE>
<HR>
</P>
<H2><A NAME="ss4.4">4.4</A> <A HREF="#toc4.4">Reserved words corresponding to the light window</A>
</H2>
<P>
<PRE>
res. word | cat. | range | def. | description
-------------------------------------------------------------------------
illumination | int | {0,..15} | 7 | illumination model
ambient_light | int | 1 | 1 | constant
diffuse_light | int | 2 | 2 | constant
reflected_light | int | 4 | 4 | constant
transmitted_light | int | 8 | 8 | constant
surface_red | int | {0,...,255} | 123 | \ outside
surface_green | int | {0,...,255} | 104 | > color of surface
surface_blue | int | {0,...,255} | 238 | / (medium slate blue)
inside_red | int | {0,...,255} | 230 | \ inside
inside_green | int | {0,...,255} | 180 | > color of surface
inside_blue | int | {0,...,255} | 30 | / (golden)
surface2_red | int | {0,...,255} | 123 | \ outside
surface2_green | int | {0,...,255} | 104 | > color of surface2
surface2_blue | int | {0,...,255} | 238 | / (medium slate blue)
inside2_red | int | {0,...,255} | 230 | \ inside
inside2_green | int | {0,...,255} | 180 | > color of surface2
inside2_blue | int | {0,...,255} | 30 | / (golden)
... | ... | ... | ... | ...
... | ... | ... | ... | ...
... | ... | ... | ... | ...
surface9_red | int | {0,...,255} | 123 | \ outside
surface9_green | int | {0,...,255} | 104 | > color of surface9
surface9_blue | int | {0,...,255} | 238 | / (medium slate blue)
inside9_red | int | {0,...,255} | 230 | \ inside
inside9_green | int | {0,...,255} | 180 | > color of surface9
inside9_blue | int | {0,...,255} | 30 | / (golden)
ambient | int | {0,...,100} | 35 | amount of ambient light
diffuse | int | {0,...,100} | 60 | diffuse reflected light
reflected | int | {0,...,100} | 60 | specular reflected light
transmitted | int | {0,...,100} | 60 | spec. transmitted light
smoothness | int | {0,...,100} | 13 | roughness of surface
transparency | int | {0,...,100} | 80 | transparency of surface
ambient2 | int | {0,...,100} | 35 | amount of ambient light
diffuse2 | int | {0,...,100} | 60 | diffuse reflected light
reflected2 | int | {0,...,100} | 60 | specular reflected light
transmitted2 | int | {0,...,100} | 60 | spec. transmitted light
smoothness2 | int | {0,...,100} | 13 | roughness of surface2
transparency2 | int | {0,...,100} | 80 | transparency of surface2
... | ... | ... | ... | ...
... | ... | ... | ... | ...
... | ... | ... | ... | ...
ambient9 | int | {0,...,100} | 35 | amount of ambient light
diffuse9 | int | {0,...,100} | 60 | diffuse reflected light
reflected9 | int | {0,...,100} | 60 | specular reflected light
transmitted9 | int | {0,...,100} | 60 | spec. transmitted light
smoothness9 | int | {0,...,100} | 13 | roughness of surface9
transparency9 | int | {0,...,100} | 80 | transparency of surface9
light1_x | double | [-9999,9999] | -100 | \
light1_y | double | [-9999,9999] | 100 | \ position and volume
light1_z | double | [-9999,9999] | 100 | / of the first light
light1_vol | int | {0,...,100} | 50 | / source
light1_red | int | {0,..,255} | 255 | \
light1_green | int | {0,..,255} | 255 | > color of first
light1_blue | int | {0,..,255} | 255 | / light source
light2_x | double | [-9999,9999] | 0 | \
light2_y | double | [-9999,9999] | 100 | \ position and volume
light2_z | double | [-9999,9999] | 100 | / of the second light
light2_vol | int | {0,...,100} | 0 | / source
light2_red | int | {0,..,255} | 255 | \
light2_green | int | {0,..,255} | 255 | > color of second
light2_blue | int | {0,..,255} | 255 | / light source
... | ... | ... | ... | ...
... | ... | ... | ... | ...
... | ... | ... | ... | ...
light9_x | double | [-9999,9999] | 100 | \
light9_y | double | [-9999,9999] | -100 | \ position and volume
light9_z | double | [-9999,9999] | 100 | / of the ninteh light
light9_vol | int | {0,...,100} | 0 | / source
light9_red | int | {0,..,255} | 255 | \
light9_green | int | {0,..,255} | 255 | > color of nineth
light9_blue | int | {0,..,255} | 255 | / light source
</PRE>
</P>
<H3>Examples</H3>
<P>
<HR>
<PRE>
illumination = ambient_light
+ diffuse_light
+ reflected_light
+ transmitted_light; // Select illumination
surface_red = 205;
surface_green = 92;
surface_blue = 92; // Select indian red for surface outside
inside_red = surface_red;
inside_green = surface_green;
inside_blue = surface_blue; // Select indian red for surface inside
ambient = 10; // 40% ambient light
diffuse = 60; // 60% diffuse light
reflected = 60; // 60% reflected light
transmitted = 70; // 60% reflected light
smoothness = 50; // make surface shiny
transparence = 90; // very transparent
thickness = 20; // but also very thick
light2_x = 100;
light2_y = 0;
light2_z = 200;
light2_volume = 100; // turn on light no. 2 red at (100,0,200)
light2_red = 255;
light2_green = 0;
light2_blue = 0;
</PRE>
<HR>
</P>
<H2><A NAME="ss4.5">4.5</A> <A HREF="#toc4.5">Reserved words corresponding to the clip window</A>
</H2>
<P>
<PRE>
reserved word | cat. | range | def. | description
-------------------------------------------------------------------------
clip | int | {0,...,5} | 0 | clipping area
ball | int | 0 | 0 | constant
cylinder_xaxis | int | 1 | 1 | constant
cylinder_yaxis | int | 2 | 2 | constant
cylinder_zaxis | int | 3 | 3 | constant
cube | int | 4 | 4 | constant
none | int | 5 | 5 | constant
clip_front | double | [-9999,9999] | 10 | \ additional clip region
clip_back | double | [-9999,9999] | -10 | /
radius | double | ]0,9999] | 10 | radius of clip region
center_x | double | [-9999,9999] | 0 | \
center_x | double | [-9999,9999] | 0 | > center of clip region
center_x | double | [-9999,9999] | 0 | /
</PRE>
</P>
<H3>Examples</H3>
<P>
<HR>
<PRE>
clip = cube;
radius = 7;
center_x = -3; // Set clipping area to cube with center at
center_y = 2; // (-3,2,1) and edge length 14
center_z = 1;
clip_front = 4; // Clip off points with z > 4
clip_back = -10; // Clip off points with z > -10
</PRE>
<HR>
</P>
<H2><A NAME="ss4.6">4.6</A> <A HREF="#toc4.6">Reserved words corresponding to the dither window</A>
</H2>
<P>
<PRE>
reserved word | cat. | range | def. | description
-------------------------------------------------------------------------
dithering_method | int | {0,...,6} | 1 | dithering method
floyd_steinberg_filter | int | 0 | 0 | constant
jarvis_judis_ninke_filter | int | 1 | 1 | constant
stucki_filter | int | 2 | 2 | constant
clustered_dot_ordered_dither | int | 3 | 3 | constant
dispersed_dot_ordered_dither | int | 4 | 4 | constant
dot_diffusion | int | 5 | 5 | constant
smooth_dot_diffusion | int | 6 | 6 | constant
</PRE>
</P>
<P>
<PRE>
reserved word | cat. | range | def. | description
-------------------------------------------------------------------------
serpentine_raster | int | {yes,no} | yes | use of serpentine raster
random_weights | int | {yes,no} | yes | use of random weights
weight | double | [0,1] | 0.5 | amount of random weights
barons | int | {0,1} | 1 | number of barons
one_baron | int | 0 | 0 | constant
two_baron | int | 1 | 1 | constant
pattern_size | int | {0,1,2} | 1 | size of dithering tile
pattern_4x4 | int | 0 | 0 | constant
pattern_8x8 | int | 1 | 1 | constant
pattern_16x16 | int | 2 | 2 | constant
enhance_edges | int | {yes,no} | yes | enhance edges of b w image
alpha | double | [0,1] | 0.9 | filter coefficient used in
| | | | for enhancing the edges
background | double | [0,1] | 1.0 | background intensity of
| | | | b w image
tone_scale_adjustment | int | {yes,no} | yes | perform tone scale adjust.
gamma | double | ]0,oo[ | 1.3 | gamma-correction
pixel_size | int | ]50,100] | 73 | correction for printers
| | | | that produce too fat pixels
</PRE>
</P>
<H3>Examples</H3>
<P>
<HR>
<PRE>
dithering_method = stucki_filter; // select stucki filter
serpentine_raster = yes; // turn on serpentine raster
random_weights = yes; // turn on random weights
weight = 0.5; // select 50% weights
enhance_edges = yes; // turn on enhancing edges
alpha = 0.8; // edges less visible than default
background = 0.5; // gray background for b w image
tone_scale_adjustment = yes; // perform tone scale adjustment
gamma = 1.5; // more gamma-correction than default
dithering_method = dispersed_dot; // select dispersed dot ordered dither
pattern_size = pattern_16x16; // select a 16x16-tile
dithering_method = dot_diffusion; // select dot-diffusion
barons = two_barons; // select a 2-barons tile
</PRE>
<HR>
</P>
<H2><A NAME="ss4.7">4.7</A> <A HREF="#toc4.7">Reserved words corresponding to the save color image window</A>
</H2>
<P>
<PRE>
reserved word | type | range | def. | description
-------------------------------------------------------------------------
color_file_format | int | {0,1} | 1 | file format
xwd | int | 0 | 0 | constant
sun | int | 1 | 1 | constant
color_file_colormap | int | {0,1,2} | 0 | colormap type
netscape | int | 0 | 0 | constant
optimized | int | 1 | 1 | constant
truecolor | int | 2 | 2 | constant
</PRE>
</P>
<H3>Examples</H3>
<P>
<HR>
<PRE>
color_file_format = xwd;
color_file_colormap = truecolor; // format is 24 bit XWD
</PRE>
<HR>
</P>
<H2><A NAME="ss4.8">4.8</A> <A HREF="#toc4.8">Reserved words corresponding to the save dithered image window</A>
</H2>
<P>
<PRE>
reserved word | type | range | def. | description
-------------------------------------------------------------------------
resolution | int | {0,...,5} | 3 | (printer) resolution
res_75dpi | int | 0 | 0 | constant
res_100dpi | int | 1 | 1 | constant
res_150dpi | int | 2 | 2 | constant
res_300dpi | int | 3 | 3 | constant
res_600dpi | int | 4 | 4 | constant
res_1200dpi | int | 5 | 5 | constant
dithered_file_format | int | {0,...,4} | 2 | file format
postscript | int | 0 | 0 | constant
encapsulated | int | 1 | 1 | constant
xbm | int | 2 | 2 | constant
tiff | int | 3 | 3 | constant
bm2font | int | 4 | 4 | constant
</PRE>
</P>
<H3>Examples</H3>
<P>
<HR>
<PRE>
resolution = res_300dpi; // select 300 dpi
dithered_file_format = bm2font; // TeX pk
</PRE>
<HR>
</P>
<H2><A NAME="ss4.9">4.9</A> <A HREF="#toc4.9">Reserved words corresponding to the numeric window</A>
</H2>
<P>
<PRE>
reserved word | cat. | range | def. | description
---------------------------------------------------------------------------
root_finder | int | {0,...,6} | 6 | used root finder
d_chain_bisection | int | 0 | 0 | constant
d_chain_regula_falsi | int | 1 | 1 | constant
d_chain_pegasus | int | 2 | 2 | constant
d_chain_illinois | int | 3 | 3 | constant
d_chain_anderson_bjoerck | int | 4 | 4 | constant
d_chain_newton | int | 5 | 5 | constant
bezier_all_roots | int | 6 | 6 | constant
epsilon | double | ]0,1[ | 1e-4 | precision of
| | | | root finder
iterations | int | [1,2000] | 200 | max. number of
| | | | iterations
</PRE>
</P>
<H3>Examples</H3>
<P>
<HR>
<PRE>
root_finder = d_chain_bisection; // Slow, but safe
epsilon = 1.0e-7; // Work very precise
iterations = 80; // max. 80 iterations on each root
</PRE>
<HR>
</P>
<H2><A NAME="ss4.10">4.10</A> <A HREF="#toc4.10">Reserved words corresponding to the curve window</A>
</H2>
<P>
<PRE>
reserved word | type | range | def. | description
---------------------------------------------------------------------------
curve_red | int | {0,...,255} | 255 | \
curve_green | int | {0,...,255} | 255 | > curve color
curve_blue | int | {0,...,255} | 255 | /
curve_width | double | {1,2,...} | 1 | width of curve
curve_gamma | double | ]0,oo[ | 4.0 |
</PRE>
</P>
<H3>Examples</H3>
<P>
<HR>
<PRE>
curve_red =0;
curve_green=255;
curve_blue =0; // make the curve look green
curve_width=6.0; // thick curve
curve_gamma=2.0; // intensity increases slower
</PRE>
<HR>
</P>
</BODY>
</HTML>
|