@hatiolab/figure-model 0.1.33 → 0.1.35
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/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/v3-asset-types.d.ts +26 -0
- package/dist/v3-asset-types.d.ts.map +1 -1
- package/dist/v3-asset.d.ts.map +1 -1
- package/dist/v3-asset.js +7 -2
- package/dist/v3-asset.js.map +1 -1
- package/dist/v3-capabilities.js +1 -0
- package/dist/v3-capabilities.js.map +1 -1
- package/dist/v3-driver.d.ts +16 -0
- package/dist/v3-driver.d.ts.map +1 -0
- package/dist/v3-driver.js +145 -0
- package/dist/v3-driver.js.map +1 -0
- package/dist/v3-from-v2.d.ts +109 -9
- package/dist/v3-from-v2.d.ts.map +1 -1
- package/dist/v3-from-v2.js +912 -119
- package/dist/v3-from-v2.js.map +1 -1
- package/dist/v3-gate.d.ts +56 -4
- package/dist/v3-gate.d.ts.map +1 -1
- package/dist/v3-gate.js +178 -21
- package/dist/v3-gate.js.map +1 -1
- package/dist/v3-graph-types.d.ts +6 -1
- package/dist/v3-graph-types.d.ts.map +1 -1
- package/dist/v3-graph.d.ts +17 -1
- package/dist/v3-graph.d.ts.map +1 -1
- package/dist/v3-graph.js +144 -20
- package/dist/v3-graph.js.map +1 -1
- package/dist/v3-kernel-version.d.ts +8 -0
- package/dist/v3-kernel-version.d.ts.map +1 -0
- package/dist/v3-kernel-version.js +11 -0
- package/dist/v3-kernel-version.js.map +1 -0
- package/dist/v3-mesh-compare.d.ts +27 -0
- package/dist/v3-mesh-compare.d.ts.map +1 -0
- package/dist/v3-mesh-compare.js +198 -0
- package/dist/v3-mesh-compare.js.map +1 -0
- package/docs/v3-motion-contract.md +178 -0
- package/docs/v3-operator-contracts.md +4 -0
- package/docs/v3-shape-dimension-contract.md +146 -0
- package/package.json +2 -1
package/dist/v3-from-v2.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type V3WorldBox } from './v3-gate.ts';
|
|
2
2
|
import { type InstanceScale } from './sizing.ts';
|
|
3
|
-
import type { Axis, FigureSource, Vec3 } from './types.ts';
|
|
3
|
+
import type { AnimationChannel, Axis, FigureSource, Vec3 } from './types.ts';
|
|
4
4
|
import type { V3Asset } from './v3-asset-types.ts';
|
|
5
5
|
/** A rule the converter cannot write in V3. The asset is not converted. */
|
|
6
6
|
export interface V3ConversionRefusal {
|
|
@@ -14,21 +14,62 @@ export interface V3ConversionLoss {
|
|
|
14
14
|
part?: string;
|
|
15
15
|
detail: string;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Something the converter normalised on purpose, with the value before and after. Not a loss: the V3 asset draws
|
|
19
|
+
* what V2 drew. The report keeps it so nobody has to rediscover why a number differs from the source.
|
|
20
|
+
*/
|
|
21
|
+
export interface V3ConversionNote {
|
|
22
|
+
code: string;
|
|
23
|
+
part?: string;
|
|
24
|
+
detail: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* How the V3 asset was produced: written by the converter from the V2 rules, or re-authored by a person
|
|
28
|
+
* (ADR-0087 ruling 1). This says nothing about whether it matches or what was lost; those are `compareV2WithV3`
|
|
29
|
+
* and `lost` / `rangeChanges` (designer's ruling, 2026-09-22: method, verification and preservation are three
|
|
30
|
+
* separate facts).
|
|
31
|
+
*/
|
|
32
|
+
export type V3ConversionMethod = 'mechanical' | 're-authored';
|
|
33
|
+
/**
|
|
34
|
+
* A change to the range of inputs the asset accepts, compared with V2. This is a behaviour-contract change, not a
|
|
35
|
+
* remark: an instance V2 drew (however badly) is one V3 refuses.
|
|
36
|
+
*/
|
|
37
|
+
export interface V3RangeChange {
|
|
38
|
+
input: string;
|
|
39
|
+
/** What V2 accepted, in words. */
|
|
40
|
+
v2: string;
|
|
41
|
+
/** The V3 input range. */
|
|
42
|
+
v3: {
|
|
43
|
+
min: number;
|
|
44
|
+
max: number;
|
|
45
|
+
};
|
|
46
|
+
part?: string;
|
|
47
|
+
reason: string;
|
|
48
|
+
}
|
|
17
49
|
export type V3ConversionResult = {
|
|
18
50
|
status: 'converted';
|
|
51
|
+
method: V3ConversionMethod;
|
|
19
52
|
asset: V3Asset;
|
|
20
53
|
lost: V3ConversionLoss[];
|
|
54
|
+
rangeChanges: V3RangeChange[];
|
|
55
|
+
notes: V3ConversionNote[];
|
|
21
56
|
} | {
|
|
22
57
|
status: 'refused';
|
|
23
58
|
refusals: V3ConversionRefusal[];
|
|
24
59
|
lost: V3ConversionLoss[];
|
|
60
|
+
rangeChanges: V3RangeChange[];
|
|
61
|
+
notes: V3ConversionNote[];
|
|
25
62
|
};
|
|
26
63
|
export interface V3ConversionOptions {
|
|
27
64
|
/** Colour of every palette token the source uses. The converter invents no colours. */
|
|
28
65
|
palette: Record<string, string>;
|
|
66
|
+
/** What that palette is called, for the report (ADR-0087 ruling 5). Without it the report carries a hash. */
|
|
67
|
+
paletteId?: string;
|
|
29
68
|
/** Asset name. Defaults to the V2 `type`. */
|
|
30
69
|
name?: string;
|
|
31
70
|
}
|
|
71
|
+
/** A short stable fingerprint of the palette, so a report can say which colours it snapshotted. */
|
|
72
|
+
export declare function paletteHash(palette: Record<string, string>): string;
|
|
32
73
|
/** The V3 design inputs that stand for the instance size, in mm. */
|
|
33
74
|
export declare const V3_SIZE_INPUTS: Readonly<Record<Axis, string>>;
|
|
34
75
|
/** Rx·Ry·Rz for degrees, the order V2 (`three` 'XYZ') and V3 `rigid@1` share. */
|
|
@@ -40,31 +81,90 @@ export declare function eulerXYZ(rotation: Partial<Vec3> | undefined): number[][
|
|
|
40
81
|
export declare function convertV2ToV3(source: unknown, options: V3ConversionOptions): V3ConversionResult;
|
|
41
82
|
/** One placed body in the world, from either side, in the bottom-origin asset frame. */
|
|
42
83
|
export type WorldBox = V3WorldBox;
|
|
43
|
-
/**
|
|
44
|
-
export
|
|
84
|
+
/** Values that move a V2 figure: parameter values by name and, per animation clip, an elapsed time in seconds. */
|
|
85
|
+
export interface V2MotionState {
|
|
86
|
+
parameters?: Record<string, number>;
|
|
87
|
+
clipTime?: Record<string, number>;
|
|
88
|
+
}
|
|
89
|
+
type Mat = number[][];
|
|
90
|
+
/** Rotation about a unit axis by degrees (Rodrigues), the matrix three's setFromAxisAngle builds. */
|
|
91
|
+
export declare function axisAngle(axis: Vec3, deg: number): Mat;
|
|
92
|
+
/** V2's clip length: the last key time across its channels, in seconds. */
|
|
93
|
+
export declare function v2ClipDuration(clip: {
|
|
94
|
+
channels: AnimationChannel[];
|
|
95
|
+
}): number;
|
|
96
|
+
/**
|
|
97
|
+
* Where V2 draws every part (and copy) at an instance scale and a motion state, as oriented world boxes.
|
|
98
|
+
* Motion follows things-scene: a translation channel shifts the part in the figure frame by the part's world
|
|
99
|
+
* factor; a rotation channel turns it about its own centre in its own frame (R_part·R_ch·R_part⁻¹); a joint turns
|
|
100
|
+
* everything in its frame about its sized origin, parents first (ADR-0066).
|
|
101
|
+
*/
|
|
102
|
+
export declare function v2WorldBoxes(source: FigureSource, scale: InstanceScale, state?: V2MotionState, options?: {
|
|
103
|
+
points?: boolean;
|
|
104
|
+
}): WorldBox[];
|
|
45
105
|
/** Where a converted V3 asset draws every part at an instance size, as world boxes. */
|
|
46
|
-
export declare function v3WorldBoxes(asset: V3Asset, size: Vec3
|
|
106
|
+
export declare function v3WorldBoxes(asset: V3Asset, size: Vec3, stateOverrides?: Record<string, number>, options?: {
|
|
107
|
+
points?: boolean;
|
|
108
|
+
}): WorldBox[];
|
|
109
|
+
/**
|
|
110
|
+
* Instance scales at which a repeated part's copy count changes, one just below and one just above each
|
|
111
|
+
* boundary near the base count (completion criterion: repeat-count boundaries).
|
|
112
|
+
*/
|
|
113
|
+
export declare function repeatBoundaryScales(source: FigureSource): InstanceScale[];
|
|
47
114
|
export interface V3SameDifference {
|
|
48
115
|
part: string;
|
|
49
116
|
scale: InstanceScale;
|
|
117
|
+
/** Which motion state was being compared; `rest` when none. */
|
|
118
|
+
state: string;
|
|
50
119
|
what: string;
|
|
51
120
|
v2: string;
|
|
52
121
|
v3: string;
|
|
53
122
|
}
|
|
54
123
|
export interface V3SameReport {
|
|
124
|
+
/** True when no difference was found over the checked scales and states. Not a guarantee over all inputs. */
|
|
55
125
|
same: boolean;
|
|
56
|
-
/** Instance scales checked
|
|
126
|
+
/** Instance scales checked. */
|
|
57
127
|
scales: InstanceScale[];
|
|
128
|
+
/** Motion states checked; `rest` is always first. */
|
|
129
|
+
states: string[];
|
|
58
130
|
boxesCompared: number;
|
|
131
|
+
/**
|
|
132
|
+
* How the surfaces were sampled, so the report says what a Hausdorff gap under tolerance does and does not
|
|
133
|
+
* prove: a bound at these sample points, not the maximum error over the whole surface.
|
|
134
|
+
*/
|
|
135
|
+
sampling: {
|
|
136
|
+
toleranceMm: number;
|
|
137
|
+
toleranceDeg: number;
|
|
138
|
+
mesh: boolean;
|
|
139
|
+
cornerDivisions: number;
|
|
140
|
+
sphereGrid: string;
|
|
141
|
+
cylinderSegments: string;
|
|
142
|
+
};
|
|
59
143
|
differences: V3SameDifference[];
|
|
60
144
|
}
|
|
61
145
|
/** ADR-0087 decision 2 tolerances. */
|
|
62
146
|
export declare const SAME_TOLERANCE_MM = 1;
|
|
63
147
|
export declare const SAME_TOLERANCE_DEG = 0.1;
|
|
148
|
+
export interface V3CompareOptions {
|
|
149
|
+
factor?: number;
|
|
150
|
+
/** Also check at half size on every axis combination (completion criterion: shrunken sizes). */
|
|
151
|
+
shrink?: boolean;
|
|
152
|
+
/** Extra instance scales, e.g. `repeatBoundaryScales(source)`. */
|
|
153
|
+
extraScales?: InstanceScale[];
|
|
154
|
+
/** Compare sampled surfaces too, not only oriented boxes. Default true. */
|
|
155
|
+
mesh?: boolean;
|
|
156
|
+
/** Motion states to compare beyond rest, each with a label for the report. */
|
|
157
|
+
states?: Array<{
|
|
158
|
+
label: string;
|
|
159
|
+
} & V2MotionState>;
|
|
160
|
+
}
|
|
161
|
+
/** The V3 state overrides that stand for a V2 motion state: parameters by name, drivers at their clip's time. */
|
|
162
|
+
export declare function v3StateOverrides(asset: V3Asset, state: V2MotionState): Record<string, number>;
|
|
64
163
|
/**
|
|
65
|
-
* "The same" (ADR-0087 decision 2): the V2 source and the V3 asset draw the same parts, each
|
|
66
|
-
* centre and
|
|
67
|
-
* base size and at every combination of doubled axes.
|
|
164
|
+
* "The same" (ADR-0087 decision 2): the V2 source and the V3 asset draw the same parts, each with the same
|
|
165
|
+
* centre and local dimensions within 1 mm and the same rotation within 0.1° (as a relative angle), with the same
|
|
166
|
+
* material, at the base size and at every combination of doubled axes, at rest and at every motion state given.
|
|
68
167
|
*/
|
|
69
|
-
export declare function compareV2WithV3(source: FigureSource, asset: V3Asset,
|
|
168
|
+
export declare function compareV2WithV3(source: FigureSource, asset: V3Asset, options?: V3CompareOptions | number): V3SameReport;
|
|
169
|
+
export {};
|
|
70
170
|
//# sourceMappingURL=v3-from-v2.d.ts.map
|
package/dist/v3-from-v2.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v3-from-v2.d.ts","sourceRoot":"","sources":["../src/v3-from-v2.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"v3-from-v2.d.ts","sourceRoot":"","sources":["../src/v3-from-v2.ts"],"names":[],"mappings":"AA8BA,OAAO,EAA+B,KAAK,UAAU,EAAE,MAAM,cAAc,CAAA;AAK3E,OAAO,EAQL,KAAK,aAAa,EACnB,MAAM,aAAa,CAAA;AAEpB,OAAO,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAqD,YAAY,EAAgB,IAAI,EAAE,MAAM,YAAY,CAAA;AAC7I,OAAO,KAAK,EAAE,OAAO,EAAsC,MAAM,qBAAqB,CAAA;AAMtF,2EAA2E;AAC3E,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAA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