brepjs 18.124.8 → 18.126.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 +689 -57
- package/dist/brepjs.js +700 -68
- package/dist/csg/builders.d.ts +21 -2
- package/dist/csg/evaluators/extrude.d.ts +5 -0
- package/dist/csg/evaluators/loft.d.ts +5 -0
- package/dist/csg/evaluators/path.d.ts +5 -0
- package/dist/csg/evaluators/profileFace.d.ts +8 -0
- package/dist/csg/evaluators/revolve.d.ts +5 -0
- package/dist/csg/expressions.d.ts +1 -0
- package/dist/csg/index.d.ts +3 -2
- package/dist/csg/segments.d.ts +44 -0
- package/dist/csg/types.d.ts +32 -1
- package/package.json +7 -7
package/dist/csg/builders.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { ScalarInput, Vec3Input } from './expressions.js';
|
|
1
|
+
import { ScalarInput, Vec2Input, Vec3Input } from './expressions.js';
|
|
2
|
+
import { Segment2D } from './segments.js';
|
|
2
3
|
import { Matrix4x4 } from '../core/types.js';
|
|
3
|
-
import { BoxNode, SphereNode, CylinderNode, ConeNode, TorusNode, PolygonNode, CircleNode, LineNode, VertexLitNode, EmptyNode, FuseNode, CutNode, IntersectNode, FuseAllNode, CutAllNode, TranslateNode, RotateNode, ScaleNode, MirrorNode, CompoundNode, InstanceNode, IRNode, SolidNode, FaceNode, EdgeNode, VertexNode } from './types.js';
|
|
4
|
+
import { BoxNode, SphereNode, CylinderNode, ConeNode, TorusNode, PolygonNode, CircleNode, LineNode, VertexLitNode, EmptyNode, FuseNode, CutNode, IntersectNode, FuseAllNode, CutAllNode, TranslateNode, RotateNode, ScaleNode, MirrorNode, ExtrudeNode, RevolveNode, LoftNode, PathNode, CompoundNode, InstanceNode, IRNode, SolidNode, FaceNode, EdgeNode, VertexNode } from './types.js';
|
|
4
5
|
export declare function box(x: ScalarInput, y: ScalarInput, z: ScalarInput): BoxNode;
|
|
5
6
|
export declare function sphere(radius: ScalarInput): SphereNode;
|
|
6
7
|
export declare function cylinder(radius: ScalarInput, height: ScalarInput): CylinderNode;
|
|
@@ -33,6 +34,24 @@ export interface MirrorOptions {
|
|
|
33
34
|
readonly at?: Vec3Input | undefined;
|
|
34
35
|
}
|
|
35
36
|
export declare function mirror(target: IRNode, options?: MirrorOptions): MirrorNode;
|
|
37
|
+
export declare function extrude(profile: FaceNode, vector: Vec3Input): ExtrudeNode;
|
|
38
|
+
/** Open (or incidentally closed) planar path in the XY plane at z = 0,
|
|
39
|
+
* producing a Wire. Segments come from `lineTo`/`arcTo`/`bezierTo`/
|
|
40
|
+
* `ellipseArcTo`. */
|
|
41
|
+
export declare function path(start: Vec2Input, segments: ReadonlyArray<Segment2D>): PathNode;
|
|
42
|
+
export interface LoftOptions {
|
|
43
|
+
readonly ruled?: boolean | undefined;
|
|
44
|
+
}
|
|
45
|
+
/** Loft through two or more face-producing sections (default ruled). */
|
|
46
|
+
export declare function loft(sections: ReadonlyArray<FaceNode>, options?: LoftOptions): LoftNode;
|
|
47
|
+
export interface RevolveOptions {
|
|
48
|
+
readonly axis?: Vec3Input | undefined;
|
|
49
|
+
readonly at?: Vec3Input | undefined;
|
|
50
|
+
}
|
|
51
|
+
/** Angle is in degrees (matching `rotate`); defaults to a full revolution
|
|
52
|
+
* around the Z axis at the origin. Evaluation clamps angles above 360 to one
|
|
53
|
+
* revolution (kernels diverge past 2*pi) and rejects non-positive angles. */
|
|
54
|
+
export declare function revolve(profile: FaceNode, angle?: ScalarInput, options?: RevolveOptions): RevolveNode;
|
|
36
55
|
export declare function compound(children: ReadonlyArray<IRNode>): CompoundNode;
|
|
37
56
|
export declare function instance(source: IRNode, placements: ReadonlyArray<Matrix4x4>, fuse?: boolean): InstanceNode;
|
|
38
57
|
export type { FaceNode, EdgeNode, VertexNode, SolidNode };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Result } from '../../core/result.js';
|
|
2
|
+
import { AnyShape, Dimension } from '../../core/shapeTypes.js';
|
|
3
|
+
import { ExtrudeNode } from '../types.js';
|
|
4
|
+
import { EvalContext } from './context.js';
|
|
5
|
+
export declare function evalExtrude(node: ExtrudeNode, ctx: EvalContext): Result<AnyShape<Dimension>>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Result } from '../../core/result.js';
|
|
2
|
+
import { AnyShape, Dimension } from '../../core/shapeTypes.js';
|
|
3
|
+
import { LoftNode } from '../types.js';
|
|
4
|
+
import { EvalContext } from './context.js';
|
|
5
|
+
export declare function evalLoft(node: LoftNode, ctx: EvalContext): Result<AnyShape<Dimension>>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Result } from '../../core/result.js';
|
|
2
|
+
import { AnyShape, Dimension } from '../../core/shapeTypes.js';
|
|
3
|
+
import { PathNode } from '../types.js';
|
|
4
|
+
import { EvalContext } from './context.js';
|
|
5
|
+
export declare function evalPath(node: PathNode, ctx: EvalContext): Result<AnyShape<Dimension>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Result } from '../../core/result.js';
|
|
2
|
+
import { Dimension } from '../../core/shapeTypes.js';
|
|
3
|
+
import { OrientedFace, PlanarFace } from '../../core/validityTypes.js';
|
|
4
|
+
import { IRNode } from '../types.js';
|
|
5
|
+
import { EvalContext } from './context.js';
|
|
6
|
+
/** Evaluate a profile child and prove it is an oriented planar face — the
|
|
7
|
+
* input contract shared by every profile-consuming feature node. */
|
|
8
|
+
export declare function resolveProfileFace(ctx: EvalContext, profile: IRNode, where: string): Result<OrientedFace<Dimension> & PlanarFace<Dimension>>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Result } from '../../core/result.js';
|
|
2
|
+
import { AnyShape, Dimension } from '../../core/shapeTypes.js';
|
|
3
|
+
import { RevolveNode } from '../types.js';
|
|
4
|
+
import { EvalContext } from './context.js';
|
|
5
|
+
export declare function evalRevolve(node: RevolveNode, ctx: EvalContext): Result<AnyShape<Dimension>>;
|
|
@@ -69,4 +69,5 @@ export declare function asVec2Expr(input: Vec2Input): Expr;
|
|
|
69
69
|
export declare function evalExpr(expr: Expr, env: Env): Result<ExprValue>;
|
|
70
70
|
export declare function evalScalar(expr: Expr, env: Env, where: string): Result<number>;
|
|
71
71
|
export declare function evalVec3(expr: Expr, env: Env, where: string): Result<Vec3>;
|
|
72
|
+
export declare function evalVec2(expr: Expr, env: Env, where: string): Result<Vec2>;
|
|
72
73
|
export declare function projectEnv(env: Env, deps: ReadonlySet<string>): Env;
|
package/dist/csg/index.d.ts
CHANGED
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
* parameterize via named expression bindings; evaluate against the active
|
|
6
6
|
* kernel with subtree-level cache reuse for incremental parametric edits.
|
|
7
7
|
*/
|
|
8
|
-
export { box, sphere, cylinder, cone, torus, polygon, circle, line, vertex, emptySolid, emptyFace, emptyWire, fuse, cut, intersect, fuseAll, cutAll, translate, rotate, scale, mirror, compound, instance, type RotateOptions, type ScaleOptions, type MirrorOptions, } from './builders.js';
|
|
8
|
+
export { box, sphere, cylinder, cone, torus, polygon, circle, line, vertex, emptySolid, emptyFace, emptyWire, fuse, cut, intersect, fuseAll, cutAll, translate, rotate, scale, mirror, extrude, revolve, loft, path, compound, instance, type RevolveOptions, type LoftOptions, type RotateOptions, type ScaleOptions, type MirrorOptions, } from './builders.js';
|
|
9
9
|
export { numLit, vec3Lit, vec2Lit, param, binOp, unaryOp, component, buildVec, add, mul, asScalarExpr, asVec3Expr, asVec2Expr, type Expr, type ExprValue, type Env, type ScalarInput, type Vec3Input, type Vec2Input, type BinaryOp, type UnaryOp, } from './expressions.js';
|
|
10
|
-
export type { IRNode, NodeKind, OutputKind, PrimitiveNode, BooleanNode, TransformIRNode, InstanceNode, SolidNode, FaceNode, EdgeNode, VertexNode, AnyNode, } from './types.js';
|
|
10
|
+
export type { IRNode, NodeKind, OutputKind, PrimitiveNode, BooleanNode, TransformIRNode, ExtrudeNode, RevolveNode, LoftNode, PathNode, InstanceNode, SolidNode, FaceNode, EdgeNode, VertexNode, AnyNode, } from './types.js';
|
|
11
11
|
export { outputKindOf } from './types.js';
|
|
12
|
+
export { lineTo, arcTo, bezierTo, ellipseArcTo, type Segment2D, type SegmentOptions, type EllipseArcOptions, } from './segments.js';
|
|
12
13
|
export { Evaluator, withEvaluator, type EvaluatorOptions, type StepInfo, type CacheStats, } from './evaluate.js';
|
|
13
14
|
export { toJSON, fromJSON, CSG_VERSION, type CsgEnvelope } from './serialize.js';
|
|
14
15
|
export { optimize, foldExpr } from './optimize.js';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Expr, ScalarInput, Vec2Input } from './expressions.js';
|
|
2
|
+
export interface LineSegment {
|
|
3
|
+
readonly kind: 'Line';
|
|
4
|
+
/** Vec2 endpoint. */
|
|
5
|
+
readonly to: Expr;
|
|
6
|
+
}
|
|
7
|
+
export interface ArcSegment {
|
|
8
|
+
readonly kind: 'Arc';
|
|
9
|
+
readonly to: Expr;
|
|
10
|
+
readonly radius: Expr;
|
|
11
|
+
readonly largeArc: boolean;
|
|
12
|
+
readonly clockwise: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface BezierSegment {
|
|
15
|
+
readonly kind: 'Bezier';
|
|
16
|
+
/** Control poles (SVG Q/C semantics), 1 or 2 entries. */
|
|
17
|
+
readonly controls: readonly Expr[];
|
|
18
|
+
readonly to: Expr;
|
|
19
|
+
}
|
|
20
|
+
export interface EllipseArcSegment {
|
|
21
|
+
readonly kind: 'EllipseArc';
|
|
22
|
+
readonly to: Expr;
|
|
23
|
+
/** Vec2 (rx, ry). */
|
|
24
|
+
readonly radii: Expr;
|
|
25
|
+
/** Rotation of the ellipse x-axis, degrees (matching Rotate). */
|
|
26
|
+
readonly rotation: Expr;
|
|
27
|
+
readonly largeArc: boolean;
|
|
28
|
+
readonly clockwise: boolean;
|
|
29
|
+
}
|
|
30
|
+
export type Segment2D = LineSegment | ArcSegment | BezierSegment | EllipseArcSegment;
|
|
31
|
+
export interface SegmentOptions {
|
|
32
|
+
readonly largeArc?: boolean | undefined;
|
|
33
|
+
readonly clockwise?: boolean | undefined;
|
|
34
|
+
}
|
|
35
|
+
export interface EllipseArcOptions extends SegmentOptions {
|
|
36
|
+
readonly rotation?: ScalarInput | undefined;
|
|
37
|
+
}
|
|
38
|
+
export declare function lineTo(to: Vec2Input): Segment2D;
|
|
39
|
+
export declare function arcTo(to: Vec2Input, radius: ScalarInput, options?: SegmentOptions): Segment2D;
|
|
40
|
+
export declare function bezierTo(controls: ReadonlyArray<Vec2Input>, to: Vec2Input): Segment2D;
|
|
41
|
+
export declare function ellipseArcTo(to: Vec2Input, radii: Vec2Input, options?: EllipseArcOptions): Segment2D;
|
|
42
|
+
export declare function hashSegments(h0: bigint, segments: readonly Segment2D[]): bigint;
|
|
43
|
+
export declare function segmentFreeParams(segments: readonly Segment2D[]): Expr[];
|
|
44
|
+
export declare function foldSegment(s: Segment2D, foldExpr: (e: Expr) => Expr): Segment2D;
|
package/dist/csg/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Expr } from './expressions.js';
|
|
2
|
+
import { Segment2D } from './segments.js';
|
|
2
3
|
import { Matrix4x4 } from '../core/types.js';
|
|
3
4
|
export type OutputKind = 'Solid' | 'Face' | 'Wire' | 'Edge' | 'Vertex' | 'Compound';
|
|
4
5
|
/** Output kinds that have a corresponding empty-shape builder + serializer. */
|
|
@@ -108,6 +109,36 @@ export interface MirrorNode extends IRNodeBase {
|
|
|
108
109
|
readonly normal?: Expr | undefined;
|
|
109
110
|
readonly at?: Expr | undefined;
|
|
110
111
|
}
|
|
112
|
+
export interface ExtrudeNode extends IRNodeBase {
|
|
113
|
+
readonly kind: 'Extrude';
|
|
114
|
+
/** Must produce OutputKind 'Face'. */
|
|
115
|
+
readonly profile: IRNode;
|
|
116
|
+
readonly vector: Expr;
|
|
117
|
+
}
|
|
118
|
+
export interface RevolveNode extends IRNodeBase {
|
|
119
|
+
readonly kind: 'Revolve';
|
|
120
|
+
/** Must produce OutputKind 'Face'. */
|
|
121
|
+
readonly profile: IRNode;
|
|
122
|
+
/** Degrees, matching Rotate. */
|
|
123
|
+
readonly angle: Expr;
|
|
124
|
+
readonly axis?: Expr | undefined;
|
|
125
|
+
readonly at?: Expr | undefined;
|
|
126
|
+
}
|
|
127
|
+
export interface PathNode extends IRNodeBase {
|
|
128
|
+
readonly kind: 'Path';
|
|
129
|
+
/** Vec2 start point; the path lies in the XY plane (z = 0) and is lifted
|
|
130
|
+
* into 3D by transform nodes. */
|
|
131
|
+
readonly start: Expr;
|
|
132
|
+
readonly segments: readonly Segment2D[];
|
|
133
|
+
}
|
|
134
|
+
export interface LoftNode extends IRNodeBase {
|
|
135
|
+
readonly kind: 'Loft';
|
|
136
|
+
/** Each section must produce OutputKind 'Face'; at least two required. */
|
|
137
|
+
readonly sections: readonly IRNode[];
|
|
138
|
+
/** Canonicalized by the builder (default true) so the default and the
|
|
139
|
+
* explicit form share one content address. */
|
|
140
|
+
readonly ruled: boolean;
|
|
141
|
+
}
|
|
111
142
|
export interface CompoundNode extends IRNodeBase {
|
|
112
143
|
readonly kind: 'Compound';
|
|
113
144
|
readonly children: readonly IRNode[];
|
|
@@ -123,7 +154,7 @@ export interface InstanceNode extends IRNodeBase {
|
|
|
123
154
|
export type PrimitiveNode = BoxNode | SphereNode | CylinderNode | ConeNode | TorusNode | PolygonNode | CircleNode | LineNode | VertexLitNode | EmptyNode;
|
|
124
155
|
export type BooleanNode = FuseNode | CutNode | IntersectNode | FuseAllNode | CutAllNode;
|
|
125
156
|
export type TransformIRNode = TranslateNode | RotateNode | ScaleNode | MirrorNode;
|
|
126
|
-
export type IRNode = PrimitiveNode | BooleanNode | TransformIRNode | CompoundNode | InstanceNode;
|
|
157
|
+
export type IRNode = PrimitiveNode | BooleanNode | TransformIRNode | ExtrudeNode | RevolveNode | LoftNode | PathNode | CompoundNode | InstanceNode;
|
|
127
158
|
export type NodeKind = IRNode['kind'];
|
|
128
159
|
export type AnyNode = IRNode;
|
|
129
160
|
/** Nodes that produce a 3D solid. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brepjs",
|
|
3
|
-
"version": "18.
|
|
3
|
+
"version": "18.126.0",
|
|
4
4
|
"description": "Web CAD library with pluggable geometry kernel",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cad",
|
|
@@ -265,8 +265,8 @@
|
|
|
265
265
|
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
|
266
266
|
"@vitest/coverage-v8": "4.1.10",
|
|
267
267
|
"brepjs-opencascade": "*",
|
|
268
|
-
"brepkit-wasm": "3.2.
|
|
269
|
-
"eslint": "10.8.
|
|
268
|
+
"brepkit-wasm": "3.2.13",
|
|
269
|
+
"eslint": "10.8.1",
|
|
270
270
|
"fast-check": "4.9.0",
|
|
271
271
|
"husky": "9.1.7",
|
|
272
272
|
"knip": "6.27.0",
|
|
@@ -274,14 +274,14 @@
|
|
|
274
274
|
"lz-string": "1.5.0",
|
|
275
275
|
"occt-wasm": "4.2.0",
|
|
276
276
|
"prettier": "3.9.6",
|
|
277
|
-
"puppeteer": "25.
|
|
277
|
+
"puppeteer": "25.5.0",
|
|
278
278
|
"size-limit": "13.0.3",
|
|
279
279
|
"sucrase": "3.35.1",
|
|
280
|
-
"tsx": "4.23.
|
|
280
|
+
"tsx": "4.23.11",
|
|
281
281
|
"typedoc": "0.28.20",
|
|
282
282
|
"typescript": "6.0.3",
|
|
283
|
-
"typescript-eslint": "8.
|
|
284
|
-
"vite": "8.2.
|
|
283
|
+
"typescript-eslint": "8.66.0",
|
|
284
|
+
"vite": "8.2.1",
|
|
285
285
|
"vite-plugin-dts": "5.0.3",
|
|
286
286
|
"vitest": "4.1.10"
|
|
287
287
|
},
|