@automovie/human 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 (162) hide show
  1. package/README.md +18 -3
  2. package/lib/generation/AutoMovieHumanDigitJoints.d.ts +8 -26
  3. package/lib/generation/AutoMovieHumanDigitJoints.js +9 -37
  4. package/lib/generation/AutoMovieHumanDigitJoints.js.map +1 -1
  5. package/lib/generation/conic/AutoMovieHumanConicLoft.d.ts +154 -0
  6. package/lib/generation/conic/AutoMovieHumanConicLoft.js +430 -0
  7. package/lib/generation/conic/AutoMovieHumanConicLoft.js.map +1 -0
  8. package/lib/generation/conic/AutoMovieHumanConicPose.d.ts +92 -0
  9. package/lib/generation/conic/AutoMovieHumanConicPose.js +202 -0
  10. package/lib/generation/conic/AutoMovieHumanConicPose.js.map +1 -0
  11. package/lib/generation/conic/AutoMovieHumanConicRelief.d.ts +52 -0
  12. package/lib/generation/conic/AutoMovieHumanConicRelief.js +88 -0
  13. package/lib/generation/conic/AutoMovieHumanConicRelief.js.map +1 -0
  14. package/lib/generation/conic/AutoMovieHumanConicSection.d.ts +252 -0
  15. package/lib/generation/conic/AutoMovieHumanConicSection.js +567 -0
  16. package/lib/generation/conic/AutoMovieHumanConicSection.js.map +1 -0
  17. package/lib/generation/f1/AutoMovieHumanF1.d.ts +265 -0
  18. package/lib/generation/f1/AutoMovieHumanF1.js +1254 -0
  19. package/lib/generation/f1/AutoMovieHumanF1.js.map +1 -0
  20. package/lib/generation/f1/AutoMovieHumanF1Antihelix.d.ts +23 -0
  21. package/lib/generation/f1/AutoMovieHumanF1Antihelix.js +65 -0
  22. package/lib/generation/f1/AutoMovieHumanF1Antihelix.js.map +1 -0
  23. package/lib/generation/f1/AutoMovieHumanF1Arm.d.ts +18 -0
  24. package/lib/generation/f1/AutoMovieHumanF1Arm.js +82 -0
  25. package/lib/generation/f1/AutoMovieHumanF1Arm.js.map +1 -0
  26. package/lib/generation/f1/AutoMovieHumanF1Axilla.d.ts +18 -0
  27. package/lib/generation/f1/AutoMovieHumanF1Axilla.js +91 -0
  28. package/lib/generation/f1/AutoMovieHumanF1Axilla.js.map +1 -0
  29. package/lib/generation/f1/AutoMovieHumanF1Breast.d.ts +18 -0
  30. package/lib/generation/f1/AutoMovieHumanF1Breast.js +75 -0
  31. package/lib/generation/f1/AutoMovieHumanF1Breast.js.map +1 -0
  32. package/lib/generation/f1/AutoMovieHumanF1Concha.d.ts +40 -0
  33. package/lib/generation/f1/AutoMovieHumanF1Concha.js +81 -0
  34. package/lib/generation/f1/AutoMovieHumanF1Concha.js.map +1 -0
  35. package/lib/generation/f1/AutoMovieHumanF1FingerIndex.d.ts +18 -0
  36. package/lib/generation/f1/AutoMovieHumanF1FingerIndex.js +59 -0
  37. package/lib/generation/f1/AutoMovieHumanF1FingerIndex.js.map +1 -0
  38. package/lib/generation/f1/AutoMovieHumanF1FingerMiddle.d.ts +18 -0
  39. package/lib/generation/f1/AutoMovieHumanF1FingerMiddle.js +59 -0
  40. package/lib/generation/f1/AutoMovieHumanF1FingerMiddle.js.map +1 -0
  41. package/lib/generation/f1/AutoMovieHumanF1FingerPinky.d.ts +18 -0
  42. package/lib/generation/f1/AutoMovieHumanF1FingerPinky.js +75 -0
  43. package/lib/generation/f1/AutoMovieHumanF1FingerPinky.js.map +1 -0
  44. package/lib/generation/f1/AutoMovieHumanF1FingerRing.d.ts +18 -0
  45. package/lib/generation/f1/AutoMovieHumanF1FingerRing.js +75 -0
  46. package/lib/generation/f1/AutoMovieHumanF1FingerRing.js.map +1 -0
  47. package/lib/generation/f1/AutoMovieHumanF1FingerThumb.d.ts +18 -0
  48. package/lib/generation/f1/AutoMovieHumanF1FingerThumb.js +59 -0
  49. package/lib/generation/f1/AutoMovieHumanF1FingerThumb.js.map +1 -0
  50. package/lib/generation/f1/AutoMovieHumanF1Frames.d.ts +97 -0
  51. package/lib/generation/f1/AutoMovieHumanF1Frames.js +160 -0
  52. package/lib/generation/f1/AutoMovieHumanF1Frames.js.map +1 -0
  53. package/lib/generation/f1/AutoMovieHumanF1Hand.d.ts +18 -0
  54. package/lib/generation/f1/AutoMovieHumanF1Hand.js +81 -0
  55. package/lib/generation/f1/AutoMovieHumanF1Hand.js.map +1 -0
  56. package/lib/generation/f1/AutoMovieHumanF1Helix.d.ts +20 -0
  57. package/lib/generation/f1/AutoMovieHumanF1Helix.js +64 -0
  58. package/lib/generation/f1/AutoMovieHumanF1Helix.js.map +1 -0
  59. package/lib/generation/f1/AutoMovieHumanF1Joints.d.ts +231 -0
  60. package/lib/generation/f1/AutoMovieHumanF1Joints.js +249 -0
  61. package/lib/generation/f1/AutoMovieHumanF1Joints.js.map +1 -0
  62. package/lib/generation/f1/AutoMovieHumanF1Landmarks.d.ts +86 -0
  63. package/lib/generation/f1/AutoMovieHumanF1Landmarks.js +89 -0
  64. package/lib/generation/f1/AutoMovieHumanF1Landmarks.js.map +1 -0
  65. package/lib/generation/f1/AutoMovieHumanF1Leg.d.ts +18 -0
  66. package/lib/generation/f1/AutoMovieHumanF1Leg.js +82 -0
  67. package/lib/generation/f1/AutoMovieHumanF1Leg.js.map +1 -0
  68. package/lib/generation/f1/AutoMovieHumanF1Nose.d.ts +18 -0
  69. package/lib/generation/f1/AutoMovieHumanF1Nose.js +82 -0
  70. package/lib/generation/f1/AutoMovieHumanF1Nose.js.map +1 -0
  71. package/lib/generation/f1/AutoMovieHumanF1Nostril.d.ts +18 -0
  72. package/lib/generation/f1/AutoMovieHumanF1Nostril.js +59 -0
  73. package/lib/generation/f1/AutoMovieHumanF1Nostril.js.map +1 -0
  74. package/lib/generation/f1/AutoMovieHumanF1Placement.d.ts +75 -0
  75. package/lib/generation/f1/AutoMovieHumanF1Placement.js +151 -0
  76. package/lib/generation/f1/AutoMovieHumanF1Placement.js.map +1 -0
  77. package/lib/generation/f1/AutoMovieHumanF1Placing.d.ts +45 -0
  78. package/lib/generation/f1/AutoMovieHumanF1Placing.js +301 -0
  79. package/lib/generation/f1/AutoMovieHumanF1Placing.js.map +1 -0
  80. package/lib/generation/f1/AutoMovieHumanF1Plate.d.ts +18 -0
  81. package/lib/generation/f1/AutoMovieHumanF1Plate.js +59 -0
  82. package/lib/generation/f1/AutoMovieHumanF1Plate.js.map +1 -0
  83. package/lib/generation/f1/AutoMovieHumanF1ToeBig.d.ts +18 -0
  84. package/lib/generation/f1/AutoMovieHumanF1ToeBig.js +59 -0
  85. package/lib/generation/f1/AutoMovieHumanF1ToeBig.js.map +1 -0
  86. package/lib/generation/f1/AutoMovieHumanF1ToeIndex.d.ts +18 -0
  87. package/lib/generation/f1/AutoMovieHumanF1ToeIndex.js +59 -0
  88. package/lib/generation/f1/AutoMovieHumanF1ToeIndex.js.map +1 -0
  89. package/lib/generation/f1/AutoMovieHumanF1ToeLittle.d.ts +18 -0
  90. package/lib/generation/f1/AutoMovieHumanF1ToeLittle.js +75 -0
  91. package/lib/generation/f1/AutoMovieHumanF1ToeLittle.js.map +1 -0
  92. package/lib/generation/f1/AutoMovieHumanF1ToeMiddle.d.ts +18 -0
  93. package/lib/generation/f1/AutoMovieHumanF1ToeMiddle.js +75 -0
  94. package/lib/generation/f1/AutoMovieHumanF1ToeMiddle.js.map +1 -0
  95. package/lib/generation/f1/AutoMovieHumanF1ToeRing.d.ts +18 -0
  96. package/lib/generation/f1/AutoMovieHumanF1ToeRing.js +75 -0
  97. package/lib/generation/f1/AutoMovieHumanF1ToeRing.js.map +1 -0
  98. package/lib/generation/f1/AutoMovieHumanF1Trunk.d.ts +18 -0
  99. package/lib/generation/f1/AutoMovieHumanF1Trunk.js +79 -0
  100. package/lib/generation/f1/AutoMovieHumanF1Trunk.js.map +1 -0
  101. package/lib/generation/f1/AutoMovieHumanF1Vault.d.ts +18 -0
  102. package/lib/generation/f1/AutoMovieHumanF1Vault.js +75 -0
  103. package/lib/generation/f1/AutoMovieHumanF1Vault.js.map +1 -0
  104. package/lib/generation/frame/AutoMovieHumanSegmentFrame.d.ts +149 -0
  105. package/lib/generation/frame/AutoMovieHumanSegmentFrame.js +290 -0
  106. package/lib/generation/frame/AutoMovieHumanSegmentFrame.js.map +1 -0
  107. package/lib/index.d.ts +11 -0
  108. package/lib/index.js +11 -0
  109. package/lib/index.js.map +1 -1
  110. package/lib/skeleton/AutoMovieHumanCanonicalBody.d.ts +7 -3
  111. package/lib/skeleton/AutoMovieHumanCanonicalBody.js +31 -3
  112. package/lib/skeleton/AutoMovieHumanCanonicalBody.js.map +1 -1
  113. package/lib/skeleton/AutoMovieHumanCanonicalProfile.d.ts +22 -31
  114. package/lib/skeleton/AutoMovieHumanCanonicalProfile.js +112 -172
  115. package/lib/skeleton/AutoMovieHumanCanonicalProfile.js.map +1 -1
  116. package/lib/skeleton/AutoMovieHumanCanonicalSolids.d.ts +65 -0
  117. package/lib/skeleton/AutoMovieHumanCanonicalSolids.js +105 -0
  118. package/lib/skeleton/AutoMovieHumanCanonicalSolids.js.map +1 -0
  119. package/lib/skeleton/index.d.ts +1 -0
  120. package/lib/skeleton/index.js +1 -0
  121. package/lib/skeleton/index.js.map +1 -1
  122. package/package.json +21 -13
  123. package/src/generation/AutoMovieHumanDigitJoints.ts +12 -47
  124. package/src/generation/conic/AutoMovieHumanConicLoft.ts +566 -0
  125. package/src/generation/conic/AutoMovieHumanConicPose.ts +213 -0
  126. package/src/generation/conic/AutoMovieHumanConicRelief.ts +94 -0
  127. package/src/generation/conic/AutoMovieHumanConicSection.ts +609 -0
  128. package/src/generation/f1/AutoMovieHumanF1.ts +1448 -0
  129. package/src/generation/f1/AutoMovieHumanF1Antihelix.ts +64 -0
  130. package/src/generation/f1/AutoMovieHumanF1Arm.ts +82 -0
  131. package/src/generation/f1/AutoMovieHumanF1Axilla.ts +90 -0
  132. package/src/generation/f1/AutoMovieHumanF1Breast.ts +74 -0
  133. package/src/generation/f1/AutoMovieHumanF1Concha.ts +80 -0
  134. package/src/generation/f1/AutoMovieHumanF1FingerIndex.ts +58 -0
  135. package/src/generation/f1/AutoMovieHumanF1FingerMiddle.ts +58 -0
  136. package/src/generation/f1/AutoMovieHumanF1FingerPinky.ts +74 -0
  137. package/src/generation/f1/AutoMovieHumanF1FingerRing.ts +74 -0
  138. package/src/generation/f1/AutoMovieHumanF1FingerThumb.ts +58 -0
  139. package/src/generation/f1/AutoMovieHumanF1Frames.ts +191 -0
  140. package/src/generation/f1/AutoMovieHumanF1Hand.ts +81 -0
  141. package/src/generation/f1/AutoMovieHumanF1Helix.ts +63 -0
  142. package/src/generation/f1/AutoMovieHumanF1Joints.ts +319 -0
  143. package/src/generation/f1/AutoMovieHumanF1Landmarks.ts +101 -0
  144. package/src/generation/f1/AutoMovieHumanF1Leg.ts +82 -0
  145. package/src/generation/f1/AutoMovieHumanF1Nose.ts +82 -0
  146. package/src/generation/f1/AutoMovieHumanF1Nostril.ts +58 -0
  147. package/src/generation/f1/AutoMovieHumanF1Placement.ts +148 -0
  148. package/src/generation/f1/AutoMovieHumanF1Placing.ts +313 -0
  149. package/src/generation/f1/AutoMovieHumanF1Plate.ts +59 -0
  150. package/src/generation/f1/AutoMovieHumanF1ToeBig.ts +58 -0
  151. package/src/generation/f1/AutoMovieHumanF1ToeIndex.ts +58 -0
  152. package/src/generation/f1/AutoMovieHumanF1ToeLittle.ts +74 -0
  153. package/src/generation/f1/AutoMovieHumanF1ToeMiddle.ts +74 -0
  154. package/src/generation/f1/AutoMovieHumanF1ToeRing.ts +74 -0
  155. package/src/generation/f1/AutoMovieHumanF1Trunk.ts +79 -0
  156. package/src/generation/f1/AutoMovieHumanF1Vault.ts +74 -0
  157. package/src/generation/frame/AutoMovieHumanSegmentFrame.ts +309 -0
  158. package/src/index.ts +11 -0
  159. package/src/skeleton/AutoMovieHumanCanonicalBody.ts +53 -3
  160. package/src/skeleton/AutoMovieHumanCanonicalProfile.ts +153 -358
  161. package/src/skeleton/AutoMovieHumanCanonicalSolids.ts +175 -0
  162. package/src/skeleton/index.ts +1 -0
