@bitbybit-dev/manifold-worker
Version:
Bit By Bit Developers Manifold Based CAD Library to Program Geometry Via WebWorker
136 lines (135 loc) • 4.97 kB
JavaScript
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
/**
* Contains various functions for Solid meshes from Manifold library https://github.com/elalish/manifold
* Thanks Manifold community for developing this kernel
*/
export class CrossSectionBooleans {
constructor(manifoldWorkerManager) {
this.manifoldWorkerManager = manifoldWorkerManager;
}
/**
* Subtract two cross sections
* @param inputs two cross sections
* @returns subtracted cross section
* @group a to b
* @shortname subtract
* @drawable true
*/
subtract(inputs) {
return __awaiter(this, void 0, void 0, function* () {
return this.manifoldWorkerManager.genericCallToWorkerPromise("crossSection.booleans.subtract", inputs);
});
}
/**
* Add two cross sections
* @param inputs two cross sections
* @returns unioned cross section
* @group a to b
* @shortname add
* @drawable true
*/
add(inputs) {
return __awaiter(this, void 0, void 0, function* () {
return this.manifoldWorkerManager.genericCallToWorkerPromise("crossSection.booleans.add", inputs);
});
}
/**
* Intersect two cross sections
* @param inputs two cross sections
* @returns intersected cross section
* @group a to b
* @shortname intersect
* @drawable true
*/
intersect(inputs) {
return __awaiter(this, void 0, void 0, function* () {
return this.manifoldWorkerManager.genericCallToWorkerPromise("crossSection.booleans.intersect", inputs);
});
}
/**
* Difference of two cross sections
* @param inputs two cross sections
* @returns difference of two cross sections
* @group 2 cross sections
* @shortname difference 2 cs
* @drawable true
*/
differenceTwo(inputs) {
return __awaiter(this, void 0, void 0, function* () {
return this.manifoldWorkerManager.genericCallToWorkerPromise("crossSection.booleans.differenceTwo", inputs);
});
}
/**
* Union of two cross sections
* @param inputs two cross sections
* @returns union of two cross sections
* @group 2 cross sections
* @shortname union 2 cs
* @drawable true
*/
unionTwo(inputs) {
return __awaiter(this, void 0, void 0, function* () {
return this.manifoldWorkerManager.genericCallToWorkerPromise("crossSection.booleans.unionTwo", inputs);
});
}
/**
* Intersection of two cross sections
* @param inputs two shapes
* @returns intersection of two cross sections
* @group 2 cross sections
* @shortname intersect 2 cs
* @drawable true
*/
intersectionTwo(inputs) {
return __awaiter(this, void 0, void 0, function* () {
return this.manifoldWorkerManager.genericCallToWorkerPromise("crossSection.booleans.intersectionTwo", inputs);
});
}
/**
* Difference of multiple cross sections
* @param inputs multiple cross sections
* @returns difference of cross sections
* @group multiple
* @shortname diff cross sections
* @drawable true
*/
difference(inputs) {
return __awaiter(this, void 0, void 0, function* () {
return this.manifoldWorkerManager.genericCallToWorkerPromise("crossSection.booleans.difference", inputs);
});
}
/**
* Union of multiple cross sections
* @param inputs multiple cross sections
* @returns union of two cross sections
* @group multiple
* @shortname union cross sections
* @drawable true
*/
union(inputs) {
return __awaiter(this, void 0, void 0, function* () {
return this.manifoldWorkerManager.genericCallToWorkerPromise("crossSection.booleans.union", inputs);
});
}
/**
* Intersection of multiple cross sections
* @param inputs two cross sections
* @returns intersection of multiple cross sections
* @group multiple
* @shortname intersection cross sections
* @drawable true
*/
intersection(inputs) {
return __awaiter(this, void 0, void 0, function* () {
return this.manifoldWorkerManager.genericCallToWorkerPromise("crossSection.booleans.intersection", inputs);
});
}
}