You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/VPythonDocs/extrusion.html
+18-5Lines changed: 18 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -49,12 +49,25 @@
49
49
<pclass="Normal"><strong>The position of the extrusion</strong> is <strong>ex.pos</strong>: After creating an extrusion named "ex", <strong>ex.pos</strong> is located at the center of the bounding box. Later changes to ex.pos move the center of the extrusion to a new location. If you specify <spanclass="attribute">pos</span> when creating the extrusion, the center of the extrusion will be moved to that location, just as if you changed ex.pos after creating the extrusion.</p>
50
50
<pclass="Normal">After creating an extrusion, changing the axis rotates the combined object. As with some other objects such as sphere or compound, changing the axis does not affect the size.</p>
<pclass="Normal">An extrusion is made out of <ahref="triangle.html">quads</a> and <ahref="triangle.html">triangles</a> which are then made into a <ahref="compound.html"><strong>compound</strong></a> object for speed of display. You can make additional copies of an extrusion by <ahref="clone.html"><strong>cloning</strong></a> it. You can move an extrusion by specifying a new <spanclass="attribute">pos</span>, and you can change its <spanclass="attribute">size</span>, <spanclass="attribute">axis</span>, <spanclass="attribute">up</span>, <spanclass="attribute">color</span>, <spanclass="attribute">opacity</span>, <spanclass="attribute">shininess</span>, and <spanclass="attribute">emissive</span>, as with other objects, but note that color is "multiplicative"; see <ahref="compound.html"><strong>compound</strong></a>.</p>
52
+
<pclass="Normal">An extrusion is made out of <ahref="triangle.html">quads</a> and <ahref="triangle.html">triangles</a> which are then made into a <ahref="compound.html"><strong>compound</strong></a> object for speed of display. You can make additional copies of an extrusion by <ahref="clone.html"><strong>cloning</strong></a> it. You can move an extrusion by specifying a new <spanclass="attribute">pos</span>, and you can change its <spanclass="attribute">size</span>, <spanclass="attribute">axis</span>, <spanclass="attribute">up</span>, <spanclass="attribute">color</span>, <spanclass="attribute">opacity</span>, <spanclass="attribute">shininess</span>, and <spanclass="attribute">emissive</span>, as with other objects. <spanclass="attributes"><spanclass="attribute">up </span><spanclass="attribute"></span> controls the orientation of the initial cross section; default is vec(0,1,0); see the box object for a discussion of this attribute</span>. Note that color is "multiplicative"; see <ahref="compound.html"><strong>compound</strong></a>.</p>
53
53
<pclass="Normal">Here are additional attributes that can be specified when creating an extrusion but cannot be changed later: </p>
54
-
<pclass="attributes"><spanclass="attribute">show_start_face</span> and <spanclass="attribute">show_end_face</span> By default, these attributes are True and the start and end faces are displayed. If you set one of these to False, that face is left open. These attributes have no effect if the path is closed.</p>
55
-
<pclass="attributes"><spanclass="attribute">start_face_color</span> and <spanclass="attribute">end_face_color</span> By default,the starting and ending faces are given the same color as the rest of the extrusion, as specified by <spanclass="attribute">color</span>, but you can specify that other colors be used for the starting or ending face. These attributes have no effect if the path is closed.</p>
56
-
<pclass="attributes"><spanclass="attribute">smooth</span> By default, adjacent normals for which the cosine of the angle between them is greater than 0.95 (corresponding to an angle of 18 degrees) are averaged so as to smooth the adjacent surfaces. You can set <spanclass="attribute">smooth</span> to a looser criterion for more smoothing. For example, setting smooth=0.9 will smooth adjoining surfaces whose orientation differs by 53 degrees, a much looser criterion.</p>
57
-
<pclass="Normal"><strong><fontcolor="#0000a0">The three steps to making an extrusion</font></strong></p>
54
+
<pclass="attributes"><spanclass="attribute">color</span> You can simply say "color=color.red" to make all the segments red, but you can also say "color = [color.red, color.green, color.blue]", in which case the first segment will be red, the second will be green, and the third will be blue. The number of colors must be the same as the number of points on the path, so the example here is for an extrusion with three points along the path. At a smooth turn along the path, the colors just before and after the joint are blended together.</p>
55
+
<pclass="attributes"><spanclass="attribute">scale</span> If scale is 3, all joints are enlarged by a factor of 3. If instead you give a list of numbers, such as "scale = [2, 3, 0.5.]", the initial cross section is scaled by a factor of 2, the second by a factor of 3, and the third by a factor of 0.5. The number of scale factors must be the same as the number of points along the path. </p>
56
+
<pclass="attributes"><spanclass="attribute">xscale</span> If xscale is 3, all joints are enlarged in the x direction by a factor of 3. If instead you give a list of numbers, such as "xscale = [2, 3, 0.5.]", the initial x component of the cross section is scaled by a factor of 2, the second by a factor of 3, and the third by a factor of 0.5. The number of xscale factors must be the same as the number of points along the path. <spanclass="Normal">By default, the starting face of an extrusion is oriented with "up" in the +y direction (unless you specify a different "up" for the extrusion).+x is to the right and +y is up.</span></p>
57
+
<pclass="attributes"><spanclass="attribute">yscale</span> If yscale is 3, all joints are enlarged in the y direction by a factor of 3. If instead you give a list of numbers, such as "yscale = [2, 3, 0.5.]", the initial y component of the cross section is scaled by a factor of 2, the second by a factor of 3, and the third by a factor of 0.5. The number of yscale factors must be the same as the number of points on the path. <spanclass="Normal">By default, the starting face of an extrusion is oriented with "up" in the +y direction (unless you specify a different "up" for the extrusion).+x is to the right and +y is up.</span></p>
58
+
<pclass="attributes"><spanclass="attribute">twist</span> If twist is 0.1 (an angle in radians), each segment of the extrusion is rotated 0.1 radians about the path, with respect to the previous segment. If instead you give a list of numbers, such as "twist = [0.1, 0.3, -0.2]", the initial cross section is rotated counterclockwise by 0.1 radians, the second cross section is rotated counterclockwise by 0.3 radians with respect of the first segment, and the third cross section is rotated clockwise by 0.2 radians with respect of the second segment. The number of twist factors must be the same as the number of points on the path.</p>
59
+
<pclass="attributes"><spanclass="attribute">show_start_face</span> and <spanclass="attribute">show_end_face</span> By default, these attributes are True and the start and end faces are displayed. If you set one of these to False, that face is left open. These attributes have no effect if the path is closed.</p>
60
+
<pclass="attributes"><spanclass="attribute">start_face_color</span> and <spanclass="attribute">end_face_color</span> By default,the starting and ending faces are given the same color as the color specified for the associated segment, but you can specify that other colors be used for the starting or ending face. These attributes have no effect if the path is closed.</p>
61
+
<pclass="attributes"><spanclass="attribute">start_normal</span> and <spanclass="attribute">end_normal</span> By default,the outward-going normals to the starting and ending faces are determined by the direction of the path from the starting point to the next segment on the path, but you can specify different normals for the starting and/or ending faces. These attributes have no effect if the path is closed.</p>
62
+
<pclass="attributes"><spanclass="attribute">smooth</span> By default, adjacent segments for which the cosine of the angle between the two path elements is greater than 0.95 (corresponding to an angle of 18 degrees) are averaged so as to smooth the adjacent surfaces. You can set <spanclass="attribute">smooth</span> to a looser criterion for more smoothing. For example, setting smooth=0.9 will smooth adjoining surfaces whose orientation differs by 53 degrees, a much looser criterion..</p>
63
+
<pclass="attributes"><spanclass="attribute">smooth_joints</span> and <spanclass="attribute">sharp_joints</span> You can override the <spanclass="attribute">smooth</span> specification for specific points along the path. Suppose that all of the joints are "smooth'; that is, the differences in direction from one segment to another are all quite small, but you would like to consider segments 2 and 5 nevertheless to be "sharp", which affects the appearance and color of the joint. In that case you would say "sharp_joints = [2, 5]". Similarly, if there are sharp turns at segments 1 and 7 that you would like to treat as "smooth", you would say "smooth_joints = [1, 7]. As usual with lists, 0 is the first joint and 1 is the second joint. Here is an example of the effect on color, where the upper example shows a fade from blue to orange, and the lower example with an inserted"sharp" joint shows an abupt color change:</p>
<pclass="Normal"><strong><fontcolor="#0000a0">The three steps to making an extrusion</font></strong></p>
58
71
<pclass="Normal"><strong>1)</strong> Create a 2D <spanclass="attribute">shape</span>, either by giving a list of points or by choosing a shape from a supplied library of common shapes. Here are three examples. The first creates a triangle by listing 2D points. The second example creates a circular shape from the <strong><ahref="shapes.html">shapes and paths library</a></strong>, and the third creates a rectangular shape, using the shapes library.</p>
0 commit comments