UNPKG

@bitbybit-dev/manifold-worker

Version:

Bit By Bit Developers Manifold Based CAD Library to Program Geometry Via WebWorker

107 lines (106 loc) 4.35 kB
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); } /** * Creates a cross section from a single polygon points * @param inputs polygon points * @returns cross section * @group create * @shortname cross section from points * @drawable true */ crossSectionFromPoints(inputs) { return __awaiter(this, void 0, void 0, function* () { return this.manifoldWorkerManager.genericCallToWorkerPromise("crossSection.crossSectionFromPoints", inputs); }); } /** * Creates a cross section from multiple polygons points * @param inputs polygons points * @returns cross section * @group create * @shortname cross section from polygons * @drawable true */ crossSectionFromPolygons(inputs) { return __awaiter(this, void 0, void 0, function* () { return this.manifoldWorkerManager.genericCallToWorkerPromise("crossSection.crossSectionFromPolygons", inputs); }); } /** * 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); }); } /** * Extracts points from a cross section * @param inputs cross section * @returns points * @group decompose * @shortname cross section to points * @drawable false */ crossSectionToPoints(inputs) { return __awaiter(this, void 0, void 0, function* () { return this.manifoldWorkerManager.genericCallToWorkerPromise("crossSection.crossSectionToPoints", 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); }); } /** * Extracts points from cross sections * @param inputs cross sections * @returns points * @group decompose * @shortname cross sections to points * @drawable false */ crossSectionsToPoints(inputs) { return __awaiter(this, void 0, void 0, function* () { return this.manifoldWorkerManager.genericCallToWorkerPromise("crossSection.crossSectionsToPoints", inputs); }); } }