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
|
<!-- This file copyright Persistence of Vision Raytracer Pty. Ltd. 2003-2004 -->
<html>
<head>
<!-- NOTE: In order to users to help find information about POV-Ray using -->
<!-- web search engines, we ask you to *not* let them index documentation -->
<!-- mirrors because effectively, when searching, users will get hundreds -->
<!-- of results containing the same information! For this reason, the two -->
<!-- meta tags below disable archiving and indexing of this page by all -->
<!-- search engines that support these meta tags. -->
<meta content="noarchive" name="robots">
<meta content="noindex" name="robots">
<meta content="no-cache" http-equiv="Pragma">
<meta content="0" http-equiv="expires">
<title>3.7.12 shapes.inc, shapes_old.inc, shapes2.inc, shapesq.inc</title>
<link href="povray35.css" rel="stylesheet" type="text/css">
</head>
<body>
<table class="NavBar" width="100%">
<tr>
<td align="left" nowrap="" valign="middle" width="32">
<a href="s_142.html"><img alt="previous" border="0" src="prev.png"></a>
</td>
<td align="left" valign="middle" width="30%">
<a href="s_142.html">3.7.11 rand.inc</a>
</td>
<td align="center" valign="middle">
<strong class="NavBar">POV-Ray 3.6 for UNIX documentation</strong><br> <strong>3.7.12
shapes.inc, shapes_old.inc, shapes2.inc, shapesq.inc</strong>
</td>
<td align="right" valign="middle" width="30%">
<a href="s_144.html">3.7.13 skies.inc, stars.inc</a>
</td>
<td align="right" nowrap="" valign="middle" width="32">
<a href="s_144.html"><img alt="next" border="0" src="next.png"></a>
</td>
</tr>
</table>
<h3><a name="s03_07_12">3.7.12 </a>shapes.inc, shapes_old.inc, shapes2.inc, shapesq.inc</h3>
<p>
These files contain predefined shapes and shape-generation macros.
</p>
<p>
"shapes.inc" includes "shapes_old.inc" and contains many macros for working with objects, and
for creating special objects, such as bevelled text, spherical height fields, and rounded shapes.
</p>
<p>
Many of the objects in "shapes_old.inc" are not very useful in the newer versions of POV-Ray, and are
kept for backwards compatability with old scenes written for versions of POV-Ray that lacked primitives like cones,
disks, planes, etc.
</p>
<p>
The file "shapes2.inc" contains some more useful shapes, including regular polyhedrons, and
"shapesq.inc" contains several quartic and cubic shape definitions.
</p>
<p>
Some of the shapes in "shapesq.inc" would be much easier to generate, more flexible, and possibly faster
rendering as isosurfaces, but are still useful for two reasons: backwards compatability, and the fact that isosurfaces
are always finite.
</p>
<h4><a name="s03_07_12_01">3.7.12.1 </a>shapes.inc</h4>
<a name="s03_07_12_01_i1"><a name="Isect"></a>
<p>
<code>Isect(Pt, Dir, Obj, OPt)</code> and <code>IsectN(Pt, Dir, Obj, OPt, ONorm)</code><br> These macros are
interfaces to the trace() function. Isect() only returns the intersection point, IsectN() returns the surface normal
as well. These macros return the point and normal information through their parameters, and true or false depending on
whether an intersection was found:<br> If an intersection is found, they return true and set OPt to the intersection
point, and ONorm to the normal. Otherwise they return false, and do not modify OPt or ONorm.<br> Parameters:
</p>
<ul>
<li>
<code>Pt</code> = The origin (starting point) of the ray.
</li>
<li>
<code>Dir</code> = The direction of the ray.
</li>
<li>
<code>Obj</code> = The object to test for intersection with.
</li>
<li>
<code>OPt</code> = A declared variable, the macro will set this to the intersection point.
</li>
<li>
<code>ONorm</code> = A declared variable, the macro will set this to the surface normal at the intersection
point.
</li>
</ul>
<a name="s03_07_12_01_i2"><a name="Extents"></a>
<p>
<code>Extents(Obj, Min, Max)</code>. This macro is a shortcut for calling both min_extent() and max_extent() to get
the corners of the bounding box of an object. It returns these values through the Min and Max parameters.<br>
Parameters:
</p>
<ul>
<li>
<code>Obj</code> = The object you are getting the extents of.
</li>
<li>
<code>Min</code> = A declared variable, the macro will set this to the min_extent of the object.
</li>
<li>
<code>Max</code> = A declared variable, the macro will set this to the max_extent of the object.
</li>
</ul>
<a name="s03_07_12_01_i3"><a name="Center_Object"></a>
<p>
<code>Center_Object(Object, Axis)</code>. A shortcut for using the Center_Trans() macro with an object.<br>
Parameters:
</p>
<ul>
<li>
<code>Object</code> = The object to be centered.
</li>
<li>
<code>Axis</code> = See Center_Trans() in the transforms.inc documentation.
</li>
</ul>
<a name="s03_07_12_01_i4"><a name="Align_Object"></a>
<p>
<code>Align_Object(Object, Axis, Pt)</code>. A shortcut for using the <a href="s_149.html#s03_07_18">Align_Trans()</a>
macro with an object.<br> Parameters:
</p>
<ul>
<li>
<code>Object</code> = The object to be aligned.
</li>
<li>
<code>Axis</code> = See Align_Trans() in the transforms.inc documentation.
</li>
<li>
<code>Point</code> = The point to which to align the bounding box of the object.
</li>
</ul>
<a name="s03_07_12_01_i5"><a name="Bevelled_Text"></a>
<p>
<code>Bevelled_Text(Font, String, Cuts, BevelAng, BevelDepth, Depth, Offset, UseMerge)</code>. This macro attempts
to "bevel" the front edges of a text object. It accomplishes this by making an intersection of multiple
copies of the text object, each sheared in a different direction. The results are no perfect, but may be entirely
acceptable for some purposes. Warning: the object generated may render considerably more slowly than an ordinary text
object.<br> Parameters:
</p>
<ul>
<li>
<code>Font</code> = A string specifying the font to use.
</li>
<li>
<code>String</code> = The text string the object is generated from.
</li>
<li>
<code>Cuts</code> = The number of intersections to use in bevelling the text. More cuts give smoother results,
but take more memory and are slower rendering.
</li>
<li>
<code>BevelAng</code> = The angle of the bevelled edge.
</li>
<li>
<code>BevelDepth</code> = The thickness of the bevelled portion.
</li>
<li>
<code>Depth</code> = The total thickness of the resulting text object.
</li>
<li>
<code>Offset</code> = The offset parameter for the text object. The z value of this vector will be ignored,
because the front faces of all the letters need to be coplanar for the bevelling to work.
</li>
<li>
<code>UseMerge</code> = Switch between merge (1) and union (0).
</li>
</ul>
<a name="s03_07_12_01_i6"><a name="Text_Space"></a>
<p>
<code>Text_Space(Font, String, Size, Spacing)</code>. Computes the width of a text string, including "white
space", it returns the advance widths of all n letters. Text_Space gives the space a text, or a glyph, occupies
in regard to its surroundings.<br> Parameters:
</p>
<ul>
<li>
<code>Font</code> = A string specifying the font to use.
</li>
<li>
<code>String</code> = The text string the object is generated from.
</li>
<li>
<code>Size</code> = A scaling value.
</li>
<li>
<code>Spacing</code> = The amount of space to add between the characters.
</li>
</ul>
<a name="s03_07_12_01_i7"><a name="Text_Width"></a>
<p>
<code>Text_Width(Font, String, Size, Spacing)</code>. Computes the width of a text string, it returns the advance
widths of the first n-1 letters, plus the glyph width of the last letter. Text_Width gives the "physical"
width of the text and if you use only one letter the "fysical" width of one glyph. <br> Parameters:
</p>
<ul>
<li>
<code>Font</code> = A string specifying the font to use.
</li>
<li>
<code>String</code> = The text string the object is generated from.
</li>
<li>
<code>Size</code> = A scaling value.
</li>
<li>
<code>Spacing</code> = The amount of space to add between the characters.
</li>
</ul>
<p>
<code>Align_Left, Align_Right, Align_Center</code>. These constants are used by the <code>Circle_Text()</code>
macro. <a name="s03_07_12_01_i8"><a name="Circle_Text"></a>
</p>
<p>
<code>Circle_Text(Font, String, Size, Spacing, Depth, Radius, Inverted, Justification, Angle)</code>. Creates a
text object with the bottom (or top) of the character cells aligned with all or part of a circle. This macro should be
used inside an <code>object{...}</code> block.<br> Parameters:
</p>
<ul>
<li>
<code>Font</code> = A string specifying the font to use.
</li>
<li>
<code>String</code> = The text string the object is generated from.
</li>
<li>
<code>Size</code> = A scaling value.
</li>
<li>
<code>Spacing</code> = The amount of space to add between the characters.
</li>
<li>
<code>Depth</code> = The thickness of the text object.
</li>
<li>
<code>Radius</code> = The radius of the circle the letters are aligned to.
</li>
<li>
<code>Inverted</code> = Controls what part of the text faces "outside". If this parameter is nonzero,
the tops of the letters will point toward the center of the circle. Otherwise, the bottoms of the letters will do so.
</li>
<li>
<code>Justification</code> = Align_Left, Align_Right, or Align_Center.
</li>
<li>
<code>Angle</code> = The point on the circle from which rendering will begin. The +x direction is 0 and the +y
direction is 90 (i.e. the angle increases anti-clockwise).
</li>
</ul>
<a name="s03_07_12_01_i9"><a name="Wedge"></a>
<p>
<code>Wedge(Angle)</code>. This macro creates an infinite wedge shape, an intersection of two planes. It is mainly
useful in CSG, for example to obtain a specific arc of a torus. The edge of the wedge is positioned along the y axis,
and one side is fixed to the zy plane, the other side rotates clockwise around the y axis.<br> Parameters:
</p>
<ul>
<li>
<code>Angle</code> = The angle, in degrees, between the sides of the wedge shape.
</li>
</ul>
<a name="s03_07_12_01_i10"><a name="Spheroid"></a>
<p>
<code>Spheroid(Center, Radius)</code>. This macro creates an unevenly scaled sphere. Radius is a vector where each
component is the radius along that axis.<br> Parameters:
</p>
<ul>
<li>
<code>Center</code> = Center of the spheroid.
</li>
<li>
<code>Radius</code> = A vector specifying the radii of the spheroid.
</li>
</ul>
<a name="s03_07_12_01_i11"><a name="Supertorus"></a>
<p>
<code>Supertorus(MajorRadius, MinorRadius, MajorControl, MinorControl, Accuracy, MaxGradient)</code>. This macro
creates an isosurface of the torus equivalent of a superellipsoid. If you specify a MaxGradient of less than 1,
evaluate will be used. You will have to adjust MaxGradient to fit the parameters you choose, a squarer supertorus will
have a higher gradient. You may want to use the function alone in your own isosurface.<br> Parameters:
</p>
<ul>
<li>
<code>MajorRadius, MinorRadius</code> = Base radii for the torus.
</li>
<li>
<code>MajorControl, MinorControl</code> = Controls for the roundness of the supertorus. Use numbers in the range
[0, 1].
</li>
<li>
<code>Accuracy</code> = The accuracy parameter.
</li>
<li>
<code>MaxGradient</code> = The max_gradient parameter.
</li>
</ul>
<a name="s03_07_12_01_i12"><a name="Supercone"></a>
<p>
<code>Supercone(EndA, A, B, EndB, C, D)</code>. This macro creates an object similar to a cone, but where the end
points are ellipses. The actual object is an intersection of a quartic with a cylinder.<br> Parameters:
</p>
<ul>
<li>
<code>EndA</code> = Center of end A.
</li>
<li>
<code>A, B</code> = Controls for the radii of end A.
</li>
<li>
<code>EndB</code> = Center of end B.
</li>
<li>
<code>C, D</code> = Controls for the radii of end B.
</li>
</ul>
<a name="s03_07_12_01_i13"><a name="Connect_Spheres"></a>
<p>
<code>Connect_Spheres(PtA, RadiusA, PtB, RadiusB)</code>. This macro creates a cone that will smoothly join two
spheres. It creates only the cone object, however, you will have to supply the spheres yourself or use the
Round_Cone2() macro instead.<br> Parameters:
</p>
<ul>
<li>
<code>PtA</code> = Center of sphere A.
</li>
<li>
<code>RadiusA</code> = Radius of sphere A.
</li>
<li>
<code>PtB</code> = Center of sphere B.
</li>
<li>
<code>RadiusB</code> = Radius of sphere B.
</li>
</ul>
<a name="s03_07_12_01_i14"><a name="Wire_Box_Union"></a>
<p>
<code>Wire_Box_Union(PtA, PtB, Radius),<br> Wire_Box_Merge(PtA, PtB, Radius),<br> Wire_Box(PtA, PtB, Radius,
UseMerge)</code>. Creates a wire-frame box from cylinders and spheres. The resulting object will fit entirely within a
box object with the same corner points.<br> Parameters:
</p>
<ul>
<li>
<code>PtA</code> = Lower-left-front corner of box.
</li>
<li>
<code>PtB</code> = Upper-right-back corner of box.
</li>
<li>
<code>Radius</code> = The radius of the cylinders and spheres composing the object.
</li>
<li>
<code>UseMerge</code> = Whether or not to use a merge.
</li>
</ul>
<a name="s03_07_12_01_i15"><a name="Round_Box_Union"></a>
<p>
<code>Round_Box_Union(PtA, PtB, EdgeRadius),<br> Round_Box_Merge(PtA, PtB, EdgeRadius),<br> Round_Box(PtA, PtB,
EdgeRadius, UseMerge)</code>. Creates a box with rounded edges from boxes, cylinders and spheres. The resulting object
will fit entirely within a box object with the same corner points. The result is slightly different from a
superellipsoid, which has no truely flat areas.<br> Parameters:
</p>
<ul>
<li>
<code>PtA</code> = Lower-left-front corner of box.
</li>
<li>
<code>PtB</code> = Upper-right-back corner of box.
</li>
<li>
<code>EdgeRadius</code> = The radius of the edges of the box.
</li>
<li>
<code>UseMerge</code> = Whether or not to use a merge.
</li>
</ul>
<a name="s03_07_12_01_i16"><a name="Round_Cylinder_Union"></a>
<p>
<code>Round_Cylinder_Union(PtA, PtB, Radius, EdgeRadius),<br> Round_Cylinder_Merge(PtA, PtB, Radius, EdgeRadius),<br>
Round_Cylinder(PtA, PtB, Radius, EdgeRadius, UseMerge)</code>. Creates a cylinder with rounded edges from cylinders
and tori. The resulting object will fit entirely within a cylinder object with the same end points and radius. The
result is slightly different from a superellipsoid, which has no truely flat areas.<br> Parameters:
</p>
<ul>
<li>
<code>PtA, PtB</code> = The end points of the cylinder.
</li>
<li>
<code>Radius</code> = The radius of the cylinder.
</li>
<li>
<code>EdgeRadius</code> = The radius of the edges of the cylinder.
</li>
<li>
<code>UseMerge</code> = Whether or not to use a merge.
</li>
</ul>
<a name="s03_07_12_01_i17"><a name="Round_Cone_Union"></a>
<p>
<code>Round_Cone_Union(PtA, RadiusA, PtB, RadiusB, EdgeRadius),<br> Round_Cone_Merge(PtA, RadiusA, PtB, RadiusB,
EdgeRadius),<br> Round_Cone(PtA, RadiusA, PtB, RadiusB, EdgeRadius, UseMerge)</code> Creates a cone with rounded edges
from cones and tori. The resulting object will fit entirely within a cone object with the same end points and radii.<br>
Parameters:
</p>
<ul>
<li>
<code>PtA, PtB</code> = The end points of the cone.
</li>
<li>
<code>RadiusA, RadiusB</code> = The radii of the cone.
</li>
<li>
<code>EdgeRadius</code> = The radius of the edges of the cone.
</li>
<li>
<code>UseMerge</code> = Whether or not to use a merge.
</li>
</ul>
<a name="s03_07_12_01_i18"><a name="Round_Cone2_Union"></a>
<p>
<code>Round_Cone2_Union(PtA, RadiusA, PtB, RadiusB),<br> Round_Cone2_Merge(PtA, RadiusA, PtB, RadiusB),<br>
Round_Cone2(PtA, RadiusA, PtB, RadiusB, UseMerge)</code>. Creates a cone with rounded edges from a cone and two
spheres. The resulting object will not fit entirely within a cone object with the same end points and radii because of
the spherical caps. The end points are not used for the conical portion, but for the spheres, a suitable cone is then
generated to smoothly join them.<br> Parameters:
</p>
<ul>
<li>
<code>PtA, PtB</code> = The centers of the sphere caps.
</li>
<li>
<code>RadiusA, RadiusB</code> = The radii of the sphere caps.
</li>
<li>
<code>UseMerge</code> = Whether or not to use a merge.
</li>
</ul>
<a name="s03_07_12_01_i19"><a name="Round_Cone3_Union"></a>
<p>
<code>Round_Cone3_Union(PtA, RadiusA, PtB, RadiusB),<br> Round_Cone3_Merge(PtA, RadiusA, PtB, RadiusB)<br>
Round_Cone3(PtA, RadiusA, PtB, RadiusB, UseMerge)</code>. Like Round_Cone2(), this creates a cone with rounded edges
from a cone and two spheres, and the resulting object will not fit entirely within a cone object with the same end
points and radii because of the spherical caps. The difference is that this macro takes the end points of the conical
portion and moves the spheres to be flush with the surface, instead of putting the spheres at the end points and
generating a cone to join them.<br> Parameters:
</p>
<ul>
<li>
<code>PtA, PtB</code> = The end points of the cone.
</li>
<li>
<code>RadiusA, RadiusB</code> = The radii of the cone.
</li>
<li>
<code>UseMerge</code> = Whether or not to use a merge.
</li>
</ul>
<a name="s03_07_12_01_i20"><a name="Quad"></a>
<p>
<code>Quad(A, B, C, D)</code> and <code>Smooth_Quad(A, NA, B, NB, C, NC, D, ND)</code>. These macros create
"quads", 4-sided polygonal objects, using triangle pairs.<br> Parameters:
</p>
<ul>
<li>
<code>A, B, C, D</code> = Vertices of the quad.
</li>
<li>
<code>NA, NB, NC, ND</code> = Vertex normals of the quad.
</li>
</ul>
<h5><a name="s03_07_12_01_01">3.7.12.1.1 </a>The HF Macros</h5>
<p>
There are several HF macros in shapes.inc, which generate meshes in various shapes. All the HF macros have these
things in common:
</p>
<ul>
<li>
The HF macros do not directly use an image for input, but evaluate a user-defined function. The macros deform the
surface based on the function values.
</li>
<li>
The macros can either write to a file to be included later, or create an object directly. If you want to output
to a file, simply specify a filename. If you want to create an object directly, specify "" as the file name
(an empty string).
</li>
<li>
The function values used for the heights will be taken from the square that goes from <0,0,0> to
<1,1,0> if UV height mapping is on. Otherwise the function values will be taken from the points where the
surface is (before the deformation).
</li>
<li>
The texture you apply to the shape will be evaluated in the square that goes from <0,0,0> to <1,1,0>
if UV texture mapping is on. Otherwise the texture is evaluated at the points where the surface is (after the
deformation.
</li>
</ul>
<p>
The usage of the different HF macros is described below.<a name="s03_07_12_01_01_i1"><a name="HF_Square"></a>
</p>
<p>
<code>HF_Square (Function, UseUVheight, UseUVtexture, Res, Smooth, FileName, MnExt, MxExt)</code>. This macro
generates a mesh in the form of a square height field, similar to the built-in height_field primitive. Also see the
general description of the HF macros above.<br> Parameters:
</p>
<ul>
<li>
<code>Function</code> = The function to use for deforming the height field.
</li>
<li>
<code>UseUVheight</code> = A boolean value telling the macro whether or not to use UV height mapping.
</li>
<li>
<code>UseUVtexture</code> = A boolean value telling the macro whether or not to use UV texture mapping.
</li>
<li>
<code>Res</code> = A 2D vector specifying the resolution of the generated mesh.
</li>
<li>
<code>Smooth</code> = A boolean value telling the macro whether or not to smooth the generated mesh.
</li>
<li>
<code>FileName</code> = The name of the output file.
</li>
<li>
<code>MnExt</code> = Lower-left-front corner of a box containing the height field.
</li>
<li>
<code>MxExt</code> = Upper-right-back corner of a box containing the height field.
</li>
</ul>
<a name="s03_07_12_01_01_i2"><a name="HF_Sphere"></a>
<p>
<code>HF_Sphere(Function, UseUVheight, UseUVtexture, Res, Smooth, FileName, Center, Radius, Depth)</code>. This
macro generates a mesh in the form of a spherical height field. When UV-mapping is used, the UV square will be wrapped
around the sphere starting at +x and going anti-clockwise around the y axis. Also see the general description of the
HF macros above. Parameters:
</p>
<ul>
<li>
<code>Function</code> = The function to use for deforming the height field.
</li>
<li>
<code>UseUVheight</code> = A boolean value telling the macro whether or not to use UV height mapping.
</li>
<li>
<code>UseUVtexture</code> = A boolean value telling the macro whether or not to use UV texture mapping.
</li>
<li>
<code>Res</code> = A 2D vector specifying the resolution of the generated mesh.
</li>
<li>
<code>Smooth</code> = A boolean value telling the macro whether or not to smooth the generated mesh.
</li>
<li>
<code>FileName</code> = The name of the output file.
</li>
<li>
<code>Center</code> = The center of the height field before being displaced, the displacement can, and most
likely will, make the object off-center.
</li>
<li>
<code>Radius</code> = The starting radius of the sphere, before being displaced.
</li>
<li>
<code>Depth</code> = The depth of the height field.
</li>
</ul>
<a name="s03_07_12_01_01_i3"><a name="HF_Cylinder"></a>
<p>
<code>HF_Cylinder(Function, UseUVheight, UseUVtexture, Res, Smooth, FileName, EndA, EndB, Radius,Depth)</code>.
This macro generates a mesh in the form of an open-ended cylindrical height field. When UV-mapping is used, the UV
square will be wrapped around the cylinder. Also see the general description of the HF macros above.<br> Parameters:
</p>
<ul>
<li>
<code>Function</code> = The function to use for deforming the height field.
</li>
<li>
<code>UseUVheight</code> = A boolean value telling the macro whether or not to use UV height mapping.
</li>
<li>
<code>UseUVtexture</code> = A boolean value telling the macro whether or not to use UV texture mapping.
</li>
<li>
<code>Res</code> = A 2D vector specifying the resolution of the generated mesh.
</li>
<li>
<code>Smooth</code> = A boolean value telling the macro whether or not to smooth the generated mesh.
</li>
<li>
<code>FileName</code> = The name of the output file.
</li>
<li>
<code>EndA, EndB</code> = The end points of the cylinder.
</li>
<li>
<code>Radius</code> = The (pre-displacement) radius of the cylinder.
</li>
<li>
<code>Depth</code> = The depth of the height field.
</li>
</ul>
<a name="s03_07_12_01_01_i4"><a name="HF_Torus"></a>
<p>
<code>HF_Torus (Function, UseUVheight, UseUVtexture, Res, Smooth, FileName, Major, Minor, Depth)</code>. This macro
generates a mesh in the form of a torus-shaped height field. When UV-mapping is used, the UV square is wrapped around
similar to spherical or cylindrical mapping. However the top and bottom edges of the map wrap over and under the torus
where they meet each other on the inner rim. Also see the general description of the HF macros above.<br> Parameters:
</p>
<ul>
<li>
<code>Function</code> = The function to use for deforming the height field.
</li>
<li>
<code>UseUVheight</code> = A boolean value telling the macro whether or not to use UV height mapping.
</li>
<li>
<code>UseUVtexture</code> = A boolean value telling the macro whether or not to use UV texture mapping.
</li>
<li>
<code>Res</code> = A 2D vector specifying the resolution of the generated mesh.
</li>
<li>
<code>Smooth</code> = A boolean value telling the macro whether or not to smooth the generated mesh.
</li>
<li>
<code>FileName</code> = The name of the output file.
</li>
<li>
<code>Major</code> = The major radius of the torus.
</li>
<li>
<code>Minor</code> = The minor radius of the torus.
</li>
</ul>
<h4><a name="s03_07_12_02">3.7.12.2 </a>shapes_old.inc</h4>
<dl>
<dt>
<code>Ellipsoid, Sphere</code>
<dd>
Unit-radius sphere at the origin.
<dt>
<code>Cylinder_X, Cylinder_Y, Cylinder_Z</code>
<dd>
Infinite cylinders.
<dt>
<code>QCone_X, QCone_Y, QCone_Z</code>
<dd>
Infinite cones.
<dt>
<code>Cone_X, Cone_Y, Cone_Z</code>
<dd>
Closed capped cones: unit-radius at -1 and 0 radius at +1 along each axis.
<dt>
<code>Plane_YZ, Plane_XZ, Plane_XY</code>
<dd>
Infinite planes passing through the origin.
<dt>
<code>Paraboloid_X, Paraboloid_Y, Paraboloid_Z</code>
<dd>
y^2 + z^2 - x = 0
<dt>
<code>Hyperboloid, Hyperboloid_Y</code>
<dd>
y - x^2 + z^2 = 0
<dt>
<code>UnitBox, Cube</code>
<dd>
A cube 2 units on each side, centered on the origin.
<dt>
<code>Disk_X, Disk_Y, Disk_Z</code>
<dd>
"Capped" cylinders, with a radius of 1 unit and a length of 2 units, centered on the origin.
</dl>
<h4><a name="s03_07_12_03">3.7.12.3 </a>shapes2.inc</h4>
<dl>
<dt>
<code>Tetrahedron</code>
<dd>
4-sided regular polyhedron.
<dt>
<code>Octahedron</code>
<dd>
8-sided regular polyhedron.
<dt>
<code>Dodecahedron</code>
<dd>
12-sided regular polyhedron.
<dt>
<code>Icosahedron</code>
<dd>
20-sided regular polyhedron.
<dt>
<code>Rhomboid</code>
<dd>
Three dimensional 4-sided diamond, basically a sheared box.
<dt>
<code>Hexagon</code>
<dd>
6-sided regular polygonal solid, axis along x.
<dt>
<code>HalfCone_Y</code>
<dd>
Convenient finite cone primitive, pointing up in the Y axis.
<dt>
<code>Pyramid</code>
<dd>
4-sided pyramid (union of triangles, can not be used in CSG).
<dt>
<code>Pyramid2</code>
<dd>
4-sided pyramid (intersection of planes, can be used in CSG).
<dt>
<code>Square_X, Square_Y, Square_Z</code>
<dd>
Finite planes stretching 1 unit along each axis. In other words, 2X2 unit squares.
</dl>
<h4><a name="s03_07_12_04">3.7.12.4 </a>shapesq.inc</h4>
<dl>
<dt>
<code>Bicorn</code>
<dd>
This curve looks like the top part of a paraboloid, bounded from below by another paraboloid. The basic equation
is:
<dd>
y^2 - (x^2 + z^2) y^2 - (x^2 + z^2 + 2 y - 1)^2 =
<dt>
<code>Crossed_Trough</code>
<dd>
This is a surface with four pieces that sweep up from the x-z plane.
<dd>
The equation is: y = x^2 z^2
<dt>
<code>Cubic_Cylinder</code>
<dd>
A drop coming out of water? This is a curve formed by using the equation:
<dd>
y = 1/2 x^2 (x + 1)
<dd>
as the radius of a cylinder having the x-axis as its central axis. The final form of the equation is:
<dd>
y^2 + z^2 = 0.5 (x^3 + x^2)
<dt>
<code>Cubic_Saddle_1</code>
<dd>
A cubic saddle. The equation is: z = x^3 - y^3
<dt>
<code>Devils_Curve</code>
<dd>
Variant of a devil's curve in 3-space. This figure has a top and bottom part that are very similar to a
hyperboloid of one sheet, however the central region is pinched in the middle leaving two teardrop shaped holes. The
equation is:
<dd>
x^4 + 2 x^2 z^2 - 0.36 x^2 - y^4 + 0.25 y^2 + z^4 = 0
<dt>
<code>Folium</code>
<dd>
This is a folium rotated about the x-axis. The formula is:
<dd>
2 x^2 - 3 x y^2 - 3 x z^2 + y^2 + z^2 = 0
<dt>
<code>Glob_5</code>
<dd>
Glob - sort of like basic teardrop shape. The equation is:
<dd>
y^2 + z^2 = 0.5 x^5 + 0.5 x^4
<dt>
<code>Twin_Glob</code>
<dd>
Variant of a lemniscate - the two lobes are much more teardrop-like.
<dt>
<code>Helix, Helix_1</code>
<dd>
Approximation to the helix z = arctan(y/x). The helix can be approximated with an algebraic equation (kept to the
range of a quartic) with the following steps:
<dd>
tan(z) = y/x => sin(z)/cos(z) = y/x =><br> (1) x sin(z) - y cos(z) = 0 Using the taylor expansions for sin,
cos about z = 0,<br> sin(z) = z - z^3/3! + z^5/5! - ...<br> cos(z) = 1 - z^2/2! + z^6/6! - ...<br> Throwing out the
high order terms, the expression (1) can be written as:<br> x (z - z^3/6) - y (1 + z^2/2) = 0, or<br><br> (2) -1/6 x
z^3 + x z + 1/2 y z^2 - y = 0<br> This helix (2) turns 90 degrees in the range 0 <= z <= sqrt(2)/2. By using
scale <2 2 2>, the helix defined below turns 90 degrees in the range 0 <= z <= sqrt(2) = 1.4042.
<dt>
<code>Hyperbolic_Torus</code>
<dd>
Hyperbolic Torus having major radius sqrt(40), minor radius sqrt(12). This figure is generated by sweeping a
circle along the arms of a hyperbola. The equation is:
<dd>
x^4 + 2 x^2 y^2 - 2 x^2 z^2 - 104 x^2 + y^4 - 2 y^2 z^2 + 56 y^2 + z^4 + 104 z^2 + 784 = 0
<dt>
<code>Lemniscate</code>
<dd>
Lemniscate of Gerono. This figure looks like two teardrops with their pointed ends connected. It is formed by
rotating the Lemniscate of Gerono about the x-axis. The formula is:
<dd>
x^4 - x^2 + y^2 + z^2 = 0
<dt>
<code>Quartic_Loop_1</code>
<dd>
This is a figure with a bumpy sheet on one side and something that looks like a paraboloid (but with an internal
bubble). The formula is:
<dd>
(x^2 + y^2 + a c x)^2 - (x^2 + y^2)(c - a x)^2
<dd>
-99*x^4+40*x^3-98*x^2*y^2-98*x^2*z^2+99*x^2+40*x*y^2
<dd>
+40*x*z^2+y^4+2*y^2*z^2-y^2+z^4-z^2
<dt>
<code>Monkey_Saddle</code>
<dd>
This surface has three parts that sweep up and three down. This gives a saddle that has a place for two legs and
a tail... The equation is:
<dd>
<code>z = c (x^3 - 3 x y^2)</code>
<dd>
The value c gives a vertical scale to the surface - the smaller the value of c, the flatter the surface will be
(near the origin).
<dt>
<code>Parabolic_Torus_40_12</code>
<dd>
Parabolic Torus having major radius sqrt(40), minor radius sqrt(12). This figure is generated by sweeping a
circle along the arms of a parabola. The equation is:
<dd>
x^4 + 2 x^2 y^2 - 2 x^2 z - 104 x^2 + y^4 - 2 y^2 z + 56 y^2 + z^2 + 104 z + 784 = 0
<dt>
<code>Piriform</code>
<dd>
This figure looks like a hersheys kiss. It is formed by sweeping a Piriform about the x-axis. A basic form of the
equation is:
<dd>
(x^4 - x^3) + y^2 + z^2 = 0.
<dt>
<code>Quartic_Paraboloid</code>
<dd>
Quartic parabola - a 4th degree polynomial (has two bumps at the bottom) that has been swept around the z axis.
The equation is:
<dd>
0.1 x^4 - x^2 - y^2 - z^2 + 0.9 = 0
<dt>
<code>Quartic_Cylinder</code>
<dd>
Quartic Cylinder - a Space Needle?
<dt>
<code>Steiner_Surface</code>
<dd>
Steiners quartic surface
<dt>
<code>Torus_40_12</code>
<dd>
Torus having major radius sqrt(40), minor radius sqrt(12).
<dt>
<code>Witch_Hat</code>
<dd>
Witch of Agnesi.
<dt>
<code>Sinsurf</code>
<dd>
Very rough approximation to the sin-wave surface z = sin(2 pi x y).
<dd>
In order to get an approximation good to 7 decimals at a distance of 1 from the origin would require a polynomial
of degree around 60, which would require around 200,000 coefficients. For best results, scale by something like <1
1 0.2>.
</dl>
<br>
<table class="NavBar" width="100%">
<tr>
<td align="left" nowrap="" valign="middle" width="32">
<a href="s_142.html"><img alt="previous" border="0" src="prev.png"></a>
</td>
<td align="left" valign="middle" width="30%">
<a href="s_142.html">3.7.11 rand.inc</a>
</td>
<td align="center" valign="middle">
<strong>3.7.12 shapes.inc, shapes_old.inc, shapes2.inc, shapesq.inc</strong>
</td>
<td align="right" valign="middle" width="30%">
<a href="s_144.html">3.7.13 skies.inc, stars.inc</a>
</td>
<td align="right" nowrap="" valign="middle" width="32">
<a href="s_144.html"><img alt="next" border="0" src="next.png"></a>
</td>
</tr>
</table>
</body> </html>
|