@code3d/core 0.0.1-alpha.4 → 0.0.1-alpha.7
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/README.md +42 -5
- package/bld/chunks/{chunk-J77FMYFY.js → chunk-4WLVDYUJ.js} +992 -545
- package/bld/chunks/chunk-4WLVDYUJ.js.map +7 -0
- package/bld/chunks/{chunk-PAIFBNU4.js → chunk-C3AJ6WNB.js} +2 -2
- package/bld/chunks/{chunk-OQLJDJIF.js → chunk-TCMEEKWL.js} +2 -2
- package/bld/chunks/{chunk-ZMT6EFHL.js → chunk-VHSPHJ5F.js} +3 -3
- package/bld/library/bound-solver.d.ts +29 -5
- package/bld/library/bound-solver.d.ts.map +1 -1
- package/bld/library/cached.d.ts +5 -3
- package/bld/library/cached.d.ts.map +1 -1
- package/bld/library/index.d.ts +4 -4
- package/bld/library/index.d.ts.map +1 -1
- package/bld/library/index.js +17 -3
- package/bld/library/kernel-cache.d.ts +6 -3
- package/bld/library/kernel-cache.d.ts.map +1 -1
- package/bld/library/relation-solver.d.ts +12 -7
- package/bld/library/relation-solver.d.ts.map +1 -1
- package/bld/library/replicad.js +2 -2
- package/bld/library/runtime.d.ts +218 -82
- package/bld/library/runtime.d.ts.map +1 -1
- package/bld/library/sketch.d.ts +2 -2
- package/bld/library/sketch.d.ts.map +1 -1
- package/bld/library/topology.d.ts +2 -0
- package/bld/library/topology.d.ts.map +1 -1
- package/bld/node/index.js +19 -5
- package/bld/node/replicad.js +4 -4
- package/bld/tooling/index.d.ts +3 -3
- package/bld/tooling/index.d.ts.map +1 -1
- package/bld/tooling/index.js +18 -10
- package/package.json +1 -1
- package/src/library/bound-solver.ts +103 -73
- package/src/library/cached.ts +29 -8
- package/src/library/index.ts +15 -4
- package/src/library/kernel-cache.ts +37 -5
- package/src/library/relation-solver.ts +194 -110
- package/src/library/runtime.ts +1046 -442
- package/src/library/sketch.ts +3 -3
- package/src/library/topology.ts +13 -2
- package/src/tooling/index.ts +15 -7
- package/bld/chunks/chunk-J77FMYFY.js.map +0 -7
- /package/bld/chunks/{chunk-PAIFBNU4.js.map → chunk-C3AJ6WNB.js.map} +0 -0
- /package/bld/chunks/{chunk-OQLJDJIF.js.map → chunk-TCMEEKWL.js.map} +0 -0
- /package/bld/chunks/{chunk-ZMT6EFHL.js.map → chunk-VHSPHJ5F.js.map} +0 -0
package/README.md
CHANGED
|
@@ -4,6 +4,12 @@ The TypeScript modeling runtime used by Code3D. Compose solids, profiles, curves
|
|
|
4
4
|
points, and editable sketches; inspect their geometry and reuse the same models
|
|
5
5
|
in the App or a supported Node.js runtime.
|
|
6
6
|
|
|
7
|
+
Model constructors define the initial origin; derived operations inherit their main
|
|
8
|
+
input frame. `group`, `union`, and `intersect` use the first member or operand,
|
|
9
|
+
`cut` uses the stock, and `loft` uses the first section. See the
|
|
10
|
+
[default origin rules](../web/src/content/docs/docs/concepts/local-coordinates.md#default-origin-rules)
|
|
11
|
+
for all constructors and explicit origin operations.
|
|
12
|
+
|
|
7
13
|
## Start with a model
|
|
8
14
|
|
|
9
15
|
```sh
|
|
@@ -43,6 +49,28 @@ angles use degrees. Read [local coordinates](../web/src/content/docs/docs/concep
|
|
|
43
49
|
and [relations](../web/src/content/docs/docs/guides/relations.mdx) before mixing
|
|
44
50
|
origin changes, alignment, and rotation.
|
|
45
51
|
|
|
52
|
+
Constraints express `on` and `align` only. Put relative `offset` and `rotate`
|
|
53
|
+
transformations in the `relate` array after the constraints. Zero values add no
|
|
54
|
+
centering or orientation condition; use point or axis alignment to center a part.
|
|
55
|
+
The App's gizmos edit or insert independent array entries.
|
|
56
|
+
|
|
57
|
+
Choose a
|
|
58
|
+
center with `pivot([x,y,z])`, self topology with `pivotVertex(id)`/`axisEdge(id)`,
|
|
59
|
+
or references with `pivotPoint(pointRef)`/`axisLine(lineRef)`; finish each selector
|
|
60
|
+
with `rotate`. Point rotations retain self XYZ axes, including external centers. Consecutive constraints solve jointly; transformations
|
|
61
|
+
then act on that result in order. A later constraint starts a new segment using
|
|
62
|
+
the preceding pose. Independent offsets use fixed composition axes, and rotations
|
|
63
|
+
default to self's current origin. Each completed transformation is one array item,
|
|
64
|
+
for example `[offset(0, 8, 0), rotate(0, 25, 0)]`. Only pivot/axis selections
|
|
65
|
+
chain into `rotate`; completed transformations cannot chain into another operation.
|
|
66
|
+
Keep a selected reference while moving it with
|
|
67
|
+
`pivotVertex(id).pivotOffset(dx, dy, dz).rotate(x, y, z)` or
|
|
68
|
+
`axisLine(axis).axisOffset(dx, dy, dz).rotate(angle)`. Point offsets use self local
|
|
69
|
+
axes; axis offsets use the selected axis frame and preserve its direction.
|
|
70
|
+
Each selector accepts one matching offset, followed by `rotate`.
|
|
71
|
+
See the [transformation example](../app/examples/constraints/transformations.ts)
|
|
72
|
+
and [placement guide](../web/src/content/docs/docs/guides/relations.mdx#transform-a-joint-result).
|
|
73
|
+
|
|
46
74
|
Build readable models from named intermediate values and public operations. A
|
|
47
75
|
profile followed by extrusion, or solids combined with Boolean operations,
|
|
48
76
|
keeps the construction understandable and editable by both people and agents.
|
|
@@ -65,7 +93,7 @@ Dimension-based primitives and numeric modeling methods retain required TypeScri
|
|
|
65
93
|
signatures while providing runtime defaults for omitted or `undefined` values.
|
|
66
94
|
Rotations and displacements default to zero, scaling to one, extrusion distance
|
|
67
95
|
to ten, and fillet radius, chamfer distance and shell thickness to one. Relation
|
|
68
|
-
rotation
|
|
96
|
+
rotation selectors use the same angle defaults; `pivot()` defaults to local zero.
|
|
69
97
|
Explicit invalid values retain their normal errors. These defaults work in
|
|
70
98
|
ordinary JavaScript execution as well as App previews.
|
|
71
99
|
|
|
@@ -142,7 +170,7 @@ const draft = sketch().relate(s => s.plane.align(host.surface(2)));
|
|
|
142
170
|
```
|
|
143
171
|
|
|
144
172
|
The target may be a named plane or a planar `host.surface(id)`. The sketch plane
|
|
145
|
-
normal is local `+Y`; alignment uses the same directed-plane,
|
|
173
|
+
normal is local `+Y`; alignment uses the same directed-plane alignment, composition-axis offset
|
|
146
174
|
and rotation semantics as model relations. It does not implicitly center the
|
|
147
175
|
sketch on a trimmed surface. An unbounded sketch plane cannot use `on()` to place
|
|
148
176
|
finite geometry against a bound; use `align()`. Topology-only pivots such as
|
|
@@ -162,14 +190,23 @@ of that geometry are not separate authoring definitions. Context outlines are
|
|
|
162
190
|
visual references only, not snapping targets or imported geometry constraints.
|
|
163
191
|
The select-surface-and-create UI is tracked separately within
|
|
164
192
|
[#114](https://github.com/vilicvane/code3d/issues/114).
|
|
165
|
-
Try [
|
|
193
|
+
Try [mounting-plate.ts](../app/examples/sketches/mounting-plate.ts).
|
|
166
194
|
|
|
167
195
|
## Cached computations and custom primitives
|
|
168
196
|
|
|
169
|
-
`
|
|
197
|
+
`cache(fn)` memoizes synchronous, deterministic data computations;
|
|
198
|
+
`cache(fn, args)` immediately returns the cached result for an argument tuple.
|
|
199
|
+
Both forms share the same function identity and argument keys. Supply custom
|
|
200
|
+
codecs in the third argument: `cache(fn, undefined, options)` for a function or
|
|
201
|
+
`cache(fn, args, options)` for a value.
|
|
170
202
|
Pass changing captured state as arguments and treat returned data as immutable.
|
|
171
203
|
Memory hits reuse the retained result; optional `encoder` / `decoder` pairs only
|
|
172
|
-
run when saving to disk or restoring it.
|
|
204
|
+
run when saving to disk or restoring it. Newly computed entries are eligible
|
|
205
|
+
for disk storage when computation reaches the configured threshold (1 ms by
|
|
206
|
+
default). Faster results remain in memory and are not encoded or written on later
|
|
207
|
+
memory hits. Change the threshold in **Settings → Cache** in the App; it applies
|
|
208
|
+
to new computations and preserves existing cache entries. Existing
|
|
209
|
+
disk records can still be restored. The App fingerprints static definitions
|
|
173
210
|
and their dependencies for persistent reuse; dynamic closures and ordinary Node
|
|
174
211
|
calls use function identity for memory reuse. No author cache IDs are needed.
|
|
175
212
|
|