-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathH3DU.CurveBuilder.html
executable file
·278 lines (219 loc) · 14.5 KB
/
H3DU.CurveBuilder.html
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
<!DOCTYPE html><html xmlns:dc="http://purl.org/dc/terms/"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width"><link rel=stylesheet type="text/css" href="/style.css">
<script type="text/x-mathjax-config"> MathJax.Hub.Config({"HTML-CSS": { availableFonts: ["STIX","TeX"], linebreaks: { automatic:true }, preferredFont: "TeX" },
tex2jax: { displayMath: [ ["$$","$$"], ["\\[", "\\]"] ], inlineMath: [ ["$", "$"], ["\\\\(","\\\\)"] ], processEscapes: true } });
</script><script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS_HTML-full"></script></head><body> <div class="header">
<nav><p><a href="#navigation">Menu</a> - <a href="#top">Top</a> - <a href="/">Home</a></nav></div>
<div class="mainarea" id="top">
<h1 id="h3ducurvebuilder">H3DU.CurveBuilder</h1>
<p><a href="index.html">Back to documentation index.</a></p>
<p><a name="H3DU.CurveBuilder"></a>
### new H3DU.CurveBuilder()</p>
<p>An evaluator of curve evaluator objects for generating
vertex attributes for a curve.</p>
<p>For more information, see the <a href="tutorial-surfaces.html">Parametric Curves and Parametric Surfaces</a> tutorial.</p>
<h3 id="methods">Methods</h3>
<ul>
<li><a href="#H3DU.CurveBuilder_attribute">attribute</a><br />Sets the parametric curve used to generate vertex attribute values.</li>
<li><a href="#H3DU.CurveBuilder_clearVertices">clearVertices</a><br />Clears the arrays of attribute values (such as positions and normals)
and vertex indices generated so far.</li>
<li><a href="#H3DU.CurveBuilder_constantAttribute">constantAttribute</a><br />Sets a value for an attribute semantic that will be the same for all
future vertices generated by the “evalCurve” method.</li>
<li><a href="#H3DU.CurveBuilder_constantColor">constantColor</a><br />Sets a value for a color attribute that will be the same for all
future vertices generated by the “evalCurve” method.</li>
<li><a href="#H3DU.CurveBuilder.curveToBuffer">curveToBuffer</a><br />Convenience method for creating a mesh buffer from a parametric
curve.</li>
<li><a href="#H3DU.CurveBuilder_evalCurve">evalCurve</a><br />Generates the vertex attributes of the parametric curves.</li>
<li><a href="#H3DU.CurveBuilder_position">position</a><br />Sets the parametric curve used to generate vertex positions.</li>
<li><a href="#H3DU.CurveBuilder_toMeshBuffer">toMeshBuffer</a><br />Generates a mesh buffer containing the vertex attributes
generated so far.</li>
</ul>
<p><a name="H3DU.CurveBuilder_attribute"></a>
### H3DU.CurveBuilder#attribute(curve, semantic, [semanticIndex], [size])</p>
<p>Sets the parametric curve used to generate vertex attribute values.</p>
<h4 id="parameters">Parameters</h4>
<ul>
<li><code>curve</code> (Type: Object)<br />A curve evaluator object that describes the parametric curve used to generate attribute values. u-coordinates for the specified curve correspond to u-coordinates for the curve used to generate vertex positions.</li>
<li>
<table>
<tbody>
<tr>
<td><code>semantic</code> (Type: number</td>
<td>string)<br />An attribute semantic, such as <a href="Semantic.html#Semantic.POSITION">Semantic.POSITION</a>, “POSITION”, or “TEXCOORD_0”. Throws an error if this value is a string and the string is invalid.</td>
</tr>
</tbody>
</table>
</li>
<li><code>semanticIndex</code> (Type: number) (optional)<br />The set index of the attribute for the specified semantic. 0 is the first index of the attribute, 1 is the second, and so on. This is ignored if “name” is a string. If null, undefined, or omitted, the default is 0.</li>
<li><code>size</code> (Type: number) (optional)<br />The number of elements in each position value. For example, if the attribute is 3-dimensional, this parameter is 3. If null, undefined, or omitted, the default is 3. Throws an error if this value is 0 or less.</li>
</ul>
<h4 id="return-value">Return Value</h4>
<p>This object. (Type: CurveBuilder)</p>
<p><a name="H3DU.CurveBuilder_clearVertices"></a>
### H3DU.CurveBuilder#clearVertices()</p>
<p>Clears the arrays of attribute values (such as positions and normals)
and vertex indices generated so far. The attributes themselves will remain.</p>
<h4 id="return-value-1">Return Value</h4>
<p>This object. (Type: CurveBuilder)</p>
<p><a name="H3DU.CurveBuilder_constantAttribute"></a>
### H3DU.CurveBuilder#constantAttribute(constantValue, semantic, [semanticIndex])</p>
<p>Sets a value for an attribute semantic that will be the same for all
future vertices generated by the “evalCurve” method.</p>
<h4 id="parameters-1">Parameters</h4>
<ul>
<li>
<table>
<tbody>
<tr>
<td><code>constantValue</code> (Type: Object</td>
<td>number)<br />A constant value for the attribute semantic.</td>
</tr>
</tbody>
</table>
</li>
<li>
<table>
<tbody>
<tr>
<td><code>semantic</code> (Type: number</td>
<td>string)<br />An attribute semantic, such as <a href="Semantic.html#Semantic.POSITION">Semantic.POSITION</a>, “POSITION”, or “TEXCOORD_0”. Throws an error if this value is a string and the string is invalid.</td>
</tr>
</tbody>
</table>
</li>
<li><code>semanticIndex</code> (Type: number) (optional)<br />The set index of the attribute for the specified semantic. 0 is the first index of the attribute, 1 is the second, and so on. This is ignored if “name” is a string. If null, undefined, or omitted, the default is 0.</li>
</ul>
<h4 id="return-value-2">Return Value</h4>
<p>This object. (Type: CurveBuilder)</p>
<h4 id="examples">Examples</h4>
<p>This example sets the color to use for future
vertices to be generated for the curve.</p>
<pre>// Set color to red
curve.constantAttribute([1,0,0],"COLOR");
</pre>
<p><a name="H3DU.CurveBuilder_constantColor"></a>
### H3DU.CurveBuilder#constantColor(color, [semanticIndex])</p>
<p>Sets a value for a color attribute that will be the same for all
future vertices generated by the “evalCurve” method.</p>
<h4 id="parameters-2">Parameters</h4>
<ul>
<li>
<table>
<tbody>
<tr>
<td><code>color</code> (Type: Array.<number></td>
<td>number</td>
<td>string)<br />A color vector or string identifying the constant color value. The alpha channel of the resulting color will be ignored.</td>
</tr>
</tbody>
</table>
</li>
<li><code>semanticIndex</code> (Type: number) (optional)<br />The set index of the attribute for the specified semantic. 0 is the first index of the attribute, 1 is the second, and so on. If null, undefined, or omitted, the default is 0.</li>
</ul>
<h4 id="return-value-3">Return Value</h4>
<p>This object. (Type: CurveBuilder)</p>
<h4 id="examples-1">Examples</h4>
<p>This example sets the color to use for future
vertices to be generated for the curve.</p>
<pre>// Set color to red
curve.constantColor("red");
</pre>
<p><a name="H3DU.CurveBuilder.curveToBuffer"></a>
### (static) H3DU.CurveBuilder.curveToBuffer(curve, [mode], [n], [u1], [u2])</p>
<p>Convenience method for creating a mesh buffer from a parametric
curve. The mesh buffer will contain positions and vertex normals that
cover the specified surface.</p>
<h4 id="parameters-3">Parameters</h4>
<ul>
<li><code>curve</code> (Type: Object)<br />A curve evaluator object that describes the parametric curve used to generate positions.</li>
<li><code>mode</code> (Type: number) (optional)<br />If this value is MeshBuffer.LINES, or is null, undefined, or omitted, generates a series of lines defining the curve. If this value is MeshBuffer.POINTS, generates a series of points along the curve. For any other value, this method has no effect.</li>
<li><code>n</code> (Type: number) (optional)<br />Number of subdivisions of the curve to be drawn. If null or undefined, a default is determined automatically based on the position curve’s arc length, or the distance taken by its path (or the default is 24 if no position curve was defined). If 0, this method has no effect. Throws an error if this value is less than 0.</li>
<li><code>u1</code> (Type: number) (optional)<br />Starting point of the curve. Default is the starting coordinate given by the curve evaluator object, or 0 if not given.</li>
<li><code>u2</code> (Type: number) (optional)<br />Ending point of the curve. Default is the ending coordinate given by the curve evaluator object, or 1 if not given.</li>
</ul>
<h4 id="return-value-4">Return Value</h4>
<p>The generated mesh buffer. (Type: MeshBuffer)</p>
<p><a name="H3DU.CurveBuilder_evalCurve"></a>
### H3DU.CurveBuilder#evalCurve([mode], [n], [u1], [u2])</p>
<p>Generates the vertex attributes of the parametric curves.</p>
<h4 id="parameters-4">Parameters</h4>
<ul>
<li><code>mode</code> (Type: number) (optional)<br />If this value is MeshBuffer.LINES, or is null, undefined, or omitted, generates a series of lines defining the curve. If this value is MeshBuffer.POINTS, generates a series of points along the curve. For any other value, this method has no effect.</li>
<li><code>n</code> (Type: number) (optional)<br />Number of subdivisions of the curve to be drawn. If null or undefined, a default is determined automatically based on the position curve’s arc length, or the distance taken by its path (or the default is 24 if no position curve was defined). If 0, this method has no effect. Throws an error if this value is less than 0.</li>
<li><code>u1</code> (Type: number) (optional)<br />Starting point of the curve. Default is the starting coordinate given by the curve evaluator object, or 0 if not given.</li>
<li><code>u2</code> (Type: number) (optional)<br />Ending point of the curve. Default is the ending coordinate given by the curve evaluator object, or 1 if not given.</li>
</ul>
<h4 id="return-value-5">Return Value</h4>
<p>This object. (Type: CurveBuilder)</p>
<p><a name="H3DU.CurveBuilder_position"></a>
### H3DU.CurveBuilder#position(curve, [size])</p>
<p>Sets the parametric curve used to generate vertex positions.</p>
<h4 id="parameters-5">Parameters</h4>
<ul>
<li><code>curve</code> (Type: Object)<br />A curve evaluator object that describes the parametric curve used to generate positions.</li>
<li><code>size</code> (Type: number) (optional)<br />The number of elements in each position value. For example, if the attribute is 3-dimensional, this parameter is 3. If null, undefined, or omitted, the default is 3. Throws an error if this value is 0 or less.</li>
</ul>
<h4 id="return-value-6">Return Value</h4>
<p>This object. (Type: CurveBuilder)</p>
<p><a name="H3DU.CurveBuilder_toMeshBuffer"></a>
### H3DU.CurveBuilder#toMeshBuffer()</p>
<p>Generates a mesh buffer containing the vertex attributes
generated so far. The mesh buffer’s primitive type will equal the
last type passed to the “mode” parameter in the CurveBuilder.curveEval method.</p>
<h4 id="return-value-7">Return Value</h4>
<p>The generated mesh buffer. (Type: MeshBuffer)</p>
<p><a href="index.html">Back to documentation index.</a></p>
</div><nav id="navigation"><ul>
<li><a href="/">Back to start site.</a>
<li><a href="https://github.com/peteroupc/peteroupc.github.io">This site's repository (source code)</a>
<li><a href="https://github.com/peteroupc/peteroupc.github.io/issues">Post an issue or comment</a></ul>
<div class="noprint">
<p>
<a href="//twitter.com/intent/tweet">Share via Twitter</a>, <a href="//www.facebook.com/sharer/sharer.php" id="sharer">Share via Facebook</a>
</p>
</div>
<h3 id="navigation">Navigation</h3>
<ul>
<li><a href="BSplineCurve.html">BSplineCurve</a></li>
<li><a href="BSplineSurface.html">BSplineSurface</a></li>
<li><a href="BufferAccessor.html">BufferAccessor</a></li>
<li><a href="Curve.html">Curve</a></li>
<li><a href="CurveBuilder.html">CurveBuilder</a></li>
<li><a href="GraphicsPath.html">GraphicsPath</a></li>
<li><a href="H3DU.html">H3DU</a></li>
<li><a href="MathUtil.html">MathUtil</a></li>
<li><a href="MeshBuffer.html">MeshBuffer</a></li>
<li><a href="Meshes.html">Meshes</a></li>
<li><a href="PiecewiseCurve.html">PiecewiseCurve</a></li>
<li><a href="Semantic.html">Semantic</a></li>
<li><a href="ShapeGroup.html">ShapeGroup</a></li>
<li><a href="Surface.html">Surface</a></li>
<li><a href="SurfaceBuilder.html">SurfaceBuilder</a></li>
<li><a href="Transform.html">Transform</a></li>
<li><a href="extras_camera.html">module:extras/camera</a></li>
<li><a href="extras_camera.Camera.html">module:extras/camera.Camera</a></li>
<li><a href="extras_camera.InputTracker.html">module:extras/camera.InputTracker</a></li>
<li><a href="extras_createwasher.html">module:extras/createwasher</a></li>
<li><a href="extras_curvetube.html">module:extras/curvetube</a></li>
<li><a href="extras_curvetube.CurveTube.html">module:extras/curvetube.CurveTube</a></li>
<li><a href="extras_derivedcurves.html">module:extras/derivedcurves</a></li>
<li><a href="extras_evaluators.html">module:extras/evaluators</a></li>
<li><a href="extras_evaluators.Roulette.html">module:extras/evaluators.Roulette</a></li>
<li><a href="extras_evaluators.SurfaceOfRevolution.html">module:extras/evaluators.SurfaceOfRevolution</a></li>
<li><a href="extras_fourierknot.html">module:extras/fourierknot</a></li>
<li><a href="extras_gradients.html">module:extras/gradients</a></li>
<li><a href="extras_marbleshader2.html">module:extras/marbleshader2</a></li>
<li><a href="extras_matrixstack.html">module:extras/matrixstack</a></li>
<li><a href="extras_matrixstack.MatrixStack.html">module:extras/matrixstack.MatrixStack</a></li>
<li><a href="extras_moresurfaces.html">module:extras/moresurfaces</a></li>
<li><a href="extras_moresurfaces.KleinBottle.html">module:extras/moresurfaces.KleinBottle</a></li>
<li><a href="extras_moresurfaces.MoebiusStrip.html">module:extras/moresurfaces.MoebiusStrip</a></li>
<li><a href="extras_pathutil.html">module:extras/pathutil</a></li>
<li><a href="extras_randompolygon.html">module:extras/randompolygon</a></li>
<li><a href="extras_starpolygon.html">module:extras/starpolygon</a></li>
<li><a href="extras_superellipsoid.html">module:extras/superellipsoid</a></li>
<li><a href="extras_superellipsoid.Supershape.html">module:extras/superellipsoid.Supershape</a></li>
<li><a href="extras_superellipsoid.Supertoroid.html">module:extras/superellipsoid.Supertoroid</a></li>
<li><a href="extras_torusknot.html">module:extras/torusknot</a></li>
<li><a href="extras_torusknot.TorusKnot.html">module:extras/torusknot.TorusKnot</a></li>
</ul>
</nav></body></html>