LegoMockupVisualizer

Creates a Three.js scene for visualizing Lego mockups

Constructor

new LegoMockupVisualizer(domElement)

Sets up a Three.js scene to visualize the lego mock up.

Parameters:
NameTypeDescription
domElementHTMLElement

HTML element that will be used as the container for the Three.js scene.

Classes

LegoMockupVisualizer

Members

camera :PerspectiveCamera

Type:
  • PerspectiveCamera

domElement :HTMLDivElement

Type:
  • HTMLDivElement

otbitControls :OrbitControls

Type:
  • OrbitControls

scene :Scene

Type:
  • Scene

Methods

addLegoPlateSimulation(heightMap, xPlates, yPlates)

Adds Lego blocks to threejs scene based on a given heightmap.

Parameters:
NameTypeDescription
heightMapArray.<Array.<number>>

2D array representing the height values of the terrain.

xPlatesnumber

The number of Lego plates to be added horizontally in the mockup.

yPlatesnumber

The number of Lego plates to be added vertically in the mockup.

createTHREEScene()

Creates a three.js scene with a camera, renderer, lights, and orbit controls.

dispose()

Clears the inner HTML of a DOM element and disposes of an orbit object.