@automovie/recovery 0.1.0 → 0.2.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.
Files changed (41) hide show
  1. package/lib/curves/AutoMovieRecoveryCompactApproximation.d.ts +125 -0
  2. package/lib/curves/AutoMovieRecoveryCompactApproximation.js +62 -0
  3. package/lib/curves/AutoMovieRecoveryCompactApproximation.js.map +1 -0
  4. package/lib/curves/AutoMovieRecoveryConicApproximation.d.ts +218 -0
  5. package/lib/curves/AutoMovieRecoveryConicApproximation.js +113 -0
  6. package/lib/curves/AutoMovieRecoveryConicApproximation.js.map +1 -0
  7. package/lib/curves/approximateAutoMovieRecoveryCompactCurves.d.ts +30 -0
  8. package/lib/curves/approximateAutoMovieRecoveryCompactCurves.js +303 -0
  9. package/lib/curves/approximateAutoMovieRecoveryCompactCurves.js.map +1 -0
  10. package/lib/curves/approximateAutoMovieRecoveryConicsAhn.d.ts +39 -0
  11. package/lib/curves/approximateAutoMovieRecoveryConicsAhn.js +289 -0
  12. package/lib/curves/approximateAutoMovieRecoveryConicsAhn.js.map +1 -0
  13. package/lib/curves/approximateAutoMovieRecoveryConicsGhosh.d.ts +32 -0
  14. package/lib/curves/approximateAutoMovieRecoveryConicsGhosh.js +350 -0
  15. package/lib/curves/approximateAutoMovieRecoveryConicsGhosh.js.map +1 -0
  16. package/lib/curves/findAutoMovieRecoveryCubicCriticalParameters.d.ts +29 -0
  17. package/lib/curves/findAutoMovieRecoveryCubicCriticalParameters.js +77 -0
  18. package/lib/curves/findAutoMovieRecoveryCubicCriticalParameters.js.map +1 -0
  19. package/lib/curves/index.d.ts +5 -0
  20. package/lib/curves/index.js +5 -0
  21. package/lib/curves/index.js.map +1 -1
  22. package/lib/internal/GhoshConicApproximationBalance.d.ts +25 -0
  23. package/lib/internal/GhoshConicApproximationBalance.js +177 -0
  24. package/lib/internal/GhoshConicApproximationBalance.js.map +1 -0
  25. package/lib/internal/GhoshConicApproximationDisplacement.d.ts +23 -0
  26. package/lib/internal/GhoshConicApproximationDisplacement.js +77 -0
  27. package/lib/internal/GhoshConicApproximationDisplacement.js.map +1 -0
  28. package/lib/internal/index.d.ts +2 -0
  29. package/lib/internal/index.js +2 -0
  30. package/lib/internal/index.js.map +1 -1
  31. package/package.json +6 -6
  32. package/src/curves/AutoMovieRecoveryCompactApproximation.ts +149 -0
  33. package/src/curves/AutoMovieRecoveryConicApproximation.ts +282 -0
  34. package/src/curves/approximateAutoMovieRecoveryCompactCurves.ts +285 -0
  35. package/src/curves/approximateAutoMovieRecoveryConicsAhn.ts +315 -0
  36. package/src/curves/approximateAutoMovieRecoveryConicsGhosh.ts +444 -0
  37. package/src/curves/findAutoMovieRecoveryCubicCriticalParameters.ts +76 -0
  38. package/src/curves/index.ts +5 -0
  39. package/src/internal/GhoshConicApproximationBalance.ts +184 -0
  40. package/src/internal/GhoshConicApproximationDisplacement.ts +83 -0
  41. package/src/internal/index.ts +2 -0
