Capítulo 32 de 859

Chapter 32: ExtrudeGeometry

Core Idea

Creates extruded geometry from a path shape.

Key Concepts

  • parameters : Object: Holds the constructor parameters that have been used to generate the geometry. Any modification after instantiation does not change the geo…

Code Examples

const length = 12, width = 8;
const shape = new THREE.Shape();
shape.moveTo( 0,0 );
shape.lineTo( 0, width );
shape.lineTo( length, width );
shape.lineTo( length, 0 );
shape.lineTo( 0, 0 );
const geometry = new THREE.ExtrudeGeometry( shape );
const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
const mesh = new THREE.Mesh( geometry, material ) ;
scene.add( mesh );
  • What it demonstrates: Typical usage of ExtrudeGeometry.

Reference Tables

Constructor

Signature
`new ExtrudeGeometry( shapes : Shape

Properties

PropertyDescription
.parameters : ObjectHolds the constructor parameters that have been used to generate the geometry. Any modification after instantiation does not change the geometry.

Key Takeaways

  1. ExtrudeGeometry extends: EventDispatcher → BufferGeometry
  2. Most relevant properties: parameters.

Connects To