@bitbybit-dev/manifold-worker
Version:
Bit By Bit Developers Manifold Based CAD Library to Program Geometry Via WebWorker
55 lines (54 loc) • 2.52 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());
});
};
import { CrossSectionOperations } from "./operations";
import { CrossSectionShapes } from "./shapes";
import { CrossSectionTransforms } from "./transforms";
import { CrossSectionBooleans } from "./booleans";
import { CrossSectionEvaluate } from "./evaluate";
/**
* Contains various functions for Solid meshes from Manifold library https://github.com/elalish/manifold
* Thanks Manifold community for developing this kernel
*/
export class ManifoldCrossSection {
constructor(manifoldWorkerManager) {
this.manifoldWorkerManager = manifoldWorkerManager;
this.shapes = new CrossSectionShapes(manifoldWorkerManager);
this.operations = new CrossSectionOperations(manifoldWorkerManager);
this.booleans = new CrossSectionBooleans(manifoldWorkerManager);
this.transforms = new CrossSectionTransforms(manifoldWorkerManager);
this.evaluate = new CrossSectionEvaluate(manifoldWorkerManager);
}
/**
* Turns cross section into polygons
* @param inputs cross section
* @returns polygons
* @group decompose
* @shortname cross section to polygons
* @drawable false
*/
crossSectionToPolygons(inputs) {
return __awaiter(this, void 0, void 0, function* () {
return this.manifoldWorkerManager.genericCallToWorkerPromise("crossSection.crossSectionToPolygons", inputs);
});
}
/**
* Turns cross sections into polygons
* @param inputs cross sections
* @returns polygons
* @group decompose
* @shortname cross sections to polygons
* @drawable false
*/
crossSectionsToPolygons(inputs) {
return __awaiter(this, void 0, void 0, function* () {
return this.manifoldWorkerManager.genericCallToWorkerPromise("crossSection.crossSectionsToPolygons", inputs);
});
}
}