@perplexdotgg/bounce 1.2.2 → 1.2.4
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 +9 -5
- package/build/bounce.d.ts +712 -220
- package/build/bounce.js +93 -1
- package/docs/documentation.md +1 -1
- package/package.json +4 -3
package/build/bounce.js
CHANGED
|
@@ -1630,6 +1630,98 @@ class Mat4 extends createClass(mat4Props) {
|
|
|
1630
1630
|
out.e14 = 0;
|
|
1631
1631
|
out.e15 = 1;
|
|
1632
1632
|
}
|
|
1633
|
+
decompose(outTranslation, outOrientation, outScale) {
|
|
1634
|
+
outTranslation.x = this.e12;
|
|
1635
|
+
outTranslation.y = this.e13;
|
|
1636
|
+
outTranslation.z = this.e14;
|
|
1637
|
+
let m11 = this.e0;
|
|
1638
|
+
let m12 = this.e1;
|
|
1639
|
+
let m13 = this.e2;
|
|
1640
|
+
let m21 = this.e4;
|
|
1641
|
+
let m22 = this.e5;
|
|
1642
|
+
let m23 = this.e6;
|
|
1643
|
+
let m31 = this.e8;
|
|
1644
|
+
let m32 = this.e9;
|
|
1645
|
+
let m33 = this.e10;
|
|
1646
|
+
outScale.x = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);
|
|
1647
|
+
outScale.y = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);
|
|
1648
|
+
outScale.z = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);
|
|
1649
|
+
let is1 = 1 / outScale.x;
|
|
1650
|
+
let is2 = 1 / outScale.y;
|
|
1651
|
+
let is3 = 1 / outScale.z;
|
|
1652
|
+
let sm11 = m11 * is1;
|
|
1653
|
+
let sm12 = m12 * is2;
|
|
1654
|
+
let sm13 = m13 * is3;
|
|
1655
|
+
let sm21 = m21 * is1;
|
|
1656
|
+
let sm22 = m22 * is2;
|
|
1657
|
+
let sm23 = m23 * is3;
|
|
1658
|
+
let sm31 = m31 * is1;
|
|
1659
|
+
let sm32 = m32 * is2;
|
|
1660
|
+
let sm33 = m33 * is3;
|
|
1661
|
+
let trace = sm11 + sm22 + sm33;
|
|
1662
|
+
let S = 0;
|
|
1663
|
+
if (trace > 0) {
|
|
1664
|
+
S = Math.sqrt(trace + 1) * 2;
|
|
1665
|
+
outOrientation.w = 0.25 * S;
|
|
1666
|
+
outOrientation.x = (sm23 - sm32) / S;
|
|
1667
|
+
outOrientation.y = (sm31 - sm13) / S;
|
|
1668
|
+
outOrientation.z = (sm12 - sm21) / S;
|
|
1669
|
+
} else if (sm11 > sm22 && sm11 > sm33) {
|
|
1670
|
+
S = Math.sqrt(1 + sm11 - sm22 - sm33) * 2;
|
|
1671
|
+
outOrientation.w = (sm23 - sm32) / S;
|
|
1672
|
+
outOrientation.x = 0.25 * S;
|
|
1673
|
+
outOrientation.y = (sm12 + sm21) / S;
|
|
1674
|
+
outOrientation.z = (sm31 + sm13) / S;
|
|
1675
|
+
} else if (sm22 > sm33) {
|
|
1676
|
+
S = Math.sqrt(1 + sm22 - sm11 - sm33) * 2;
|
|
1677
|
+
outOrientation.w = (sm31 - sm13) / S;
|
|
1678
|
+
outOrientation.x = (sm12 + sm21) / S;
|
|
1679
|
+
outOrientation.y = 0.25 * S;
|
|
1680
|
+
outOrientation.z = (sm23 + sm32) / S;
|
|
1681
|
+
} else {
|
|
1682
|
+
S = Math.sqrt(1 + sm33 - sm11 - sm22) * 2;
|
|
1683
|
+
outOrientation.w = (sm12 - sm21) / S;
|
|
1684
|
+
outOrientation.x = (sm31 + sm13) / S;
|
|
1685
|
+
outOrientation.y = (sm23 + sm32) / S;
|
|
1686
|
+
outOrientation.z = 0.25 * S;
|
|
1687
|
+
}
|
|
1688
|
+
return this;
|
|
1689
|
+
}
|
|
1690
|
+
compose(translation, orientation, scale2) {
|
|
1691
|
+
let x2 = orientation.x, y4 = orientation.y, z = orientation.z, w3 = orientation.w;
|
|
1692
|
+
let x22 = x2 + x2;
|
|
1693
|
+
let y22 = y4 + y4;
|
|
1694
|
+
let z2 = z + z;
|
|
1695
|
+
let xx = x2 * x22;
|
|
1696
|
+
let xy = x2 * y22;
|
|
1697
|
+
let xz = x2 * z2;
|
|
1698
|
+
let yy = y4 * y22;
|
|
1699
|
+
let yz = y4 * z2;
|
|
1700
|
+
let zz = z * z2;
|
|
1701
|
+
let wx = w3 * x22;
|
|
1702
|
+
let wy = w3 * y22;
|
|
1703
|
+
let wz = w3 * z2;
|
|
1704
|
+
let sx = scale2.x;
|
|
1705
|
+
let sy = scale2.y;
|
|
1706
|
+
let sz = scale2.z;
|
|
1707
|
+
this.e0 = (1 - (yy + zz)) * sx;
|
|
1708
|
+
this.e1 = (xy + wz) * sx;
|
|
1709
|
+
this.e2 = (xz - wy) * sx;
|
|
1710
|
+
this.e3 = 0;
|
|
1711
|
+
this.e4 = (xy - wz) * sy;
|
|
1712
|
+
this.e5 = (1 - (xx + zz)) * sy;
|
|
1713
|
+
this.e6 = (yz + wx) * sy;
|
|
1714
|
+
this.e7 = 0;
|
|
1715
|
+
this.e8 = (xz + wy) * sz;
|
|
1716
|
+
this.e9 = (yz - wx) * sz;
|
|
1717
|
+
this.e10 = (1 - (xx + yy)) * sz;
|
|
1718
|
+
this.e11 = 0;
|
|
1719
|
+
this.e12 = translation.x;
|
|
1720
|
+
this.e13 = translation.y;
|
|
1721
|
+
this.e14 = translation.z;
|
|
1722
|
+
this.e15 = 1;
|
|
1723
|
+
return this;
|
|
1724
|
+
}
|
|
1633
1725
|
}
|
|
1634
1726
|
const rotation$3 = /* @__PURE__ */ Quat.create();
|
|
1635
1727
|
const cross_bn_cn = /* @__PURE__ */ Vec3.create();
|
|
@@ -2096,7 +2188,7 @@ let Triangle$1 = class Triangle extends createClass(triangleProps$1) {
|
|
|
2096
2188
|
};
|
|
2097
2189
|
const faceProps = {
|
|
2098
2190
|
numVertices: 0,
|
|
2099
|
-
buffer: LazyReferenceListType((
|
|
2191
|
+
buffer: LazyReferenceListType(() => Vec3)
|
|
2100
2192
|
};
|
|
2101
2193
|
const triangle$1 = /* @__PURE__ */ Triangle$1.create();
|
|
2102
2194
|
const tempVertex = /* @__PURE__ */ Vec3.create();
|
package/docs/documentation.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Bounce API Reference
|
|
2
2
|
|
|
3
|
-
Bounce is a fast, deterministic 3D physics library for TypeScript and JavaScript. It's written in pure TypeScript (no WebAssembly).
|
|
3
|
+
Bounce is a fast, deterministic 3D physics library for TypeScript and JavaScript projects. It's written in pure TypeScript (no WebAssembly).
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perplexdotgg/bounce",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Bounce",
|
|
6
6
|
"main": "./build/bounce.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"test": "vitest"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"monomorph": "^1.5.
|
|
15
|
+
"monomorph": "^1.5.6"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/node": "^24.9.2",
|
|
@@ -28,5 +28,6 @@
|
|
|
28
28
|
"repository": {
|
|
29
29
|
"type": "git",
|
|
30
30
|
"url": "https://codeberg.org/perplexdotgg/bounce"
|
|
31
|
-
}
|
|
31
|
+
},
|
|
32
|
+
"funding": "https://opencollective.com/perplexgg"
|
|
32
33
|
}
|