@@ -0,0 +1,350 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.approximateAutoMovieRecoveryConicsGhosh = approximateAutoMovieRecoveryConicsGhosh;
4
+ const GhoshConicApproximationBalance_1 = require("../internal/GhoshConicApproximationBalance");
5
+ const GhoshConicApproximationDisplacement_1 = require("../internal/GhoshConicApproximationDisplacement");
6
+ const AutoMovieRecoveryConicApproximation_1 = require("./AutoMovieRecoveryConicApproximation");
7
+ /**
8
+ * Numerically reproduce the endpoint-bitangent equioscillation construction of
9
+ * Ghosh, Petitjean and Vegter, Approximation by Conic Splines (2007), sections
10
+ * 3.2–3.4 and 6, DOI 10.1007/s11786-007-0004-8.
11
+ *
12
+ * Source breaks are hard boundaries: piecewise Hermite input does not acquire
13
+ * the paper's smoothness merely by supplying derivatives. On each smooth chart
14
+ * we sample nonzero curvature and monotone affine curvature, construct the
15
+ * endpoint triple-contact limits of the positive-weight bitangent family, and
16
+ * bisect its weight until refined positive and negative normal extrema balance.
17
+ * Located extrema are exchanged into the fitting nodes; independent held-out
18
+ * nodes then validate the selected coefficient rather than driving its fit.
19
+ * Endpoint bisection then selects an interval meeting the requested tolerance.
20
+ * Unlike the paper's symbolic implementation, this experiment uses finite
21
+ * admission/extremum samples, so neither Hausdorff certification nor global
22
+ * minimum arc count is claimed. Collinear charts are an explicit line extension.
23
+ * A zero-curvature chart endpoint uses the compactified infinite-weight limit
24
+ * only to bracket finite positive weights. This is an explicit numerical
25
+ * boundary extension, not a proof that the paper's theorem admits that endpoint.
26
+ * Source callback failures refuse the whole call and discard all coefficients;
27
+ * sampled mathematical admission failures may leave explicitly partial coverage.
28
+ *
29
+ * @evidence contracts/development/common.md#meaningful-documentation States provenance, source-parameter units, preserved breaks, numerical admission, sampled errors, line extension and explicit refusal/partial coverage.
30
+ * @evidence contracts/development/implementation.md#principled-implementation Sections 3.2–3.4 and 6 supply bitangent normal-displacement equioscillation and endpoint bisection; proposition 2.3 supplies affine curvature. Finite samples replace symbolic extrema and cannot certify the continuous premises.
31
+ * @evidence contracts/development/implementation.md#clear-and-simple-structure Local helpers own source queries, differential admission, tangent-triangle algebra, displacement and the two nested bisections; no Human-specific data enters recovery.
32
+ * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No source samples become output coefficients, no input smoothing or fixture branch is used, and unsupported intervals remain omitted with diagnostics.
33
+ * @evidence contracts/development/implementation.md#efficient-algorithms Chart count, accepted arcs and caller depth bound interval visits. Each candidate alternates 32-step weight bisection with at most depth extremum exchanges; the balance helper bounds its witness/golden-search cost, and 64 independent nodes validate the result. A separate visit budget bounds unsuccessful subdivision.
34
+ * @evidence contracts/development/implementation.md#reuse-equivalent-work Each candidate caches its source points, normals and barycentric coordinates across coefficient bisection; accepted coefficients and measured error are reused when the endpoint search advances.
35
+ * @evidence contracts/development/implementation.md#bound-retention-and-release-resources The synchronous pure call retains only its bounded interval stack, result arcs and one candidate's samples; no callback, handle or source array survives return.
36
+ */
37
+ function approximateAutoMovieRecoveryConicsGhosh(curve, options) {
38
+ const errors = AutoMovieRecoveryConicApproximation_1.AutoMovieRecoveryConicApproximation.validate(curve, options);
39
+ const diagnostics = new Set(errors);
40
+ const arcs = [];
41
+ let queries = 0;
42
+ let omitted = 0;
43
+ let visits = 0;
44
+ let sourceFailure;
45
+ const roundoff = 128 * Number.EPSILON;
46
+ /** Root-rounding residual admission changes the decision, never the source jet. */
47
+ function zeroCurvature(t, v, a, j) {
48
+ const width = curve.domain[1] - curve.domain[0];
49
+ const parameterScale = Math.max(width, Math.abs(t));
50
+ const scale = Math.hypot(...v) * (Math.hypot(...a) + parameterScale * Math.hypot(...j));
51
+ return Math.abs(AutoMovieRecoveryConicApproximation_1.AutoMovieRecoveryConicApproximation.cross(v, a)) <= roundoff * scale;
52
+ }
53
+ /** Count every source callback and reject nonfinite data at its first use. */
54
+ function point(t, order = 0, side) {
55
+ ++queries;
56
+ try {
57
+ const p = order === 0 ? curve.evaluate(t) : curve.derivative(t, order, side);
58
+ if (p.length !== 2 || !Number.isFinite(p[0]) || !Number.isFinite(p[1]))
59
+ throw new Error(`Nonfinite source ${order === 0 ? "point" : "derivative"} at parameter ${t}.`);
60
+ // Callbacks may reuse one mutable scratch tuple between successive queries.
61
+ return [p[0], p[1]];
62
+ }
63
+ catch (error) {
64
+ sourceFailure = error instanceof Error ? error.message : String(error);
65
+ throw error;
66
+ }
67
+ }
68
+ /** Form a local vector without retaining or modifying the source tuple. */
69
+ function subtract(a, b) {
70
+ return [a[0] - b[0], a[1] - b[1]];
71
+ }
72
+ /** Keep admission separate from coefficient approximation and tolerance. */
73
+ function finite(p) {
74
+ return Number.isFinite(p[0]) && Number.isFinite(p[1]);
75
+ }
76
+ /** Sample proposition 2.3; this is evidence of admission, not a proof of it. */
77
+ function admit(a, b) {
78
+ let sign = 0;
79
+ let trend = 0;
80
+ let previous;
81
+ let previousUncertainty = 0;
82
+ let zero = 0;
83
+ let boundary = 0;
84
+ for (let i = 0; i <= 8; ++i) {
85
+ const t = a + ((b - a) * i) / 8;
86
+ const side = i === 0 ? "right" : i === 8 ? "left" : undefined;
87
+ const v = point(t, 1, side);
88
+ const acceleration = point(t, 2, side);
89
+ const jerk = point(t, 3, side);
90
+ const fourth = point(t, 4, side);
91
+ if (![v, acceleration, jerk, fourth].every(finite) ||
92
+ Math.hypot(...v) === 0)
93
+ return "Nonfinite or nonregular source jet.";
94
+ const determinant = AutoMovieRecoveryConicApproximation_1.AutoMovieRecoveryConicApproximation.cross(v, acceleration);
95
+ const determinantScale = Math.hypot(...v) * Math.hypot(...acceleration);
96
+ if ((i === 0 || i === 8) && zeroCurvature(t, v, acceleration, jerk)) {
97
+ ++boundary;
98
+ ++zero;
99
+ continue;
100
+ }
101
+ if (Math.abs(determinant) <= roundoff * determinantScale) {
102
+ ++zero;
103
+ continue;
104
+ }
105
+ if (sign !== 0 && Math.sign(determinant) !== sign)
106
+ return "Inflection prevents a nonvanishing-curvature chart.";
107
+ sign = Math.sign(determinant);
108
+ // phi=det(alpha',alpha'')^(1/3); differentiate phi analytically.
109
+ // Combining proposition 2.3 avoids subtraction of two phi derivatives.
110
+ const first = AutoMovieRecoveryConicApproximation_1.AutoMovieRecoveryConicApproximation.cross(v, jerk);
111
+ const second = AutoMovieRecoveryConicApproximation_1.AutoMovieRecoveryConicApproximation.cross(acceleration, jerk) + AutoMovieRecoveryConicApproximation_1.AutoMovieRecoveryConicApproximation.cross(v, fourth);
112
+ const phi = Math.cbrt(determinant);
113
+ const positiveTerm = (AutoMovieRecoveryConicApproximation_1.AutoMovieRecoveryConicApproximation.cross(acceleration, jerk) + second / 3) / phi ** 5;
114
+ const negativeTerm = (5 * first * first) / (9 * phi ** 8);
115
+ const curvature = positiveTerm - negativeTerm;
116
+ const uncertainty = roundoff * (Math.abs(positiveTerm) + Math.abs(negativeTerm));
117
+ if (!Number.isFinite(curvature))
118
+ return "Affine curvature overflow.";
119
+ if (previous !== undefined) {
120
+ const difference = curvature - previous;
121
+ const threshold = 128 *
122
+ Math.sqrt(Number.EPSILON) *
123
+ Math.max(Number.MIN_VALUE, Math.abs(curvature), Math.abs(previous)) +
124
+ uncertainty +
125
+ previousUncertainty;
126
+ if (Math.abs(difference) > threshold) {
127
+ if (trend !== 0 && Math.sign(difference) !== trend)
128
+ return "Affine curvature is not sample-monotone.";
129
+ trend = Math.sign(difference);
130
+ }
131
+ }
132
+ previous = curvature;
133
+ previousUncertainty = uncertainty;
134
+ }
135
+ if (zero === 9)
136
+ return "line";
137
+ if (zero !== boundary)
138
+ return "Interior zero curvature prevents a regular chart.";
139
+ if (boundary !== 0)
140
+ diagnostics.add("Numerical boundary extension: a zero-curvature chart endpoint uses the infinite-weight family limit for bracketing only; the paper's nonzero-curvature theorem is not asserted there.");
141
+ return "regular";
142
+ }
143
+ /** Exact straight input is a declared extension beyond the paper's premise. */
144
+ function line(a, b) {
145
+ const p = point(a);
146
+ const q = point(b);
147
+ const chord = subtract(q, p);
148
+ const length = Math.hypot(...chord);
149
+ if (!finite(p) || !finite(q) || length === 0)
150
+ return undefined;
151
+ for (let i = 1; i < 16; ++i) {
152
+ const v = subtract(point(a + ((b - a) * i) / 16), p);
153
+ const projection = (v[0] * chord[0] + v[1] * chord[1]) / length ** 2;
154
+ if (!finite(v) ||
155
+ Math.abs(AutoMovieRecoveryConicApproximation_1.AutoMovieRecoveryConicApproximation.cross(chord, v)) / length > roundoff * length ||
156
+ projection < 0 ||
157
+ projection > 1)
158
+ return undefined;
159
+ }
160
+ diagnostics.add("Exactly collinear sampled charts use a line extension, outside the paper's nonzero-curvature theorem.");
161
+ return {
162
+ domain: [a, b],
163
+ controls: [p, [(p[0] + q[0]) / 2, (p[1] + q[1]) / 2], q],
164
+ weight: 1,
165
+ maximumSampleErrorMm: 0,
166
+ };
167
+ }
168
+ /** Fit the one-parameter bitangent family, never free least-squares controls. */
169
+ function fit(a, b) {
170
+ const p = point(a);
171
+ const q = point(b);
172
+ const v = point(a, 1, "right");
173
+ const z = point(b, 1, "left");
174
+ const determinant = AutoMovieRecoveryConicApproximation_1.AutoMovieRecoveryConicApproximation.cross(v, z);
175
+ if (![p, q, v, z].every(finite) ||
176
+ Math.abs(determinant) <= roundoff * Math.hypot(...v) * Math.hypot(...z))
177
+ return undefined;
178
+ const factor = AutoMovieRecoveryConicApproximation_1.AutoMovieRecoveryConicApproximation.cross(subtract(q, p), z) / determinant;
179
+ const corner = [p[0] + factor * v[0], p[1] + factor * v[1]];
180
+ const endDirection = subtract(q, corner);
181
+ if (factor <= 0 || endDirection[0] * z[0] + endDirection[1] * z[1] <= 0)
182
+ return undefined;
183
+ const x = subtract(corner, p);
184
+ const y = subtract(q, p);
185
+ const area = AutoMovieRecoveryConicApproximation_1.AutoMovieRecoveryConicApproximation.cross(x, y);
186
+ if (!finite(corner) || area === 0)
187
+ return undefined;
188
+ /** Affine barycentric coordinates are linear, including along a normal. */
189
+ function coordinates(sample) {
190
+ const delta = subtract(sample.point, p);
191
+ const l1 = AutoMovieRecoveryConicApproximation_1.AutoMovieRecoveryConicApproximation.cross(delta, y) / area;
192
+ const l2 = AutoMovieRecoveryConicApproximation_1.AutoMovieRecoveryConicApproximation.cross(x, delta) / area;
193
+ const n1 = AutoMovieRecoveryConicApproximation_1.AutoMovieRecoveryConicApproximation.cross(sample.normal, y) / area;
194
+ const n2 = AutoMovieRecoveryConicApproximation_1.AutoMovieRecoveryConicApproximation.cross(x, sample.normal) / area;
195
+ return { value: [1 - l1 - l2, l1, l2], normal: [-n1 - n2, n1, n2] };
196
+ }
197
+ /** Source evaluation is cached once across the coefficient bisections. */
198
+ function sample(t) {
199
+ const position = point(t);
200
+ const tangent = point(t, 1);
201
+ const speed = Math.hypot(...tangent);
202
+ if (!finite(position) || !finite(tangent) || speed === 0)
203
+ return undefined;
204
+ return coordinates({
205
+ point: position,
206
+ normal: [-tangent[1] / speed, tangent[0] / speed],
207
+ });
208
+ }
209
+ // Section 3.1 defines endpoint limits by triple contact. For rational
210
+ // Q=(A,B,E), Q'(0)=2w(B-A), so kappa(0)=|det(B-A,E-A)| /
211
+ // (2w²|B-A|³). Matching each source endpoint curvature gives the exact
212
+ // boundary weights of C_u, without truncating its interior contact range.
213
+ const accelerationA = point(a, 2, "right");
214
+ const accelerationB = point(b, 2, "left");
215
+ const ka = zeroCurvature(a, v, accelerationA, point(a, 3, "right"))
216
+ ? 0
217
+ : Math.abs(AutoMovieRecoveryConicApproximation_1.AutoMovieRecoveryConicApproximation.cross(v, accelerationA)) / Math.hypot(...v) ** 3;
218
+ const kb = zeroCurvature(b, z, accelerationB, point(b, 3, "left"))
219
+ ? 0
220
+ : Math.abs(AutoMovieRecoveryConicApproximation_1.AutoMovieRecoveryConicApproximation.cross(z, accelerationB)) / Math.hypot(...z) ** 3;
221
+ const wa = Math.sqrt(Math.abs(area) / (2 * ka * Math.hypot(...x) ** 3));
222
+ const wb = Math.sqrt(Math.abs(area) / (2 * kb * Math.hypot(...endDirection) ** 3));
223
+ if (Number.isNaN(wa) || Number.isNaN(wb) || wa <= 0 || wb <= 0)
224
+ return undefined;
225
+ const left = Math.min(wa === Infinity ? 1 : wa / (1 + wa), wb === Infinity ? 1 : wb / (1 + wb));
226
+ const right = Math.max(wa === Infinity ? 1 : wa / (1 + wa), wb === Infinity ? 1 : wb / (1 + wb));
227
+ if (left === 1)
228
+ return undefined;
229
+ // Source-coordinate subtraction and barycentric arithmetic have a finite
230
+ // roundoff floor. It controls extremum-search convergence, never tolerance.
231
+ const uncertainty = roundoff *
232
+ Math.max(AutoMovieRecoveryConicApproximation_1.AutoMovieRecoveryConicApproximation.distance(p, q), Math.abs(p[0]), Math.abs(p[1]), Math.abs(q[0]), Math.abs(q[1]));
233
+ const refined = (0, GhoshConicApproximationBalance_1.GhoshConicApproximationBalance)(sample, [a, b], [left, right], options.maximumDepth, uncertainty);
234
+ if (refined === undefined)
235
+ return undefined;
236
+ const rho = refined[0];
237
+ const weight = rho / (1 - rho);
238
+ if (!Number.isFinite(weight) || weight <= 0)
239
+ return undefined;
240
+ let maximum = refined[1];
241
+ // These half-shifted nodes never participate in fitting the weight.
242
+ for (let i = 0; i < 64; ++i) {
243
+ const coordinate = sample(a + ((b - a) * (i + 0.5)) / 64);
244
+ const d = coordinate === undefined ? undefined : (0, GhoshConicApproximationDisplacement_1.GhoshConicApproximationDisplacement)(coordinate, rho);
245
+ if (d === undefined)
246
+ return undefined;
247
+ maximum = Math.max(maximum, Math.abs(d));
248
+ }
249
+ return {
250
+ domain: [a, b],
251
+ controls: [p, corner, q],
252
+ weight,
253
+ maximumSampleErrorMm: maximum,
254
+ };
255
+ }
256
+ /** Construct an immutable report, with omissions distinct from fit precision. */
257
+ function result() {
258
+ return {
259
+ method: "ghosh-petitjean-vegter-2007-numerical-equioscillation-boundary-extension",
260
+ status: omitted === 0 && errors.length === 0
261
+ ? "complete"
262
+ : arcs.length === 0
263
+ ? "refused"
264
+ : "partial",
265
+ arcs,
266
+ diagnostics: [...diagnostics],
267
+ maximumSampleErrorMm: arcs.reduce((value, arc) => Math.max(value, arc.maximumSampleErrorMm), 0),
268
+ certified: false,
269
+ queries,
270
+ };
271
+ }
272
+ if (errors.length !== 0)
273
+ return result();
274
+ diagnostics.add("Numerical adaptation: sampled regularity, affine-curvature monotonicity and normal extrema do not certify the paper's smoothness/Hausdorff hypotheses or optimal arc count.");
275
+ const breaks = [
276
+ curve.domain[0],
277
+ ...new Set(curve.breaks),
278
+ curve.domain[1],
279
+ ].sort((a, b) => a - b);
280
+ const pending = [];
281
+ for (let i = breaks.length - 2; i >= 0; --i)
282
+ pending.push({ a: breaks[i], b: breaks[i + 1], depth: 0 });
283
+ const visitBudget = (breaks.length + options.maximumArcs) * (options.maximumDepth + 1) * 2;
284
+ try {
285
+ while (pending.length !== 0) {
286
+ if (arcs.length + omitted >= options.maximumArcs ||
287
+ ++visits > visitBudget) {
288
+ omitted += pending.length;
289
+ diagnostics.add("Arc or admission-work budget exhausted; remaining source domains are omitted.");
290
+ break;
291
+ }
292
+ const interval = pending.pop();
293
+ const { a, b, depth } = interval;
294
+ const admission = admit(a, b);
295
+ let candidate = admission === "regular"
296
+ ? fit(a, b)
297
+ : admission === "line"
298
+ ? line(a, b)
299
+ : undefined;
300
+ if (candidate !== undefined &&
301
+ candidate.maximumSampleErrorMm <= options.toleranceMm) {
302
+ arcs.push(candidate);
303
+ continue;
304
+ }
305
+ // Proposition 3.4 permits endpoint bisection on an admitted affine spiral.
306
+ // A failed numerical candidate is only an upper search bound, never a fit.
307
+ if (admission === "regular" && candidate !== undefined) {
308
+ let left = a;
309
+ let right = b;
310
+ let accepted;
311
+ for (let iteration = 0; iteration < options.maximumDepth - depth; ++iteration) {
312
+ const middle = (left + right) / 2;
313
+ candidate = fit(a, middle);
314
+ if (candidate !== undefined &&
315
+ candidate.maximumSampleErrorMm <= options.toleranceMm) {
316
+ left = middle;
317
+ accepted = candidate;
318
+ }
319
+ else
320
+ right = middle;
321
+ }
322
+ if (accepted !== undefined) {
323
+ arcs.push(accepted);
324
+ pending.push({ a: accepted.domain[1], b, depth: depth + 1 });
325
+ continue;
326
+ }
327
+ }
328
+ const middle = (a + b) / 2;
329
+ if (depth >= options.maximumDepth || middle === a || middle === b) {
330
+ ++omitted;
331
+ diagnostics.add(admission === "regular" || admission === "line"
332
+ ? "Unresolved bitangent triangle, normal intersection or tolerance at subdivision limit."
333
+ : admission);
334
+ }
335
+ else {
336
+ pending.push({ a: middle, b, depth: depth + 1 }, { a, b: middle, depth: depth + 1 });
337
+ }
338
+ }
339
+ }
340
+ catch (error) {
341
+ if (sourceFailure === undefined)
342
+ throw error;
343
+ errors.push(sourceFailure);
344
+ diagnostics.add(`Source callback failure: ${sourceFailure}`);
345
+ arcs.length = 0;
346
+ ++omitted;
347
+ }
348
+ return result();
349
+ }
350
+ //# sourceMappingURL=approximateAutoMovieRecoveryConicsGhosh.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"approximateAutoMovieRecoveryConicsGhosh.js","sourceRoot":"","sources":["../../src/curves/approximateAutoMovieRecoveryConicsGhosh.ts"],"names":[],"mappings":";;;AAAA,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MAAM,GAAW,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;YACnC,IAAI,KAAK,IAAI,OAAO,CAAC,YAAY,IAAI,MAAM,KAAK,CAAC,IAAI,MAAM,KAAK,CAAC,EAAE,CAAC;gBAClE,EAAE,OAAO,CAAC;gBACV,WAAW,CAAC,GAAG,CACb,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,MAAM;oBAC7C,CAAC,CAAC,uFAAuF;oBACzF,CAAC,CAAC,SAAS,CACd,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,IAAI,CACV,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC,EAAE,EAClC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC,EAAE,CACnC,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,aAAa,KAAK,SAAS;YAAE,MAAM,KAAK,CAAC;QAC7C,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC3B,WAAW,CAAC,GAAG,CAAC,4BAA4B,aAAa,EAAE,CAAC,CAAC;QAC7D,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAChB,EAAE,OAAO,CAAC;IACZ,CAAC;IACD,OAAO,MAAM,EAAE,CAAC;AAClB,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { AutoMovieRecoveryConicApproximation as C } from "./AutoMovieRecoveryConicApproximation";
2
+ /**
3
+ * Locate isolated cubic regularity and affine-curvature candidates analytically.
4
+ *
5
+ * For p(t)=a*t^3+b*t^2+c*t+d, D=cross(p',p'') is quadratic,
6
+ * D=D0+e0*t+f*t^2/2 with e0=6*cross(c,a), f=12*cross(b,a).
7
+ * Away from D=0, affine curvature has a stationary value only where e=D'=0
8
+ * or 4*e^2-9*f*D=0. The existing engine polynomial-root owner evaluates these
9
+ * source-coefficient polynomials; it does not fit observations or a point grid.
10
+ * Roots of the two derivative components also identify stationary candidates.
11
+ *
12
+ * Input is a finite planar Bernstein control quadruple, in any fixed uniform
13
+ * spatial unit. Translation and uniform edge normalization condition only the
14
+ * root calculation: the supplied controls and source evaluator stay unchanged.
15
+ * Results are numerical candidates in the open normalized interval, not exact
16
+ * real roots or certified isolating intervals. Exactly identical values merge;
17
+ * nearby distinct values remain separate. A constant polynomial has no isolated
18
+ * roots. Zero-curvature values include inflections, repeated roots and stationary
19
+ * points and do not themselves establish source regularity.
20
+ *
21
+ * @evidence contracts/development/common.md#meaningful-documentation States the derivative polynomials, normalized parameter, source preservation, conditioning, degenerate cases and numerical proof limits.
22
+ * @evidence contracts/development/implementation.md#principled-implementation Cubic differentiation gives the exact bounded-degree critical equations in real arithmetic; binary64 root candidates reuse the engine's normalized monotone-partition owner and stationary candidates require both velocity components to vanish within Horner roundoff.
23
+ * @evidence contracts/development/implementation.md#clear-and-simple-structure This pure coefficient helper owns one derivation; the shared namespace exposes it to Ahn, Ghosh and their source-chart adapter without artifact I/O.
24
+ * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No Human coordinates, finite-difference offsets, epsilon root merging, endpoint displacement or altered source jets are used. Nonfinite controls or unrepresentable edge arithmetic throw RangeError.
25
+ * @evidence contracts/development/implementation.md#efficient-algorithms A fixed four-control source yields polynomial degrees at most two; the engine solver has bounded derivative recursion and 60 bisections, giving constant work and storage per cubic.
26
+ * @evidence contracts/development/implementation.md#reuse-equivalent-work One difference/normalization pass supplies the velocity, curvature and affine critical polynomials; callers may reuse the returned candidates for both algorithms.
27
+ * @evidence contracts/development/implementation.md#bound-retention-and-release-resources All coefficients and root arrays are call-local; only scalar parameters and diagnostics transfer to the caller, with no retained source or external resource.
28
+ */
29
+ export declare function findAutoMovieRecoveryCubicCriticalParameters(controls: readonly [C.Point, C.Point, C.Point, C.Point]): C.ICubicCriticalParameters;
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findAutoMovieRecoveryCubicCriticalParameters = findAutoMovieRecoveryCubicCriticalParameters;
4
+ const engine_1 = require("@automovie/engine");
5
+ /**
6
+ * Locate isolated cubic regularity and affine-curvature candidates analytically.
7
+ *
8
+ * For p(t)=a*t^3+b*t^2+c*t+d, D=cross(p',p'') is quadratic,
9
+ * D=D0+e0*t+f*t^2/2 with e0=6*cross(c,a), f=12*cross(b,a).
10
+ * Away from D=0, affine curvature has a stationary value only where e=D'=0
11
+ * or 4*e^2-9*f*D=0. The existing engine polynomial-root owner evaluates these
12
+ * source-coefficient polynomials; it does not fit observations or a point grid.
13
+ * Roots of the two derivative components also identify stationary candidates.
14
+ *
15
+ * Input is a finite planar Bernstein control quadruple, in any fixed uniform
16
+ * spatial unit. Translation and uniform edge normalization condition only the
17
+ * root calculation: the supplied controls and source evaluator stay unchanged.
18
+ * Results are numerical candidates in the open normalized interval, not exact
19
+ * real roots or certified isolating intervals. Exactly identical values merge;
20
+ * nearby distinct values remain separate. A constant polynomial has no isolated
21
+ * roots. Zero-curvature values include inflections, repeated roots and stationary
22
+ * points and do not themselves establish source regularity.
23
+ *
24
+ * @evidence contracts/development/common.md#meaningful-documentation States the derivative polynomials, normalized parameter, source preservation, conditioning, degenerate cases and numerical proof limits.
25
+ * @evidence contracts/development/implementation.md#principled-implementation Cubic differentiation gives the exact bounded-degree critical equations in real arithmetic; binary64 root candidates reuse the engine's normalized monotone-partition owner and stationary candidates require both velocity components to vanish within Horner roundoff.
26
+ * @evidence contracts/development/implementation.md#clear-and-simple-structure This pure coefficient helper owns one derivation; the shared namespace exposes it to Ahn, Ghosh and their source-chart adapter without artifact I/O.
27
+ * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No Human coordinates, finite-difference offsets, epsilon root merging, endpoint displacement or altered source jets are used. Nonfinite controls or unrepresentable edge arithmetic throw RangeError.
28
+ * @evidence contracts/development/implementation.md#efficient-algorithms A fixed four-control source yields polynomial degrees at most two; the engine solver has bounded derivative recursion and 60 bisections, giving constant work and storage per cubic.
29
+ * @evidence contracts/development/implementation.md#reuse-equivalent-work One difference/normalization pass supplies the velocity, curvature and affine critical polynomials; callers may reuse the returned candidates for both algorithms.
30
+ * @evidence contracts/development/implementation.md#bound-retention-and-release-resources All coefficients and root arrays are call-local; only scalar parameters and diagnostics transfer to the caller, with no retained source or external resource.
31
+ */
32
+ function findAutoMovieRecoveryCubicCriticalParameters(controls) {
33
+ if (controls.length !== 4)
34
+ throw new RangeError("Cubic critical parameters require four finite planar Bernstein controls.");
35
+ for (let i = 0; i < 4; ++i) {
36
+ const p = controls[i];
37
+ if (p === undefined || !Array.isArray(p) || p.length !== 2 || !Number.isFinite(p[0]) || !Number.isFinite(p[1]))
38
+ throw new RangeError("Cubic critical parameters require four finite planar Bernstein controls.");
39
+ }
40
+ const raw = controls.slice(1).map((p, i) => [p[0] - controls[i][0], p[1] - controls[i][1]]);
41
+ const scale = Math.max(...raw.flatMap((p) => [Math.abs(p[0]), Math.abs(p[1])]));
42
+ if (!Number.isFinite(scale))
43
+ throw new RangeError("Source control differences exceed finite binary64 arithmetic.");
44
+ if (scale === 0)
45
+ return { breaks: [], zeroCurvature: [], affineCritical: [], stationary: [], collinear: true,
46
+ diagnostics: ["Constant cubic: every parameter is stationary; no isolated critical parameters exist."] };
47
+ const edges = raw.map((p) => [p[0] / scale, p[1] / scale]);
48
+ const a = [edges[2][0] - 2 * edges[1][0] + edges[0][0], edges[2][1] - 2 * edges[1][1] + edges[0][1]];
49
+ const b = [3 * (edges[1][0] - edges[0][0]), 3 * (edges[1][1] - edges[0][1])];
50
+ const c = [3 * edges[0][0], 3 * edges[0][1]];
51
+ const determinant = (x, y) => x[0] * y[1] - x[1] * y[0];
52
+ const d0 = 2 * determinant(c, b);
53
+ const e0 = 6 * determinant(c, a);
54
+ const f = 12 * determinant(b, a);
55
+ const collinear = d0 === 0 && e0 === 0 && f === 0;
56
+ const zeroCurvature = collinear ? [] : (0, engine_1.rootsAutoMovieViewPolynomial)([d0, e0, f / 2]);
57
+ const affineCritical = collinear ? [] : [...new Set([
58
+ ...(0, engine_1.rootsAutoMovieViewPolynomial)([e0, f]),
59
+ ...(0, engine_1.rootsAutoMovieViewPolynomial)([4 * e0 * e0 - 9 * f * d0, -f * e0, -f * f / 2]),
60
+ ])].sort((x, y) => x - y);
61
+ // A common velocity root is a regularity event even when D is identically
62
+ // zero or touches zero without changing sign. Both components must agree.
63
+ const vx = [c[0], 2 * b[0], 3 * a[0]];
64
+ const vy = [c[1], 2 * b[1], 3 * a[1]];
65
+ const primary = vx.some((v) => v !== 0) ? vx : vy;
66
+ const residual = (coefficients, t) => coefficients[0] + t * (coefficients[1] + t * coefficients[2]);
67
+ const allowance = (coefficients, t) => 64 * Number.EPSILON * (Math.abs(coefficients[0]) + Math.abs(t * coefficients[1]) + Math.abs(t * t * coefficients[2]));
68
+ const stationary = (0, engine_1.rootsAutoMovieViewPolynomial)(primary).filter((t) => Math.abs(residual(vx, t)) <= allowance(vx, t) && Math.abs(residual(vy, t)) <= allowance(vy, t));
69
+ const diagnostics = ["Critical parameters are binary64 polynomial-root candidates, not certified real-root enclosures; close multiple roots may remain unresolved."];
70
+ if (collinear)
71
+ diagnostics.push("Curvature numerator is identically zero: regular pieces are collinear and have no isolated curvature roots.");
72
+ if (!collinear && e0 === 0 && f === 0)
73
+ diagnostics.push("Affine curvature is constant on regular intervals; no isolated affine-curvature extrema exist.");
74
+ return { breaks: [...new Set([...zeroCurvature, ...affineCritical, ...stationary])].sort((x, y) => x - y),
75
+ zeroCurvature, affineCritical, stationary, collinear, diagnostics };
76
+ }
77
+ //# sourceMappingURL=findAutoMovieRecoveryCubicCriticalParameters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findAutoMovieRecoveryCubicCriticalParameters.js","sourceRoot":"","sources":["../../src/curves/findAutoMovieRecoveryCubicCriticalParameters.ts"],"names":[],"mappings":";;;AAAA,8CAAiE;AAIjE;;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AAE,CAAC,CAAC,CAAC,CAAC;IAClG,MAAM,WAAW,GAAa,CAAC,8IAA8I,CAAC,CAAC;IAC/K,IAAI,SAAS;QAAE,WAAW,CAAC,IAAI,CAAC,6GAA6G,CAAC,CAAC;IAC/I,IAAI,CAAC,SAAS,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,WAAW,CAAC,IAAI,CAAC,gGAAgG,CAAC,CAAC;IAC1J,OAAO,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,aAAa,EAAE,GAAG,cAAc,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAS,EAAE,CAAS,EAAU,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;QAC/H,aAAa,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;AACxE,CAAC"}
@@ -1 +1,6 @@
1
1
  export * from "./convertAutoMovieRecoveryCurves";
