three-csg-ts
Advanced tools
Comparing version 1.0.6 to 2.0.0
@@ -5,2 +5,19 @@ # Changelog | ||
## [2.0.0](https://github.com/Jiro-Digital/three-csg-ts/compare/v1.0.6...v2.0.0) (2020-12-13) | ||
### ⚠ BREAKING CHANGES | ||
* target es6 | ||
### Features | ||
* target es6 ([6cea95e](https://github.com/Jiro-Digital/three-csg-ts/commit/6cea95e49dfe04c6984dcdb9ce075c84830e6453)) | ||
### Bug Fixes | ||
* handle Matrix4 getInverse deprecation in three r123 ([d04eb4b](https://github.com/Jiro-Digital/three-csg-ts/commit/d04eb4bb2efa01a26353d50ea50a678c4f2f2feb)) | ||
* upgrade dependencies ([b40b1a0](https://github.com/Jiro-Digital/three-csg-ts/commit/b40b1a0741bd147cf13fdb6ee1856862648d2c5c)) | ||
### [1.0.6](https://github.com/Jiro-Digital/three-csg-ts/compare/v1.0.5...v1.0.6) (2020-10-27) | ||
@@ -7,0 +24,0 @@ |
410
lib/index.js
@@ -1,18 +0,2 @@ | ||
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = function (d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
}; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CSG = void 0; | ||
var three_1 = require("three"); | ||
import { Face3, Geometry, Matrix3, Matrix4, Mesh, Vector3 } from 'three'; | ||
/** | ||
@@ -22,24 +6,24 @@ * Holds a binary space partition tree representing a 3D solid. Two solids can | ||
*/ | ||
var CSG = /** @class */ (function () { | ||
function CSG() { | ||
export class CSG { | ||
constructor() { | ||
this.polygons = []; | ||
} | ||
CSG.fromPolygons = function (polygons) { | ||
var csg = new CSG(); | ||
static fromPolygons(polygons) { | ||
const csg = new CSG(); | ||
csg.polygons = polygons; | ||
return csg; | ||
}; | ||
CSG.fromGeometry = function (geom) { | ||
} | ||
static fromGeometry(geom) { | ||
if (geom.isBufferGeometry) { | ||
geom = new three_1.Geometry().fromBufferGeometry(geom); | ||
geom = new Geometry().fromBufferGeometry(geom); | ||
} | ||
var fs = geom.faces; | ||
var vs = geom.vertices; | ||
var polys = []; | ||
var fm = ['a', 'b', 'c']; | ||
for (var i = 0; i < fs.length; i++) { | ||
var f = fs[i]; | ||
var vertices = []; | ||
for (var j = 0; j < 3; j++) { | ||
var uvs = geom.faceVertexUvs[0][i] !== undefined && | ||
const fs = geom.faces; | ||
const vs = geom.vertices; | ||
const polys = []; | ||
const fm = ['a', 'b', 'c']; | ||
for (let i = 0; i < fs.length; i++) { | ||
const f = fs[i]; | ||
const vertices = []; | ||
for (let j = 0; j < 3; j++) { | ||
const uvs = geom.faceVertexUvs[0][i] !== undefined && | ||
geom.faceVertexUvs[0][i][j] !== undefined | ||
@@ -53,10 +37,8 @@ ? geom.faceVertexUvs[0][i][j] | ||
return CSG.fromPolygons(polys); | ||
}; | ||
CSG.fromMesh = function (mesh) { | ||
var csg = CSG.fromGeometry(mesh.geometry); | ||
} | ||
static fromMesh(mesh) { | ||
const csg = CSG.fromGeometry(mesh.geometry); | ||
CSG._tmpm3.getNormalMatrix(mesh.matrix); | ||
for (var _i = 0, _a = csg.polygons; _i < _a.length; _i++) { | ||
var p = _a[_i]; | ||
for (var _b = 0, _c = p.vertices; _b < _c.length; _b++) { | ||
var v = _c[_b]; | ||
for (const p of csg.polygons) { | ||
for (const v of p.vertices) { | ||
v.pos.applyMatrix4(mesh.matrix); | ||
@@ -67,36 +49,42 @@ v.normal.applyMatrix3(CSG._tmpm3); | ||
return csg; | ||
}; | ||
CSG.toMesh = function (csg, toMatrix) { | ||
var geom = new three_1.Geometry(); | ||
var ps = csg.polygons; | ||
var vs = geom.vertices; | ||
var fvuv = geom.faceVertexUvs[0]; | ||
for (var _i = 0, ps_1 = ps; _i < ps_1.length; _i++) { | ||
var p = ps_1[_i]; | ||
var pvs = p.vertices; | ||
var v0 = vs.length; | ||
var pvlen = pvs.length; | ||
for (var _a = 0, pvs_1 = pvs; _a < pvs_1.length; _a++) { | ||
var pv = pvs_1[_a]; | ||
vs.push(new three_1.Vector3().copy(pv.pos)); | ||
} | ||
static toMesh(csg, toMatrix) { | ||
const geom = new Geometry(); | ||
const ps = csg.polygons; | ||
const vs = geom.vertices; | ||
const fvuv = geom.faceVertexUvs[0]; | ||
for (const p of ps) { | ||
const pvs = p.vertices; | ||
const v0 = vs.length; | ||
const pvlen = pvs.length; | ||
for (const pv of pvs) { | ||
vs.push(new Vector3().copy(pv.pos)); | ||
} | ||
for (var j = 3; j <= pvlen; j++) { | ||
var fc = new three_1.Face3(v0, v0 + j - 2, v0 + j - 1); | ||
var fuv = []; | ||
for (let j = 3; j <= pvlen; j++) { | ||
const fc = new Face3(v0, v0 + j - 2, v0 + j - 1); | ||
const fuv = []; | ||
fvuv.push(fuv); | ||
var fnml = fc.vertexNormals; | ||
fnml.push(new three_1.Vector3().copy(pvs[0].normal)); | ||
fnml.push(new three_1.Vector3().copy(pvs[j - 2].normal)); | ||
fnml.push(new three_1.Vector3().copy(pvs[j - 1].normal)); | ||
const fnml = fc.vertexNormals; | ||
fnml.push(new Vector3().copy(pvs[0].normal)); | ||
fnml.push(new Vector3().copy(pvs[j - 2].normal)); | ||
fnml.push(new Vector3().copy(pvs[j - 1].normal)); | ||
// check for uv property | ||
if (pvs[0].uv && pvs[j - 2].uv && pvs[j - 1].uv) { | ||
fuv.push(new three_1.Vector3().copy(pvs[0].uv)); | ||
fuv.push(new three_1.Vector3().copy(pvs[j - 2].uv)); | ||
fuv.push(new three_1.Vector3().copy(pvs[j - 1].uv)); | ||
fuv.push(new Vector3().copy(pvs[0].uv)); | ||
fuv.push(new Vector3().copy(pvs[j - 2].uv)); | ||
fuv.push(new Vector3().copy(pvs[j - 1].uv)); | ||
} | ||
fc.normal = new three_1.Vector3().copy(p.plane.normal); | ||
fc.normal = new Vector3().copy(p.plane.normal); | ||
geom.faces.push(fc); | ||
} | ||
} | ||
var inv = new three_1.Matrix4().getInverse(toMatrix); | ||
let inv; | ||
// test for matrix invert method introduced in r123 | ||
if (typeof toMatrix['invert'] === 'function') { | ||
inv = toMatrix.invert(); | ||
} | ||
else { | ||
// enables compatibility with previous versions | ||
inv = new Matrix4().getInverse(toMatrix); | ||
} | ||
geom.applyMatrix4(inv); | ||
@@ -106,3 +94,3 @@ geom.verticesNeedUpdate = geom.elementsNeedUpdate = geom.normalsNeedUpdate = true; | ||
geom.computeBoundingBox(); | ||
var m = new three_1.Mesh(geom); | ||
const m = new Mesh(geom); | ||
m.matrix.copy(toMatrix); | ||
@@ -112,4 +100,4 @@ m.matrix.decompose(m.position, m.rotation, m.scale); | ||
return m; | ||
}; | ||
CSG.iEval = function (tokens) { | ||
} | ||
static iEval(tokens) { | ||
if (typeof tokens === 'string') { | ||
@@ -119,4 +107,3 @@ CSG.currentOp = tokens; | ||
else if (tokens instanceof Array) { | ||
for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) { | ||
var token = tokens_1[_i]; | ||
for (const token of tokens) { | ||
CSG.iEval(token); | ||
@@ -126,3 +113,3 @@ } | ||
else if (typeof tokens === 'object') { | ||
var op = CSG.currentOp; | ||
const op = CSG.currentOp; | ||
tokens.updateMatrix(); | ||
@@ -140,4 +127,4 @@ tokens.updateMatrixWorld(); | ||
} // union,subtract,intersect,inverse | ||
}; | ||
CSG.eval = function (tokens, doRemove) { | ||
} | ||
static eval(tokens, doRemove) { | ||
// [['add',mesh,mesh,mesh,mesh],['sub',mesh,mesh,mesh,mesh]] | ||
@@ -148,20 +135,20 @@ CSG.currentOp = null; | ||
CSG.iEval(tokens); | ||
var result = CSG.toMesh(CSG.currentPrim, CSG.sourceMesh.matrix); | ||
const result = CSG.toMesh(CSG.currentPrim, CSG.sourceMesh.matrix); | ||
result.material = CSG.sourceMesh.material; | ||
result.castShadow = result.receiveShadow = true; | ||
return result; | ||
}; | ||
CSG.prototype.clone = function () { | ||
var csg = new CSG(); | ||
csg.polygons = this.polygons.map(function (p) { | ||
} | ||
clone() { | ||
const csg = new CSG(); | ||
csg.polygons = this.polygons.map((p) => { | ||
return p.clone(); | ||
}); | ||
return csg; | ||
}; | ||
CSG.prototype.toPolygons = function () { | ||
} | ||
toPolygons() { | ||
return this.polygons; | ||
}; | ||
CSG.prototype.union = function (csg) { | ||
var a = new Node(this.clone().polygons); | ||
var b = new Node(csg.clone().polygons); | ||
} | ||
union(csg) { | ||
const a = new Node(this.clone().polygons); | ||
const b = new Node(csg.clone().polygons); | ||
a.clipTo(b); | ||
@@ -174,6 +161,6 @@ b.clipTo(a); | ||
return CSG.fromPolygons(a.allPolygons()); | ||
}; | ||
CSG.prototype.subtract = function (csg) { | ||
var a = new Node(this.clone().polygons); | ||
var b = new Node(csg.clone().polygons); | ||
} | ||
subtract(csg) { | ||
const a = new Node(this.clone().polygons); | ||
const b = new Node(csg.clone().polygons); | ||
a.invert(); | ||
@@ -188,6 +175,6 @@ a.clipTo(b); | ||
return CSG.fromPolygons(a.allPolygons()); | ||
}; | ||
CSG.prototype.intersect = function (csg) { | ||
var a = new Node(this.clone().polygons); | ||
var b = new Node(csg.clone().polygons); | ||
} | ||
intersect(csg) { | ||
const a = new Node(this.clone().polygons); | ||
const b = new Node(csg.clone().polygons); | ||
a.invert(); | ||
@@ -201,30 +188,26 @@ b.clipTo(a); | ||
return CSG.fromPolygons(a.allPolygons()); | ||
}; | ||
CSG.prototype.inverse = function () { | ||
var csg = this.clone(); | ||
csg.polygons.map(function (p) { | ||
} | ||
inverse() { | ||
const csg = this.clone(); | ||
csg.polygons.map((p) => { | ||
p.flip(); | ||
}); | ||
return csg; | ||
}; | ||
CSG._tmpm3 = new three_1.Matrix3(); | ||
return CSG; | ||
}()); | ||
exports.CSG = CSG; | ||
} | ||
} | ||
CSG._tmpm3 = new Matrix3(); | ||
/** | ||
* Represents a 3D vector. | ||
*/ | ||
var Vector = /** @class */ (function (_super) { | ||
__extends(Vector, _super); | ||
function Vector(x, y, z) { | ||
var _this = this; | ||
class Vector extends Vector3 { | ||
constructor(x, y, z) { | ||
if (arguments.length === 3) { | ||
_this = _super.call(this, x, y, z) || this; | ||
super(x, y, z); | ||
} | ||
else if (Array.isArray(x)) { | ||
_this = _super.call(this, x[0], x[1], x[2]) || this; | ||
super(x[0], x[1], x[2]); | ||
} | ||
else if (typeof x === 'object') { | ||
_this = _super.call(this) || this; | ||
_this.copy(x); | ||
super(); | ||
this.copy(x); | ||
} | ||
@@ -234,33 +217,31 @@ else { | ||
} | ||
return _this; | ||
} | ||
Vector.prototype.clone = function () { | ||
clone() { | ||
return new Vector(this.x, this.y, this.z); | ||
}; | ||
Vector.prototype.negated = function () { | ||
} | ||
negated() { | ||
return this.clone().multiplyScalar(-1); | ||
}; | ||
Vector.prototype.plus = function (a) { | ||
} | ||
plus(a) { | ||
return this.clone().add(a); | ||
}; | ||
Vector.prototype.minus = function (a) { | ||
} | ||
minus(a) { | ||
return this.clone().sub(a); | ||
}; | ||
Vector.prototype.times = function (a) { | ||
} | ||
times(a) { | ||
return this.clone().multiplyScalar(a); | ||
}; | ||
Vector.prototype.dividedBy = function (a) { | ||
} | ||
dividedBy(a) { | ||
return this.clone().divideScalar(a); | ||
}; | ||
Vector.prototype.lerp = function (a, t) { | ||
} | ||
lerp(a, t) { | ||
return this.plus(a.minus(this).times(t)); | ||
}; | ||
Vector.prototype.unit = function () { | ||
} | ||
unit() { | ||
return this.dividedBy(this.length()); | ||
}; | ||
Vector.prototype.cross = function (a) { | ||
return three_1.Vector3.prototype.cross.call(this.clone(), a); | ||
}; | ||
return Vector; | ||
}(three_1.Vector3)); | ||
} | ||
cross(a) { | ||
return Vector3.prototype.cross.call(this.clone(), a); | ||
} | ||
} | ||
/** | ||
@@ -275,4 +256,4 @@ * Represents a vertex of a polygon. Use your own vertex class instead of this | ||
*/ | ||
var Vertex = /** @class */ (function () { | ||
function Vertex(pos, normal, uv) { | ||
class Vertex { | ||
constructor(pos, normal, uv) { | ||
this.pos = new Vector(pos.x, pos.y, pos.z); | ||
@@ -283,37 +264,36 @@ this.normal = new Vector(normal.x, normal.y, normal.z); | ||
} | ||
Vertex.prototype.clone = function () { | ||
clone() { | ||
return new Vertex(this.pos.clone(), this.normal.clone(), this.uv ? this.uv.clone() : undefined); | ||
}; | ||
} | ||
// Invert all orientation-specific data (e.g. vertex normal). Called when the | ||
// orientation of a polygon is flipped. | ||
Vertex.prototype.flip = function () { | ||
flip() { | ||
this.normal = this.normal.negated(); | ||
}; | ||
} | ||
// Create a new vertex between this vertex and `other` by linearly | ||
// interpolating all properties using a parameter of `t`. Subclasses should | ||
// override this to interpolate additional properties. | ||
Vertex.prototype.interpolate = function (other, t) { | ||
interpolate(other, t) { | ||
return new Vertex(this.pos.lerp(other.pos, t), this.normal.lerp(other.normal, t), this.uv ? this.uv.lerp(other.uv, t) : undefined); | ||
}; | ||
return Vertex; | ||
}()); | ||
} | ||
} | ||
/** | ||
* Represents a plane in 3D space. | ||
*/ | ||
var Plane = /** @class */ (function () { | ||
function Plane(normal, w) { | ||
class Plane { | ||
constructor(normal, w) { | ||
this.normal = normal; | ||
this.w = w; | ||
} | ||
Plane.fromPoints = function (a, b, c) { | ||
var n = b.minus(a).cross(c.minus(a)).unit(); | ||
static fromPoints(a, b, c) { | ||
const n = b.minus(a).cross(c.minus(a)).unit(); | ||
return new Plane(n, n.dot(a)); | ||
}; | ||
Plane.prototype.clone = function () { | ||
} | ||
clone() { | ||
return new Plane(this.normal.clone(), this.w); | ||
}; | ||
Plane.prototype.flip = function () { | ||
} | ||
flip() { | ||
this.normal = this.normal.negated(); | ||
this.w = -this.w; | ||
}; | ||
} | ||
// Split `polygon` by this plane if needed, then put the polygon or polygon | ||
@@ -324,15 +304,14 @@ // fragments in the appropriate lists. Coplanar polygons go into either | ||
// either `front` or `back`. | ||
Plane.prototype.splitPolygon = function (polygon, coplanarFront, coplanarBack, front, back) { | ||
var COPLANAR = 0; | ||
var FRONT = 1; | ||
var BACK = 2; | ||
var SPANNING = 3; | ||
splitPolygon(polygon, coplanarFront, coplanarBack, front, back) { | ||
const COPLANAR = 0; | ||
const FRONT = 1; | ||
const BACK = 2; | ||
const SPANNING = 3; | ||
// Classify each point as well as the entire polygon into one of the above | ||
// four classes. | ||
var polygonType = 0; | ||
var types = []; | ||
for (var _i = 0, _a = polygon.vertices; _i < _a.length; _i++) { | ||
var vertex = _a[_i]; | ||
var t = this.normal.dot(vertex.pos) - this.w; | ||
var type = t < -Plane.EPSILON ? BACK : t > Plane.EPSILON ? FRONT : COPLANAR; | ||
let polygonType = 0; | ||
const types = []; | ||
for (const vertex of polygon.vertices) { | ||
const t = this.normal.dot(vertex.pos) - this.w; | ||
const type = t < -Plane.EPSILON ? BACK : t > Plane.EPSILON ? FRONT : COPLANAR; | ||
polygonType |= type; | ||
@@ -355,10 +334,10 @@ types.push(type); | ||
case SPANNING: { | ||
var f = []; | ||
var b = []; | ||
for (var i = 0; i < polygon.vertices.length; i++) { | ||
var j = (i + 1) % polygon.vertices.length; | ||
var ti = types[i]; | ||
var tj = types[j]; | ||
var vi = polygon.vertices[i]; | ||
var vj = polygon.vertices[j]; | ||
const f = []; | ||
const b = []; | ||
for (let i = 0; i < polygon.vertices.length; i++) { | ||
const j = (i + 1) % polygon.vertices.length; | ||
const ti = types[i]; | ||
const tj = types[j]; | ||
const vi = polygon.vertices[i]; | ||
const vj = polygon.vertices[j]; | ||
if (ti !== BACK) { | ||
@@ -371,5 +350,5 @@ f.push(vi); | ||
if ((ti | tj) === SPANNING) { | ||
var t = (this.w - this.normal.dot(vi.pos)) / | ||
const t = (this.w - this.normal.dot(vi.pos)) / | ||
this.normal.dot(vj.pos.minus(vi.pos)); | ||
var v = vi.interpolate(vj, t); | ||
const v = vi.interpolate(vj, t); | ||
f.push(v); | ||
@@ -388,8 +367,7 @@ b.push(v.clone()); | ||
} | ||
}; | ||
// the tolerance used by `splitPolygon()` to decide if a | ||
// point is on the plane. | ||
Plane.EPSILON = 1e-5; | ||
return Plane; | ||
}()); | ||
} | ||
} | ||
// the tolerance used by `splitPolygon()` to decide if a | ||
// point is on the plane. | ||
Plane.EPSILON = 1e-5; | ||
/** | ||
@@ -405,5 +383,4 @@ * Represents a convex polygon. The vertices used to initialize a polygon must | ||
*/ | ||
var Polygon = /** @class */ (function () { | ||
function Polygon(vertices, shared) { | ||
if (shared === void 0) { shared = null; } | ||
class Polygon { | ||
constructor(vertices, shared = null) { | ||
this.vertices = vertices; | ||
@@ -413,16 +390,15 @@ this.shared = shared; | ||
} | ||
Polygon.prototype.clone = function () { | ||
var vertices = this.vertices.map(function (v) { | ||
clone() { | ||
const vertices = this.vertices.map((v) => { | ||
return v.clone(); | ||
}); | ||
return new Polygon(vertices, this.shared); | ||
}; | ||
Polygon.prototype.flip = function () { | ||
this.vertices.reverse().map(function (v) { | ||
} | ||
flip() { | ||
this.vertices.reverse().map((v) => { | ||
v.flip(); | ||
}); | ||
this.plane.flip(); | ||
}; | ||
return Polygon; | ||
}()); | ||
} | ||
} | ||
/** | ||
@@ -435,4 +411,4 @@ * Holds a node in a BSP tree. A BSP tree is built from a collection of polygons | ||
*/ | ||
var Node = /** @class */ (function () { | ||
function Node(polygons) { | ||
class Node { | ||
constructor(polygons) { | ||
this.plane = null; | ||
@@ -446,16 +422,15 @@ this.front = null; | ||
} | ||
Node.prototype.clone = function () { | ||
var node = new Node(); | ||
clone() { | ||
const node = new Node(); | ||
node.plane = this.plane && this.plane.clone(); | ||
node.front = this.front && this.front.clone(); | ||
node.back = this.back && this.back.clone(); | ||
node.polygons = this.polygons.map(function (p) { | ||
node.polygons = this.polygons.map((p) => { | ||
return p.clone(); | ||
}); | ||
return node; | ||
}; | ||
} | ||
// Convert solid space to empty space and empty space to solid space. | ||
Node.prototype.invert = function () { | ||
for (var _i = 0, _a = this.polygons; _i < _a.length; _i++) { | ||
var polygon = _a[_i]; | ||
invert() { | ||
for (const polygon of this.polygons) { | ||
polygon.flip(); | ||
@@ -470,16 +445,15 @@ } | ||
} | ||
var temp = this.front; | ||
const temp = this.front; | ||
this.front = this.back; | ||
this.back = temp; | ||
}; | ||
} | ||
// Recursively remove all polygons in `polygons` that are inside this BSP | ||
// tree. | ||
Node.prototype.clipPolygons = function (polygons) { | ||
clipPolygons(polygons) { | ||
if (!this.plane) { | ||
return polygons.slice(); | ||
} | ||
var front = []; | ||
var back = []; | ||
for (var _i = 0, polygons_1 = polygons; _i < polygons_1.length; _i++) { | ||
var polygon = polygons_1[_i]; | ||
let front = []; | ||
let back = []; | ||
for (const polygon of polygons) { | ||
this.plane.splitPolygon(polygon, front, back, front, back); | ||
@@ -492,6 +466,6 @@ } | ||
return front.concat(back); | ||
}; | ||
} | ||
// Remove all polygons in this BSP tree that are inside the other BSP tree | ||
// `bsp`. | ||
Node.prototype.clipTo = function (bsp) { | ||
clipTo(bsp) { | ||
this.polygons = bsp.clipPolygons(this.polygons); | ||
@@ -504,6 +478,6 @@ if (this.front) { | ||
} | ||
}; | ||
} | ||
// Return a list of all polygons in this BSP tree. | ||
Node.prototype.allPolygons = function () { | ||
var polygons = this.polygons.slice(); | ||
allPolygons() { | ||
let polygons = this.polygons.slice(); | ||
if (this.front) { | ||
@@ -516,3 +490,3 @@ polygons = polygons.concat(this.front.allPolygons()); | ||
return polygons; | ||
}; | ||
} | ||
// Build a BSP tree out of `polygons`. When called on an existing tree, the | ||
@@ -522,3 +496,3 @@ // new polygons are filtered down to the bottom of the tree and become new | ||
// (no heuristic is used to pick a good split). | ||
Node.prototype.build = function (polygons) { | ||
build(polygons) { | ||
if (!polygons.length) { | ||
@@ -530,6 +504,5 @@ return; | ||
} | ||
var front = []; | ||
var back = []; | ||
for (var _i = 0, polygons_2 = polygons; _i < polygons_2.length; _i++) { | ||
var polygon = polygons_2[_i]; | ||
const front = []; | ||
const back = []; | ||
for (const polygon of polygons) { | ||
this.plane.splitPolygon(polygon, this.polygons, this.polygons, front, back); | ||
@@ -549,4 +522,3 @@ } | ||
} | ||
}; | ||
return Node; | ||
}()); | ||
} | ||
} |
{ | ||
"name": "three-csg-ts", | ||
"version": "1.0.6", | ||
"version": "2.0.0", | ||
"description": "CSG library for use with THREE.js", | ||
@@ -34,18 +34,18 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@types/jest": "^25.2.3", | ||
"@types/node": "^12.19.2", | ||
"@typescript-eslint/eslint-plugin": "^3.10.1", | ||
"@typescript-eslint/parser": "^3.10.1", | ||
"eslint": "^7.12.1", | ||
"eslint-config-prettier": "^6.14.0", | ||
"eslint-plugin-jest": "^23.20.0", | ||
"husky": "^4.3.0", | ||
"jest": "^25.5.4", | ||
"lint-staged": "^10.5.0", | ||
"prettier": "^2.1.2", | ||
"@types/jest": "^26.0.19", | ||
"@types/node": "^14.14.13", | ||
"@typescript-eslint/eslint-plugin": "^4.9.1", | ||
"@typescript-eslint/parser": "^4.9.1", | ||
"eslint": "^7.15.0", | ||
"eslint-config-prettier": "^7.0.0", | ||
"eslint-plugin-jest": "^24.1.3", | ||
"husky": "^4.3.6", | ||
"jest": "^26.6.3", | ||
"lint-staged": "^10.5.3", | ||
"prettier": "^2.2.1", | ||
"prettier-plugin-organize-imports": "^1.1.1", | ||
"standard-version": "^9.0.0", | ||
"three": "^0.121.1", | ||
"ts-jest": "^25.5.1", | ||
"typescript": "^3.9.7" | ||
"three": "^0.123.0", | ||
"ts-jest": "^26.4.4", | ||
"typescript": "^4.1.3" | ||
}, | ||
@@ -52,0 +52,0 @@ "peerDependencies": { |
29589
591