Lathe

components/meshes/ Lathe

Constructor

.new Lathe(paramsopt)

A LatheGeometry allows you to create shapes from a smooth curve. This curve is defined by a number of points (also called knots) and is most often called a spline. This spline is rotated around a fixed point and results in vase- and bell-like shapes.

In 3D computer graphics, a lathed object is a 3D model whose vertex geometry is produced by rotating the points of a spline or other point set around a fixed axis. The lathing may be partial; the amount of rotation is not necessarily a full 360 degrees. The point set providing the initial source data can be thought of as a cross section through the object along a plane containing its axis of radial symmetry.

The following example shows a geometry which can be generated using Lathe class.

Source:
Parameters:
Name Type Attributes Description
params Object <optional>

The params.

Example

Creating a Lath, and adding to app

const points = [];

for (let i = 0; i < 10; i++) {
  points.push(
    new THREE.Vector2(
      (Math.sin(i * 0.7) * 15 + 50) / 10,
      (i - 5) * 0.2
    )
  );
}

const lathe = new Lathe({
  geometry: {
    points: points
  },

  material: new THREE.MeshBasicMaterial({
    color: 0xffffff
  }),

  position: [0, 50, 10]
}).addTo(app);

Extends module:core.MeshComponent

Members

(private) ._wait :Array

Array of promises that should be resolved before Component is ready.

Inherited From:
Source:

.children :Array

Collection of child Components.

Inherited From:
Source:

.defaults :Object

Default values for parameters

Overrides:
Default Value:
                  
    {
      geometry: {
        points: []
      }
    }
    
Source:

.instructions :Object

Instructions

Overrides:
Default Value:
                  
    {
      geometry: ['points']
    }
    
Source:

.isDeffered :Boolean

Returns whether the object is async (wait promises are more than 0).

Inherited From:
Source:

.manager :ModuleManager

Returns the ModuleManager used for this component.

Inherited From:
Source:

.modules :Array

Collection of modules.

Inherited From:
Source:

.native :Object

Returns the native object used for this component.

Inherited From:
Source:

Methods

(static) .build(params) → {THREE.Mesh}

Build livecycle creates a mesh using input params.

Source:
Parameters:
Name Type Description
params Object

Component parameters.

.add(object) → {Promise}

Add a child Component.

Inherited From:
Source:
Parameters:
Name Type Description
object Component

Component that should be added as a child.

.addTo(object)

Adds this Component to specified App/Component.

Inherited From:
Source:
Parameters:
Name Type Description
object Component

Component that will be a parent of this.

.clone() → {MeshComponent}

Make a clone of this MeshComponent using .copy()

Inherited From:
Source:

.copy() → {this}

Copy source transforms & execute Component.copy()

Inherited From:
Source:

.defer(func)

Execute func (Callback) when Component is ready.

Inherited From:
Source:
Parameters:
Name Type Description
func function

Callback.

.remove(object)

Remove a child Component.

Inherited From:
Source:
Parameters:
Name Type Description
object Component

Component that should be a child of this Component.

.updateParams() → {Object}

Updates parameters of the Component.

Inherited From:
Source:

.wait(promiseopt) → {Promise}

Wait for a promise.

Inherited From:
Source:
Parameters:
Name Type Attributes Description
promise Promise <optional>

The promise that should be added to a queue.

.wrap() → {Promise}

Wraps transforms (position & rotation)

Inherited From:
Source: