How to use the ShapeGeometry function from three
Find comprehensive JavaScript three.ShapeGeometry code examples handpicked from public code repositorys.
three.ShapeGeometry is a class in the Three.js library that creates a geometry by extruding a 2D shape along a path.
137 138 139 140 141 142 143 144 145 146
var shape = new THREE.Shape(faceplateShapePoints); shape.holes.push(circleHole); shape.holes.push(circleHole2); var shapeGeometry = new THREE.ShapeGeometry(shape); var rotateMatrix = (new THREE.Matrix4()).makeRotationFromEuler(new THREE.Euler(Math.PI * 0.5, Math.PI, 0)); var translateMatrix = (new THREE.Matrix4()).makeTranslation(0, circleDepth, 0); shapeGeometry.applyMatrix(rotateMatrix); shapeGeometry.applyMatrix(translateMatrix);
39 40 41 42 43 44 45 46 47 48
_results.push(new THREE.Shape(projectRing(hole))); } return _results; })(); return new THREE.ShapeGeometry(shape); } MeshFactory.generateFromGeoJson = function(geoJson, options) { switch (geoJson.type) {
How does three.ShapeGeometry work?
three.ShapeGeometry is a class in the Three.js library that is used to create a 3D geometry from a 2D shape defined using the three.Shape class by extruding the shape along a given path. The extrusion can be customized by setting various properties of the three.ExtrudeGeometry class, such as the depth, bevel thickness, and bevel size. The resulting geometry can be used as a mesh in a Three.js scene to create 3D graphics.
11512 11513 11514 11515 11516 11517 11518 11519 11520 11521
points.push(new THREE.Vector2( corner.x, corner.y)); }); var shape = new THREE.Shape(points); var geometry = new THREE.ShapeGeometry(shape); scope.floorPlane = new THREE.Mesh(geometry, new THREE.MeshBasicMaterial({ side: THREE.DoubleSide }));
+ 69 other calls in file
Ai Example
1 2 3 4 5 6 7 8 9 10
import * as THREE from "three"; const triangleShape = new THREE.Shape(); triangleShape.moveTo(0, 0); triangleShape.lineTo(1, 0); triangleShape.lineTo(0.5, 1); const geometry = new THREE.ShapeGeometry(triangleShape); const material = new THREE.MeshBasicMaterial({ color: 0xffffff }); const mesh = new THREE.Mesh(geometry, material);
In this example, we create a Shape object by defining three points and connecting them with lines. We then pass this shape object to the ShapeGeometry constructor to create a geometry object, which we use along with a MeshBasicMaterial to create a Mesh object.
three.Vector3 is the most popular function in three (22341 examples)