@@ -0,0 +1,202 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AutoMovieHumanConicPose = void 0;
4
+ const engine_1 = require("@automovie/engine");
5
+ const AutoMovieHumanConicLoft_1 = require("./AutoMovieHumanConicLoft");
6
+ /**
7
+ * A conic family carried to a pose: what a change of its course's joint angles asks of the family besides moving its centres.
8
+ *
9
+ * A jointed course (`AutoMovieViewAxis.jointed`) rounds each interior centre by a turn of arclength `2 half`, which leaves both
10
+ * neighbouring segments at the set-back `d` from the centre; between two turns the course is the segment's own line, a straight run.
11
+ * The straight runs are bone and the turn is the joint, so a pose must keep each run on its bone:
12
+ *
13
+ * 1. **Set-back.** `d = half g(angle)` with `g` a function of the turn's angle alone (`share`, read from the engine's own preparation).
14
+ * At another angle the same `half` gives another set-back, and every station past the turn slides along its bone. A posed turn
15
+ * therefore takes `half' = half g(angle) / g(angle')`, which keeps `d`, and the turn's arclength changes by `2 (half' - half)`.
16
+ * 2. **Stations.** Every station of the family (`knots`, `tips`, relief windows, roll knots) is carried by a piecewise-linear map from
17
+ * the reference course to the posed one (`map`). A run's skin rides one segment, the bone that ends at the run's far centre, so
18
+ * every station of a run keeps its distance from that centre; the first run keeps its distances from the first centre. A turn's span
19
+ * is mapped linearly onto what lies between its neighbours' runs: its own changed arclength and, where a run's near centre stands on
20
+ * another segment than its bone (a built corner fixed in the parent), whatever length the line between the two centres gained or
21
+ * lost. That length is absorbed at the joint the turn stands for, not along the bone.
22
+ * 3. **Twist.** The chart is carried from `up` through each turn by that turn's own rotation, so a joint's rotation about its bone's
23
+ * axis moves no centre and leaves the chart where it was, while everything on the segments past it turns. The posed family takes a
24
+ * `roll` (`AutoMovieHumanConicLoft.IRoll`) that brings the chart on each run to where that run's segment carries the reference chart;
25
+ * along a run the roll goes linearly from the angle of the run before it, at its proximal joint, to its own at its distal joint, as a
26
+ * twist chain spreads a forearm's pronation along its length, and it holds its value across a turn.
27
+ *
28
+ * At the reference pose all three are exact no-ops: the halves, the stations and the arrays that hold them are the family's own.
29
+ */
30
+ var AutoMovieHumanConicPose;
31
+ (function (AutoMovieHumanConicPose) {
32
+ /** Twists under this many radians are none: far above the rounding of an angle between unit vectors (1e-16), far below any joint's motion. */
33
+ const NO_TWIST = 1e-12;
34
+ /** Knots of the roll along one run besides its ends: the natural cubic through five points of a line departs from it only near the run's ends. */
35
+ const ROLL_KNOTS = 3;
36
+ /**
37
+ * A turn's set-back as a share of its half arclength, by its angle: the engine's own preparation of a made corner of that angle with a
38
+ * half of 1 mm between two segments of 1 km (the set-back is linear in the half and does not read the lengths). A straight joint has
39
+ * no turn; its share is the limit 1 of a vanishing angle, where the turn lies along both segments.
40
+ */
41
+ function share(angle) {
42
+ if (angle === 0)
43
+ return 1;
44
+ const made = engine_1.AutoMovieViewJointedCourse.prepare([[-1e6, 0, 0], [0, 0, 0], [1e6 * Math.cos(angle), 1e6 * Math.sin(angle), 0]], [1]);
45
+ if (typeof made === "string")
46
+ throw new Error("pose: no turn of " + angle + " rad: " + made);
47
+ return made.turns[0].setback;
48
+ }
49
+ AutoMovieHumanConicPose.share = share;
50
+ /** The turn angle at each interior centre, radians, as the engine reads it: `atan2(|a x b|, a . b)` of the neighbouring unit directions. */
51
+ function angles(centres) {
52
+ const directions = centres.slice(1).map((p, i) => {
53
+ const d = [p[0] - centres[i][0], p[1] - centres[i][1], p[2] - centres[i][2]];
54
+ const l = Math.hypot(d[0], d[1], d[2]);
55
+ return [d[0] / l, d[1] / l, d[2] / l];
56
+ });
57
+ return directions.slice(1).map((b, i) => {
58
+ const a = directions[i];
59
+ const n = [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];
60
+ return Math.atan2(Math.hypot(n[0], n[1], n[2]), a[0] * b[0] + a[1] * b[1] + a[2] * b[2]);
61
+ });
62
+ }
63
+ AutoMovieHumanConicPose.angles = angles;
64
+ /**
65
+ * The halves that keep every turn's set-back when a course's centres move: `half' = half g(angle) / g(angle')`. At unchanged angles
66
+ * the given array itself is returned.
67
+ */
68
+ function halves(reference, given, posed) {
69
+ const [from, to] = [angles(reference), angles(posed)];
70
+ const out = given.map((half, i) => (from[i] === to[i] ? half : (half * share(from[i])) / share(to[i])));
71
+ return out.every((half, i) => half === given[i]) ? given : out;
72
+ }
73
+ AutoMovieHumanConicPose.halves = halves;
74
+ /** A course's runs and turns in arclength. A straight joint keeps its half as the stretch its set-backs span, which the engine walks as plain line. */
75
+ function course(centres, given) {
76
+ const lengths = centres.slice(1).map((p, i) => Math.hypot(p[0] - centres[i][0], p[1] - centres[i][1], p[2] - centres[i][2]));
77
+ const turned = angles(centres);
78
+ const setbacks = turned.map((angle, i) => given[i] * share(angle));
79
+ const starts = [];
80
+ let s = 0;
81
+ for (let i = 0; i < turned.length; ++i) {
82
+ s += lengths[i] - (i >= 1 ? setbacks[i - 1] : 0) - setbacks[i];
83
+ starts.push(s);
84
+ s += 2 * given[i];
85
+ }
86
+ return { lengths, angles: turned, halves: [...given], setbacks, starts, total: s + lengths.at(-1) - (setbacks.at(-1) ?? 0) };
87
+ }
88
+ AutoMovieHumanConicPose.course = course;
89
+ /** The stations where a course's law changes: its start, each turn's start and end, and its end. */
90
+ function breaks(c) {
91
+ return [0, ...c.starts.flatMap((start, i) => [start, start + 2 * c.halves[i]]), c.total];
92
+ }
93
+ /**
94
+ * The map of stations from a reference course to its posed course, of slope 1 on every run and before the first centre and past the
95
+ * last, and linear across each turn's span. A run after a turn ends where the posed course's run ends, at its far centre's set-back,
96
+ * and keeps its reference length back from there; the first run starts at the first centre. Each turn's span lies between its
97
+ * neighbours' runs, so it takes the turn's own change of arclength and any change of the following segment's length. Null when the
98
+ * two courses' breakpoints are the same numbers, where the map is the identity; a span left without length is refused.
99
+ */
100
+ function map(reference, posed) {
101
+ const x = breaks(reference);
102
+ const to = breaks(posed);
103
+ // The posed breakpoints: each turn's start as the engine dates it, and each turn's span ending where the next run, of its reference
104
+ // length, starts.
105
+ const y = to.map((station, i) => (i >= 2 && i % 2 === 0 && i + 1 < to.length ? to[i + 1] - (x[i + 1] - x[i]) : station));
106
+ if (y.some((station, i) => i >= 1 && !(station > y[i - 1]) && x[i] > x[i - 1]))
107
+ throw new Error("pose: a turn's span is left without length");
108
+ if (x.every((s, i) => s === y[i]))
109
+ return null;
110
+ return (station) => {
111
+ if (station <= x[0])
112
+ return y[0] + (station - x[0]);
113
+ for (let i = 1; i < x.length; ++i)
114
+ if (station <= x[i])
115
+ return x[i] === x[i - 1] ? y[i] : y[i - 1] + ((y[i] - y[i - 1]) * (station - x[i - 1])) / (x[i] - x[i - 1]);
116
+ return y.at(-1) + (station - x.at(-1));
117
+ };
118
+ }
119
+ AutoMovieHumanConicPose.map = map;
120
+ /**
121
+ * The roll that brings a posed family's chart on each run to where the run's segment carries the reference chart.
122
+ *
123
+ * On run `k` the angle is read at the run's middle: from the posed course's own chart `u`, carried from `up` by the turns alone, toward
124
+ * `v`, to the reference course's own `u` there, carried likewise, as `carried` maps it into the pose. Each angle is taken on the branch nearest the run
125
+ * before it. The roll's knots stand at each run's ends and `ROLL_KNOTS` points between, on the line from the angle of the run before
126
+ * (the first run: its own) to the run's own, so it holds across every turn. Absent when no run's angle reaches `NO_TWIST`.
127
+ *
128
+ * @param reference The family as stored, in the reference pose.
129
+ * @param posed Its centres, halves and `up` at the pose, without a roll.
130
+ * @param carried A direction of the reference pose on run `k`, as that run's segment carries it to the pose.
131
+ */
132
+ function twist(reference, posed, carried) {
133
+ // A posed course the engine does not admit has no chart to read; the family is refused with the engine's own rule when it is lofted.
134
+ if (typeof engine_1.AutoMovieViewJointedCourse.prepare(posed.centres, posed.halves) === "string")
135
+ return undefined;
136
+ const [from, to] = [course(reference.centres, reference.halves), course(posed.centres, posed.halves)];
137
+ const ends = (c) => c.lengths.map((_, k) => [k === 0 ? 0 : c.starts[k - 1] + 2 * c.halves[k - 1], k < c.starts.length ? c.starts[k] : c.total]);
138
+ const [runs, placed] = [ends(from), ends(to)];
139
+ // Both charts are read as the turns alone carry them: a family's own roll rides on top of either and is no twist of a joint.
140
+ const [stored, moved] = [AutoMovieHumanConicLoft_1.AutoMovieHumanConicLoft.axis({ centres: reference.centres, halves: reference.halves, up: reference.up }), AutoMovieHumanConicLoft_1.AutoMovieHumanConicLoft.axis({ centres: posed.centres, halves: posed.halves, up: posed.up })];
141
+ const turned = [];
142
+ for (let k = 0; k < runs.length; ++k) {
143
+ const target = carried(k, stored.at((runs[k][0] + runs[k][1]) / 2).u);
144
+ const frame = moved.at((placed[k][0] + placed[k][1]) / 2);
145
+ const angle = Math.atan2(target[0] * frame.v[0] + target[1] * frame.v[1] + target[2] * frame.v[2], target[0] * frame.u[0] + target[1] * frame.u[1] + target[2] * frame.u[2]);
146
+ const before = turned.at(-1) ?? 0;
147
+ turned.push(angle + 2 * Math.PI * Math.round((before - angle) / (2 * Math.PI)));
148
+ }
149
+ if (turned.every((angle) => Math.abs(angle) < NO_TWIST))
150
+ return undefined;
151
+ const knots = [];
152
+ const values = [];
153
+ placed.forEach(([start, end], k) => {
154
+ const [a, b] = [turned[Math.max(0, k - 1)], turned[k]];
155
+ for (let i = 0; i <= ROLL_KNOTS + 1; ++i) {
156
+ const t = i / (ROLL_KNOTS + 1);
157
+ const station = start + (end - start) * t;
158
+ if (knots.length > 0 && !(station > knots.at(-1)))
159
+ continue;
160
+ knots.push(station);
161
+ values.push(a + (b - a) * t);
162
+ }
163
+ });
164
+ return { knots, values };
165
+ }
166
+ AutoMovieHumanConicPose.twist = twist;
167
+ /**
168
+ * A family carried to a pose: its centres and `up` as given, its halves keeping every set-back, its stations mapped, and the roll its
169
+ * joints' twists ask for. Its section values, layout and relief nets are the family's own arrays; where no station moves, so are its
170
+ * `knots`, `tips` and reliefs. `station` maps a station of the reference family to the posed one.
171
+ *
172
+ * A family that already rolls its chart (`roll`) keeps that roll on mapped knots; such a family whose joints also twist is refused,
173
+ * since one roll would have to carry both.
174
+ */
175
+ function repose(family, centres, up, carried) {
176
+ const posed = halves(family.centres, family.halves, centres);
177
+ const station = centres.length < 3 ? null : map(course(family.centres, family.halves), course(centres, posed));
178
+ const twisted = centres.length < 3 ? undefined : twist(family, { centres, halves: posed, up }, carried);
179
+ if (twisted !== undefined && family.roll !== undefined)
180
+ throw new Error("pose: " + family.name + " rolls its chart and its joints twist");
181
+ const tip = (end) => (end === null || station === null ? end : { ...end, from: station(end.from), tip: station(end.tip) });
182
+ return {
183
+ station,
184
+ family: {
185
+ ...family,
186
+ centres,
187
+ halves: posed,
188
+ up,
189
+ ...(twisted !== undefined ? { roll: twisted } : family.roll === undefined || station === null ? {} : { roll: { knots: family.roll.knots.map(station), values: family.roll.values } }),
190
+ ...(station === null
191
+ ? {}
192
+ : {
193
+ knots: family.knots.map(station),
194
+ ...(family.tips === undefined ? {} : { tips: [tip(family.tips[0]), tip(family.tips[1])] }),
195
+ ...(family.reliefs === undefined ? {} : { reliefs: family.reliefs.map((relief) => ({ ...relief, stations: [station(relief.stations[0]), station(relief.stations[1])] })) }),
196
+ }),
197
+ },
198
+ };
199
+ }
200
+ AutoMovieHumanConicPose.repose = repose;
201
+ })(AutoMovieHumanConicPose || (exports.AutoMovieHumanConicPose = AutoMovieHumanConicPose = {}));
202
+ //# sourceMappingURL=AutoMovieHumanConicPose.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AutoMovieHumanConicPose.js","sourceRoot":"","sources":["../../../src/generation/conic/AutoMovieHumanConicPose.ts"],"names":[],"mappings":";;;AAAA,8CAA+D;AAE/D,uEAAoE;AAEpE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,IAAiB,uBAAuB,CAwLvC;AAxLD,WAAiB,uBAAuB;IAwBtC,8IAA8I;IAC9I,MAAM,QAAQ,GAAW,KAAK,CAAC;IAE/B,kJAAkJ;IAClJ,MAAM,UAAU,GAAW,CAAC,CAAC;IAE7B;;;;OAIG;IACH,SAAgB,KAAK,CAAC,KAAa;QACjC,IAAI,KAAK,KAAK,CAAC;YAAE,OAAO,CAAC,CAAC;QAC1B,MAAM,IAAI,GAAgD,mCAA0B,CAA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AAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAA+E,EAAE,CAAC;wBACxK,GAAG,CAAC,MAAM,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAuE,EAAmE,EAAE,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;qBAC9S,CAAC;aACP;SACF,CAAC;IACJ,CAAC;IAvBe,wBAAA,MAAM,SAuBrB,CAAA;AACH,CAAC,EAxLgB,uBAAuB,aAAvB,uBAAuB,GAAvB,uBAAuB,QAwLvC"}
@@ -0,0 +1,52 @@
1
+ import type { IAutoMovieLoftRelief } from "@automovie/engine";
2
+ /**
3
+ * The compact forms a family's relief nets are stored in, and their expansion to the nets the engine reads.
4
+ *
5
+ * A net repeats numbers in two ways the body's symmetry gives. A net of a median part whose window stands about the median plane is its
6
+ * own mirror image: its column `b` equals its column `columns - 1 - b`, the map the engine's uniform cubic gives a window reflected
7
+ * about its middle (`AutoMovieLoftRelief.height`: control `i` of `n` stands at parameter `i - 1` of `[0, n - 3]`, and the reflection
8
+ * `x -> n - 3 - x` sends it to `n - 1 - i`). And a net fitted on one side of such a part has a twin on the other, the same heights with
9
+ * their columns in the other order. A module stores the half and names the twin; `list` returns the full nets.
10
+ *
11
+ * Every expansion copies stored doubles and computes nothing, so a figure built from the expanded nets is built from the same numbers
12
+ * as one whose module wrote them all out.
13
+ */
14
+ export declare namespace AutoMovieHumanConicRelief {
15
+ /** A net stored as the reflection of an earlier one of its family's list. */
16
+ interface ITwin {
17
+ /** The twin's own name. */
18
+ name: string;
19
+ /** The name of the net it reflects, which stands before it in the list. */
20
+ twin: string;
21
+ /** The twin's own phase window, radians. */
22
+ phases: [number, number];
23
+ /** The twin's own unit direction of height. */
24
+ axis: [number, number, number];
25
+ /** The twin's own turning direction; present exactly when the original has one. */
26
+ turn?: [number, number, number];
27
+ }
28
+ /**
29
+ * The full heights of a net that is its own mirror image, from its stored half.
30
+ *
31
+ * @param rows The net's rows.
32
+ * @param columns The net's columns, odd: the middle column is its own image and is stored once.
33
+ * @param half Columns 0 to `(columns - 1) / 2` of every row, row by row.
34
+ * @returns `rows * columns` heights, row by row: each row's stored columns, then the columns before the middle in reverse.
35
+ */
36
+ function mirrored(rows: number, columns: number, half: readonly number[]): number[];
37
+ /**
38
+ * A net's twin across the median plane: the original's stations, rows, columns and heights with every row's columns in the other
39
+ * order, under the twin's own name, window and directions.
40
+ *
41
+ * @param original The net fitted on one side.
42
+ * @param own The twin's name, phase window and directions.
43
+ */
44
+ function twin(original: IAutoMovieLoftRelief, own: Omit<ITwin, "twin">): IAutoMovieLoftRelief;
45
+ /**
46
+ * A family's nets from their stored list, in its order: a net written whole or through `mirrored` stands as it is, and a twin is the
47
+ * reflection of the net it names, which must stand before it.
48
+ */
49
+ function list(entries: readonly (IAutoMovieLoftRelief | ITwin)[]): IAutoMovieLoftRelief[];
50
+ /** How many heights a net's module stores: its half's for a mirrored net, none for a twin, and all of them for a net written whole. */
51
+ function stored(relief: IAutoMovieLoftRelief): number;
52
+ }
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AutoMovieHumanConicRelief = void 0;
4
+ /**
5
+ * The compact forms a family's relief nets are stored in, and their expansion to the nets the engine reads.
6
+ *
7
+ * A net repeats numbers in two ways the body's symmetry gives. A net of a median part whose window stands about the median plane is its
8
+ * own mirror image: its column `b` equals its column `columns - 1 - b`, the map the engine's uniform cubic gives a window reflected
9
+ * about its middle (`AutoMovieLoftRelief.height`: control `i` of `n` stands at parameter `i - 1` of `[0, n - 3]`, and the reflection
10
+ * `x -> n - 3 - x` sends it to `n - 1 - i`). And a net fitted on one side of such a part has a twin on the other, the same heights with
11
+ * their columns in the other order. A module stores the half and names the twin; `list` returns the full nets.
12
+ *
13
+ * Every expansion copies stored doubles and computes nothing, so a figure built from the expanded nets is built from the same numbers
14
+ * as one whose module wrote them all out.
15
+ */
16
+ var AutoMovieHumanConicRelief;
17
+ (function (AutoMovieHumanConicRelief) {
18
+ /** How many heights each expanded net's module stores, by the expanded `heights` array itself. */
19
+ const STORED = new WeakMap();
20
+ /**
21
+ * The full heights of a net that is its own mirror image, from its stored half.
22
+ *
23
+ * @param rows The net's rows.
24
+ * @param columns The net's columns, odd: the middle column is its own image and is stored once.
25
+ * @param half Columns 0 to `(columns - 1) / 2` of every row, row by row.
26
+ * @returns `rows * columns` heights, row by row: each row's stored columns, then the columns before the middle in reverse.
27
+ */
28
+ function mirrored(rows, columns, half) {
29
+ if (!Number.isInteger(rows) || !Number.isInteger(columns) || columns % 2 !== 1)
30
+ throw new Error("mirrored: a net of " + rows + " by " + columns + " has no middle column to reflect about");
31
+ const kept = (columns + 1) / 2;
32
+ if (half.length !== rows * kept)
33
+ throw new Error("mirrored: " + half.length + " heights given for " + rows + " rows of " + kept + " stored columns");
34
+ const out = new Array(rows * columns);
35
+ for (let a = 0; a < rows; ++a)
36
+ for (let b = 0; b < columns; ++b)
37
+ out[a * columns + b] = half[a * kept + Math.min(b, columns - 1 - b)];
38
+ STORED.set(out, half.length);
39
+ return out;
40
+ }
41
+ AutoMovieHumanConicRelief.mirrored = mirrored;
42
+ /**
43
+ * A net's twin across the median plane: the original's stations, rows, columns and heights with every row's columns in the other
44
+ * order, under the twin's own name, window and directions.
45
+ *
46
+ * @param original The net fitted on one side.
47
+ * @param own The twin's name, phase window and directions.
48
+ */
49
+ function twin(original, own) {
50
+ if ((original.turn === undefined) !== (own.turn === undefined))
51
+ throw new Error("twin: " + own.name + " and " + original.name + " do not both turn their cast");
52
+ if (original.shift !== undefined)
53
+ throw new Error("twin: " + original.name + " carries a station map, which no twin reflects");
54
+ const { rows, columns } = original;
55
+ const heights = new Array(rows * columns);
56
+ for (let a = 0; a < rows; ++a)
57
+ for (let b = 0; b < columns; ++b)
58
+ heights[a * columns + b] = original.heights[a * columns + (columns - 1 - b)];
59
+ STORED.set(heights, 0);
60
+ return { name: own.name, stations: original.stations, phases: own.phases, axis: own.axis, ...(own.turn === undefined ? {} : { turn: own.turn }), rows, columns, heights };
61
+ }
62
+ AutoMovieHumanConicRelief.twin = twin;
63
+ /**
64
+ * A family's nets from their stored list, in its order: a net written whole or through `mirrored` stands as it is, and a twin is the
65
+ * reflection of the net it names, which must stand before it.
66
+ */
67
+ function list(entries) {
68
+ const out = [];
69
+ for (const entry of entries) {
70
+ if (!("twin" in entry)) {
71
+ out.push(entry);
72
+ continue;
73
+ }
74
+ const original = out.find((relief) => relief.name === entry.twin);
75
+ if (original === undefined)
76
+ throw new Error("list: " + entry.name + " reflects " + entry.twin + ", which does not stand before it");
77
+ out.push(twin(original, { name: entry.name, phases: entry.phases, axis: entry.axis, ...(entry.turn === undefined ? {} : { turn: entry.turn }) }));
78
+ }
79
+ return out;
80
+ }
81
+ AutoMovieHumanConicRelief.list = list;
82
+ /** How many heights a net's module stores: its half's for a mirrored net, none for a twin, and all of them for a net written whole. */
83
+ function stored(relief) {
84
+ return STORED.get(relief.heights) ?? relief.heights.length;
85
+ }
86
+ AutoMovieHumanConicRelief.stored = stored;
87
+ })(AutoMovieHumanConicRelief || (exports.AutoMovieHumanConicRelief = AutoMovieHumanConicRelief = {}));
88
+ //# sourceMappingURL=AutoMovieHumanConicRelief.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AutoMovieHumanConicRelief.js","sourceRoot":"","sources":["../../../src/generation/conic/Auto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CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;IAC7D,CAAC;IAFe,0BAAA,MAAM,SAErB,CAAA;AACH,CAAC,EA/EgB,yBAAyB,aAAzB,yBAAyB,GAAzB,yBAAyB,QA+EzC"}
@@ -0,0 +1,252 @@
1
+ import { AutoMovieViewChain } from "@automovie/engine";
2
+ /**
3
+ * One section of a conic family as a short vector of named shape numbers,
4
+ * read through a layout of anchors.
5
+ *
6
+ * A section is a closed chain of conic arcs through its anchors in
7
+ * increasing phase. Every anchor is a point whose tangent the layout fixes
8
+ * by rule, so no number is spent on a direction that anatomy already gives:
9
+ *
10
+ * - `u`: a point where the section runs parallel to the chart's `v` axis: a
11
+ * front or back extreme. Its numbers are its `u` and `v`; a `mid` anchor
12
+ * stands on the median line `v = 0` and has only `u`.
13
+ * - `v`: a point where the section runs parallel to the `u` axis: a side
14
+ * extreme. Its numbers are its `u` and `v`.
15
+ * - `m`: the median point of the conic triangle its two neighbours span:
16
+ * `S = M + f (A - M)` on the segment from the chord midpoint `M` to the
17
+ * meeting `A` of the neighbours' tangent lines, with the tangent parallel to
18
+ * the chord, as every conic has at its own median point. Its number is `f`.
19
+ * Its neighbours are the nearest anchors of a lower `level`, so medians
20
+ * nest: a level 2 median halves an arc a level 1 median already made.
21
+ * - `i`: an inflection between two neighbours whose tangents are parallel.
22
+ * An S-shaped stretch crosses its own chord once, at the inflection, so
23
+ * the point is `P0 + t (P2 - P0)` and its tangent is the chord's direction
24
+ * turned by `d`. Its numbers are `t` and `d`.
25
+ * - `f`: a point on one of the part's feature lines (a tip's ridge, a wing's
26
+ * top, a groove's floor or the inflection beside it), its tangent free. Each
27
+ * number is a field along the stations like every other, so the feature line
28
+ * is a smooth longitudinal control curve, the way an aircraft's lines are
29
+ * drawn, and a feature that fades away leaves its anchor on a smooth stretch.
30
+ * Every feature of a run stands on one chord, its frame's (`frame`: the
31
+ * extremes either side of the run), so the features keep their order round
32
+ * the section wherever they fade, as an `i` anchor keeps it. Its numbers are
33
+ * its share of what is left of that chord past the feature before it
34
+ * (`along`), its offset `o` square to the chord in millimetres outward, and
35
+ * its tangent's turn `h` from the chord's direction, radians (`place`). Read
36
+ * as free chart coordinates, f1's nose's six feature lines left that order
37
+ * at 146 of 157 stations where its alar crease and wing fade; each on the
38
+ * chord from the feature before it, a tenth of a millimetre at one feature
39
+ * turned the next one's chord past its arc's own turn and the fit stood
40
+ * against those walls in both directions.
41
+ *
42
+ * After the anchors come the shoulders, one per arc between consecutive
43
+ * anchors: the conic shoulder `rho = |M S| / |M A|` of the engine's native
44
+ * chain (`AutoMovieViewChain`). A `mirror` layout lists the anchors of the
45
+ * half `v >= 0` from the front median anchor to the back median anchor and
46
+ * reflects them, so a bilateral section spends its numbers once.
47
+ *
48
+ * Shares (`f`, `t`, shoulders) are confined to `[EDGE, 1 - EDGE]` inside the
49
+ * model itself, and shoulders to at most `FAIR`, so an offline fit, the
50
+ * authored numbers and the generated surface read one curve.
51
+ */
52
+ export declare namespace AutoMovieHumanConicSection {
53
+ /** A planar chart point, millimetres. */
54
+ type P = [number, number];
55
+ /** One anchor of a layout. */
56
+ interface IAnchor {
57
+ /** The tangent rule, as the namespace describes. */
58
+ kind: "u" | "v" | "m" | "i" | "f";
59
+ /** A `u` anchor on the median line `v = 0`. */
60
+ mid?: boolean;
61
+ /** One of the four anchors the engine takes as its `+u`, `+v`, `-u`, `-v` guides, in that order along the chain. */
62
+ guide?: boolean;
63
+ /** Nesting level of an `m` or `i` anchor, 1 when absent: its neighbours are the nearest anchors of a lower level. */
64
+ level?: number;
65
+ /** The feature line an `f` anchor stands on, for its seed and its record; generation does not read it. */
66
+ feature?: "convex" | "concave" | "inflection";
67
+ /** Phase window in radians where an observation of this `u`, `v` or `f` anchor is sought; generation does not read it. */
68
+ window?: [number, number];
69
+ /** Whether an observation takes the window's largest or smallest coordinate; generation does not read it. */
70
+ pick?: "max" | "min";
71
+ }
72
+ /** The anchors of a section family. */
73
+ interface ILayout {
74
+ /** Anchors in increasing phase; for a mirror layout the half from phase 0 to pi inclusive. */
75
+ anchors: IAnchor[];
76
+ /** Reflect the listed half in the median line `v = 0`. */
77
+ mirror: boolean;
78
+ /**
79
+ * Least shoulder an arc of this family takes; absent, only the model's edge bound holds. An arc whose shoulder lies far under the
80
+ * ellipse's `sqrt(2) - 1` hugs its chord and turns at its ends, and where two such arcs meet at an extreme the wall turns within a few
81
+ * millimetres: f1's trunk held 0.22 to 0.36 either side of its side extreme over the hips, turned 1.06 degrees a half millimetre there
82
+ * against 0.2 elsewhere, and drew an upright line down each hip. It is a family's own number, not the model's, because other walls
83
+ * (the face's, the leg's) were fitted with lower shoulders where their skin wants them.
84
+ *
85
+ * A list holds one least per arc, in the order of the shoulders (`leastOf`). The bound belongs to the arcs that need it, not to the
86
+ * whole section: f1's foot end was fitted under 0.3 for the two arcs at its top, whose corner drew a slot at the big toe's root, and
87
+ * the same bound held the sole's arc at 0.3 from 896 to 960 mm, where the skin wants a flatter arc, so the wall stood 1.0 to 1.7 mm
88
+ * under the sole and each section fitted alone without it came within 0.4 to 0.85 mm.
89
+ */
90
+ least?: number | readonly number[];
91
+ }
92
+ /** What a field measures: millimetres, a share in (0, 1), or an angle in radians. */
93
+ type Unit = "mm" | "share" | "angle";
94
+ /** The closed chain of a field vector with the positions of the engine's four guides in it. */
95
+ interface IChain {
96
+ /** The native chain input: points, tangents and shoulders in increasing phase. */
97
+ input: AutoMovieViewChain.IInput;
98
+ /** Indices of the `+u`, `+v`, `-u`, `-v` guides in the chain. */
99
+ guides: number[];
100
+ }
101
+ /** The limb layout: four extremes, each quarter halved `depth` times by nested medians (4, 8 or 16 conics). */
102
+ function limb(depth: number): ILayout;
103
+ /**
104
+ * The lens layout: a long thin section with its length along the chart's `v`, its two faces' extremes on the median line `v = 0` and
105
+ * its two ends' extremes free, each quarter halved `depth` times by nested medians. A flat face has no one extreme: a free face extreme
106
+ * of a lens 30 mm long and 5 thick wandered from one end of its face to the other between neighbouring stations (the ear's plate), and
107
+ * the engine's chain between such stations was refused. On the median line each face's extreme stands where the course crosses the
108
+ * lens, at one number each, and the lens's two ends, where it turns, carry the free extremes.
109
+ */
110
+ function lens(depth: number): ILayout;
111
+ /**
112
+ * The bilateral layout: the front and back extremes on the median line and one side extreme between them, each arc halved `depth` times
113
+ * by nested medians, the half reflected in the median line (4, 8 or 16 conics). A section symmetric about the median plane has its
114
+ * front and back extremes on that plane with their tangents square to it, so those extremes cost one number each and the half the rest;
115
+ * fitted as a limb, such a section spends twice the numbers and its front and back anchors wander off the median line wherever the
116
+ * front is flat, each drawing the crease where two conics meet along the skin.
117
+ */
118
+ function bilateral(depth: number): ILayout;
119
+ /**
120
+ * The limb layout of the given median depth with a groove after each listed anchor: two inflections and the groove's own median between
121
+ * them, `[i, m, i]`, the inflections a level deeper than every median and the groove's median a level deeper again, so each inflection
122
+ * stands on the chord of the anchors round it and the groove's floor on the triangle of its two inflections. Across a family the
123
+ * inflections' shares and turns are fields like every other, so each groove's two inflection lines run along the stations as smooth
124
+ * curves, the way conic lofting draws a concavity with one more control line. On `limb(1)` a groove seeds an admissible chain only after
125
+ * a `u` extreme (anchors 0 and 4).
126
+ *
127
+ * @param depth The limb's median depth.
128
+ * @param after Indices into `limb(depth).anchors` after which a groove stands, each at most once.
129
+ */
130
+ function inflected(depth: number, after: readonly number[]): ILayout;
131
+ /** One run of feature anchors inserted after an anchor of a base layout (`featured`). */
132
+ interface IFeatureRun {
133
+ /** Index in the base layout's anchors after which the run stands. */
134
+ after: number;
135
+ /** The feature anchors (`f`), in increasing phase. */
136
+ anchors: IAnchor[];
137
+ }
138
+ /**
139
+ * A base layout with feature runs inserted after given anchors, and the listed median anchors (`m`) of the base turned into feature
140
+ * anchors (`f`) at the same place in the order. Only the model's own anchor kinds are used.
141
+ *
142
+ * A median stands on the triangle of the nearest anchors already resolved when it is (`neighbours`), which are the feature anchors
143
+ * once any stand in its run, since features resolve before every median (`resolve`); its tangent is then parallel to a different
144
+ * chord (`resolve`: a median's tangent is its neighbours' chord). So a feature inserted beside a median moves that median, and no field
145
+ * vector of the featured layout reproduces the stored section there. Turned into a feature anchor, the old median keeps its own point
146
+ * and tangent, and a stored wall of the base layout converts exactly (`convert`): each inserted feature splits a stored conic arc at
147
+ * an interior point into two conic arcs, which de Casteljau's construction on the rational quadratic's homogeneous controls gives
148
+ * exactly (Farin, Curves and Surfaces for CAGD, rational quadratic Bezier curves).
149
+ *
150
+ * @param base The layout the features go into.
151
+ * @param runs After which anchor of `base` each run of feature anchors stands.
152
+ * @param freed Indices in `base` of median anchors (`m`) turned into feature anchors.
153
+ */
154
+ function featured(base: ILayout, runs: readonly IFeatureRun[], freed?: readonly number[]): ILayout;
155
+ /**
156
+ * The field vector of `featured(base, runs, freed)` that draws the same closed chain as `values` on `base`: every base anchor where it
157
+ * was (a freed median as a feature at its own point and tangent), each run's features on the base arc that follows the anchor they
158
+ * stand after, at equal steps of their projection on their frame's chord between the arc's two ends (so a feature's share along the
159
+ * chord, the number a featured layout stores, is a smooth function of the base's fields), and every shoulder that of its piece of the
160
+ * base arc.
161
+ * A piece `[a, b]` of the rational quadratic with homogeneous controls `(P0, 1), (w P1, w), (P2, 1)` has the blossom controls
162
+ * `B(a, a)`, `B(a, b)`, `B(b, b)`, so its middle weight normalised by its end weights is `W1 / sqrt(W0 W2)` and its shoulder
163
+ * `w / (1 + w)` (the shoulder `rho = |M S| / |M A|` of a conic of middle weight `w`).
164
+ *
165
+ * @param values A section's field vector on `base`.
166
+ * @param base Its layout.
167
+ * @param runs The inserted feature runs (`featured`); a run after anchor `k` lies on the base arc from anchor `k` to `k + 1`.
168
+ * @param freed The base medians turned into features.
169
+ * @returns The field vector on `featured(base, runs, freed)`.
170
+ */
171
+ function convert(values: readonly number[], base: ILayout, runs: readonly IFeatureRun[], freed?: readonly number[]): number[];
172
+ /** Unit of every field of a layout, in field order: each anchor's numbers, then one shoulder per arc. */
173
+ function units(layout: ILayout): Unit[];
174
+ /** Offsets of every anchor's first field, and the offset of the first shoulder. */
175
+ function offsets(layout: ILayout): {
176
+ at: number[];
177
+ shoulders: number;
178
+ };
179
+ /** Dependent anchors (`m`, `i`) by increasing level, the order they are resolved in. */
180
+ function dependents(layout: ILayout): number[];
181
+ /**
182
+ * The two extremes a feature anchor `k` stands between: the nearest `u` or `v` anchor before it and the nearest after it, in the
183
+ * layout's order (round the end of the list for a closed layout). Every feature of a run shares this frame and its chord.
184
+ */
185
+ function frame(k: number, layout: ILayout): [number, number];
186
+ /**
187
+ * Where along its frame's chord a feature anchor stands: the feature before it in the run at `previous` (0 at the run's first), its
188
+ * own share `share` of what is left of the chord after that. Each feature then stands past the one before it by construction.
189
+ */
190
+ function along(previous: number, share: number): number;
191
+ /**
192
+ * A feature point on the chord from `p0` to `p2`: at `t` of the way along it, the offset `o` square to it, millimetres outward (to the
193
+ * right of travel, which is outward on a counter-clockwise section), and its tangent the chord's direction turned by `h` radians.
194
+ */
195
+ function place(p0: P, p2: P, t: number, o: number, h: number): {
196
+ point: P;
197
+ tangent: P;
198
+ };
199
+ /**
200
+ * The numbers `[share, o, h]` of a feature point `p` with the tangent heading `heading` on the chord from `p0` to `p2`, the feature
201
+ * before it in the run at `previous` of the way along (`along`, `place`), and how far along the chord `p` itself stands.
202
+ */
203
+ function unplace(p0: P, p2: P, p: P, heading: number, previous: number): {
204
+ values: [number, number, number];
205
+ t: number;
206
+ };
207
+ /** The nearest resolved anchors before and after anchor `k`. */
208
+ function neighbours(k: number, done: readonly (P | null)[]): [number, number];
209
+ /**
210
+ * A stored shoulder as the model reads it: inside `[EDGE, FAIR]`, and at least the layout's `least`. A fit may store a shoulder past those
211
+ * bounds where it changes nothing at the fitted sections; between the knots the field's natural cubic then crosses a bound and the arc
212
+ * holds still there while its neighbours move, which draws a level line across the wall.
213
+ *
214
+ * @param value The stored shoulder.
215
+ * @param layout The layout it belongs to.
216
+ * @param arc The arc's index among the shoulders, which selects its least when the layout lists one per arc.
217
+ */
218
+ function shoulder(value: number, layout: ILayout, arc?: number): number;
219
+ /**
220
+ * The least shoulder of one arc of a layout (`ILayout.least`): the layout's one number, or that arc's entry of its list; undefined
221
+ * where the layout sets none.
222
+ *
223
+ * @param layout The layout.
224
+ * @param arc The arc's index among the shoulders.
225
+ */
226
+ function leastOf(layout: ILayout, arc: number): number | undefined;
227
+ /** Confine a share to the model's bounds. */
228
+ function clamp(share: number): number;
229
+ /** Meeting point of two tangent lines; the chord midpoint when they are parallel. */
230
+ function meet(p0: P, t0: P, p2: P, t2: P): P;
231
+ /** Resolve a field vector into its closed chain. */
232
+ function resolve(values: readonly number[], layout: ILayout): IChain;
233
+ /**
234
+ * The field vector with the shoulders of the two arcs that meet at anchor `k` set so the section's curvature is continuous there, each
235
+ * arc keeping its triangle (its two end points and the meeting of their tangents).
236
+ *
237
+ * Two conics that meet at an anchor share its tangent but not its curvature, and where one arc ends nearly flat and the next starts sharply
238
+ * bent the wall turns within a few millimetres along the anchor's whole station line: f1's trunk over the hips met at its first median with
239
+ * curvatures of 1.2 and 308 per metre and drew an upright line down each hip. For a rational quadratic with end weights 1 and middle
240
+ * weight `w = rho / (1 - rho)` the curvature at an end is `|(P1 - P0) x (P2 - P1)| / (w^2 |leg|^3)`, the leg the side of the triangle at
241
+ * that end (Farin, rational quadratic Bezier curves; Pottmann, curvature continuous conic splines). Both curvatures are brought to their
242
+ * geometric mean, so each arc's weight moves by the same factor; the shoulders stay within the model's bounds, where the joint is as near
243
+ * G2 as they allow. Merged into one conic instead (both halves of one arc split at its shoulder), the hip's shape moved further.
244
+ *
245
+ * @param values The section's field vector.
246
+ * @param layout Its layout, not a mirror's last anchor: `k` must have an arc on either side in the listed anchors.
247
+ * @param k The anchor.
248
+ */
249
+ function continuous(values: readonly number[], layout: ILayout, k: number): number[];
250
+ /** Build the engine's native conic chain from a field vector. */
251
+ function chain(values: readonly number[], layout: ILayout): AutoMovieViewChain.ISection;
252
+ }