-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy patharrow.html
More file actions
107 lines (103 loc) · 7.54 KB
/
Copy patharrow.html
File metadata and controls
107 lines (103 loc) · 7.54 KB
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/template.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>arrow</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<link href="VisualRef.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style1 {font-size: x-large}
-->
</style>
<style type="text/css">
<!--
.style2 {font-size: xx-large}
-->
</style>
<!-- InstanceEndEditable -->
<link href="VisualRef.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="230" height="30" border="0">
<tr>
<td width="66"><a name="top" id="top"></a><a href="index.html"><strong>Home</strong></a></td>
<td width="154"><span class="Normal"><a href="primitives.html"><strong>Pictures</strong></a> of 3D objects</span></td>
</tr>
</table>
<table width="438" height="30" border="0">
<tr>
<td width="151"><select id="menu1" onchange="jumpMenu(this)">
</select></td>
<td width="163"><select id="menu2" onchange="jumpMenu(this)">
</select></td>
<td width="110"><select id="menu3" onchange="jumpMenu(this)">
</select></td>
</tr>
</table>
<table width="454" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutDefaultTable-->
<tr>
<td width="454" rowspan="2" valign="top"><!-- InstanceBeginEditable name="content" -->
<table width="99%" border="1">
<tr>
<td width="76%"><div align="center"><span class="style1 style2"><font color="#0000A0">arrow</font></span></div></td>
<td width="24%"><img src="images/arrow.jpg" alt="arrow" width="130" height="127" /></td>
</tr>
</table>
<div></div>
<div>
<p class="Normal"> <img src="images/arrow_info.jpg" alt="arrow" width="263" height="152" align="right" /> The arrow object has a straight box-shaped shaft with an arrowhead at one end. The following statement will display an arrow pointing parallel to the x axis, 5 units long:</p>
<div>
<p class="program"> <br />
pointer = arrow( pos=vec(0,2,1),<br />
shaftwidth=1,<br />
axis_and_length=vec(5,0,0) )</p>
<p class="Normal"> The arrow object has the following attributes and
default values, similar to those for <a href="cylinder.html">cylinder</a>: <span class="attribute">pos<font color="#000000"> vec(0,0,0), </font><font color="#FF0000">axis_and_length</font> </span><font color="#000000">vec(1,0,0), </font><span class="attribute">color<font color="#000000"> vec(1,1,1)
which is color.white</font></span>, <span class="attribute">opacity</span> (1)<span class="attribute"><font color="#000000">,</font></span><font color="#000000"> <span class="attribute">shininess</span> (0<span class="attribute">.</span>6), <span class="attribute">emissive</span> (False), <span class="attribute">up<font color="#000000"> vec(0,1,0)</font></span></font>, and <span class="attribute">visible</span> (True).
As with <a href="box.html">box</a>, the <span class="attribute">up</span> attribute
is significant for arrow because the shaft and head have square
cross sections, and setting the <span class="attribute">up</span> attribute
rotates the arrow about its axis.</p>
<p class="Normal"><strong>axis_and_length:</strong> Due to its typical uses for quantitative displays of vector quantities, the arrow object differs from the other 3D objects. There is no size attribute; the lateral dimensions are determined by <span class="attribute">shaftwidth</span>. The attribute <font color="#FF0000">axis_and_length</font> is used to specify simultaneously the direction and the length of the arrow object. For example, pointer.axis_and_length = vec(3,4,0) yields an arrow pointing in the direction of vec(3,4,0) with a length that is 5, the magnitude of this vector.</p>
<p class="Normal">Additional arrow attributes:</p>
<p class="attributes"> <span class="attribute">shaftwidth</span> By default, shaftwidth
= 0.1*(length of arrow)</p>
<p class="attributes"> <span class="attribute">headwidth</span> By default, headwidth
= 2*shaftwidth</p>
<p class="attributes"> <span class="attribute">headlength</span> By default, headlength
= 3*shaftwidth</p>
<p class="Normal"> Assigning <span class="attribute">shaftwidth = 0</span> makes it be the default (0.1 times the length of the arrow). If you don't explicitly set <span class="attribute">headwidth</span> or <span class="attribute">headlength</span>, its length is based as shown above on <span class="attribute">shaftwidth</span> (either the default or whatever value you specify for <span class="attribute">shaftwidth</span>). If <span class="attribute">headlength</span> becomes larger than half the length of the arrow, or the shaft becomes thinner
than 1/50 the length, the entire arrow is scaled accordingly.</p>
<p class="Normal">If you specifically specify <span class="attribute">shaftwidth</span> yourself, the only adjustment that is made is that <span class="attribute">headlength</span> is
adjusted so that it never gets longer than half the total length,
so that the total length of the arrow is correct. This means that
very short, thick arrows look similar to a thumbtack, with a nearly
flat head. </p>
<p class="Normal"><strong>No texture:</strong> Currently it is not possible to apply a texture to an arrow. </p>
<p class="Normal"> <strong>End vs center:</strong> The <span class="attribute">pos</span> attribute
for arrow, cone, cylinder, helix, and pyramid corresponds to one end of the object,
whereas for a box, ring, or sphere it corresponds to the center of the object. </p>
<p class="Normal">To attach an arrow to a moving object, see <a href="trail.html"><strong>Attach a trail or arrow</strong></a>.</p>
<p class="Normal">See <a href="rotation.html"><strong>Rotating an Object</strong></a> for an easy way to change the orientation of an object.</p>
<p class="Normal">When you run a program, for convenience GlowScript
creates a <a href="canvas.html">canvas</a> on the web page and names it <span class="attribute">scene</span>.
Objects that you create are drawn on this canvas. If you have more than one canvas, you can specify in which canvas to place a new object, as in box(canvas=myscene); in JavaScript this would be box( {canvas:myscene} ). If you don't specify a canvas, the new object goes into the most recently created canvas, or the most recently selected canvas as specified by setting <span class="attribute">canvas.selected</span>.</p>
<div>
<div></div>
</div>
<div> </div>
<p class="Normal"><strong><font color="#0000a0">JavaScript</font></strong></p>
<p class="Normal">See the <a href="cylinder.html"><strong>cylinder</strong></a> documentation for how to create an object in JavaScript. </p>
</div>
</div>
<!-- InstanceEndEditable --></td>
</tr>
</table>
<p><a href="#top"><strong>Top of page</strong></a></p>
</body>
<script type="text/javascript" language="javascript" src="navigation.js"></script>
<!-- InstanceEnd --></html>