Menu - Top - Home - Donate to Me

SurfaceOfRevolution

Back to documentation index.

SurfaceOfRevolution(curve, minval, maxval, [axis])

A surface evaluator object for a surface of revolution, which results by revolving a two-dimensional curve around an axis.

This class is considered a supplementary class to the Public Domain HTML 3D Library and is not considered part of that library.

Parameters

Methods

SurfaceOfRevolution#endPoints()

SurfaceOfRevolution#evaluate(u, v)

Finds the coordinates of the given point of this surface.

Parameters

Return Value

An array containing the coordinates of the position at the given point. It will have three elements. (Type: Array.<number>)

(static) SurfaceOfRevolution.fromFunction(func, minval, maxval, [axis])

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).

Parameters

Return Value

Return value. (Type: SurfaceOfRevolution)

Example

The following creates an evaluator for a cone which starts at the origin and runs 10 units along the Z axis.

var surf=SurfaceOfRevolution.fromFunction(
function(x) {
"use strict"; return x/2; }, // use a constantly increasing function
0, 10);

This is an evaluator for the same cone, but shifted 3 units back.

var surf=SurfaceOfRevolution.fromFunction(
function(x) {
"use strict"; x+=3; return x/2; },
-3,7);

The following creates an evaluator for a cylinder which runs from 5 to 10 units, and with a radius of 2 units.

var surf=SurfaceOfRevolution.fromFunction(
function(x) {
"use strict"; return 2; }, // use a constant radius
5, 10);

(static) SurfaceOfRevolution.torus(outerRadius, innerRadius, [curve], [axis])

A surface evaluator object for a torus, a special case of a surface of revolution.

Parameters

Return Value

Return value. (Type: SurfaceOfRevolution)

Back to documentation index.