From 8e176e83b59d160020037b47c5fc24bd656f6757 Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Sun, 12 Mar 2017 17:14:20 +0100 Subject: [PATCH] ConvexGeometry: Clean up --- src/Three.js | 1 - src/geometries/ConvexGeometry.js | 75 -------------------------------- src/geometries/Geometries.js | 1 - 3 files changed, 77 deletions(-) delete mode 100644 src/geometries/ConvexGeometry.js diff --git a/src/Three.js b/src/Three.js index 642ea3c8b0..86c86576d9 100644 --- a/src/Three.js +++ b/src/Three.js @@ -100,7 +100,6 @@ export { QuaternionLinearInterpolant } from './math/interpolants/QuaternionLinea export { LinearInterpolant } from './math/interpolants/LinearInterpolant.js'; export { DiscreteInterpolant } from './math/interpolants/DiscreteInterpolant.js'; export { CubicInterpolant } from './math/interpolants/CubicInterpolant.js'; -export { QuickHull3 } from './math/convexhull/QuickHull3.js'; export { Interpolant } from './math/Interpolant.js'; export { Triangle } from './math/Triangle.js'; export { _Math as Math } from './math/Math.js'; diff --git a/src/geometries/ConvexGeometry.js b/src/geometries/ConvexGeometry.js deleted file mode 100644 index cf5c5e6709..0000000000 --- a/src/geometries/ConvexGeometry.js +++ /dev/null @@ -1,75 +0,0 @@ -/** - * @author Mugen87 / https://github.com/Mugen87 - */ - -import { Geometry } from '../core/Geometry'; -import { BufferGeometry } from '../core/BufferGeometry'; -import { Float32BufferAttribute } from '../core/BufferAttribute'; -import { QuickHull3 } from '../math/convexhull/QuickHull3'; - -function ConvexGeometry( points ) { - - Geometry.call( this ); - - this.type = 'ConvexGeometry'; - - this.fromBufferGeometry( new ConvexBufferGeometry( points ) ); - this.mergeVertices(); - -} - -ConvexGeometry.prototype = Object.create( Geometry.prototype ); -ConvexGeometry.prototype.constructor = ConvexGeometry; - - -function ConvexBufferGeometry( points ) { - - BufferGeometry.call( this ); - - this.type = 'ConvexBufferGeometry'; - - // buffers - - var vertices = []; - var normals = []; - - // execute QuickHull - - var quickHull = new THREE.QuickHull3().setFromPoints( points ); - - // generate vertices and normals - - var faces = quickHull.faces; - - for ( var i = 0; i < faces.length; i ++ ) { - - var face = faces[ i ]; - var edge = face.edge; - - // we move along a doubly-connected edge list to access all face points (see HalfEdge docs) - - do { - - var point = edge.head().point; - - vertices.push( point.x, point.y, point.z ); - normals.push( face.normal.x, face.normal.y, face.normal.z ); - - edge = edge.next; - - } while ( edge !== face.edge ); - - } - - // build geometry - - this.addAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) ); - this.addAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) ); - -} - -ConvexBufferGeometry.prototype = Object.create( BufferGeometry.prototype ); -ConvexBufferGeometry.prototype.constructor = ConvexBufferGeometry; - - -export { ConvexGeometry, ConvexBufferGeometry }; diff --git a/src/geometries/Geometries.js b/src/geometries/Geometries.js index 91c0f35e11..c374cb5e85 100644 --- a/src/geometries/Geometries.js +++ b/src/geometries/Geometries.js @@ -20,4 +20,3 @@ export { ConeGeometry, ConeBufferGeometry } from './ConeGeometry.js'; export { CylinderGeometry, CylinderBufferGeometry } from './CylinderGeometry.js'; export { CircleGeometry, CircleBufferGeometry } from './CircleGeometry.js'; export { BoxGeometry, BoxBufferGeometry } from './BoxGeometry.js'; -export { ConvexGeometry, ConvexBufferGeometry } from './ConvexGeometry.js'; -- GitLab