UNPKG

@bitbybit-dev/manifold-worker

Version:

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

84 lines (83 loc) 3.24 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()); }); }; /** * Contains various functions for Solid meshes from Manifold library https://github.com/elalish/manifold * Thanks Manifold community for developing this kernel */ export class CrossSectionEvaluate { constructor(manifoldWorkerManager) { this.manifoldWorkerManager = manifoldWorkerManager; } /** * Get area of cross section * @param inputs cross section * @returns area of cross section * @group basic * @shortname area * @drawable false */ area(inputs) { return __awaiter(this, void 0, void 0, function* () { return this.manifoldWorkerManager.genericCallToWorkerPromise("crossSection.evaluate.area", inputs); }); } /** * Check if cross section is empty * @param inputs cross section * @returns boolean indicating emptyness * @group basic * @shortname is empty * @drawable false */ isEmpty(inputs) { return __awaiter(this, void 0, void 0, function* () { return this.manifoldWorkerManager.genericCallToWorkerPromise("crossSection.evaluate.isEmpty", inputs); }); } /** * Get number of vertices in cross section * @param inputs cross section * @returns number of vertices of cross section * @group basic * @shortname num vert * @drawable false */ numVert(inputs) { return __awaiter(this, void 0, void 0, function* () { return this.manifoldWorkerManager.genericCallToWorkerPromise("crossSection.evaluate.numVert", inputs); }); } /** * Get number of contours in cross section * @param inputs cross section * @returns number of contour of cross section * @group basic * @shortname num contour * @drawable false */ numContour(inputs) { return __awaiter(this, void 0, void 0, function* () { return this.manifoldWorkerManager.genericCallToWorkerPromise("crossSection.evaluate.numContour", inputs); }); } /** * Get the bounds of the contour as a rectangle. Output is given in two vec2 points in the array. First array is the min point and second array is the max point. * @param inputs cross section * @returns bounds of cross section * @group basic * @shortname bounds * @drawable false */ bounds(inputs) { return __awaiter(this, void 0, void 0, function* () { return this.manifoldWorkerManager.genericCallToWorkerPromise("crossSection.evaluate.bounds", inputs); }); } }