2
+ export * from "./AutoMovieRecoveryCompactApproximation";
3
+ export * from "./AutoMovieRecoveryConicApproximation";
4
+ export * from "./approximateAutoMovieRecoveryCompactCurves";
5
+ export * from "./approximateAutoMovieRecoveryConicsAhn";
6
+ export * from "./approximateAutoMovieRecoveryConicsGhosh";
@@ -15,4 +15,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./convertAutoMovieRecoveryCurves"), exports);
18
+ __exportStar(require("./AutoMovieRecoveryCompactApproximation"), exports);
19
+ __exportStar(require("./AutoMovieRecoveryConicApproximation"), exports);
20
+ __exportStar(require("./approximateAutoMovieRecoveryCompactCurves"), exports);
21
+ __exportStar(require("./approximateAutoMovieRecoveryConicsAhn"), exports);
22
+ __exportStar(require("./approximateAutoMovieRecoveryConicsGhosh"), exports);
18
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/curves/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mEAAiD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/curves/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mEAAiD;AACjD,0EAAwD;AACxD,wEAAsD;AACtD,8EAA4D;AAC5D,0EAAwD;AACxD,4EAA0D"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Balance a bitangent conic's signed normal extrema with numerical exchange.
3
+ * Initial source nodes bracket witnessed displacement peaks. Golden-section
4
+ * refinement locates each such peak between nodes, then its source coordinate
5
+ * joins the coefficient bisection and the two signed lobes are rebalanced.
6
+ * This implements the extrema/equioscillation criterion of Ghosh et al. (2007),
7
+ * sections 3.2–3.3 and 6, without treating a fixed grid maximum as a supremum.
8
+ *
9
+ * The returned tuple is [rho, refined maximum displacement in millimetres].
10
+ * Finite peak brackets still do not certify that an arbitrary callback has no
11
+ * unwitnessed extrema; exhausted exchange or an invalid normal returns absent.
12
+ * Source endpoints have displacement zero by exact endpoint interpolation.
13
+ *
14
+ * @evidence contracts/development/common.md#meaningful-documentation Explains extrema exchange, compactified weight, physical error, endpoint zeros, finite-bracket limits and absent-result effects.
15
+ * @evidence contracts/development/implementation.md#principled-implementation Ghosh's equioscillation minimizes opposing signed normal lobes; scalar bisection is alternated with bracketed extremum optimization instead of accepting sampled maxima. Golden-section convergence stops at binary64 parameter resolution and invalid normal graphs remain unsupported.
16
+ * @evidence contracts/development/implementation.md#clear-and-simple-structure The helper owns weight/extremum search while its caller owns differential admission, tangent geometry, independent validation and interval coverage.
17
+ * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No sample-count increase, inflated fit tolerance, input smoothing, missing-domain bridge or fixture-specific coefficient is used. New fitting nodes are located extrema and a roundoff allowance only controls search convergence.
18
+ * @evidence contracts/development/implementation.md#efficient-algorithms For E bounded exchanges, N initial/located extrema and G golden iterations, time is O(E*(32*N+N*G)); the caller's depth bounds E and binary64 precision bounds G. Source-coordinate caching avoids repeated callbacks at identical parameters.
19
+ * @evidence contracts/development/implementation.md#reuse-equivalent-work A call-local parameter map reuses source points/normals throughout weight iterations and peak refinement; source identity and interval are fixed for the call.
20
+ * @evidence contracts/development/implementation.md#bound-retention-and-release-resources Fit nodes and cached coordinates are bounded by exchanges and golden iterations, discarded on return, and never appear in the returned coefficients.
21
+ */
22
+ export declare function GhoshConicApproximationBalance(sample: (t: number) => {
23
+ value: readonly number[];
24
+ normal: readonly number[];
25
+ } | undefined, domain: readonly [number, number], bounds: readonly [number, number], maximumExchanges: number, roundoffMm: number): readonly [number, number] | undefined;