figureone
    Preparing search index...

    Revolve shape options object that extends OBJ_Generic3All and OBJ_FigurePrimitive.

    Revolve (or radially sweep) a profile in the XY plane around the x axis to form a 3D surface. The profile y values must be greater than or equal to 0.

    Profiles can be open (start and end point are different) or closed (start and end point are equal).

    For predictable lighting results, profiles should be created with the following rules:

    • An open profile's start points should have an x value less than its end point
    • Closed profiles where all points have y > 0 should be defined in the clockwise direction when looking at the XY plane from the +z axis.

    If an open profile's start and ends points are at y = 0, then the final shape will look solid.

    If an open profile's start and/or ends points have y > 0, then the final shape will look like a surface open at the ends with y > 0. As a surface can have only one color, then looking inside the shape the surface lighting will be opposite to that expected. To create open ended solids with lighting that is as expected, create the outside and inside surface with a closed profile.

    To test examples, append them to the boilerplate

    figure.add({
    make: 'revolve',
    profile: [[0, 0], [0, 0.05], [0.5, 0.05], [0.6, 0.1], [0.7, 0]],
    axis: [0, 1, 0],
    color: [1, 0, 0, 1],
    sides: 20,
    });
    // If creating a shell, then also create the inside surface as this will make
    // lighting more correct (note there is not shaddows).
    // Ensure to close the shell by adding the first point to the end of the
    // profile
    figure.add({
    make: 'revolve',
    profile: [[0, 0.15], [0.5, 0.3], [0.5, 0.29], [0, 0.14], [0, 0.15]],
    color: [1, 0, 0, 1],
    sides: 30,
    normals: 'curveRadial',
    });
    // Curvy vase like shape
    const x = Fig.range(0, 0.5, 0.01);
    const profile = x.map(_x => [_x, 0.1 + 0.05 * Math.sin(_x * 2 * Math.PI * 2)]);
    figure.add({
    make: 'revolve',
    profile: [...profile, [0.4, 0], [0, 0], [0, 0.1]],
    axis: [0, 1, 0],
    color: [1, 0, 0, 1],
    sides: 30,
    });
    // Make a torus by revolving a polygon around the axis. As the polygon is above
    // the x axis, a hole will be created
    // Try using `normals: 'curve'`, `normals: 'curveProfile'`, and
    // `normals: 'curveRadial'` to see different curve options.
    const { polygon } = Fig;
    figure.add({
    make: 'revolve',
    profile: polygon({
    radius: 0.1, center: [0, 0.3], sides: 20, direction: -1, close: true,
    }),
    color: [1, 0, 0, 1],
    sides: 30,
    });
    // Wire mesh arrow
    figure.add({
    make: 'revolve',
    profile: [[0, 0.03], [0.4, 0.03], [0.4, 0.09], [0.7, 0]],
    axis: [0, 1, 0],
    color: [1, 0, 0, 1],
    sides: 20,
    lines: true,
    });
    // Open profile y = 0 at ends
    figure.add({
    make: 'revolve',
    profile: [[0, 0], [0, 0.3], [0.5, 0.2], [1, 0.3], [1, 0]],
    color: [1, 0, 0, 1],
    sides: 30,
    });
    // Open profile y > 0 at ends
    figure.add({
    make: 'revolve',
    profile: [[0, 0.3], [0.5, 0.2], [1, 0.3]],
    color: [1, 0, 0, 1],
    sides: 30,
    });
    // Closed Profile
    figure.add({
    make: 'revolve',
    profile: [[0, 0.3], [0.5, 0.2], [1, 0.3], [1, 0.29], [0.5, 0.19], [0, 0.29], [0, 0.3]],
    color: [1, 0, 0, 1],
    sides: 30,
    });
    @interface