brepjs 18.101.0 → 18.102.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/brepjs.cjs +140 -0
- package/dist/brepjs.js +136 -3
- package/dist/index.d.ts +2 -1
- package/dist/operations/instanceFns.d.ts +66 -0
- package/package.json +1 -1
package/dist/brepjs.cjs
CHANGED
|
@@ -2132,6 +2132,139 @@ function roof(w, options) {
|
|
|
2132
2132
|
}
|
|
2133
2133
|
}
|
|
2134
2134
|
//#endregion
|
|
2135
|
+
//#region src/operations/instanceFns.ts
|
|
2136
|
+
/**
|
|
2137
|
+
* Transform-only instancing — hold ONE source shape + N placements without
|
|
2138
|
+
* copying the kernel shape. Real geometry (a Compound, or a fused solid) or a
|
|
2139
|
+
* render payload (one mesh + N matrices) is produced only on demand.
|
|
2140
|
+
*
|
|
2141
|
+
* A 10x10 grid is 1 solid + 100 transforms, not 100 booleans. Materialize-on-
|
|
2142
|
+
* export keeps the kernel work deferred; `instancedMesh` meshes the source once
|
|
2143
|
+
* for an instanced (e.g. three.js InstancedMesh) preview.
|
|
2144
|
+
*/
|
|
2145
|
+
function translation(v) {
|
|
2146
|
+
return [
|
|
2147
|
+
[
|
|
2148
|
+
1,
|
|
2149
|
+
0,
|
|
2150
|
+
0,
|
|
2151
|
+
v[0]
|
|
2152
|
+
],
|
|
2153
|
+
[
|
|
2154
|
+
0,
|
|
2155
|
+
1,
|
|
2156
|
+
0,
|
|
2157
|
+
v[1]
|
|
2158
|
+
],
|
|
2159
|
+
[
|
|
2160
|
+
0,
|
|
2161
|
+
0,
|
|
2162
|
+
1,
|
|
2163
|
+
v[2]
|
|
2164
|
+
],
|
|
2165
|
+
[
|
|
2166
|
+
0,
|
|
2167
|
+
0,
|
|
2168
|
+
0,
|
|
2169
|
+
1
|
|
2170
|
+
]
|
|
2171
|
+
];
|
|
2172
|
+
}
|
|
2173
|
+
function isVec3Array(p) {
|
|
2174
|
+
const first = p[0];
|
|
2175
|
+
return first !== void 0 && typeof first[0] === "number";
|
|
2176
|
+
}
|
|
2177
|
+
function make(source, placements, grid) {
|
|
2178
|
+
return {
|
|
2179
|
+
__instanced: true,
|
|
2180
|
+
source,
|
|
2181
|
+
placements,
|
|
2182
|
+
grid,
|
|
2183
|
+
[Symbol.dispose]() {
|
|
2184
|
+
source[Symbol.dispose]();
|
|
2185
|
+
}
|
|
2186
|
+
};
|
|
2187
|
+
}
|
|
2188
|
+
/** Type guard for an InstancedShape. */
|
|
2189
|
+
function isInstanced(x) {
|
|
2190
|
+
return typeof x === "object" && x !== null && x.__instanced === true;
|
|
2191
|
+
}
|
|
2192
|
+
/**
|
|
2193
|
+
* Instance a shape across explicit placements. `Vec3[]` is translate-only sugar
|
|
2194
|
+
* for `Matrix4x4[]`. The source is owned by the returned container.
|
|
2195
|
+
*/
|
|
2196
|
+
function instance(source, placements) {
|
|
2197
|
+
return make(source, isVec3Array(placements) ? placements.map(translation) : placements.map((m) => m.map((row) => [...row])));
|
|
2198
|
+
}
|
|
2199
|
+
/** Instance a shape across a cols x rows grid in the XY plane. */
|
|
2200
|
+
function instanceGrid(source, opts) {
|
|
2201
|
+
const { cols, rows, pitchX, pitchY } = opts;
|
|
2202
|
+
if (!Number.isInteger(cols) || !Number.isInteger(rows) || cols < 1 || rows < 1) throw new RangeError(`instanceGrid: cols and rows must be positive integers, got ${cols}x${rows}`);
|
|
2203
|
+
const placements = [];
|
|
2204
|
+
for (let i = 0; i < cols; i++) for (let j = 0; j < rows; j++) placements.push(translation([
|
|
2205
|
+
i * pitchX,
|
|
2206
|
+
j * pitchY,
|
|
2207
|
+
0
|
|
2208
|
+
]));
|
|
2209
|
+
return make(source, placements, {
|
|
2210
|
+
cols,
|
|
2211
|
+
rows,
|
|
2212
|
+
pitchX,
|
|
2213
|
+
pitchY
|
|
2214
|
+
});
|
|
2215
|
+
}
|
|
2216
|
+
/** Number of placements. */
|
|
2217
|
+
function instanceCount(inst) {
|
|
2218
|
+
return inst.placements.length;
|
|
2219
|
+
}
|
|
2220
|
+
/**
|
|
2221
|
+
* Produce real geometry: a Compound of N placed copies (default), or a single
|
|
2222
|
+
* fused solid (`fuse: true`, 3D only). This is where the N kernel transforms
|
|
2223
|
+
* happen. A grid-built instance fuses via the faster kernel `gridPattern`.
|
|
2224
|
+
*/
|
|
2225
|
+
function materialize(inst, opts = {}) {
|
|
2226
|
+
const { source, placements, grid } = inst;
|
|
2227
|
+
if (placements.length === 0) return require_errors.err(require_errors.validationError("INSTANCE_EMPTY", "materialize: instance has no placements"));
|
|
2228
|
+
if (opts.fuse) {
|
|
2229
|
+
if (!require_shapeTypes.isShape3D(source)) return require_errors.err(require_errors.validationError("MATERIALIZE_NOT_3D", "materialize({fuse:true}) requires a 3D source shape"));
|
|
2230
|
+
if (grid) return require_threadFns.gridPattern(source, [
|
|
2231
|
+
1,
|
|
2232
|
+
0,
|
|
2233
|
+
0
|
|
2234
|
+
], [
|
|
2235
|
+
0,
|
|
2236
|
+
1,
|
|
2237
|
+
0
|
|
2238
|
+
], grid.cols, grid.rows, grid.pitchX, grid.pitchY);
|
|
2239
|
+
return combine(source, placements, true);
|
|
2240
|
+
}
|
|
2241
|
+
return combine(source, placements, false);
|
|
2242
|
+
}
|
|
2243
|
+
function combine(source, placements, fuse) {
|
|
2244
|
+
const copies = [];
|
|
2245
|
+
for (const m of placements) {
|
|
2246
|
+
const placed = require_shapeFns.applyMatrix(source, m);
|
|
2247
|
+
if (!placed.ok) {
|
|
2248
|
+
for (const c of copies) c[Symbol.dispose]();
|
|
2249
|
+
return placed;
|
|
2250
|
+
}
|
|
2251
|
+
copies.push(placed.value);
|
|
2252
|
+
}
|
|
2253
|
+
const result = fuse ? require_solidBuilders.fuseAll(copies, { unsafe: true }) : require_errors.ok(require_solidBuilders.makeCompound(copies));
|
|
2254
|
+
for (const c of copies) if (!result.ok || c !== result.value) c[Symbol.dispose]();
|
|
2255
|
+
return result;
|
|
2256
|
+
}
|
|
2257
|
+
/**
|
|
2258
|
+
* Mesh the source once and return it alongside the placements — the
|
|
2259
|
+
* "one tessellation, N placements" render payload for an instanced draw.
|
|
2260
|
+
*/
|
|
2261
|
+
function instancedMesh(inst, opts) {
|
|
2262
|
+
return {
|
|
2263
|
+
geometry: require_meshFns.mesh(inst.source, opts),
|
|
2264
|
+
instances: inst.placements
|
|
2265
|
+
};
|
|
2266
|
+
}
|
|
2267
|
+
//#endregion
|
|
2135
2268
|
//#region src/kernel/solverAdapter.ts
|
|
2136
2269
|
/**
|
|
2137
2270
|
* Constraint solver adapter — analytical solver for simple assembly mates.
|
|
@@ -6788,6 +6921,7 @@ exports.getTagMetadata = require_shapeFns.getTagMetadata;
|
|
|
6788
6921
|
exports.getVertices = require_topologyQueryFns.getVertices;
|
|
6789
6922
|
exports.getVoxel = getVoxel;
|
|
6790
6923
|
exports.getWires = require_topologyQueryFns.getWires;
|
|
6924
|
+
exports.gridPattern = require_threadFns.gridPattern;
|
|
6791
6925
|
exports.guidedSweep = require_loftFns.guidedSweep;
|
|
6792
6926
|
exports.heal = heal;
|
|
6793
6927
|
exports.healFace = require_healingFns.healFace;
|
|
@@ -6810,6 +6944,10 @@ exports.initFromManifold = require_shapeTypes.initFromManifold;
|
|
|
6810
6944
|
exports.initFromOC = require_shapeTypes.initFromOC;
|
|
6811
6945
|
exports.initVoxel = initVoxel;
|
|
6812
6946
|
exports.innerWires = require_faceFns.innerWires;
|
|
6947
|
+
exports.instance = instance;
|
|
6948
|
+
exports.instanceCount = instanceCount;
|
|
6949
|
+
exports.instanceGrid = instanceGrid;
|
|
6950
|
+
exports.instancedMesh = instancedMesh;
|
|
6813
6951
|
exports.interpolateCurve = require_curveFns.interpolateCurve;
|
|
6814
6952
|
exports.intersect = intersect;
|
|
6815
6953
|
exports.intersect2D = require_boolean2D.intersect2D;
|
|
@@ -6840,6 +6978,7 @@ exports.isFace = require_shapeTypes.isFace;
|
|
|
6840
6978
|
exports.isFilletRadius = isFilletRadius;
|
|
6841
6979
|
exports.isInitRequest = require_workerHandler.isInitRequest;
|
|
6842
6980
|
exports.isInside2D = require_blueprintFns.isInside2D;
|
|
6981
|
+
exports.isInstanced = isInstanced;
|
|
6843
6982
|
exports.isLive = require_shapeTypes.isLive;
|
|
6844
6983
|
exports.isManifoldShell = require_shapeTypes.isManifoldShell;
|
|
6845
6984
|
exports.isNumber = isNumber;
|
|
@@ -6893,6 +7032,7 @@ exports.map = require_errors.map;
|
|
|
6893
7032
|
exports.mapBoth = require_errors.mapBoth;
|
|
6894
7033
|
exports.mapErr = require_errors.mapErr;
|
|
6895
7034
|
exports.match = require_errors.match;
|
|
7035
|
+
exports.materialize = materialize;
|
|
6896
7036
|
exports.measureArea = require_measureFns.measureArea;
|
|
6897
7037
|
exports.measureCurvatureAt = require_measureFns.measureCurvatureAt;
|
|
6898
7038
|
exports.measureCurvatureAtMid = require_measureFns.measureCurvatureAtMid;
|
package/dist/brepjs.js
CHANGED
|
@@ -13,9 +13,9 @@ import { a as curveIsPeriodic, c as curvePointAt, d as flipOrientation, f as get
|
|
|
13
13
|
import { a as meshEdges$1, c as createMeshCache, i as mesh$1, n as exportSTEP, o as meshMultiLOD, r as exportSTL, s as clearMeshCache, t as exportIGES } from "./meshFns-CAAarhVm.js";
|
|
14
14
|
import { n as getAtOrThrow, r as lastOrThrow, t as firstOrThrow } from "./arrayAccess-DrUGPADn.js";
|
|
15
15
|
import { _ as makeThreePointArc, d as makeCircle, h as makeLine, l as makeBSplineInterpolation, n as fill, r as makeFace, s as assembleWire } from "./surfaceBuilders-Bww4jhBo.js";
|
|
16
|
-
import { _ as section$1, b as split$1, d as booleanPipeline, f as cut$2, g as intersect$2, h as fuseAll$2, m as fuse$2, p as cutAll$2, r as makeCylinder, v as sectionToFace$1, y as slice$1 } from "./solidBuilders-Biwv2cW3.js";
|
|
16
|
+
import { _ as section$1, b as split$1, d as booleanPipeline, f as cut$2, g as intersect$2, h as fuseAll$2, m as fuse$2, p as cutAll$2, r as makeCylinder, t as makeCompound, v as sectionToFace$1, y as slice$1 } from "./solidBuilders-Biwv2cW3.js";
|
|
17
17
|
import { A as edgesOfFace, C as shellWithEvolution, D as getNurbsCurveData, E as fuseAllBisect, F as chamferDistAngle, I as toBufferGeometryData, L as toGroupedBufferGeometryData, M as sharedEdges, N as verticesOfEdge, O as getNurbsSurfaceData, P as wiresOfFace, R as toLODGeometryData, S as intersectWithEvolution, T as cutAllBisect, _ as positionOnCurve, a as healFace, b as filletWithEvolution, c as isValid$1, d as draft$1, f as fillet$1, g as variableFillet, h as thicken$1, i as heal$1, j as facesOfEdge, k as adjacentFaces, l as solidFromShell, m as shell$1, n as fixSelfIntersection, o as healSolid, p as offset$1, r as fixShape, s as healWire, t as autoHeal, u as chamfer$1, v as chamferWithEvolution, w as checkBoolean, x as fuseWithEvolution, y as cutWithEvolution, z as toLineGeometryData } from "./healingFns-Bb3eEBNm.js";
|
|
18
|
-
import { A as setJointValue, B as findNode, C as cylindricalJoint, D as planarJoint, E as mechanismDOF, F as quatRotate, H as updateNode, I as addChild, J as createAssembly, K as linearPattern, L as collectShapes, M as sphericalJoint, N as quatFromAxisAngle, O as prismaticJoint, P as quatFromTo, R as countNodes, S as addJoint, T as jointTransform, U as walkAssembly, V as removeChild, W as circularPattern, _ as exportURDF, a as deserializeHistory, b as inverseKinematics, c as modifyStep, d as replayFrom, f as replayHistory, g as undoLast, h as stepsFrom, i as createRegistry, j as setJointValues, k as revoluteJoint, l as registerOperation, m as stepCount, n as addStep, o as findStep, p as serializeHistory, q as exportAssemblySTEP, r as createHistory, s as getShape, t as thread, u as registerShape, v as importURDF, w as forwardKinematics, x as jointTrajectory, y as jointsFromDH, z as createAssemblyNode } from "./threadFns-8rKpQXiR.js";
|
|
18
|
+
import { A as setJointValue, B as findNode, C as cylindricalJoint, D as planarJoint, E as mechanismDOF, F as quatRotate, G as gridPattern, H as updateNode, I as addChild, J as createAssembly, K as linearPattern, L as collectShapes, M as sphericalJoint, N as quatFromAxisAngle, O as prismaticJoint, P as quatFromTo, R as countNodes, S as addJoint, T as jointTransform, U as walkAssembly, V as removeChild, W as circularPattern, _ as exportURDF, a as deserializeHistory, b as inverseKinematics, c as modifyStep, d as replayFrom, f as replayHistory, g as undoLast, h as stepsFrom, i as createRegistry, j as setJointValues, k as revoluteJoint, l as registerOperation, m as stepCount, n as addStep, o as findStep, p as serializeHistory, q as exportAssemblySTEP, r as createHistory, s as getShape, t as thread, u as registerShape, v as importURDF, w as forwardKinematics, x as jointTrajectory, y as jointsFromDH, z as createAssemblyNode } from "./threadFns-8rKpQXiR.js";
|
|
19
19
|
import { n as BaseSketcher2d, r as organiseBlueprints, t as BlueprintSketcher } from "./blueprintSketcher-CEQ8s7TD.js";
|
|
20
20
|
import { a as createTypedFinder, i as wireFinder, n as edgeFinder, r as faceFinder, t as getSingleFace } from "./helpers-DT44wBAD.js";
|
|
21
21
|
import { A as sketchEllipse, D as makeBaseBox, E as deserializeDrawing, F as sketchRectangle, I as sketchRoundedRectangle, L as FaceSketcher, M as sketchHelix, N as sketchParametricFunction, O as polysideInnerRadius, P as sketchPolysides, R as Sketcher, S as drawText, _ as drawPolysides, a as drawingIntersect, b as drawSingleCircle, c as rotateDrawing, d as drawFaceOutline, f as drawProjection, g as drawPointsInterpolation, h as drawParametricFunction, i as drawingFuse, j as sketchFaceOffset, k as sketchCircle, l as scaleDrawing, m as drawEllipse, n as drawingCut, o as drawingToSketchOnPlane, p as drawCircle, r as drawingFillet, s as mirrorDrawing, t as drawingChamfer, u as translateDrawing, v as drawRectangle, w as draw, x as drawSingleEllipse, y as drawRoundedRectangle } from "./drawFns-CsXPFyDe.js";
|
|
@@ -2143,6 +2143,139 @@ function roof(w, options) {
|
|
|
2143
2143
|
}
|
|
2144
2144
|
}
|
|
2145
2145
|
//#endregion
|
|
2146
|
+
//#region src/operations/instanceFns.ts
|
|
2147
|
+
/**
|
|
2148
|
+
* Transform-only instancing — hold ONE source shape + N placements without
|
|
2149
|
+
* copying the kernel shape. Real geometry (a Compound, or a fused solid) or a
|
|
2150
|
+
* render payload (one mesh + N matrices) is produced only on demand.
|
|
2151
|
+
*
|
|
2152
|
+
* A 10x10 grid is 1 solid + 100 transforms, not 100 booleans. Materialize-on-
|
|
2153
|
+
* export keeps the kernel work deferred; `instancedMesh` meshes the source once
|
|
2154
|
+
* for an instanced (e.g. three.js InstancedMesh) preview.
|
|
2155
|
+
*/
|
|
2156
|
+
function translation(v) {
|
|
2157
|
+
return [
|
|
2158
|
+
[
|
|
2159
|
+
1,
|
|
2160
|
+
0,
|
|
2161
|
+
0,
|
|
2162
|
+
v[0]
|
|
2163
|
+
],
|
|
2164
|
+
[
|
|
2165
|
+
0,
|
|
2166
|
+
1,
|
|
2167
|
+
0,
|
|
2168
|
+
v[1]
|
|
2169
|
+
],
|
|
2170
|
+
[
|
|
2171
|
+
0,
|
|
2172
|
+
0,
|
|
2173
|
+
1,
|
|
2174
|
+
v[2]
|
|
2175
|
+
],
|
|
2176
|
+
[
|
|
2177
|
+
0,
|
|
2178
|
+
0,
|
|
2179
|
+
0,
|
|
2180
|
+
1
|
|
2181
|
+
]
|
|
2182
|
+
];
|
|
2183
|
+
}
|
|
2184
|
+
function isVec3Array(p) {
|
|
2185
|
+
const first = p[0];
|
|
2186
|
+
return first !== void 0 && typeof first[0] === "number";
|
|
2187
|
+
}
|
|
2188
|
+
function make(source, placements, grid) {
|
|
2189
|
+
return {
|
|
2190
|
+
__instanced: true,
|
|
2191
|
+
source,
|
|
2192
|
+
placements,
|
|
2193
|
+
grid,
|
|
2194
|
+
[Symbol.dispose]() {
|
|
2195
|
+
source[Symbol.dispose]();
|
|
2196
|
+
}
|
|
2197
|
+
};
|
|
2198
|
+
}
|
|
2199
|
+
/** Type guard for an InstancedShape. */
|
|
2200
|
+
function isInstanced(x) {
|
|
2201
|
+
return typeof x === "object" && x !== null && x.__instanced === true;
|
|
2202
|
+
}
|
|
2203
|
+
/**
|
|
2204
|
+
* Instance a shape across explicit placements. `Vec3[]` is translate-only sugar
|
|
2205
|
+
* for `Matrix4x4[]`. The source is owned by the returned container.
|
|
2206
|
+
*/
|
|
2207
|
+
function instance(source, placements) {
|
|
2208
|
+
return make(source, isVec3Array(placements) ? placements.map(translation) : placements.map((m) => m.map((row) => [...row])));
|
|
2209
|
+
}
|
|
2210
|
+
/** Instance a shape across a cols x rows grid in the XY plane. */
|
|
2211
|
+
function instanceGrid(source, opts) {
|
|
2212
|
+
const { cols, rows, pitchX, pitchY } = opts;
|
|
2213
|
+
if (!Number.isInteger(cols) || !Number.isInteger(rows) || cols < 1 || rows < 1) throw new RangeError(`instanceGrid: cols and rows must be positive integers, got ${cols}x${rows}`);
|
|
2214
|
+
const placements = [];
|
|
2215
|
+
for (let i = 0; i < cols; i++) for (let j = 0; j < rows; j++) placements.push(translation([
|
|
2216
|
+
i * pitchX,
|
|
2217
|
+
j * pitchY,
|
|
2218
|
+
0
|
|
2219
|
+
]));
|
|
2220
|
+
return make(source, placements, {
|
|
2221
|
+
cols,
|
|
2222
|
+
rows,
|
|
2223
|
+
pitchX,
|
|
2224
|
+
pitchY
|
|
2225
|
+
});
|
|
2226
|
+
}
|
|
2227
|
+
/** Number of placements. */
|
|
2228
|
+
function instanceCount(inst) {
|
|
2229
|
+
return inst.placements.length;
|
|
2230
|
+
}
|
|
2231
|
+
/**
|
|
2232
|
+
* Produce real geometry: a Compound of N placed copies (default), or a single
|
|
2233
|
+
* fused solid (`fuse: true`, 3D only). This is where the N kernel transforms
|
|
2234
|
+
* happen. A grid-built instance fuses via the faster kernel `gridPattern`.
|
|
2235
|
+
*/
|
|
2236
|
+
function materialize(inst, opts = {}) {
|
|
2237
|
+
const { source, placements, grid } = inst;
|
|
2238
|
+
if (placements.length === 0) return err(validationError("INSTANCE_EMPTY", "materialize: instance has no placements"));
|
|
2239
|
+
if (opts.fuse) {
|
|
2240
|
+
if (!isShape3D(source)) return err(validationError("MATERIALIZE_NOT_3D", "materialize({fuse:true}) requires a 3D source shape"));
|
|
2241
|
+
if (grid) return gridPattern(source, [
|
|
2242
|
+
1,
|
|
2243
|
+
0,
|
|
2244
|
+
0
|
|
2245
|
+
], [
|
|
2246
|
+
0,
|
|
2247
|
+
1,
|
|
2248
|
+
0
|
|
2249
|
+
], grid.cols, grid.rows, grid.pitchX, grid.pitchY);
|
|
2250
|
+
return combine(source, placements, true);
|
|
2251
|
+
}
|
|
2252
|
+
return combine(source, placements, false);
|
|
2253
|
+
}
|
|
2254
|
+
function combine(source, placements, fuse) {
|
|
2255
|
+
const copies = [];
|
|
2256
|
+
for (const m of placements) {
|
|
2257
|
+
const placed = applyMatrix$1(source, m);
|
|
2258
|
+
if (!placed.ok) {
|
|
2259
|
+
for (const c of copies) c[Symbol.dispose]();
|
|
2260
|
+
return placed;
|
|
2261
|
+
}
|
|
2262
|
+
copies.push(placed.value);
|
|
2263
|
+
}
|
|
2264
|
+
const result = fuse ? fuseAll$2(copies, { unsafe: true }) : ok(makeCompound(copies));
|
|
2265
|
+
for (const c of copies) if (!result.ok || c !== result.value) c[Symbol.dispose]();
|
|
2266
|
+
return result;
|
|
2267
|
+
}
|
|
2268
|
+
/**
|
|
2269
|
+
* Mesh the source once and return it alongside the placements — the
|
|
2270
|
+
* "one tessellation, N placements" render payload for an instanced draw.
|
|
2271
|
+
*/
|
|
2272
|
+
function instancedMesh(inst, opts) {
|
|
2273
|
+
return {
|
|
2274
|
+
geometry: mesh$1(inst.source, opts),
|
|
2275
|
+
instances: inst.placements
|
|
2276
|
+
};
|
|
2277
|
+
}
|
|
2278
|
+
//#endregion
|
|
2146
2279
|
//#region src/kernel/solverAdapter.ts
|
|
2147
2280
|
/**
|
|
2148
2281
|
* Constraint solver adapter — analytical solver for simple assembly mates.
|
|
@@ -6526,4 +6659,4 @@ var csg_exports = /* @__PURE__ */ __exportAll({
|
|
|
6526
6659
|
withEvaluator: () => withEvaluator
|
|
6527
6660
|
});
|
|
6528
6661
|
//#endregion
|
|
6529
|
-
export { BaseSketcher2d, BlueprintSketcher, BrepBugError, BrepErrorCode, BrepWrapperError, BrepkitAdapter, CompoundSketch, DEFAULT_CAPABILITIES, DEG2RAD, DisposalScope, EXACT_BREP_CAPABILITIES, FaceSketcher, HASH_CODE_MAX, OK, OcctWasmAdapter, RAD2DEG, Sketch, Sketcher, Sketches, addChild, addHoles, addJoint, addMate, addStep, adjacentFaces, all, andThen, applyGlue, applyMatrix, approximateCurve, as2D, as3D, asTopo, assignRoles, autoHeal, bezier, blueprintToDXF, booleanPipeline, booleans_exports as booleans, boss, box, bsplineApprox, bug, cameraFromPlane, cameraLookAt, captureHint, cast, castShape, castShape3D, chamfer, chamferDistAngle as chamferDistAngleShape, chamferWithEvolution, checkAllInterferences, checkBoolean, checkInterference, circle, circularPattern, classifyPointOnFace, clearMeshCache, clone, closedWire, collect, collectShapes, colorFaces, colorShape, complexExtrude, composeTransforms, compound, compoundSketchExtrude, compoundSketchFace, compoundSketchLoft, compoundSketchRevolve, computationError, computeStraightSkeleton, cone, construction_exports as construction, convexHull, cornerFinder, countNodes, createAssembly, createAssemblyNode, createBlueprint, createCamera, createCompound, createCompoundBlueprint, createDistanceQuery, createEdge, createFace, createHandle, createHistory, createKernelHandle, createMeshCache, createNamedPlane, createOperationRegistry, createPlane, createRef, createRegistry, createShell, createSolid, createTaskQueue, createVertex, createWire, createWorkerClient, createWorkerHandler, csg_exports as csg, currentQuality, curve2dBoundingBox, curve2dDistanceFrom, curve2dFirstPoint, curve2dIsOnCurve, curve2dLastPoint, curve2dParameter, curve2dSplitAt, curve2dTangentAt, curveAxis, curveEndPoint, curveIsClosed, curveIsPeriodic, curveLength, curvePeriod, curvePointAt, curveStartPoint, curveTangentAt, cut, cut2D, cutAll, cutAllBisect, cutBlueprints, cutWithEvolution, cylinder, cylindricalJoint, defaultScorer, dequeueTask, describe, deserializeDrawing, deserializeHistory, fromBREP as deserializeShape, downcast, draft, draw, drawCircle, drawEllipse, drawFaceOutline, drawParametricFunction, drawPointsInterpolation, drawPolysides, drawProjection, drawRectangle, drawRoundedRectangle, drawSingleCircle, drawSingleEllipse, drawText, drawingChamfer, drawingCut, drawingFillet, drawingFuse, drawingIntersect, drawingToSketchOnPlane, drill, edgeFinder, edgesOfFace, ellipse, ellipseArc, ellipsoid, enqueueTask, err, exportAssemblySTEP, exportDXF, exportGlb, exportGltf, exportIGES, exportOBJ, exportSTEP, exportSTEPConfigured, exportSTL, exportThreeMF, exportURDF, extrude, extrudeAll, face, faceAxis, faceCenter, faceFinder, faceGeomType, faceOrientation, facesOfEdge, fieldBoolean, fieldContour, fieldOffset, fieldReinit, fieldShell, fill, filledFace, fillet, filletWithEvolution, findFacesByTag, findNode, findStep, fixSelfIntersection, fixShape, flatMap, flatten, flipFaceOrientation, flipOrientation, fontMetrics, forwardKinematics, fromBREP$1 as fromBREP, fromKernelDir, fromKernelPnt, fromKernelVec, fromNullable, fuse, fuse2D, fuseAll, fuseAllBisect, fuseBlueprints, fuseWithEvolution, gearGeometry, getActiveVoxelId, getBounds, getBounds2D, getCompSolids, getCurveType, getDisposalStats, getEdges, getFaceColor, getFaceOrigins, getFaceTags, getFaces, getFont, getHashCode, getShape as getHistoryShape, getKernel, getKernelCapabilities, getKernelTier, getNurbsCurveData, getNurbsSurfaceData, getOrientation, getOrientation2D, getPerformanceStats, getShapeColor, getShapeKind, getShells, getSingleFace, getSolids, getSurfaceType, getTagMetadata, getVertices, getVoxel, getWires, guidedSweep, heal, healFace, healSolid, healWire, helix, hull, importDXF, importGLB, importIGES, importOBJ, importSTEP, importSTL, importSVG, importSVGPathD, importThreeMF, importURDF, init, initFromManifold, initFromOC, initVoxel, innerWires, interpolateCurve, intersect, intersect2D, intersectBlueprints, intersectWithEvolution, invalidateShapeCache, inverseKinematics, ioNs_exports as io, ioError, is2D, is3D, isChamferRadius, isClosedWire, isCompSolid, isCompound, isDisposeRequest, isEdge, isEmpty, isEqualShape, isErr, isErrorResponse, isFace, isFilletRadius, isInitRequest, isInside2D, isLive, isManifoldShell, isNumber, isOk, isOperationRequest, isOrientedFace, isPlanarFace, isPlanarWire, isProjectionPlane, isEmpty$1 as isQueueEmpty, isSameShape, isShape1D, isShape3D, isShell, isSolid, isSuccessResponse, isValid, isValidSolid, isVertex, isWire, iterCompSolids, iterEdges, iterFaces, iterShells, iterSolids, iterTopo, iterVertices, iterWires, jointTrajectory, jointTransform, jointsFromDH, kernelCall, kernelCallRaw, kernelCallScoped, kernelError, latticeInfill, latticeInfillShape, line, linearPattern, loadFont, loft, loftAll, makeBaseBox, makeExternalGear, makeInternalGear, makePlane, makePlanetaryGear, makeProjectedEdges, manifoldShell, map, mapBoth, mapErr, match, measureArea, measureCurvatureAt, measureCurvatureAtMid, measureDistance, measureDistanceProps, measureLength, measureLinearProps, measureSurfaceProps, measureVolume, measureVolumeProps, measurement_exports as measurement, mechanismDOF, mesh, meshEdges, meshMultiLOD, minkowski, mirror, mirror2D, mirrorDrawing, mirrorJoin, modifiers_exports as modifiers, modifyStep, moduleInitError, multiSectionSweep, normalAt, offset, offsetFace, offsetMesh, offsetShape, offsetWire2D, ok, or, orElse, organiseBlueprints, orientedFace, outerWire, patterns_exports as patterns, pendingCount, pipeline, pivotPlane, planarFace, planarJoint, planarWire, planetPlacements, pocket, pointOnSurface, pointsInside, polygon, polyhedron, polysideInnerRadius, polysidesBlueprint, positionOnCurve, prewarm, primitives_exports as primitives, prismaticJoint, projectEdges, projectPointOnFace, query_exports as query, queryError, rectangularPattern, registerHandler, registerKernel, registerKernelTier, registerOperation, registerShape, registerVoxel, rejectAll, removeChild, removeHolesFromFace, repairMesh, replayFrom, replayHistory, resetDisposalStats, resetPerformanceStats, resize, resolve, resolve3D, resolveDirection, resolvePlane, resolveRef, reverseCurve, revoluteJoint, revolve, roof, rotate, rotate2D, rotateDrawing, roundedRectangleBlueprint, scale, scale2D, scaleDrawing, box$1 as sdfBox, capsule as sdfCapsule, cone$1 as sdfCone, cylinder$1 as sdfCylinder, fieldAxialRamp as sdfFieldAxialRamp, fieldClamp as sdfFieldClamp, fieldConst as sdfFieldConst, fieldFromSdf as sdfFieldFromSdf, fieldRadialRamp as sdfFieldRadialRamp, lattice as sdfLattice, plane as sdfPlane, roundedBox as sdfRoundedBox, sphere as sdfSphere, strutLattice as sdfStrutLattice, sweep as sdfSweep, torus as sdfTorus, section, sectionToFace, serializeHistory, setJointValue, setJointValues, setShapeOrigin, setTagMetadata, sewShells, shape, shapeToMeshInput, shapeType, sharedEdges, shell, shellMesh, shellShape, shellWithEvolution, simplify, sketchCircle, sketchEllipse, sketchExtrude, sketchFace, sketchFaceOffset, sketchHelix, sketchLoft, sketchOnFace2D, sketchOnPlane2D, sketchParametricFunction, sketchPolysides, sketchRectangle, sketchRevolve, sketchRoundedRectangle, sketchSweep, sketchText, sketchWires, sketcherStateError, slice, solid, solidFromShell, solveAssembly, sphere$1 as sphere, sphericalJoint, split, stepCount, stepsFrom, stretch2D, subFace, supportExtrude, supportsConstraintSketch, supportsProjection, surfaceFromGrid, surfaceFromImage, sweep$1 as sweep, tagFaces, tangentArc, tap, tapErr, textBlueprints, textMetrics, thicken, thread, threePointArc, toBREP, toBufferGeometryData, toGroupedBufferGeometryData, toKernelVec, toLODGeometryData, toLineGeometryData, toSVGPathD, toVec2, toVec3, torus$1 as torus, tpmsLattice, transformCopy, transforms_exports as transforms, translate, translate2D, translateDrawing, translatePlane, tryCatch, tryCatchAsync, twistExtrude, typeCastError, undoLast, unsupportedError, unwrap, unwrapErr, unwrapOr, unwrapOrElse, updateNode, updateRoles, uvBounds, uvCoordinates, validSolid, validatePlanetary, validationError, variableFillet, vecAdd, vecAngle, vecCross, vecDistance, vecDot, vecEquals, vecIsZero, vecLength, vecLengthSq, vecNegate, vecNormalize, vecProjectToPlane, vecRepr, vecRotate, vecScale, vecSub, vertex, vertexFinder, vertexPosition, verticesOfEdge, voxelBoolean, voxelBooleanField, voxelBooleanFieldShapes, voxelBooleanShapes, voxelField, voxelFieldFromShape, walkAssembly, windingNumbers, wire, wireFinder, wireLoop, wiresOfFace, withKernel, withKernelDir, withKernelPnt, withKernelVec, withQuality, withScope, withScopeResult, withScopeResultAsync, withTier, zip as zipResults };
|
|
6662
|
+
export { BaseSketcher2d, BlueprintSketcher, BrepBugError, BrepErrorCode, BrepWrapperError, BrepkitAdapter, CompoundSketch, DEFAULT_CAPABILITIES, DEG2RAD, DisposalScope, EXACT_BREP_CAPABILITIES, FaceSketcher, HASH_CODE_MAX, OK, OcctWasmAdapter, RAD2DEG, Sketch, Sketcher, Sketches, addChild, addHoles, addJoint, addMate, addStep, adjacentFaces, all, andThen, applyGlue, applyMatrix, approximateCurve, as2D, as3D, asTopo, assignRoles, autoHeal, bezier, blueprintToDXF, booleanPipeline, booleans_exports as booleans, boss, box, bsplineApprox, bug, cameraFromPlane, cameraLookAt, captureHint, cast, castShape, castShape3D, chamfer, chamferDistAngle as chamferDistAngleShape, chamferWithEvolution, checkAllInterferences, checkBoolean, checkInterference, circle, circularPattern, classifyPointOnFace, clearMeshCache, clone, closedWire, collect, collectShapes, colorFaces, colorShape, complexExtrude, composeTransforms, compound, compoundSketchExtrude, compoundSketchFace, compoundSketchLoft, compoundSketchRevolve, computationError, computeStraightSkeleton, cone, construction_exports as construction, convexHull, cornerFinder, countNodes, createAssembly, createAssemblyNode, createBlueprint, createCamera, createCompound, createCompoundBlueprint, createDistanceQuery, createEdge, createFace, createHandle, createHistory, createKernelHandle, createMeshCache, createNamedPlane, createOperationRegistry, createPlane, createRef, createRegistry, createShell, createSolid, createTaskQueue, createVertex, createWire, createWorkerClient, createWorkerHandler, csg_exports as csg, currentQuality, curve2dBoundingBox, curve2dDistanceFrom, curve2dFirstPoint, curve2dIsOnCurve, curve2dLastPoint, curve2dParameter, curve2dSplitAt, curve2dTangentAt, curveAxis, curveEndPoint, curveIsClosed, curveIsPeriodic, curveLength, curvePeriod, curvePointAt, curveStartPoint, curveTangentAt, cut, cut2D, cutAll, cutAllBisect, cutBlueprints, cutWithEvolution, cylinder, cylindricalJoint, defaultScorer, dequeueTask, describe, deserializeDrawing, deserializeHistory, fromBREP as deserializeShape, downcast, draft, draw, drawCircle, drawEllipse, drawFaceOutline, drawParametricFunction, drawPointsInterpolation, drawPolysides, drawProjection, drawRectangle, drawRoundedRectangle, drawSingleCircle, drawSingleEllipse, drawText, drawingChamfer, drawingCut, drawingFillet, drawingFuse, drawingIntersect, drawingToSketchOnPlane, drill, edgeFinder, edgesOfFace, ellipse, ellipseArc, ellipsoid, enqueueTask, err, exportAssemblySTEP, exportDXF, exportGlb, exportGltf, exportIGES, exportOBJ, exportSTEP, exportSTEPConfigured, exportSTL, exportThreeMF, exportURDF, extrude, extrudeAll, face, faceAxis, faceCenter, faceFinder, faceGeomType, faceOrientation, facesOfEdge, fieldBoolean, fieldContour, fieldOffset, fieldReinit, fieldShell, fill, filledFace, fillet, filletWithEvolution, findFacesByTag, findNode, findStep, fixSelfIntersection, fixShape, flatMap, flatten, flipFaceOrientation, flipOrientation, fontMetrics, forwardKinematics, fromBREP$1 as fromBREP, fromKernelDir, fromKernelPnt, fromKernelVec, fromNullable, fuse, fuse2D, fuseAll, fuseAllBisect, fuseBlueprints, fuseWithEvolution, gearGeometry, getActiveVoxelId, getBounds, getBounds2D, getCompSolids, getCurveType, getDisposalStats, getEdges, getFaceColor, getFaceOrigins, getFaceTags, getFaces, getFont, getHashCode, getShape as getHistoryShape, getKernel, getKernelCapabilities, getKernelTier, getNurbsCurveData, getNurbsSurfaceData, getOrientation, getOrientation2D, getPerformanceStats, getShapeColor, getShapeKind, getShells, getSingleFace, getSolids, getSurfaceType, getTagMetadata, getVertices, getVoxel, getWires, gridPattern, guidedSweep, heal, healFace, healSolid, healWire, helix, hull, importDXF, importGLB, importIGES, importOBJ, importSTEP, importSTL, importSVG, importSVGPathD, importThreeMF, importURDF, init, initFromManifold, initFromOC, initVoxel, innerWires, instance, instanceCount, instanceGrid, instancedMesh, interpolateCurve, intersect, intersect2D, intersectBlueprints, intersectWithEvolution, invalidateShapeCache, inverseKinematics, ioNs_exports as io, ioError, is2D, is3D, isChamferRadius, isClosedWire, isCompSolid, isCompound, isDisposeRequest, isEdge, isEmpty, isEqualShape, isErr, isErrorResponse, isFace, isFilletRadius, isInitRequest, isInside2D, isInstanced, isLive, isManifoldShell, isNumber, isOk, isOperationRequest, isOrientedFace, isPlanarFace, isPlanarWire, isProjectionPlane, isEmpty$1 as isQueueEmpty, isSameShape, isShape1D, isShape3D, isShell, isSolid, isSuccessResponse, isValid, isValidSolid, isVertex, isWire, iterCompSolids, iterEdges, iterFaces, iterShells, iterSolids, iterTopo, iterVertices, iterWires, jointTrajectory, jointTransform, jointsFromDH, kernelCall, kernelCallRaw, kernelCallScoped, kernelError, latticeInfill, latticeInfillShape, line, linearPattern, loadFont, loft, loftAll, makeBaseBox, makeExternalGear, makeInternalGear, makePlane, makePlanetaryGear, makeProjectedEdges, manifoldShell, map, mapBoth, mapErr, match, materialize, measureArea, measureCurvatureAt, measureCurvatureAtMid, measureDistance, measureDistanceProps, measureLength, measureLinearProps, measureSurfaceProps, measureVolume, measureVolumeProps, measurement_exports as measurement, mechanismDOF, mesh, meshEdges, meshMultiLOD, minkowski, mirror, mirror2D, mirrorDrawing, mirrorJoin, modifiers_exports as modifiers, modifyStep, moduleInitError, multiSectionSweep, normalAt, offset, offsetFace, offsetMesh, offsetShape, offsetWire2D, ok, or, orElse, organiseBlueprints, orientedFace, outerWire, patterns_exports as patterns, pendingCount, pipeline, pivotPlane, planarFace, planarJoint, planarWire, planetPlacements, pocket, pointOnSurface, pointsInside, polygon, polyhedron, polysideInnerRadius, polysidesBlueprint, positionOnCurve, prewarm, primitives_exports as primitives, prismaticJoint, projectEdges, projectPointOnFace, query_exports as query, queryError, rectangularPattern, registerHandler, registerKernel, registerKernelTier, registerOperation, registerShape, registerVoxel, rejectAll, removeChild, removeHolesFromFace, repairMesh, replayFrom, replayHistory, resetDisposalStats, resetPerformanceStats, resize, resolve, resolve3D, resolveDirection, resolvePlane, resolveRef, reverseCurve, revoluteJoint, revolve, roof, rotate, rotate2D, rotateDrawing, roundedRectangleBlueprint, scale, scale2D, scaleDrawing, box$1 as sdfBox, capsule as sdfCapsule, cone$1 as sdfCone, cylinder$1 as sdfCylinder, fieldAxialRamp as sdfFieldAxialRamp, fieldClamp as sdfFieldClamp, fieldConst as sdfFieldConst, fieldFromSdf as sdfFieldFromSdf, fieldRadialRamp as sdfFieldRadialRamp, lattice as sdfLattice, plane as sdfPlane, roundedBox as sdfRoundedBox, sphere as sdfSphere, strutLattice as sdfStrutLattice, sweep as sdfSweep, torus as sdfTorus, section, sectionToFace, serializeHistory, setJointValue, setJointValues, setShapeOrigin, setTagMetadata, sewShells, shape, shapeToMeshInput, shapeType, sharedEdges, shell, shellMesh, shellShape, shellWithEvolution, simplify, sketchCircle, sketchEllipse, sketchExtrude, sketchFace, sketchFaceOffset, sketchHelix, sketchLoft, sketchOnFace2D, sketchOnPlane2D, sketchParametricFunction, sketchPolysides, sketchRectangle, sketchRevolve, sketchRoundedRectangle, sketchSweep, sketchText, sketchWires, sketcherStateError, slice, solid, solidFromShell, solveAssembly, sphere$1 as sphere, sphericalJoint, split, stepCount, stepsFrom, stretch2D, subFace, supportExtrude, supportsConstraintSketch, supportsProjection, surfaceFromGrid, surfaceFromImage, sweep$1 as sweep, tagFaces, tangentArc, tap, tapErr, textBlueprints, textMetrics, thicken, thread, threePointArc, toBREP, toBufferGeometryData, toGroupedBufferGeometryData, toKernelVec, toLODGeometryData, toLineGeometryData, toSVGPathD, toVec2, toVec3, torus$1 as torus, tpmsLattice, transformCopy, transforms_exports as transforms, translate, translate2D, translateDrawing, translatePlane, tryCatch, tryCatchAsync, twistExtrude, typeCastError, undoLast, unsupportedError, unwrap, unwrapErr, unwrapOr, unwrapOrElse, updateNode, updateRoles, uvBounds, uvCoordinates, validSolid, validatePlanetary, validationError, variableFillet, vecAdd, vecAngle, vecCross, vecDistance, vecDot, vecEquals, vecIsZero, vecLength, vecLengthSq, vecNegate, vecNormalize, vecProjectToPlane, vecRepr, vecRotate, vecScale, vecSub, vertex, vertexFinder, vertexPosition, verticesOfEdge, voxelBoolean, voxelBooleanField, voxelBooleanFieldShapes, voxelBooleanShapes, voxelField, voxelFieldFromShape, walkAssembly, windingNumbers, wire, wireFinder, wireLoop, wiresOfFace, withKernel, withKernelDir, withKernelPnt, withKernelVec, withQuality, withScope, withScopeResult, withScopeResultAsync, withTier, zip as zipResults };
|
package/dist/index.d.ts
CHANGED
|
@@ -118,7 +118,8 @@ export { guidedSweep, type GuidedSweepOptions } from './operations/guidedSweepFn
|
|
|
118
118
|
export { roof, type RoofOptions } from './operations/roofFns.js';
|
|
119
119
|
export { computeStraightSkeleton, type SkPoint2D, type SkeletonNode, type SkeletonFace, type StraightSkeleton, } from './operations/straightSkeleton.js';
|
|
120
120
|
export { exportAssemblySTEP, type ShapeOptions, type SupportedUnit, } from './operations/exporterFns.js';
|
|
121
|
-
export { linearPattern, circularPattern } from './operations/patternFns.js';
|
|
121
|
+
export { linearPattern, circularPattern, gridPattern } from './operations/patternFns.js';
|
|
122
|
+
export { instance, instanceGrid, materialize, instancedMesh, instanceCount, isInstanced, type InstancedShape, type InstancedMesh, type InstanceGridOptions, type MaterializeOptions, } from './operations/instanceFns.js';
|
|
122
123
|
export { createAssemblyNode, addChild, removeChild, updateNode, findNode, walkAssembly, countNodes, collectShapes, type AssemblyNode, type AssemblyNodeOptions, } from './operations/assemblyFns.js';
|
|
123
124
|
export { addMate, solveAssembly, type MateConstraint, type MateEntity, type AssemblySolveResult, } from './operations/mateFns.js';
|
|
124
125
|
export { revoluteJoint, prismaticJoint, cylindricalJoint, planarJoint, sphericalJoint, setJointValue, setJointValues, jointTransform, addJoint, forwardKinematics, mechanismDOF, type Joint, type JointDOF, type JointAxis, type JointType, type JointPose, type JointOptions, type CylindricalOptions, type PlanarOptions, type SphericalOptions, } from './operations/jointFns.js';
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Result } from '../core/result.js';
|
|
2
|
+
import { AnyShape, Dimension } from '../core/shapeTypes.js';
|
|
3
|
+
import { Matrix4x4, Vec3 } from '../core/types.js';
|
|
4
|
+
import { ShapeMesh, MeshOptions } from '../topology/meshFns.js';
|
|
5
|
+
/** Grid provenance, set by `instanceGrid`, lets `materialize({fuse})` route
|
|
6
|
+
* through the faster kernel `gridPattern` path instead of fusing N copies. */
|
|
7
|
+
interface GridSpec {
|
|
8
|
+
readonly cols: number;
|
|
9
|
+
readonly rows: number;
|
|
10
|
+
readonly pitchX: number;
|
|
11
|
+
readonly pitchY: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* One source shape replicated across N placements. Not a kernel-backed shape
|
|
15
|
+
* (no `.wrapped`) — an app-level container that owns the single source handle.
|
|
16
|
+
*/
|
|
17
|
+
export interface InstancedShape<D extends Dimension = '3D'> extends Disposable {
|
|
18
|
+
readonly __instanced: true;
|
|
19
|
+
/** The single shared source shape (owned — disposed with this container). */
|
|
20
|
+
readonly source: AnyShape<D>;
|
|
21
|
+
/** Per-instance world transforms (row-major 4x4). */
|
|
22
|
+
readonly placements: ReadonlyArray<Matrix4x4>;
|
|
23
|
+
/** Present when built by `instanceGrid` — enables the gridPattern fuse path. */
|
|
24
|
+
readonly grid?: GridSpec | undefined;
|
|
25
|
+
[Symbol.dispose](): void;
|
|
26
|
+
}
|
|
27
|
+
/** Type guard for an InstancedShape. */
|
|
28
|
+
export declare function isInstanced(x: unknown): x is InstancedShape<Dimension>;
|
|
29
|
+
/**
|
|
30
|
+
* Instance a shape across explicit placements. `Vec3[]` is translate-only sugar
|
|
31
|
+
* for `Matrix4x4[]`. The source is owned by the returned container.
|
|
32
|
+
*/
|
|
33
|
+
export declare function instance<D extends Dimension>(source: AnyShape<D>, placements: readonly Matrix4x4[] | readonly Vec3[]): InstancedShape<D>;
|
|
34
|
+
export interface InstanceGridOptions {
|
|
35
|
+
readonly cols: number;
|
|
36
|
+
readonly rows: number;
|
|
37
|
+
readonly pitchX: number;
|
|
38
|
+
readonly pitchY: number;
|
|
39
|
+
}
|
|
40
|
+
/** Instance a shape across a cols x rows grid in the XY plane. */
|
|
41
|
+
export declare function instanceGrid<D extends Dimension>(source: AnyShape<D>, opts: InstanceGridOptions): InstancedShape<D>;
|
|
42
|
+
/** Number of placements. */
|
|
43
|
+
export declare function instanceCount(inst: InstancedShape<Dimension>): number;
|
|
44
|
+
export interface MaterializeOptions {
|
|
45
|
+
/** Fuse the placed copies into a single solid (3D only). Default: false —
|
|
46
|
+
* returns a Compound of separate placed parts. */
|
|
47
|
+
readonly fuse?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Produce real geometry: a Compound of N placed copies (default), or a single
|
|
51
|
+
* fused solid (`fuse: true`, 3D only). This is where the N kernel transforms
|
|
52
|
+
* happen. A grid-built instance fuses via the faster kernel `gridPattern`.
|
|
53
|
+
*/
|
|
54
|
+
export declare function materialize<D extends Dimension>(inst: InstancedShape<D>, opts?: MaterializeOptions): Result<AnyShape<Dimension>>;
|
|
55
|
+
export interface InstancedMesh {
|
|
56
|
+
/** The source shape meshed ONCE. */
|
|
57
|
+
readonly geometry: ShapeMesh;
|
|
58
|
+
/** Per-instance transforms — feed to e.g. three.js InstancedMesh. */
|
|
59
|
+
readonly instances: ReadonlyArray<Matrix4x4>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Mesh the source once and return it alongside the placements — the
|
|
63
|
+
* "one tessellation, N placements" render payload for an instanced draw.
|
|
64
|
+
*/
|
|
65
|
+
export declare function instancedMesh(inst: InstancedShape<Dimension>, opts?: MeshOptions): InstancedMesh;
|
|
66
|
+
export {};
|