-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathSurfaceOfRevolution.html
executable file
·190 lines (152 loc) · 11.5 KB
/
SurfaceOfRevolution.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
<!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="surfaceofrevolution">SurfaceOfRevolution</h1>
<p><a href="index.html">Back to documentation index.</a></p>
<p><a name="SurfaceOfRevolution"></a>
### SurfaceOfRevolution(curve, minval, maxval, [axis])</p>
<p>A surface evaluator object for a surface of revolution,
which results by revolving a two-dimensional curve around an axis.</p>
<p>This class is considered a supplementary class to the
Public Domain HTML 3D Library and is not considered part of that
library.</p>
<h4 id="parameters">Parameters</h4>
<ul>
<li><code>curve</code> (Type: Object)<br />A curve evaluator object that describes a 2-dimensional curve to rotate about the axis of rotation, as specified in the “axis” parameter. The curve’s x-coordinates correspond to elevation, and its y-coordinates correspond to radius.</li>
</ul>
<p>If the curve function draws a curve that goes both above and below the axis of rotation, such as a circle or ellipse, the v-coordinates given in <em>minval</em> and <em>maxval</em> must restrict the curve definition to no more than half of the curve.
* <code>minval</code> (Type: number)<br />Smallest v-coordinate.
* <code>maxval</code> (Type: number)<br />Largest v-coordinate. If <em>minval</em> is greater than <em>maxval</em>, both values will be swapped.
* <code>axis</code> (Type: Array.<number>) (optional)<br />Axis of rotation, around which the curve will be rotated to generate the surface of revolution. If null, undefined, or omitted, the positive z-axis (0, 0, 1) will be the axis of rotation. This parameter is a 3-element array describing the x-, y-, and z-coordinates, respectively, of a 3D point. The axis of rotation will run in the direction from the origin to the point given in this parameter. This parameter need not be a <a href="tutorial-glmath.html">unit vector</a>.</p>
<h3 id="methods">Methods</h3>
<ul>
<li><a href="#SurfaceOfRevolution_endPoints">endPoints</a></li>
<li><a href="#SurfaceOfRevolution_evaluate">evaluate</a><br />Finds the coordinates of the specified point of this surface.</li>
<li><a href="#SurfaceOfRevolution.fromFunction">fromFunction</a><br />Creates a surface evaluator object for a surface of revolution
whose curve is the graph of a single-variable function.</li>
<li><a href="#SurfaceOfRevolution.torus">torus</a><br />A surface evaluator object for a torus, a special case of a surface of revolution.</li>
</ul>
<p><a name="SurfaceOfRevolution_endPoints"></a>
### SurfaceOfRevolution#endPoints()</p>
<p><a name="SurfaceOfRevolution_evaluate"></a>
### SurfaceOfRevolution#evaluate(u, v)</p>
<p>Finds the coordinates of the specified point of this surface.</p>
<h4 id="parameters-1">Parameters</h4>
<ul>
<li><code>u</code> (Type: number)<br />u-coordinate of the surface to evaluate.</li>
<li><code>v</code> (Type: number)<br />v-coordinate of the surface to evaluate.</li>
</ul>
<h4 id="return-value">Return Value</h4>
<p>An array containing the coordinates
of the position at the specified point. It will have three elements. (Type: Array.<number>)</p>
<p><a name="SurfaceOfRevolution.fromFunction"></a>
### (static) SurfaceOfRevolution.fromFunction(func, minval, maxval, [axis])</p>
<p>Creates a surface evaluator object for a surface of revolution
whose curve is the graph of a single-variable function.
The resulting surface will have a circular cross section
along its length.
Examples of surfaces generated by this technique are
cones, frustums, cylinders, spheres, and spheroids (the
bases of these surfaces won’t be generated).</p>
<h4 id="parameters-2">Parameters</h4>
<ul>
<li><code>func</code> (Type: function)<br />Function whose graph will be rotated about the axis of rotation, as specified in the “axis” parameter. The function takes a number as a single parameter and returns a number. The return value is effectively the radius of each part of the surface from beginning to end.</li>
<li><code>minval</code> (Type: number)<br />Smallest parameter of the function. This is a number of units from the origin along the axis of rotation.</li>
<li><code>maxval</code> (Type: number)<br />Largest parameter of the function. This is a number of units from the origin along the axis of rotation. If <em>minval</em> is greater than <em>maxval</em>, both values will be swapped.</li>
<li><code>axis</code> (Type: Array.<number>) (optional)<br />Axis of rotation, around which the function graph will be rotated to generate the surface of revolution. If null, undefined, or omitted, the positive z-axis (0, 0, 1) will be the axis of rotation. This parameter is a 3-element array describing the x-, y-, and z-coordinates, respectively, of a 3D point. The axis of rotation will run in the direction from the origin to the point given in this parameter. This parameter need not be a <a href="tutorial-glmath.html">unit vector</a>.</li>
</ul>
<h4 id="return-value-1">Return Value</h4>
<p>Return value. (Type: <a href="SurfaceOfRevolution.html">SurfaceOfRevolution</a>)</p>
<h4 id="example">Example</h4>
<p>The following creates an evaluator for a cone
which starts at the origin and runs 10 units along the z-axis.</p>
<pre>var surf=SurfaceOfRevolution.fromFunction(
function(x) {
"use strict"; return x/2; }, // use a constantly increasing function
0, 10);
</pre>
<p>This is an evaluator for the same cone, but
shifted 3 units back.</p>
<pre>var surf=SurfaceOfRevolution.fromFunction(
function(x) {
"use strict"; x+=3; return x/2; },
-3,7);
</pre>
<p>The following creates an evaluator for a cylinder
which runs from 5 to 10 units, and with a radius of 2 units.</p>
<pre>var surf=SurfaceOfRevolution.fromFunction(
function(x) {
"use strict"; return 2; }, // use a constant radius
5, 10);
</pre>
<p><a name="SurfaceOfRevolution.torus"></a>
### (static) SurfaceOfRevolution.torus(outerRadius, innerRadius, [curve], [axis])</p>
<p>A surface evaluator object for a torus, a special case of a surface of revolution.</p>
<h4 id="parameters-3">Parameters</h4>
<ul>
<li><code>outerRadius</code> (Type: number)<br />Radius from the center to the innermost part of the torus.</li>
<li><code>innerRadius</code> (Type: number)<br />Radius from the inner edge to the innermost part of the torus.</li>
<li><code>curve</code> (Type: Object) (optional)<br />A curve evaluator object that describes a 2-dimensional curve to serve as the cross section of the torus. The curve need not be closed; in fact, certain special surfaces can result by leaving the ends open. If null, undefined, or omitted, uses a circular cross section with a radius of 1.</li>
<li><code>axis</code> (Type: Array.<number>) (optional)<br />Axis of rotation, which the torus will pass through. If null, undefined, or omitted, the positive z-axis (0, 0, 1) will be the axis of rotation. This parameter is a 3-element array describing the x-, y-, and z-coordinates, respectively, of a 3D point. The axis of rotation will run in the direction from the origin to the point given in this parameter. This parameter need not be a <a href="tutorial-glmath.html">unit vector</a>.</li>
</ul>
<h4 id="return-value-2">Return Value</h4>
<p>Return value. (Type: <a href="SurfaceOfRevolution.html">SurfaceOfRevolution</a>)</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>