This repository has been archived on 2023-03-25. You can view files and clone it, but cannot push or open issues or pull requests.
mightyscape-1.1-deprecated/extensions/fablabchemnitz/papercraft/openjscad/node_modules/@jscad/io-utils/ensureManifoldness.js

19 lines
617 B
JavaScript

/**
* wrapper around internal csg methods (in case they change) to make sure
* it resuts in a manifold mesh
* @constructor
* @param {string} title - The title of the book.
* @return {csg}
*/
function ensureManifoldness (input) {
const transform = input => {
input = 'reTesselated' in input ? input.reTesselated() : input
input = 'fixTJunctions' in input ? input.fixTJunctions() : input // fixTJunctions also calls this.canonicalized() so no need to do it twice
return input
}
return input.constructor !== Array ? transform(input) : input.map(transform)
}
module.exports = ensureManifoldness