@alancnet/three-csg

0.0.1 • Public • Published

THREE.CSG

A THREE.js plugin to allow implementing boolean operations on THREE Objects(Mesh, Geometry). The boolean operations are supported by csg.js. For an overview of the CSG process, see the orginal csg.js code.

Include in Your HTML

Remember to include THREE.js before including this plugin.

<script src="dist/THREE.CSG.js"></script>

Usage

Convert between THREE object and CSG object

# convert THREE.Geometry to CSG format
var csg = THREE.CSG.fromGeometry(geometry)

# convert THREE.Mesh to CSG format
var csg = THREE.CSG.fromMesh(mesh)

# convert to THREE.Geometry
var geometry = THREE.CSG.toGeometry(csg)

# convert to THREE.Mesh
var mesh = THREE.CSG.toMesh(csg, material)

Boolean Operations

# Union
var result = A.union(B)

# Subtract
var result = A.subtract(B)

# Intersect
var result = A.intersect(B)

NOTE: Both A and B should be in CSG format for boolean operations.

Live Demo

live Demo

Development

# install dependencies
npm install

# build for production
npm run build

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.1
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.1
    0

Package Sidebar

Install

npm i @alancnet/three-csg

Weekly Downloads

0

Version

0.0.1

License

ISC

Unpacked Size

604 kB

Total Files

9

Last publish

Collaborators

  • alancnet