@franzenzenhofer/asanakit 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.
- package/README.md +78 -46
- package/dist/anatomy/muscles.d.ts +10 -7
- package/dist/anatomy/muscles.d.ts.map +1 -1
- package/dist/anatomy/muscles.js +21 -17
- package/dist/anatomy/muscles.js.map +1 -1
- package/dist/anatomy/validate.d.ts.map +1 -1
- package/dist/anatomy/validate.js +16 -10
- package/dist/anatomy/validate.js.map +1 -1
- package/dist/cli/commands/export.d.ts.map +1 -1
- package/dist/cli/commands/export.js +24 -2
- package/dist/cli/commands/export.js.map +1 -1
- package/dist/cli/commands/info.d.ts.map +1 -1
- package/dist/cli/commands/info.js +3 -1
- package/dist/cli/commands/info.js.map +1 -1
- package/dist/cli/commands/render.d.ts.map +1 -1
- package/dist/cli/commands/render.js +12 -3
- package/dist/cli/commands/render.js.map +1 -1
- package/dist/cli/commands/view.d.ts +3 -0
- package/dist/cli/commands/view.d.ts.map +1 -0
- package/dist/cli/commands/view.js +40 -0
- package/dist/cli/commands/view.js.map +1 -0
- package/dist/cli/index.js +7 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/resolve.d.ts +6 -0
- package/dist/cli/resolve.d.ts.map +1 -1
- package/dist/cli/resolve.js +40 -0
- package/dist/cli/resolve.js.map +1 -1
- package/dist/core/camera.d.ts +56 -0
- package/dist/core/camera.d.ts.map +1 -0
- package/dist/core/camera.js +20 -0
- package/dist/core/camera.js.map +1 -0
- package/dist/core/joints.d.ts +18 -0
- package/dist/core/joints.d.ts.map +1 -0
- package/dist/core/joints.js +27 -0
- package/dist/core/joints.js.map +1 -0
- package/dist/core/quat.d.ts +18 -0
- package/dist/core/quat.d.ts.map +1 -0
- package/dist/core/quat.js +25 -0
- package/dist/core/quat.js.map +1 -0
- package/dist/core/rig.d.ts +1 -6
- package/dist/core/rig.d.ts.map +1 -1
- package/dist/core/rig.js +45 -74
- package/dist/core/rig.js.map +1 -1
- package/dist/core/skeleton.d.ts +4 -13
- package/dist/core/skeleton.d.ts.map +1 -1
- package/dist/core/skeleton.js +39 -69
- package/dist/core/skeleton.js.map +1 -1
- package/dist/core/types.d.ts +62 -55
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js.map +1 -1
- package/dist/core/vec3.d.ts +13 -0
- package/dist/core/vec3.d.ts.map +1 -0
- package/dist/core/vec3.js +26 -0
- package/dist/core/vec3.js.map +1 -0
- package/dist/export3d/gltf.d.ts +11 -0
- package/dist/export3d/gltf.d.ts.map +1 -0
- package/dist/export3d/gltf.js +28 -0
- package/dist/export3d/gltf.js.map +1 -0
- package/dist/export3d/index.d.ts +3 -0
- package/dist/export3d/index.d.ts.map +1 -0
- package/dist/export3d/index.js +3 -0
- package/dist/export3d/index.js.map +1 -0
- package/dist/export3d/shims.d.ts +7 -0
- package/dist/export3d/shims.d.ts.map +1 -0
- package/dist/export3d/shims.js +27 -0
- package/dist/export3d/shims.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/library/index.js +4 -4
- package/dist/library/index.js.map +1 -1
- package/dist/model/pose.d.ts +11 -5
- package/dist/model/pose.d.ts.map +1 -1
- package/dist/model/pose.js +30 -16
- package/dist/model/pose.js.map +1 -1
- package/dist/model/schema.d.ts +69 -28
- package/dist/model/schema.d.ts.map +1 -1
- package/dist/model/schema.js +57 -17
- package/dist/model/schema.js.map +1 -1
- package/dist/physics/index.d.ts +3 -0
- package/dist/physics/index.d.ts.map +1 -0
- package/dist/physics/index.js +3 -0
- package/dist/physics/index.js.map +1 -0
- package/dist/physics/rapier-types.d.ts +60 -0
- package/dist/physics/rapier-types.d.ts.map +1 -0
- package/dist/physics/rapier-types.js +12 -0
- package/dist/physics/rapier-types.js.map +1 -0
- package/dist/physics/settle.d.ts +3 -0
- package/dist/physics/settle.d.ts.map +1 -0
- package/dist/physics/settle.js +108 -0
- package/dist/physics/settle.js.map +1 -0
- package/dist/physics/world.d.ts +4 -0
- package/dist/physics/world.d.ts.map +1 -0
- package/dist/physics/world.js +18 -0
- package/dist/physics/world.js.map +1 -0
- package/dist/render/anatomy.js +1 -1
- package/dist/render/anatomy.js.map +1 -1
- package/dist/render/annotations.d.ts +3 -2
- package/dist/render/annotations.d.ts.map +1 -1
- package/dist/render/annotations.js.map +1 -1
- package/dist/render/camera.d.ts +43 -0
- package/dist/render/camera.d.ts.map +1 -0
- package/dist/render/camera.js +57 -0
- package/dist/render/camera.js.map +1 -0
- package/dist/render/context.d.ts +5 -3
- package/dist/render/context.d.ts.map +1 -1
- package/dist/render/figure.d.ts +4 -2
- package/dist/render/figure.d.ts.map +1 -1
- package/dist/render/figure.js +29 -43
- package/dist/render/figure.js.map +1 -1
- package/dist/render/index.d.ts +1 -0
- package/dist/render/index.d.ts.map +1 -1
- package/dist/render/index.js +1 -0
- package/dist/render/index.js.map +1 -1
- package/dist/render/props.d.ts +4 -3
- package/dist/render/props.d.ts.map +1 -1
- package/dist/render/props.js.map +1 -1
- package/dist/render/scene.d.ts +7 -1
- package/dist/render/scene.d.ts.map +1 -1
- package/dist/render/scene.js +8 -1
- package/dist/render/scene.js.map +1 -1
- package/dist/render/sheet.d.ts +3 -0
- package/dist/render/sheet.d.ts.map +1 -1
- package/dist/render/sheet.js +2 -0
- package/dist/render/sheet.js.map +1 -1
- package/dist/solve.d.ts +14 -0
- package/dist/solve.d.ts.map +1 -0
- package/dist/solve.js +17 -0
- package/dist/solve.js.map +1 -0
- package/dist/standards/keypoints.d.ts +2 -10
- package/dist/standards/keypoints.d.ts.map +1 -1
- package/dist/standards/keypoints.js +33 -14
- package/dist/standards/keypoints.js.map +1 -1
- package/dist/three/index.d.ts +2 -0
- package/dist/three/index.d.ts.map +1 -0
- package/dist/three/index.js +2 -0
- package/dist/three/index.js.map +1 -0
- package/dist/three/scene.d.ts +22 -0
- package/dist/three/scene.d.ts.map +1 -0
- package/dist/three/scene.js +90 -0
- package/dist/three/scene.js.map +1 -0
- package/dist/viewer/html.d.ts +16 -0
- package/dist/viewer/html.d.ts.map +1 -0
- package/dist/viewer/html.js +59 -0
- package/dist/viewer/html.js.map +1 -0
- package/dist/viewer/index.d.ts +2 -0
- package/dist/viewer/index.d.ts.map +1 -0
- package/dist/viewer/index.js +2 -0
- package/dist/viewer/index.js.map +1 -0
- package/dist/viewer/viewer.bundle.js +4119 -0
- package/docs/AUTHORING.md +119 -58
- package/package.json +20 -5
- package/poses/surf/bottom-turn.pose.yaml +24 -24
- package/poses/surf/cutback.pose.yaml +24 -24
- package/poses/surf/duck-dive.pose.yaml +23 -23
- package/poses/surf/noseride.pose.yaml +23 -25
- package/poses/surf/paddling.pose.yaml +24 -24
- package/poses/surf/pop-up.pose.yaml +24 -24
- package/poses/surf/takeoff.pose.yaml +24 -24
- package/poses/surf/tube-stance.pose.yaml +24 -24
- package/poses/yoga/ashtanga/adho-mukha-svanasana.pose.yaml +22 -22
- package/poses/yoga/ashtanga/ardha-uttanasana.pose.yaml +22 -22
- package/poses/yoga/ashtanga/baddha-konasana.pose.yaml +21 -23
- package/poses/yoga/ashtanga/balasana.pose.yaml +23 -23
- package/poses/yoga/ashtanga/chaturanga-dandasana.pose.yaml +21 -21
- package/poses/yoga/ashtanga/dandasana.pose.yaml +21 -23
- package/poses/yoga/ashtanga/halasana.pose.yaml +23 -23
- package/poses/yoga/ashtanga/janu-sirsasana-a.pose.yaml +22 -22
- package/poses/yoga/ashtanga/karnapidasana.pose.yaml +23 -23
- package/poses/yoga/ashtanga/marichyasana-a.pose.yaml +22 -22
- package/poses/yoga/ashtanga/marichyasana-c.pose.yaml +21 -23
- package/poses/yoga/ashtanga/matsyasana.pose.yaml +23 -23
- package/poses/yoga/ashtanga/navasana.pose.yaml +22 -22
- package/poses/yoga/ashtanga/padahastasana.pose.yaml +22 -22
- package/poses/yoga/ashtanga/padangusthasana.pose.yaml +22 -22
- package/poses/yoga/ashtanga/padmasana.pose.yaml +22 -24
- package/poses/yoga/ashtanga/parsvottanasana.pose.yaml +22 -22
- package/poses/yoga/ashtanga/paschimottanasana.pose.yaml +22 -22
- package/poses/yoga/ashtanga/prasarita-padottanasana-a.pose.yaml +26 -26
- package/poses/yoga/ashtanga/prasarita-padottanasana-c.pose.yaml +26 -26
- package/poses/yoga/ashtanga/primary.seq.yaml +2 -4
- package/poses/yoga/ashtanga/purvottanasana.pose.yaml +22 -22
- package/poses/yoga/ashtanga/salamba-sarvangasana.pose.yaml +23 -23
- package/poses/yoga/ashtanga/samasthiti.pose.yaml +10 -10
- package/poses/yoga/ashtanga/savasana.pose.yaml +21 -21
- package/poses/yoga/ashtanga/setu-bandhasana.pose.yaml +22 -22
- package/poses/yoga/ashtanga/sirsasana.pose.yaml +23 -23
- package/poses/yoga/ashtanga/supta-padangusthasana.pose.yaml +22 -22
- package/poses/yoga/ashtanga/upavistha-konasana.pose.yaml +22 -22
- package/poses/yoga/ashtanga/urdhva-dhanurasana.pose.yaml +23 -23
- package/poses/yoga/ashtanga/urdhva-hastasana.pose.yaml +22 -22
- package/poses/yoga/ashtanga/urdhva-mukha-svanasana.pose.yaml +22 -22
- package/poses/yoga/ashtanga/utkatasana.pose.yaml +22 -22
- package/poses/yoga/ashtanga/uttanasana.pose.yaml +22 -22
- package/poses/yoga/ashtanga/utthita-parsvakonasana.pose.yaml +24 -24
- package/poses/yoga/ashtanga/utthita-trikonasana.pose.yaml +24 -24
- package/poses/yoga/ashtanga/virabhadrasana-a.pose.yaml +22 -22
- package/poses/yoga/ashtanga/virabhadrasana-b.pose.yaml +21 -23
package/dist/core/rig.js
CHANGED
|
@@ -2,96 +2,67 @@
|
|
|
2
2
|
* Bone lengths are fractions of stature (1.0 = sole to crown) and follow the
|
|
3
3
|
* classic 7.5-heads canon used in anatomical drawing, with hip height at ~0.53
|
|
4
4
|
* of stature. The rig is authored for the figure's LEFT side and the center
|
|
5
|
-
* chain; the right side is generated by mirroring
|
|
6
|
-
* the same joint angles on both sides.
|
|
5
|
+
* chain; the right side is generated by mirroring.
|
|
7
6
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* The figure stands at the origin facing +z, with +x its anatomical left and
|
|
8
|
+
* +y up. Every bone carries its rest direction and its two anatomical rotation
|
|
9
|
+
* axes as explicit vectors - the whole sign convention of the pose format is
|
|
10
|
+
* data in this file, not logic in the solver.
|
|
11
11
|
*/
|
|
12
|
+
const UP = [0, 1, 0];
|
|
13
|
+
const DOWN = [0, -1, 0];
|
|
14
|
+
const LEFT = [1, 0, 0];
|
|
15
|
+
const FORWARD = [0, 0, 1];
|
|
16
|
+
/** Feet rest pointing forward, dropped a little toward the floor. */
|
|
17
|
+
const FOOT_DROP_DEG = 20;
|
|
18
|
+
const FOOT_DIR = [0, -Math.sin((FOOT_DROP_DEG * Math.PI) / 180), Math.cos((FOOT_DROP_DEG * Math.PI) / 180)];
|
|
12
19
|
const CENTER_BONES = [
|
|
13
|
-
|
|
14
|
-
{ id: '
|
|
15
|
-
{ id: '
|
|
16
|
-
{ id: '
|
|
20
|
+
// Positive flex bends forward, positive abduct leans toward the figure's left.
|
|
21
|
+
{ id: 'pelvis', parent: null, attach: 'end', length: 0.1, dir: UP, flexAxis: LEFT, abductAxis: [0, 0, -1], twistAxis: UP, side: 'center', group: 'torso' },
|
|
22
|
+
{ id: 'spine', parent: 'pelvis', attach: 'end', length: 0.17, dir: UP, flexAxis: LEFT, abductAxis: [0, 0, -1], twistAxis: UP, side: 'center', group: 'torso' },
|
|
23
|
+
{ id: 'neck', parent: 'spine', attach: 'end', length: 0.06, dir: UP, flexAxis: LEFT, abductAxis: [0, 0, -1], twistAxis: UP, side: 'center', group: 'torso' },
|
|
24
|
+
{ id: 'head', parent: 'neck', attach: 'end', length: 0.13, dir: UP, flexAxis: LEFT, abductAxis: [0, 0, -1], twistAxis: UP, side: 'center', group: 'head' },
|
|
17
25
|
];
|
|
18
26
|
const LEFT_BONES = [
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
length: 0.165,
|
|
35
|
-
restAngle: 180,
|
|
36
|
-
side: 'left',
|
|
37
|
-
group: 'arm',
|
|
38
|
-
},
|
|
39
|
-
{ id: 'forearmL', parent: 'upperArmL', attach: 'end', length: 0.145, restAngle: 0, side: 'left', group: 'arm' },
|
|
40
|
-
{ id: 'handL', parent: 'forearmL', attach: 'end', length: 0.055, restAngle: 0, side: 'left', group: 'arm' },
|
|
41
|
-
{
|
|
42
|
-
id: 'hipL',
|
|
43
|
-
parent: 'pelvis',
|
|
44
|
-
attach: 'start',
|
|
45
|
-
length: 0.085,
|
|
46
|
-
restAngle: -90,
|
|
47
|
-
side: 'left',
|
|
48
|
-
group: 'torso',
|
|
49
|
-
lateral: true,
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
id: 'thighL',
|
|
53
|
-
parent: 'hipL',
|
|
54
|
-
attach: 'end',
|
|
55
|
-
angleParent: 'pelvis',
|
|
56
|
-
length: 0.245,
|
|
57
|
-
restAngle: 180,
|
|
58
|
-
side: 'left',
|
|
59
|
-
group: 'leg',
|
|
60
|
-
},
|
|
61
|
-
{ id: 'shinL', parent: 'thighL', attach: 'end', length: 0.245, restAngle: 0, side: 'left', group: 'leg', flexSign: -1 },
|
|
62
|
-
{
|
|
63
|
-
id: 'footL',
|
|
64
|
-
parent: 'shinL',
|
|
65
|
-
attach: 'end',
|
|
66
|
-
length: 0.09,
|
|
67
|
-
restAngle: 70,
|
|
68
|
-
side: 'left',
|
|
69
|
-
group: 'leg',
|
|
70
|
-
foot: true,
|
|
71
|
-
},
|
|
27
|
+
// Shoulder girdle: flex swings the shoulder forward, abduct shrugs it up.
|
|
28
|
+
{ id: 'clavicleL', parent: 'spine', attach: 'end', length: 0.1, dir: LEFT, flexAxis: [0, -1, 0], abductAxis: FORWARD, twistAxis: LEFT, side: 'left', group: 'torso' },
|
|
29
|
+
// Arm: flex raises it forward, abduct lifts it sideways away from the body,
|
|
30
|
+
// positive twist rotates it externally.
|
|
31
|
+
{ id: 'upperArmL', parent: 'clavicleL', attach: 'end', length: 0.165, dir: DOWN, flexAxis: [-1, 0, 0], abductAxis: FORWARD, twistAxis: UP, side: 'left', group: 'arm' },
|
|
32
|
+
{ id: 'forearmL', parent: 'upperArmL', attach: 'end', length: 0.145, dir: DOWN, flexAxis: [-1, 0, 0], abductAxis: FORWARD, twistAxis: UP, side: 'left', group: 'arm' },
|
|
33
|
+
{ id: 'handL', parent: 'forearmL', attach: 'end', length: 0.055, dir: DOWN, flexAxis: [-1, 0, 0], abductAxis: FORWARD, twistAxis: UP, side: 'left', group: 'arm' },
|
|
34
|
+
// Pelvic girdle, mirroring the shoulder girdle one storey down.
|
|
35
|
+
{ id: 'hipL', parent: 'pelvis', attach: 'start', length: 0.085, dir: LEFT, flexAxis: [0, -1, 0], abductAxis: FORWARD, twistAxis: LEFT, side: 'left', group: 'torso' },
|
|
36
|
+
// Leg: hip flex swings the thigh forward; the knee's flex axis points the
|
|
37
|
+
// other way, because a knee bends backward - that is anatomy, stated as data.
|
|
38
|
+
{ id: 'thighL', parent: 'hipL', attach: 'end', length: 0.245, dir: DOWN, flexAxis: [-1, 0, 0], abductAxis: FORWARD, twistAxis: UP, side: 'left', group: 'leg' },
|
|
39
|
+
{ id: 'shinL', parent: 'thighL', attach: 'end', length: 0.245, dir: DOWN, flexAxis: [1, 0, 0], abductAxis: FORWARD, twistAxis: UP, side: 'left', group: 'leg' },
|
|
40
|
+
// Foot: positive flex is dorsiflexion (toes up), positive abduct turns the toes out.
|
|
41
|
+
{ id: 'footL', parent: 'shinL', attach: 'end', length: 0.09, dir: FOOT_DIR, flexAxis: [-1, 0, 0], abductAxis: UP, twistAxis: FOOT_DIR, side: 'left', group: 'leg' },
|
|
72
42
|
];
|
|
73
43
|
const RIGHT_SUFFIX = /L$/;
|
|
74
44
|
const mirrorId = (id) => (RIGHT_SUFFIX.test(id) ? id.replace(RIGHT_SUFFIX, 'R') : id);
|
|
45
|
+
/** Plain directions reflect across the sagittal plane: negate x. */
|
|
46
|
+
const mirrorDir = (v) => [-v[0], v[1], v[2]];
|
|
47
|
+
/**
|
|
48
|
+
* Rotation axes are pseudovectors: reflecting a rotation flips its sense, so
|
|
49
|
+
* the mirrored axis keeps x and negates y and z. This is exactly what makes
|
|
50
|
+
* "abduct = away from the midline" hold on both sides with no code branch.
|
|
51
|
+
*/
|
|
52
|
+
const mirrorAxis = (v) => [v[0], -v[1], -v[2]];
|
|
75
53
|
const mirrorBone = (bone) => ({
|
|
76
54
|
...bone,
|
|
77
55
|
id: mirrorId(bone.id),
|
|
78
56
|
parent: bone.parent === null ? null : mirrorId(bone.parent),
|
|
79
|
-
|
|
57
|
+
dir: mirrorDir(bone.dir),
|
|
58
|
+
flexAxis: mirrorAxis(bone.flexAxis),
|
|
59
|
+
abductAxis: mirrorAxis(bone.abductAxis),
|
|
60
|
+
twistAxis: mirrorAxis(bone.twistAxis),
|
|
80
61
|
side: 'right',
|
|
81
62
|
});
|
|
82
63
|
export const DEFAULT_RIG = {
|
|
83
|
-
name: 'humanoid
|
|
64
|
+
name: 'humanoid',
|
|
84
65
|
// Parents precede children, so a single forward pass solves the chain.
|
|
85
66
|
bones: [...CENTER_BONES, ...LEFT_BONES, ...LEFT_BONES.map(mirrorBone)],
|
|
86
67
|
};
|
|
87
|
-
/**
|
|
88
|
-
* Views are 2D projections of a 3D body, so they only need two foreshortening
|
|
89
|
-
* factors plus a rule for which way the feet point.
|
|
90
|
-
*/
|
|
91
|
-
export const VIEWS = {
|
|
92
|
-
front: { lateralScale: 1, footScale: 0.45, mirrorLimbs: true },
|
|
93
|
-
back: { lateralScale: 1, footScale: 0.45, mirrorLimbs: true },
|
|
94
|
-
side: { lateralScale: 0.18, footScale: 1, mirrorLimbs: false },
|
|
95
|
-
'three-quarter': { lateralScale: 0.7, footScale: 0.8, mirrorLimbs: false },
|
|
96
|
-
};
|
|
97
68
|
//# sourceMappingURL=rig.js.map
|
package/dist/core/rig.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rig.js","sourceRoot":"","sources":["../../src/core/rig.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rig.js","sourceRoot":"","sources":["../../src/core/rig.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,MAAM,EAAE,GAAS,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAC3B,MAAM,IAAI,GAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC9B,MAAM,IAAI,GAAS,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAC7B,MAAM,OAAO,GAAS,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAEhC,qEAAqE;AACrE,MAAM,aAAa,GAAG,EAAE,CAAC;AACzB,MAAM,QAAQ,GAAS,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,aAAa,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,aAAa,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;AAElH,MAAM,YAAY,GAAuB;IACvC,+EAA+E;IAC/E,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE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/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* shoulder on the other side of the spine. Limbs only mirror when the figure
|
|
7
|
-
* faces us; in profile both arms swing the same way, because we are looking at
|
|
8
|
-
* both of them from the same side.
|
|
9
|
-
*/
|
|
10
|
-
export declare const sideSign: (bone: BoneDef, view: ViewId) => number;
|
|
11
|
-
/**
|
|
12
|
-
* Forward kinematics: turn a pose (joint angles) into world-space bone segments,
|
|
13
|
-
* named landmarks and bounds. Pure and deterministic - the same pose always
|
|
14
|
-
* yields byte-identical geometry.
|
|
3
|
+
* Forward kinematics: turn a pose (joint rotations about anatomical axes) into
|
|
4
|
+
* world-space bone segments, named landmarks and bounds. Pure and
|
|
5
|
+
* deterministic - the same pose always yields byte-identical geometry.
|
|
15
6
|
*/
|
|
16
7
|
export declare const solveSkeleton: (pose: KinematicPose, rig: Rig) => Skeleton;
|
|
17
8
|
//# sourceMappingURL=skeleton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skeleton.d.ts","sourceRoot":"","sources":["../../src/core/skeleton.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"skeleton.d.ts","sourceRoot":"","sources":["../../src/core/skeleton.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAKV,aAAa,EAEb,GAAG,EACH,QAAQ,EACT,MAAM,YAAY,CAAC;AAwGpB;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,aAAa,EAAE,KAAK,GAAG,KAAG,QAyB7D,CAAC"}
|
package/dist/core/skeleton.js
CHANGED
|
@@ -1,43 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
const view = VIEWS[pose.view];
|
|
5
|
-
const foreshorten = (bone.lateral ? view.lateralScale : 1) * (bone.foot ? view.footScale : 1);
|
|
6
|
-
return bone.length * foreshorten * pose.root.scale;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Which way a positive angle turns a right-side bone.
|
|
10
|
-
*
|
|
11
|
-
* Lateral bones (clavicle, hip) always mirror - that is what puts the right
|
|
12
|
-
* shoulder on the other side of the spine. Limbs only mirror when the figure
|
|
13
|
-
* faces us; in profile both arms swing the same way, because we are looking at
|
|
14
|
-
* both of them from the same side.
|
|
15
|
-
*/
|
|
16
|
-
export const sideSign = (bone, view) => {
|
|
17
|
-
if (bone.side !== 'right')
|
|
18
|
-
return 1;
|
|
19
|
-
if (bone.lateral === true)
|
|
20
|
-
return -1;
|
|
21
|
-
return VIEWS[view].mirrorLimbs ? -1 : 1;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Where the left/right offset points on screen.
|
|
25
|
-
*
|
|
26
|
-
* Facing the viewer it lies in the picture plane, so it swings with the torso: a
|
|
27
|
-
* tilted chest tilts the shoulder line. Seen from the side it points into the
|
|
28
|
-
* screen, so it must project as a small sideways nudge and nothing else - if it
|
|
29
|
-
* rotated with the torso, a figure in a horizontal plank would end up with one
|
|
30
|
-
* shoulder above the other and one hand hovering off the floor.
|
|
31
|
-
*/
|
|
32
|
-
const isDepthAxis = (bone, view) => bone.lateral === true && VIEWS[view].lateralScale < 1;
|
|
33
|
-
const relativeAngle = (bone, pose, parentAngle, joint) => {
|
|
34
|
-
if (isDepthAxis(bone, pose.view))
|
|
35
|
-
return bone.side === 'right' ? 180 : 0;
|
|
36
|
-
return parentAngle + sideSign(bone, pose.view) * (bone.restAngle + joint);
|
|
37
|
-
};
|
|
1
|
+
import { jointQuat, sphereDir } from './joints.js';
|
|
2
|
+
import { axisAngleDeg, mulQuat, rotateVec3, rotationTo, yawPitchRollDeg } from './quat.js';
|
|
3
|
+
import { add3, midpoint3, scale3 } from './vec3.js';
|
|
38
4
|
const assertKnownJoints = (pose, rig) => {
|
|
39
5
|
const known = new Set(rig.bones.map((b) => b.id));
|
|
40
|
-
const names = [...Object.keys(pose.joints), ...Object.keys(pose.world
|
|
6
|
+
const names = [...Object.keys(pose.joints), ...Object.keys(pose.world)];
|
|
41
7
|
for (const joint of names) {
|
|
42
8
|
if (!known.has(joint)) {
|
|
43
9
|
throw new Error(`Unknown bone "${joint}". Known bones: ${[...known].sort().join(', ')}`);
|
|
@@ -50,42 +16,47 @@ const originOf = (bone, parent, pose) => {
|
|
|
50
16
|
return pose.root.position;
|
|
51
17
|
return bone.attach === 'start' ? parent.start : parent.end;
|
|
52
18
|
};
|
|
53
|
-
/**
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
19
|
+
/**
|
|
20
|
+
* A `world` override aims the bone at an absolute direction, whatever its
|
|
21
|
+
* parent does - which is how a human (or a model) actually thinks about a
|
|
22
|
+
* posture: "the front thigh points down and forward", not "rotate the hip 60
|
|
23
|
+
* degrees from neutral". The orientation is the shortest arc from rest, plus
|
|
24
|
+
* any requested twist about the target direction; children hang off it.
|
|
25
|
+
*/
|
|
26
|
+
const worldOrientation = (bone, target) => {
|
|
27
|
+
const dir = sphereDir(target);
|
|
28
|
+
const swing = rotationTo(bone.dir, dir);
|
|
29
|
+
const twist = target.twist ?? 0;
|
|
30
|
+
return twist === 0 ? swing : mulQuat(axisAngleDeg(dir, twist), swing);
|
|
57
31
|
};
|
|
58
|
-
const solveBone = (bone, solved, pose) => {
|
|
32
|
+
const solveBone = (bone, solved, pose, rootQuat) => {
|
|
59
33
|
const parent = bone.parent === null ? null : solved[bone.parent];
|
|
60
34
|
if (bone.parent !== null && parent === undefined) {
|
|
61
35
|
throw new Error(`Bone "${bone.id}" is listed before its parent "${bone.parent}"`);
|
|
62
36
|
}
|
|
63
|
-
const
|
|
64
|
-
const
|
|
37
|
+
const override = pose.world[bone.id];
|
|
38
|
+
const parentQuat = parent === null || parent === undefined ? rootQuat : parent.orientation;
|
|
39
|
+
const orientation = override === undefined
|
|
40
|
+
? mulQuat(parentQuat, jointQuat(bone, pose.joints[bone.id] ?? 0))
|
|
41
|
+
: worldOrientation(bone, override);
|
|
65
42
|
const start = originOf(bone, parent ?? null, pose);
|
|
66
|
-
const length =
|
|
43
|
+
const length = bone.length * pose.root.scale;
|
|
67
44
|
return {
|
|
68
45
|
id: bone.id,
|
|
69
46
|
start,
|
|
70
|
-
end:
|
|
71
|
-
|
|
47
|
+
end: add3(start, rotateVec3(orientation, scale3(bone.dir, length))),
|
|
48
|
+
orientation,
|
|
72
49
|
length,
|
|
73
50
|
side: bone.side,
|
|
74
51
|
group: bone.group,
|
|
75
52
|
};
|
|
76
53
|
};
|
|
77
|
-
const solveBones = (pose, rig) => {
|
|
78
|
-
const solved = {};
|
|
79
|
-
for (const bone of rig.bones)
|
|
80
|
-
solved[bone.id] = solveBone(bone, solved, pose);
|
|
81
|
-
return solved;
|
|
82
|
-
};
|
|
83
54
|
const landmarksOf = (b) => ({
|
|
84
55
|
hipCenter: b.pelvis.start,
|
|
85
56
|
waist: b.pelvis.end,
|
|
86
57
|
chest: b.spine.end,
|
|
87
58
|
neckBase: b.neck.start,
|
|
88
|
-
headCenter:
|
|
59
|
+
headCenter: midpoint3(b.head.start, b.head.end),
|
|
89
60
|
headTop: b.head.end,
|
|
90
61
|
shoulderL: b.clavicleL.end,
|
|
91
62
|
elbowL: b.upperArmL.end,
|
|
@@ -109,31 +80,30 @@ const boundsOf = (points) => ({
|
|
|
109
80
|
maxX: Math.max(...points.map((p) => p[0])),
|
|
110
81
|
minY: Math.min(...points.map((p) => p[1])),
|
|
111
82
|
maxY: Math.max(...points.map((p) => p[1])),
|
|
83
|
+
minZ: Math.min(...points.map((p) => p[2])),
|
|
84
|
+
maxZ: Math.max(...points.map((p) => p[2])),
|
|
112
85
|
});
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
...bone,
|
|
116
|
-
start: transformPoint(bone.start, dy, flip),
|
|
117
|
-
end: transformPoint(bone.end, dy, flip),
|
|
118
|
-
worldAngle: flip ? 180 - bone.worldAngle : bone.worldAngle,
|
|
119
|
-
});
|
|
86
|
+
const lift = (bone, dy) => dy === 0
|
|
87
|
+
? bone
|
|
88
|
+
: { ...bone, start: add3(bone.start, [0, dy, 0]), end: add3(bone.end, [0, dy, 0]) };
|
|
120
89
|
/**
|
|
121
|
-
* Forward kinematics: turn a pose (joint
|
|
122
|
-
* named landmarks and bounds. Pure and
|
|
123
|
-
* yields byte-identical geometry.
|
|
90
|
+
* Forward kinematics: turn a pose (joint rotations about anatomical axes) into
|
|
91
|
+
* world-space bone segments, named landmarks and bounds. Pure and
|
|
92
|
+
* deterministic - the same pose always yields byte-identical geometry.
|
|
124
93
|
*/
|
|
125
94
|
export const solveSkeleton = (pose, rig) => {
|
|
126
95
|
assertKnownJoints(pose, rig);
|
|
127
|
-
const
|
|
96
|
+
const rootQuat = yawPitchRollDeg(pose.root.yaw, pose.root.pitch, pose.root.roll);
|
|
97
|
+
const raw = {};
|
|
98
|
+
for (const bone of rig.bones)
|
|
99
|
+
raw[bone.id] = solveBone(bone, raw, pose, rootQuat);
|
|
128
100
|
const rawPoints = Object.values(raw).flatMap((b) => [b.start, b.end]);
|
|
129
101
|
const dy = pose.grounded ? -boundsOf(rawPoints).minY : 0;
|
|
130
|
-
const
|
|
131
|
-
const bones = Object.fromEntries(Object.entries(raw).map(([id, bone]) => [id, transformBone(bone, dy, flip)]));
|
|
102
|
+
const bones = Object.fromEntries(Object.entries(raw).map(([id, bone]) => [id, lift(bone, dy)]));
|
|
132
103
|
const landmarks = landmarksOf(bones);
|
|
133
104
|
const bounds = boundsOf(Object.values(bones).flatMap((b) => [b.start, b.end]));
|
|
134
105
|
return {
|
|
135
106
|
rig,
|
|
136
|
-
view: pose.view,
|
|
137
107
|
scale: pose.root.scale,
|
|
138
108
|
bones,
|
|
139
109
|
landmarks,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skeleton.js","sourceRoot":"","sources":["../../src/core/skeleton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"skeleton.js","sourceRoot":"","sources":["../../src/core/skeleton.ts"],"names":[],"mappings":"AAA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EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAEzD,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,CAC9B,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAC/B,CAAC;IAEjC,MAAM,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;IACrC,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAE/E,OAAO;QACL,GAAG;QACH,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK;QACtB,KAAK;QACL,SAAS;QACT,MAAM;QACN,MAAM,EAAE,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI;KAClC,CAAC;AACJ,CAAC,CAAC"}
|
package/dist/core/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Quat } from './quat.js';
|
|
2
|
+
import type { Vec3 } from './vec3.js';
|
|
2
3
|
export type Side = 'left' | 'right' | 'center';
|
|
3
4
|
export type BoneGroup = 'torso' | 'head' | 'arm' | 'leg';
|
|
4
5
|
export declare const BONE_IDS: readonly ["pelvis", "spine", "neck", "head", "clavicleL", "upperArmL", "forearmL", "handL", "clavicleR", "upperArmR", "forearmR", "handR", "hipL", "thighL", "shinL", "footL", "hipR", "thighR", "shinR", "footR"];
|
|
@@ -7,98 +8,104 @@ export type BoneId = (typeof BONE_IDS)[number];
|
|
|
7
8
|
export type JointId = BoneId;
|
|
8
9
|
export declare const LANDMARK_IDS: readonly ["hipCenter", "waist", "chest", "neckBase", "headCenter", "headTop", "shoulderL", "elbowL", "wristL", "handTipL", "shoulderR", "elbowR", "wristR", "handTipR", "hipJointL", "kneeL", "ankleL", "toeL", "hipJointR", "kneeR", "ankleR", "toeR"];
|
|
9
10
|
export type LandmarkId = (typeof LANDMARK_IDS)[number];
|
|
11
|
+
/**
|
|
12
|
+
* A bone in anatomical neutral (standing, arms down, facing +z). The three
|
|
13
|
+
* axes carry the whole sign convention of the format, as data:
|
|
14
|
+
*
|
|
15
|
+
* - `dir` - the direction the bone points at rest (unit vector)
|
|
16
|
+
* - `flexAxis` - positive `flex` rotates about this: anatomical flexion
|
|
17
|
+
* (a knee bends backward, a hip swings forward - each bone's axis says so)
|
|
18
|
+
* - `abductAxis` - positive `abduct` moves the bone away from the midline
|
|
19
|
+
* (for center bones: toward the figure's left)
|
|
20
|
+
* - `twistAxis` - positive `twist` turns about this, along the bone: external
|
|
21
|
+
* rotation for limbs, turning toward the figure's left for center bones
|
|
22
|
+
*
|
|
23
|
+
* Because the signs live in the axes - and axes mirror as the pseudovectors
|
|
24
|
+
* they are - the right side is an exact mirror of the left and swapping L/R
|
|
25
|
+
* joint values mirrors a pose. No code branches on side anywhere.
|
|
26
|
+
*/
|
|
10
27
|
export interface BoneDef {
|
|
11
28
|
readonly id: BoneId;
|
|
12
29
|
readonly parent: BoneId | null;
|
|
13
30
|
/** Which end of the parent bone this bone hangs off. */
|
|
14
31
|
readonly attach: 'start' | 'end';
|
|
15
|
-
/**
|
|
16
|
-
* The bone whose direction this bone's rest angle is measured against, when
|
|
17
|
-
* that differs from the bone it hangs off. An upper arm *attaches* to the
|
|
18
|
-
* clavicle (which points sideways) but *aims* relative to the spine - keeping
|
|
19
|
-
* the two apart is what stops a profile figure's right arm pointing skyward.
|
|
20
|
-
*/
|
|
21
|
-
readonly angleParent?: BoneId;
|
|
22
32
|
/** Bone length as a fraction of the figure's stature (1.0 = full height). */
|
|
23
33
|
readonly length: number;
|
|
24
|
-
|
|
25
|
-
readonly
|
|
34
|
+
readonly dir: Vec3;
|
|
35
|
+
readonly flexAxis: Vec3;
|
|
36
|
+
readonly abductAxis: Vec3;
|
|
37
|
+
readonly twistAxis: Vec3;
|
|
26
38
|
readonly side: Side;
|
|
27
39
|
readonly group: BoneGroup;
|
|
28
|
-
/** Lateral bones (clavicle, hip) foreshorten as the figure turns away from the viewer. */
|
|
29
|
-
readonly lateral?: boolean;
|
|
30
|
-
/** Foot bones foreshorten in front/back views. */
|
|
31
|
-
readonly foot?: boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Which way a positive joint value bends this bone. -1 for the shin, so that
|
|
34
|
-
* "shinL: 90" means the knee is flexed 90 degrees - the way a knee actually
|
|
35
|
-
* bends - rather than hyperextended by 90.
|
|
36
|
-
*/
|
|
37
|
-
readonly flexSign?: number;
|
|
38
40
|
}
|
|
39
41
|
export interface Rig {
|
|
40
42
|
readonly name: string;
|
|
41
43
|
readonly bones: readonly BoneDef[];
|
|
42
44
|
}
|
|
43
|
-
|
|
44
|
-
export interface
|
|
45
|
-
|
|
46
|
-
readonly
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
45
|
+
/** A joint rotation in degrees about the bone's anatomical axes, applied twist, then abduct, then flex. */
|
|
46
|
+
export interface JointRotation {
|
|
47
|
+
readonly flex: number;
|
|
48
|
+
readonly abduct: number;
|
|
49
|
+
readonly twist: number;
|
|
50
|
+
}
|
|
51
|
+
/** A scalar is pure flexion - the common case reads like anatomy: "forearmL: 90" bends the elbow. */
|
|
52
|
+
export type JointValue = number | Partial<JointRotation>;
|
|
53
|
+
/**
|
|
54
|
+
* An absolute bone direction: where the bone points in world space, whatever
|
|
55
|
+
* its parent does. `azimuth` turns from +z (the figure's facing direction)
|
|
56
|
+
* toward +x (the figure's left); `elevation` rises from horizontal (90 = up).
|
|
57
|
+
*/
|
|
58
|
+
export interface WorldDirection {
|
|
59
|
+
readonly azimuth: number;
|
|
60
|
+
readonly elevation: number;
|
|
61
|
+
readonly twist?: number | undefined;
|
|
57
62
|
}
|
|
58
63
|
export interface KinematicPose {
|
|
59
|
-
readonly view: ViewId;
|
|
60
64
|
readonly root: {
|
|
61
|
-
readonly position:
|
|
62
|
-
/**
|
|
63
|
-
readonly
|
|
65
|
+
readonly position: Vec3;
|
|
66
|
+
/** Degrees. Yaw turns the figure (+ = toward its left), pitch tips it forward, roll cartwheels it. */
|
|
67
|
+
readonly yaw: number;
|
|
68
|
+
readonly pitch: number;
|
|
69
|
+
readonly roll: number;
|
|
64
70
|
readonly scale: number;
|
|
65
71
|
};
|
|
66
|
-
readonly joints: Partial<Record<JointId,
|
|
67
|
-
|
|
68
|
-
* Absolute bone directions in degrees. A bone listed here points exactly this
|
|
69
|
-
* way in world space, whatever its parent does - which is how a human (or a
|
|
70
|
-
* model) actually thinks about a posture: "the front thigh points down-left at
|
|
71
|
-
* -150 degrees", not "rotate the hip 60 degrees from neutral".
|
|
72
|
-
*/
|
|
73
|
-
readonly world?: Partial<Record<JointId, number>>;
|
|
72
|
+
readonly joints: Partial<Record<JointId, JointValue>>;
|
|
73
|
+
readonly world: Partial<Record<JointId, WorldDirection>>;
|
|
74
74
|
/** Translate the solved figure so its lowest point sits on y = 0. */
|
|
75
75
|
readonly grounded: boolean;
|
|
76
|
-
/** Mirror the solved figure across the vertical axis (a figure facing the other way). */
|
|
77
|
-
readonly flip?: boolean;
|
|
78
76
|
}
|
|
79
77
|
export interface BoneSegment {
|
|
80
78
|
readonly id: BoneId;
|
|
81
|
-
readonly start:
|
|
82
|
-
readonly end:
|
|
83
|
-
/**
|
|
84
|
-
readonly
|
|
79
|
+
readonly start: Vec3;
|
|
80
|
+
readonly end: Vec3;
|
|
81
|
+
/** World orientation of the bone's rest frame. */
|
|
82
|
+
readonly orientation: Quat;
|
|
85
83
|
readonly length: number;
|
|
86
84
|
readonly side: Side;
|
|
87
85
|
readonly group: BoneGroup;
|
|
88
86
|
}
|
|
87
|
+
/** 2D extent in a projected picture plane. */
|
|
89
88
|
export interface Bounds {
|
|
90
89
|
readonly minX: number;
|
|
91
90
|
readonly minY: number;
|
|
92
91
|
readonly maxX: number;
|
|
93
92
|
readonly maxY: number;
|
|
94
93
|
}
|
|
94
|
+
/** 3D extent of a solved skeleton. */
|
|
95
|
+
export interface Bounds3 {
|
|
96
|
+
readonly minX: number;
|
|
97
|
+
readonly minY: number;
|
|
98
|
+
readonly minZ: number;
|
|
99
|
+
readonly maxX: number;
|
|
100
|
+
readonly maxY: number;
|
|
101
|
+
readonly maxZ: number;
|
|
102
|
+
}
|
|
95
103
|
export interface Skeleton {
|
|
96
104
|
readonly rig: Rig;
|
|
97
|
-
readonly view: ViewId;
|
|
98
105
|
readonly scale: number;
|
|
99
106
|
readonly bones: Record<BoneId, BoneSegment>;
|
|
100
|
-
readonly landmarks: Record<LandmarkId,
|
|
101
|
-
readonly bounds:
|
|
107
|
+
readonly landmarks: Record<LandmarkId, Vec3>;
|
|
108
|
+
readonly bounds: Bounds3;
|
|
102
109
|
/** Sole-to-crown extent of the solved figure. */
|
|
103
110
|
readonly height: number;
|
|
104
111
|
}
|
package/dist/core/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,MAAM,IAAI,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE/C,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;AAEzD,eAAO,MAAM,QAAQ,oNAqBX,CAAC;AAEX,MAAM,MAAM,MAAM,GAAG,CAAC,OA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AE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC5C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAC7C,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,iDAAiD;IACjD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB"}
|
package/dist/core/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,QAAQ;IACR,OAAO;IACP,MAAM;IACN,MAAM;IACN,WAAW;IACX,WAAW;IACX,UAAU;IACV,OAAO;IACP,WAAW;IACX,WAAW;IACX,UAAU;IACV,OAAO;IACP,MAAM;IACN,QAAQ;IACR,OAAO;IACP,OAAO;IACP,MAAM;IACN,QAAQ;IACR,OAAO;IACP,OAAO;CACC,CAAC;AAOX,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,WAAW;IACX,OAAO;IACP,OAAO;IACP,UAAU;IACV,YAAY;IACZ,SAAS;IACT,WAAW;IACX,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,WAAW;IACX,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,WAAW;IACX,OAAO;IACP,QAAQ;IACR,MAAM;IACN,WAAW;IACX,OAAO;IACP,QAAQ;IACR,MAAM;CACE,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type Vec3 = readonly [number, number, number];
|
|
2
|
+
export declare const vec3: (x: number, y: number, z: number) => Vec3;
|
|
3
|
+
export declare const add3: (a: Vec3, b: Vec3) => Vec3;
|
|
4
|
+
export declare const sub3: (a: Vec3, b: Vec3) => Vec3;
|
|
5
|
+
export declare const scale3: (a: Vec3, k: number) => Vec3;
|
|
6
|
+
export declare const len3: (a: Vec3) => number;
|
|
7
|
+
export declare const dist3: (a: Vec3, b: Vec3) => number;
|
|
8
|
+
export declare const dot3: (a: Vec3, b: Vec3) => number;
|
|
9
|
+
export declare const cross3: (a: Vec3, b: Vec3) => Vec3;
|
|
10
|
+
export declare const lerp3: (a: Vec3, b: Vec3, t: number) => Vec3;
|
|
11
|
+
export declare const midpoint3: (a: Vec3, b: Vec3) => Vec3;
|
|
12
|
+
export declare const normalize3: (a: Vec3) => Vec3;
|
|
13
|
+
//# sourceMappingURL=vec3.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vec3.d.ts","sourceRoot":"","sources":["../../src/core/vec3.ts"],"names":[],"mappings":"AAeA,MAAM,MAAM,IAAI,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAIrD,eAAO,MAAM,IAAI,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,KAAG,IAAiB,CAAC;AAEzE,eAAO,MAAM,IAAI,GAAI,GAAG,IAAI,EAAE,GAAG,IAAI,KAAG,IAAuD,CAAC;AAEhG,eAAO,MAAM,IAAI,GAAI,GAAG,IAAI,EAAE,GAAG,IAAI,KAAG,IAAuD,CAAC;AAEhG,eAAO,MAAM,MAAM,GAAI,GAAG,IAAI,EAAE,GAAG,MAAM,KAAG,IAAyD,CAAC;AAEtG,eAAO,MAAM,IAAI,GAAI,GAAG,IAAI,KAAG,MAAsB,CAAC;AAEtD,eAAO,MAAM,KAAK,GAAI,GAAG,IAAI,EAAE,GAAG,IAAI,KAAG,MAAuB,CAAC;AAEjE,eAAO,MAAM,IAAI,GAAI,GAAG,IAAI,EAAE,GAAG,IAAI,KAAG,MAAsB,CAAC;AAE/D,eAAO,MAAM,MAAM,GAAI,GAAG,IAAI,EAAE,GAAG,IAAI,KAAG,IAAyD,CAAC;AAEpG,eAAO,MAAM,KAAK,GAAI,GAAG,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,KAAG,IAA2D,CAAC;AAEhH,eAAO,MAAM,SAAS,GAAI,GAAG,IAAI,EAAE,GAAG,IAAI,KAAG,IAAwB,CAAC;AAEtE,eAAO,MAAM,UAAU,GAAI,GAAG,IAAI,KAAG,IAA0D,CAAC"}
|