Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update "main" from "lib" to "three-csg.js" in package.json #65

Open
wants to merge 38 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
427afcf
Initial code commit for v1 alpha
chandlerprall Jan 17, 2019
9956c5f
fixed examples & readme
chandlerprall Jan 17, 2019
865b7ae
Added three-csg.js build to repo
chandlerprall Jan 17, 2019
74d9529
Updated example files with OrbitControls, timers, and face counts
dannyfritz Jan 17, 2019
1668a9e
Merge pull request #49 from dannyfritz/updated-examples
chandlerprall Jan 17, 2019
9e07df2
Fix union face bug
chandlerprall Jan 19, 2019
a1ee8ad
optimizations & realtime example
chandlerprall Jan 19, 2019
8bb0462
Added caching, fixed union bug
chandlerprall Jan 19, 2019
b428388
removed invalid test
chandlerprall Jan 19, 2019
ff0bbe8
optimizing toward realtime
chandlerprall Jan 19, 2019
08513a8
bug fixes and initial docs
chandlerprall Jan 27, 2019
49c79ad
Updated docs
chandlerprall Jan 28, 2019
5eccaa9
Clean up memory leak in realtime example
chandlerprall Feb 6, 2019
d21ed0b
enable cache in realtime example
chandlerprall Feb 6, 2019
a5f60e3
Include Three's OrbitControls in examples
chandlerprall Feb 7, 2019
76336f8
no need to make clone when creating new Triangle as Triangle construc…
Jul 3, 2019
40fa3aa
added return values types for clarification
Jul 3, 2019
5178ced
Merge pull request #54 from avalero/feature/triangleclone
chandlerprall Jul 3, 2019
6bb3b6e
Merge pull request #55 from avalero/feature/triangleTypings
chandlerprall Jul 3, 2019
e5c64a6
no need to clone a,b,c as they will be cloned on triangle constructor
Jul 3, 2019
34ca543
Merge pull request #56 from avalero/feature/optimizations
chandlerprall Jul 3, 2019
1f455d1
not used type
Jul 3, 2019
786611b
added type definitions to functions return values
Jul 3, 2019
fbb3526
added type definitions to functions return values
Jul 3, 2019
a3f24d2
BSP to buffer and from buffer
Jul 16, 2019
965c172
Triangle Test to Number Array
Jul 16, 2019
39416fa
Triangle Test fromNumberArray
Jul 16, 2019
fbcef44
Triangle Test from/to BufferArray
Jul 16, 2019
7e434e3
Triangle Test from/to BufferArray
Jul 16, 2019
c39e2b6
added test for BSP Node to Buffer from Buffer
Jul 16, 2019
53fc253
added test for BSP Node to Buffer from Buffer
Jul 16, 2019
349872e
Merge pull request #57 from avalero/feature/arraybuffer
chandlerprall Jul 16, 2019
e2384d4
boolean operations over an array of objects
Jul 23, 2019
65a21f8
boolean operations over an array of objects
Jul 23, 2019
b78b924
perform boolean operations of arrays of objects
Jul 23, 2019
6565d45
Merge pull request #58 from avalero/feature/multiboolean
chandlerprall Jul 24, 2019
6c2ea9c
Update package.json
sehyun-hwang Sep 21, 2020
ea24800
Update package.json
sehyun-hwang Apr 19, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.idea
node_modules
lib
types
32 changes: 15 additions & 17 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
The MIT License
Zlib License

Copyright (c) 2012 Chandler Prall. All rights reserved.
Copyright © 2018 Chandler Prall

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Constructive Solid Geometry library for Three.js

## Installation

### npm/yarn

`npm install --save three-csg`

`yarn add [email protected]`

### Manually

The top-level `three-csg.js` file in this repo is a UMD build you can copy into your project and include via a `<script>` tag, or by `require()`ing it in commonjs-enabled environments like `node` and `webpack`.

## Usage

There are three methods on the top level library: `union`, `intersect`, and `subtract`. Each takes the target meshes as arguments and optionally a material to apply to the new mesh as the third.

The operations take into account any translation, rotation, and scaling transforms on the source meshes and are non-destructive, leaving the original meshes fully intact. The resulting geometry is centered in its bounding box and the new mesh is positioning relative to the original objects.

### Example

```javascript
// assuming Three.js and threecsg have been included
// either by a <script> tag or require()ing them

const box = new THREE.Mesh(new THREE.BoxGeometry(1, 1, 1));
const sphere = new THREE.Mesh(new THREE.SphereGeometry(1));
sphere.position.y = 0.5; // sit the sphere's center on top of box

const material = new THREE.MeshNormalMaterial();

const unionmesh = threecsg.union(box, sphere, material); // combine box and sphere
const intersectmesh = threecsg.intersect(box, sphere, material); // find intersection of box and sphere
const subtractmesh = threecsg.subtract(box, sphere, material); // removes parts of box that don't overlap with sphere
```
Loading