@ac-kit/math-geometry 0.1.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/CHANGELOG.md +7 -0
- package/LICENSE +28 -0
- package/README.md +86 -0
- package/dist/angles.d.ts +31 -0
- package/dist/angles.d.ts.map +1 -0
- package/dist/angles.js +53 -0
- package/dist/angles.js.map +1 -0
- package/dist/box3.d.ts +17 -0
- package/dist/box3.d.ts.map +1 -0
- package/dist/box3.js +82 -0
- package/dist/box3.js.map +1 -0
- package/dist/box4.d.ts +9 -0
- package/dist/box4.d.ts.map +1 -0
- package/dist/box4.js +7 -0
- package/dist/box4.js.map +1 -0
- package/dist/circle2.d.ts +74 -0
- package/dist/circle2.d.ts.map +1 -0
- package/dist/circle2.js +100 -0
- package/dist/circle2.js.map +1 -0
- package/dist/coordinate-spaces.d.ts +39 -0
- package/dist/coordinate-spaces.d.ts.map +1 -0
- package/dist/coordinate-spaces.js +52 -0
- package/dist/coordinate-spaces.js.map +1 -0
- package/dist/coordinates-vec2.d.ts +7 -0
- package/dist/coordinates-vec2.d.ts.map +1 -0
- package/dist/coordinates-vec2.js +35 -0
- package/dist/coordinates-vec2.js.map +1 -0
- package/dist/coordinates-vec3.d.ts +11 -0
- package/dist/coordinates-vec3.d.ts.map +1 -0
- package/dist/coordinates-vec3.js +61 -0
- package/dist/coordinates-vec3.js.map +1 -0
- package/dist/coordinates.d.ts +54 -0
- package/dist/coordinates.d.ts.map +1 -0
- package/dist/coordinates.js +2 -0
- package/dist/coordinates.js.map +1 -0
- package/dist/euler-angles-quaternion.d.ts +7 -0
- package/dist/euler-angles-quaternion.d.ts.map +1 -0
- package/dist/euler-angles-quaternion.js +100 -0
- package/dist/euler-angles-quaternion.js.map +1 -0
- package/dist/euler-angles.d.ts +33 -0
- package/dist/euler-angles.d.ts.map +1 -0
- package/dist/euler-angles.js +35 -0
- package/dist/euler-angles.js.map +1 -0
- package/dist/geometry-vectors.d.ts +11 -0
- package/dist/geometry-vectors.d.ts.map +1 -0
- package/dist/geometry-vectors.js +19 -0
- package/dist/geometry-vectors.js.map +1 -0
- package/dist/globals.d.ts +47 -0
- package/dist/globals.d.ts.map +1 -0
- package/dist/globals.js +29 -0
- package/dist/globals.js.map +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/dist/line2.d.ts +43 -0
- package/dist/line2.d.ts.map +1 -0
- package/dist/line2.js +68 -0
- package/dist/line2.js.map +1 -0
- package/dist/line3.d.ts +30 -0
- package/dist/line3.d.ts.map +1 -0
- package/dist/line3.js +46 -0
- package/dist/line3.js.map +1 -0
- package/dist/mesh3.d.ts +32 -0
- package/dist/mesh3.d.ts.map +1 -0
- package/dist/mesh3.js +142 -0
- package/dist/mesh3.js.map +1 -0
- package/dist/plane3.d.ts +38 -0
- package/dist/plane3.d.ts.map +1 -0
- package/dist/plane3.js +60 -0
- package/dist/plane3.js.map +1 -0
- package/dist/point2.d.ts +41 -0
- package/dist/point2.d.ts.map +1 -0
- package/dist/point2.js +92 -0
- package/dist/point2.js.map +1 -0
- package/dist/point3.d.ts +43 -0
- package/dist/point3.d.ts.map +1 -0
- package/dist/point3.js +103 -0
- package/dist/point3.js.map +1 -0
- package/dist/point4.d.ts +12 -0
- package/dist/point4.d.ts.map +1 -0
- package/dist/point4.js +28 -0
- package/dist/point4.js.map +1 -0
- package/dist/polygon2.d.ts +30 -0
- package/dist/polygon2.d.ts.map +1 -0
- package/dist/polygon2.js +127 -0
- package/dist/polygon2.js.map +1 -0
- package/dist/polygon3.d.ts +28 -0
- package/dist/polygon3.d.ts.map +1 -0
- package/dist/polygon3.js +112 -0
- package/dist/polygon3.js.map +1 -0
- package/dist/ray2.d.ts +14 -0
- package/dist/ray2.d.ts.map +1 -0
- package/dist/ray2.js +27 -0
- package/dist/ray2.js.map +1 -0
- package/dist/ray3.d.ts +30 -0
- package/dist/ray3.d.ts.map +1 -0
- package/dist/ray3.js +81 -0
- package/dist/ray3.js.map +1 -0
- package/dist/rect2.d.ts +54 -0
- package/dist/rect2.d.ts.map +1 -0
- package/dist/rect2.js +149 -0
- package/dist/rect2.js.map +1 -0
- package/dist/segment2.d.ts +24 -0
- package/dist/segment2.d.ts.map +1 -0
- package/dist/segment2.js +55 -0
- package/dist/segment2.js.map +1 -0
- package/dist/segment3.d.ts +13 -0
- package/dist/segment3.d.ts.map +1 -0
- package/dist/segment3.js +33 -0
- package/dist/segment3.js.map +1 -0
- package/dist/size2.d.ts +33 -0
- package/dist/size2.d.ts.map +1 -0
- package/dist/size2.js +81 -0
- package/dist/size2.js.map +1 -0
- package/dist/size3.d.ts +21 -0
- package/dist/size3.d.ts.map +1 -0
- package/dist/size3.js +59 -0
- package/dist/size3.js.map +1 -0
- package/dist/size4.d.ts +10 -0
- package/dist/size4.d.ts.map +1 -0
- package/dist/size4.js +16 -0
- package/dist/size4.js.map +1 -0
- package/dist/sphere3.d.ts +13 -0
- package/dist/sphere3.d.ts.map +1 -0
- package/dist/sphere3.js +26 -0
- package/dist/sphere3.js.map +1 -0
- package/dist/triangle2.d.ts +17 -0
- package/dist/triangle2.d.ts.map +1 -0
- package/dist/triangle2.js +31 -0
- package/dist/triangle2.js.map +1 -0
- package/dist/triangle3.d.ts +20 -0
- package/dist/triangle3.d.ts.map +1 -0
- package/dist/triangle3.js +43 -0
- package/dist/triangle3.js.map +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Vec2 } from "@ac-kit/math-linear";
|
|
2
|
+
import { PolarCoords, PolygonalPolarCoords, PolygonalPolarSystem } from "./coordinates.js";
|
|
3
|
+
export declare function vec2ToPolar(v: Vec2): PolarCoords;
|
|
4
|
+
export declare function polarToVec2(coords: PolarCoords): Vec2;
|
|
5
|
+
export declare function vec2ToPolygonalPolar(v: Vec2, system: PolygonalPolarSystem): PolygonalPolarCoords;
|
|
6
|
+
export declare function polygonalPolarToVec2(coords: PolygonalPolarCoords): Vec2;
|
|
7
|
+
//# sourceMappingURL=coordinates-vec2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinates-vec2.d.ts","sourceRoot":"","sources":["../src/coordinates-vec2.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAG3C,OAAO,EACN,WAAW,EACX,oBAAoB,EACpB,oBAAoB,EACpB,MAAM,kBAAkB,CAAC;AAE1B,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,GAAG,WAAW,CAIhD;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAKrD;AAED,wBAAgB,oBAAoB,CACnC,CAAC,EAAE,IAAI,EACP,MAAM,EAAE,oBAAoB,GAC1B,oBAAoB,CActB;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,oBAAoB,GAAG,IAAI,CAWvE"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { mod } from "@ac-kit/core";
|
|
2
|
+
import { TWO_PI } from "@ac-kit/math-scalar";
|
|
3
|
+
export function vec2ToPolar(v) {
|
|
4
|
+
const radius = Math.hypot(v[0], v[1]);
|
|
5
|
+
const angle = Math.atan2(v[1], v[0]);
|
|
6
|
+
return { radius, angle };
|
|
7
|
+
}
|
|
8
|
+
export function polarToVec2(coords) {
|
|
9
|
+
return [
|
|
10
|
+
coords.radius * Math.cos(coords.angle),
|
|
11
|
+
coords.radius * Math.sin(coords.angle),
|
|
12
|
+
];
|
|
13
|
+
}
|
|
14
|
+
export function vec2ToPolygonalPolar(v, system) {
|
|
15
|
+
const euclideanDist = Math.hypot(v[0], v[1]);
|
|
16
|
+
const angle = Math.atan2(v[1], v[0]);
|
|
17
|
+
// φ: offset from the nearest sector bisector, range [-π/n, π/n)
|
|
18
|
+
const sectorAngle = TWO_PI / system.sides;
|
|
19
|
+
const halfSector = sectorAngle / 2;
|
|
20
|
+
const normalizedOffset = mod(angle - system.rotation, sectorAngle);
|
|
21
|
+
const phi = normalizedOffset - halfSector;
|
|
22
|
+
// boundaryDist = cos(π/n) / cos(φ) → radius = euclideanDist / boundaryDist
|
|
23
|
+
const radius = (euclideanDist * Math.cos(phi)) / Math.cos(halfSector);
|
|
24
|
+
return { system, radius, angle };
|
|
25
|
+
}
|
|
26
|
+
export function polygonalPolarToVec2(coords) {
|
|
27
|
+
const { radius, angle, system } = coords;
|
|
28
|
+
const sectorAngle = TWO_PI / system.sides;
|
|
29
|
+
const halfSector = sectorAngle / 2;
|
|
30
|
+
const normalizedOffset = mod(angle - system.rotation, sectorAngle);
|
|
31
|
+
const phi = normalizedOffset - halfSector;
|
|
32
|
+
const euclideanDist = (radius * Math.cos(halfSector)) / Math.cos(phi);
|
|
33
|
+
return [euclideanDist * Math.cos(angle), euclideanDist * Math.sin(angle)];
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=coordinates-vec2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinates-vec2.js","sourceRoot":"","sources":["../src/coordinates-vec2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAQ7C,MAAM,UAAU,WAAW,CAAC,CAAO;IAClC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACtC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACrC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,MAAmB;IAC9C,OAAO;QACN,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,G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M,GAAG,GAAG,gBAAgB,GAAG,UAAU,CAAC;IAE1C,MAAM,aAAa,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAEtE,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;AAC3E,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Vec3 } from "@ac-kit/math-linear";
|
|
2
|
+
import { CylindricalCoordsY, CylindricalCoordsZ, SphericalCoordsY, SphericalCoordsZ } from "./coordinates.js";
|
|
3
|
+
export declare function vec3ToCylindricalY(v: Vec3): CylindricalCoordsY;
|
|
4
|
+
export declare function cylindricalYToVec3(coords: CylindricalCoordsY): Vec3;
|
|
5
|
+
export declare function vec3ToSphericalY(v: Vec3): SphericalCoordsY;
|
|
6
|
+
export declare function sphericalYToVec3(coords: SphericalCoordsY): Vec3;
|
|
7
|
+
export declare function vec3ToCylindricalZ(v: Vec3): CylindricalCoordsZ;
|
|
8
|
+
export declare function cylindricalZToVec3(coords: CylindricalCoordsZ): Vec3;
|
|
9
|
+
export declare function vec3ToSphericalZ(v: Vec3): SphericalCoordsZ;
|
|
10
|
+
export declare function sphericalZToVec3(coords: SphericalCoordsZ): Vec3;
|
|
11
|
+
//# sourceMappingURL=coordinates-vec3.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinates-vec3.d.ts","sourceRoot":"","sources":["../src/coordinates-vec3.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE3C,OAAO,EACN,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,MAAM,kBAAkB,CAAC;AAE1B,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,IAAI,GAAG,kBAAkB,CAM9D;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAMnE;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,IAAI,GAAG,gBAAgB,CAO1D;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAO/D;AAED,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,IAAI,GAAG,kBAAkB,CAM9D;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAMnE;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,IAAI,GAAG,gBAAgB,CAO1D;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAO/D"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export function vec3ToCylindricalY(v) {
|
|
2
|
+
return {
|
|
3
|
+
radius: Math.hypot(v[0], v[2]),
|
|
4
|
+
azimuth: Math.atan2(v[2], v[0]),
|
|
5
|
+
height: v[1],
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export function cylindricalYToVec3(coords) {
|
|
9
|
+
return [
|
|
10
|
+
coords.radius * Math.cos(coords.azimuth),
|
|
11
|
+
coords.height,
|
|
12
|
+
coords.radius * Math.sin(coords.azimuth),
|
|
13
|
+
];
|
|
14
|
+
}
|
|
15
|
+
export function vec3ToSphericalY(v) {
|
|
16
|
+
const radius = Math.hypot(v[0], v[1], v[2]);
|
|
17
|
+
return {
|
|
18
|
+
radius,
|
|
19
|
+
azimuth: Math.atan2(v[2], v[0]),
|
|
20
|
+
inclination: Math.acos(v[1] / radius),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export function sphericalYToVec3(coords) {
|
|
24
|
+
const sinI = Math.sin(coords.inclination);
|
|
25
|
+
return [
|
|
26
|
+
coords.radius * sinI * Math.cos(coords.azimuth),
|
|
27
|
+
coords.radius * Math.cos(coords.inclination),
|
|
28
|
+
coords.radius * sinI * Math.sin(coords.azimuth),
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
export function vec3ToCylindricalZ(v) {
|
|
32
|
+
return {
|
|
33
|
+
radius: Math.hypot(v[0], v[1]),
|
|
34
|
+
azimuth: Math.atan2(v[1], v[0]),
|
|
35
|
+
height: v[2],
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export function cylindricalZToVec3(coords) {
|
|
39
|
+
return [
|
|
40
|
+
coords.radius * Math.cos(coords.azimuth),
|
|
41
|
+
coords.radius * Math.sin(coords.azimuth),
|
|
42
|
+
coords.height,
|
|
43
|
+
];
|
|
44
|
+
}
|
|
45
|
+
export function vec3ToSphericalZ(v) {
|
|
46
|
+
const radius = Math.hypot(v[0], v[1], v[2]);
|
|
47
|
+
return {
|
|
48
|
+
radius,
|
|
49
|
+
azimuth: Math.atan2(v[1], v[0]),
|
|
50
|
+
inclination: Math.acos(v[2] / radius),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export function sphericalZToVec3(coords) {
|
|
54
|
+
const sinI = Math.sin(coords.inclination);
|
|
55
|
+
return [
|
|
56
|
+
coords.radius * sinI * Math.cos(coords.azimuth),
|
|
57
|
+
coords.radius * sinI * Math.sin(coords.azimuth),
|
|
58
|
+
coords.radius * Math.cos(coords.inclination),
|
|
59
|
+
];
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=coordinates-vec3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinates-vec3.js","sourceRoot":"","sources":["../src/coordinates-vec3.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,kBAAkB,CAAC,CAAO;IACzC,OAAO;QACN,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9B,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,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I,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC;QAC/C,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC;KAC5C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/** Polygonal polar coordinate system. */
|
|
2
|
+
export type PolygonalPolarSystem = {
|
|
3
|
+
sides: number;
|
|
4
|
+
rotation: number;
|
|
5
|
+
};
|
|
6
|
+
/** Polygonal polar coordinates. */
|
|
7
|
+
export type PolygonalPolarCoords = {
|
|
8
|
+
system: PolygonalPolarSystem;
|
|
9
|
+
radius: number;
|
|
10
|
+
angle: number;
|
|
11
|
+
};
|
|
12
|
+
/** Polar coordinates. */
|
|
13
|
+
export type PolarCoords = {
|
|
14
|
+
radius: number;
|
|
15
|
+
angle: number;
|
|
16
|
+
};
|
|
17
|
+
declare const _sysTag: unique symbol;
|
|
18
|
+
type InSystem_<T, S extends string> = T & {
|
|
19
|
+
readonly [_sysTag]: S;
|
|
20
|
+
};
|
|
21
|
+
/** Spherical coordinates. */
|
|
22
|
+
export type SphericalCoords = {
|
|
23
|
+
radius: number;
|
|
24
|
+
azimuth: number;
|
|
25
|
+
inclination: number;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Spherical coordinates with Y-up (default in graphics): azimuth in XZ plane,
|
|
29
|
+
* inclination from +y axis
|
|
30
|
+
*/
|
|
31
|
+
export type SphericalCoordsY = InSystem_<SphericalCoords, "y">;
|
|
32
|
+
/**
|
|
33
|
+
* Spherical coordinates with Z-up (physics / ISO 80000-2): azimuth in XY plane,
|
|
34
|
+
* inclination from +z axis
|
|
35
|
+
*/
|
|
36
|
+
export type SphericalCoordsZ = InSystem_<SphericalCoords, "z">;
|
|
37
|
+
/** Cylindrical coordinates. */
|
|
38
|
+
export type CylindricalCoords = {
|
|
39
|
+
radius: number;
|
|
40
|
+
azimuth: number;
|
|
41
|
+
height: number;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Cylindrical coordinates with Y-up (default in graphics): azimuth in XZ plane,
|
|
45
|
+
* height along Y
|
|
46
|
+
*/
|
|
47
|
+
export type CylindricalCoordsY = InSystem_<CylindricalCoords, "y">;
|
|
48
|
+
/**
|
|
49
|
+
* Cylindrical coordinates with Z-up (physics): azimuth in XY plane, height
|
|
50
|
+
* along Z
|
|
51
|
+
*/
|
|
52
|
+
export type CylindricalCoordsZ = InSystem_<CylindricalCoords, "z">;
|
|
53
|
+
export {};
|
|
54
|
+
//# sourceMappingURL=coordinates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinates.d.ts","sourceRoot":"","sources":["../src/coordinates.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,MAAM,MAAM,oBAAoB,GAAG;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,mCAAmC;AACnC,MAAM,MAAM,oBAAoB,GAAG;IAClC,MAAM,EAAE,oBAAoB,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,yBAAyB;AACzB,MAAM,MAAM,WAAW,GAAG;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,OAAO,CAAC,MAAM,OAAO,EAAE,OAAO,MAAM,CAAC;AACrC,KAAK,SAAS,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,IAAI,CAAC,GAAG;IAAE,QAAQ,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;CAAE,CAAC;AAEpE,6BAA6B;AAC7B,MAAM,MAAM,eAAe,GAAG;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,SAAS,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;AAE/D;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,SAAS,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;AAE/D,+BAA+B;AAC/B,MAAM,MAAM,iBAAiB,GAAG;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,SAAS,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC;AAEnE;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,SAAS,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinates.js","sourceRoot":"","sources":["../src/coordinates.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Mat4x4, Quaternion } from "@ac-kit/math-linear";
|
|
2
|
+
import { EulerAngles, EulerOrder } from "./euler-angles.js";
|
|
3
|
+
export declare function eulerAnglesToQuaternion(eulerAngles: EulerAngles): Quaternion;
|
|
4
|
+
export declare function quaternionToEulerAngles(q: Quaternion, order?: EulerOrder): EulerAngles;
|
|
5
|
+
export declare function eulerAnglesToMat4x4(eulerAngles: EulerAngles): Mat4x4;
|
|
6
|
+
export declare function mat4x4ToEulerAngles(m: Mat4x4, order?: EulerOrder): EulerAngles;
|
|
7
|
+
//# sourceMappingURL=euler-angles-quaternion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"euler-angles-quaternion.d.ts","sourceRoot":"","sources":["../src/euler-angles-quaternion.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,MAAM,EACN,UAAU,EAGV,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE5D,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,WAAW,GAAG,UAAU,CAoD5E;AAED,wBAAgB,uBAAuB,CACtC,CAAC,EAAE,UAAU,EACb,KAAK,GAAE,UAAkB,GACvB,WAAW,CA8Eb;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAGpE;AAED,wBAAgB,mBAAmB,CAClC,CAAC,EAAE,MAAM,EACT,KAAK,GAAE,UAAkB,GACvB,WAAW,CAGb"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { quaternionFromRotationMatrix, quaternionToRotationMatrix, } from "@ac-kit/math-linear";
|
|
2
|
+
import { diffOfProducts, sumOfProducts } from "@ac-kit/math-scalar";
|
|
3
|
+
export function eulerAnglesToQuaternion(eulerAngles) {
|
|
4
|
+
const c1 = Math.cos(eulerAngles.x / 2);
|
|
5
|
+
const c2 = Math.cos(eulerAngles.y / 2);
|
|
6
|
+
const c3 = Math.cos(eulerAngles.z / 2);
|
|
7
|
+
const s1 = Math.sin(eulerAngles.x / 2);
|
|
8
|
+
const s2 = Math.sin(eulerAngles.y / 2);
|
|
9
|
+
const s3 = Math.sin(eulerAngles.z / 2);
|
|
10
|
+
switch (eulerAngles.order) {
|
|
11
|
+
case "XYZ":
|
|
12
|
+
return [
|
|
13
|
+
sumOfProducts(s1 * c2, c3, c1 * s2, s3),
|
|
14
|
+
diffOfProducts(c1 * s2, c3, s1 * c2, s3),
|
|
15
|
+
sumOfProducts(c1 * c2, s3, s1 * s2, c3),
|
|
16
|
+
diffOfProducts(c1 * c2, c3, s1 * s2, s3),
|
|
17
|
+
];
|
|
18
|
+
case "YXZ":
|
|
19
|
+
return [
|
|
20
|
+
sumOfProducts(s1 * c2, c3, c1 * s2, s3),
|
|
21
|
+
diffOfProducts(c1 * s2, c3, s1 * c2, s3),
|
|
22
|
+
diffOfProducts(c1 * c2, s3, s1 * s2, c3),
|
|
23
|
+
sumOfProducts(c1 * c2, c3, s1 * s2, s3),
|
|
24
|
+
];
|
|
25
|
+
case "ZXY":
|
|
26
|
+
return [
|
|
27
|
+
diffOfProducts(s1 * c2, c3, c1 * s2, s3),
|
|
28
|
+
sumOfProducts(c1 * s2, c3, s1 * c2, s3),
|
|
29
|
+
sumOfProducts(c1 * c2, s3, s1 * s2, c3),
|
|
30
|
+
diffOfProducts(c1 * c2, c3, s1 * s2, s3),
|
|
31
|
+
];
|
|
32
|
+
case "ZYX":
|
|
33
|
+
return [
|
|
34
|
+
diffOfProducts(s1 * c2, c3, c1 * s2, s3),
|
|
35
|
+
sumOfProducts(c1 * s2, c3, s1 * c2, s3),
|
|
36
|
+
diffOfProducts(c1 * c2, s3, s1 * s2, c3),
|
|
37
|
+
sumOfProducts(c1 * c2, c3, s1 * s2, s3),
|
|
38
|
+
];
|
|
39
|
+
case "YZX":
|
|
40
|
+
return [
|
|
41
|
+
sumOfProducts(s1 * c2, c3, c1 * s2, s3),
|
|
42
|
+
sumOfProducts(c1 * s2, c3, s1 * c2, s3),
|
|
43
|
+
diffOfProducts(c1 * c2, s3, s1 * s2, c3),
|
|
44
|
+
diffOfProducts(c1 * c2, c3, s1 * s2, s3),
|
|
45
|
+
];
|
|
46
|
+
case "XZY":
|
|
47
|
+
return [
|
|
48
|
+
diffOfProducts(s1 * c2, c3, c1 * s2, s3),
|
|
49
|
+
diffOfProducts(c1 * s2, c3, s1 * c2, s3),
|
|
50
|
+
sumOfProducts(c1 * c2, s3, s1 * s2, c3),
|
|
51
|
+
sumOfProducts(c1 * c2, c3, s1 * s2, s3),
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export function quaternionToEulerAngles(q, order = "XYZ") {
|
|
56
|
+
const x = q[0], y = q[1], z = q[2], w = q[3];
|
|
57
|
+
let eulerX, eulerY, eulerZ;
|
|
58
|
+
switch (order) {
|
|
59
|
+
case "XYZ":
|
|
60
|
+
eulerX = Math.atan2(2 * sumOfProducts(w, x, y, z), 1 - 2 * (x * x + y * y));
|
|
61
|
+
eulerY = Math.asin(2 * diffOfProducts(w, y, z, x));
|
|
62
|
+
eulerZ = Math.atan2(2 * sumOfProducts(w, z, x, y), 1 - 2 * (y * y + z * z));
|
|
63
|
+
break;
|
|
64
|
+
case "YXZ":
|
|
65
|
+
eulerX = Math.asin(2 * diffOfProducts(w, x, y, z));
|
|
66
|
+
eulerY = Math.atan2(2 * sumOfProducts(w, y, z, x), 1 - 2 * (x * x + y * y));
|
|
67
|
+
eulerZ = Math.atan2(2 * sumOfProducts(w, z, x, y), 1 - 2 * (y * y + z * z));
|
|
68
|
+
break;
|
|
69
|
+
case "ZXY":
|
|
70
|
+
eulerX = Math.asin(2 * sumOfProducts(w, x, y, z));
|
|
71
|
+
eulerY = Math.atan2(2 * diffOfProducts(w, y, z, x), 1 - 2 * (x * x + y * y));
|
|
72
|
+
eulerZ = Math.atan2(2 * diffOfProducts(w, z, x, y), 1 - 2 * (y * y + z * z));
|
|
73
|
+
break;
|
|
74
|
+
case "ZYX":
|
|
75
|
+
eulerX = Math.atan2(2 * diffOfProducts(w, x, y, z), 1 - 2 * (x * x + z * z));
|
|
76
|
+
eulerY = Math.asin(2 * sumOfProducts(w, y, x, z));
|
|
77
|
+
eulerZ = Math.atan2(2 * diffOfProducts(w, z, x, y), 1 - 2 * (y * y + z * z));
|
|
78
|
+
break;
|
|
79
|
+
case "YZX":
|
|
80
|
+
eulerX = Math.atan2(2 * sumOfProducts(w, x, z, y), 1 - 2 * (x * x + z * z));
|
|
81
|
+
eulerY = Math.atan2(2 * diffOfProducts(w, y, x, z), 1 - 2 * (y * y + z * z));
|
|
82
|
+
eulerZ = Math.asin(2 * sumOfProducts(w, z, x, y));
|
|
83
|
+
break;
|
|
84
|
+
case "XZY":
|
|
85
|
+
eulerX = Math.atan2(2 * diffOfProducts(w, x, z, y), 1 - 2 * (x * x + y * y));
|
|
86
|
+
eulerY = Math.atan2(2 * sumOfProducts(w, y, x, z), 1 - 2 * (y * y + z * z));
|
|
87
|
+
eulerZ = Math.asin(2 * diffOfProducts(w, z, x, y));
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
return { x: eulerX, y: eulerY, z: eulerZ, order };
|
|
91
|
+
}
|
|
92
|
+
export function eulerAnglesToMat4x4(eulerAngles) {
|
|
93
|
+
const q = eulerAnglesToQuaternion(eulerAngles);
|
|
94
|
+
return quaternionToRotationMatrix(q);
|
|
95
|
+
}
|
|
96
|
+
export function mat4x4ToEulerAngles(m, order = "XYZ") {
|
|
97
|
+
const q = quaternionFromRotationMatrix(m);
|
|
98
|
+
return quaternionToEulerAngles(q, order);
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=euler-angles-quaternion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"euler-angles-quaternion.js","sourceRoot":"","sources":["../src/euler-angles-quaternion.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,4BAA4B,EAC5B,0BAA0B,GAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIpE,MAAM,UAAU,uBAAuB,CAAC,WAAwB;IAC/D,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACvC,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACvC,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACvC,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACvC,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACvC,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC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ACvB,CAAC;YACF,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YACnD,MAAM;IACR,CAAC;IAED,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,WAAwB;IAC3D,MAAM,CAAC,GAAG,uBAAuB,CAAC,WAAW,CAAC,CAAC;IAC/C,OAAO,0BAA0B,CAAC,CAAC,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,mBAAmB,CAClC,CAAS,EACT,KAAK,GAAe,KAAK;IAEzB,MAAM,CAAC,GAAG,4BAA4B,CAAC,CAAC,CAAC,CAAC;IAC1C,OAAO,uBAAuB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export type EulerOrder = "XYZ" | "YXZ" | "ZXY" | "ZYX" | "YZX" | "XZY";
|
|
2
|
+
/**
|
|
3
|
+
* Euler angles represent a rotation in 3D space using three angles (x, y, z)
|
|
4
|
+
* and a specific order of rotations.
|
|
5
|
+
*
|
|
6
|
+
* Note: Euler angles suffer from gimbal lock, which can lead to a loss of one
|
|
7
|
+
* degree of freedom in 3D space. For many applications, quaternions are
|
|
8
|
+
* preferred for representing rotations.
|
|
9
|
+
*/
|
|
10
|
+
export type EulerAngles = {
|
|
11
|
+
order: EulerOrder;
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
z: number;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Exact equality of the three angles and the rotation order.
|
|
18
|
+
*
|
|
19
|
+
* Compares the angles as given: two sets a full turn apart are not equal, and
|
|
20
|
+
* neither are two orders that happen to describe the same rotation. Normalise
|
|
21
|
+
* with {@link eulerAnglesNormalize} first if that is not what you want.
|
|
22
|
+
*/
|
|
23
|
+
export declare function eulerAnglesEqual(a: EulerAngles, b: EulerAngles): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Whether the three angles are within `tolerance` radians of each other and the
|
|
26
|
+
* rotation orders match.
|
|
27
|
+
*
|
|
28
|
+
* Not transitive, so never a basis for ordering or for a set or map key — use
|
|
29
|
+
* {@link eulerAnglesEqual} there.
|
|
30
|
+
*/
|
|
31
|
+
export declare function eulerAnglesIsClose(a: EulerAngles, b: EulerAngles, tolerance?: number): boolean;
|
|
32
|
+
export declare function eulerAnglesNormalize(a: EulerAngles): EulerAngles;
|
|
33
|
+
//# sourceMappingURL=euler-angles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"euler-angles.d.ts","sourceRoot":"","sources":["../src/euler-angles.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAEvE;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG;IACzB,KAAK,EAAE,UAAU,CAAC;IAElB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACV,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,WAAW,GAAG,OAAO,CAExE;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CACjC,CAAC,EAAE,WAAW,EACd,CAAC,EAAE,WAAW,EACd,SAAS,GAAE,MAA+C,GACxD,OAAO,CAOT;AAED,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,WAAW,GAAG,WAAW,CAOhE"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { isCloseAbsolute } from "@ac-kit/core";
|
|
2
|
+
import { angleNormalizeRad } from "./angles.js";
|
|
3
|
+
import { geometryConfig } from "./globals.js";
|
|
4
|
+
/**
|
|
5
|
+
* Exact equality of the three angles and the rotation order.
|
|
6
|
+
*
|
|
7
|
+
* Compares the angles as given: two sets a full turn apart are not equal, and
|
|
8
|
+
* neither are two orders that happen to describe the same rotation. Normalise
|
|
9
|
+
* with {@link eulerAnglesNormalize} first if that is not what you want.
|
|
10
|
+
*/
|
|
11
|
+
export function eulerAnglesEqual(a, b) {
|
|
12
|
+
return a.x === b.x && a.y === b.y && a.z === b.z && a.order === b.order;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Whether the three angles are within `tolerance` radians of each other and the
|
|
16
|
+
* rotation orders match.
|
|
17
|
+
*
|
|
18
|
+
* Not transitive, so never a basis for ordering or for a set or map key — use
|
|
19
|
+
* {@link eulerAnglesEqual} there.
|
|
20
|
+
*/
|
|
21
|
+
export function eulerAnglesIsClose(a, b, tolerance = geometryConfig.defaultAngularTolerance) {
|
|
22
|
+
return (isCloseAbsolute(a.x, b.x, tolerance) &&
|
|
23
|
+
isCloseAbsolute(a.y, b.y, tolerance) &&
|
|
24
|
+
isCloseAbsolute(a.z, b.z, tolerance) &&
|
|
25
|
+
a.order === b.order);
|
|
26
|
+
}
|
|
27
|
+
export function eulerAnglesNormalize(a) {
|
|
28
|
+
return {
|
|
29
|
+
x: angleNormalizeRad(a.x),
|
|
30
|
+
y: angleNormalizeRad(a.y),
|
|
31
|
+
z: angleNormalizeRad(a.z),
|
|
32
|
+
order: a.order,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=euler-angles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"euler-angles.js","sourceRoot":"","sources":["../src/euler-angles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAoB9C;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,CAAc,EAAE,CAAc;IAC9D,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK,CAAC;AACzE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CACjC,CAAc,EACd,CAAc,EACd,SAAS,GAAW,cAAc,CAAC,uBAAuB;IAE1D,OAAO,CACN,eAAe,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC;QACpC,eAAe,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC;QACpC,eAAe,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC;QACpC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK,CACnB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,CAAc;IAClD,OAAO;QACN,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;QACzB,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;QACzB,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;QACzB,KAAK,EAAE,CAAC,CAAC,KAAK;KACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Vec2, Vec3, Vec4 } from "@ac-kit/math-linear";
|
|
2
|
+
import { Point2 } from "./point2.js";
|
|
3
|
+
import { Point3 } from "./point3.js";
|
|
4
|
+
import { Point4 } from "./point4.js";
|
|
5
|
+
export declare function point2ToVec2(p: Point2): Vec2;
|
|
6
|
+
export declare function vec2ToPoint2(v: Vec2): Point2;
|
|
7
|
+
export declare function point3ToVec3(p: Point3): Vec3;
|
|
8
|
+
export declare function vec3ToPoint3(v: Vec3): Point3;
|
|
9
|
+
export declare function vec4ToPoint4(v: Vec4): Point4;
|
|
10
|
+
export declare function point4ToVec4(p: Point4): Vec4;
|
|
11
|
+
//# sourceMappingURL=geometry-vectors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometry-vectors.d.ts","sourceRoot":"","sources":["../src/geometry-vectors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAE5C;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,IAAI,GAAG,MAAM,CAE5C;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAE5C;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,IAAI,GAAG,MAAM,CAE5C;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,IAAI,GAAG,MAAM,CAE5C;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAE5C"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function point2ToVec2(p) {
|
|
2
|
+
return [p.x, p.y];
|
|
3
|
+
}
|
|
4
|
+
export function vec2ToPoint2(v) {
|
|
5
|
+
return { x: v[0], y: v[1] };
|
|
6
|
+
}
|
|
7
|
+
export function point3ToVec3(p) {
|
|
8
|
+
return [p.x, p.y, p.z];
|
|
9
|
+
}
|
|
10
|
+
export function vec3ToPoint3(v) {
|
|
11
|
+
return { x: v[0], y: v[1], z: v[2] };
|
|
12
|
+
}
|
|
13
|
+
export function vec4ToPoint4(v) {
|
|
14
|
+
return { x: v[0], y: v[1], z: v[2], w: v[3] };
|
|
15
|
+
}
|
|
16
|
+
export function point4ToVec4(p) {
|
|
17
|
+
return [p.x, p.y, p.z, p.w];
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=geometry-vectors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometry-vectors.js","sourceRoot":"","sources":["../src/geometry-vectors.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,YAAY,CAAC,CAAS;IACrC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,CAAO;IACnC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,CAAS;IACrC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,CAAO;IACnC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,CAAO;IACnC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,CAAS;IACrC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Global tolerance defaults for the geometry module.
|
|
3
|
+
*
|
|
4
|
+
* Every predicate that needs a tolerance accepts one per call and falls back
|
|
5
|
+
* here only when none is given. Users may mutate these fields freely at
|
|
6
|
+
* runtime.
|
|
7
|
+
*
|
|
8
|
+
* The split between a linear and an angular tolerance follows the CAD kernels —
|
|
9
|
+
* OpenCASCADE's `Precision::Confusion()` and `Precision::Angular()`, ACIS's
|
|
10
|
+
* `SPAresabs` and `SPAresnor` — because the two quantities are not
|
|
11
|
+
* interchangeable: one is a length in the caller's units, the other is
|
|
12
|
+
* dimensionless.
|
|
13
|
+
*
|
|
14
|
+
* ```ts
|
|
15
|
+
* import { geometryConfig } from "@ac-kit/math-geometry";
|
|
16
|
+
*
|
|
17
|
+
* // Working in millimetres rather than metres
|
|
18
|
+
* geometryConfig.defaultLinearTolerance = 1e-6;
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* These are process-global and mutable: two libraries sharing one process
|
|
22
|
+
* cannot disagree, and a change applies to every later call. Pass a tolerance
|
|
23
|
+
* explicitly wherever that matters.
|
|
24
|
+
*/
|
|
25
|
+
export declare const geometryConfig: {
|
|
26
|
+
/**
|
|
27
|
+
* Largest distance, in the caller's own units, at which two positions still
|
|
28
|
+
* count as coincident — the bound for incidence predicates such as
|
|
29
|
+
* `plane3ContainsPoint` and `line2ContainsPoint`, where an exact test is
|
|
30
|
+
* useless because a constructed point never lands exactly on a plane.
|
|
31
|
+
*
|
|
32
|
+
* Default: `1e-9`.
|
|
33
|
+
*/
|
|
34
|
+
defaultLinearTolerance: number;
|
|
35
|
+
/**
|
|
36
|
+
* Largest dimensionless residual at which a direction still counts as
|
|
37
|
+
* degenerate — the bound for the parallel and near-zero guards that protect a
|
|
38
|
+
* division or a normalisation, such as `line2Intersect`'s denominator.
|
|
39
|
+
*
|
|
40
|
+
* Dimensionless, so it is compared against a quantity already scaled by the
|
|
41
|
+
* operands' magnitudes rather than against a raw length.
|
|
42
|
+
*
|
|
43
|
+
* Default: `1e-10`.
|
|
44
|
+
*/
|
|
45
|
+
defaultAngularTolerance: number;
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=globals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"globals.d.ts","sourceRoot":"","sources":["../src/globals.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,cAAc,EAAE;IAC5B;;;;;;;OAOG;IACH,sBAAsB,EAAE,MAAM,CAAC;IAC/B;;;;;;;;;OASG;IACH,uBAAuB,EAAE,MAAM,CAAC;CAIhC,CAAC"}
|
package/dist/globals.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Global tolerance defaults for the geometry module.
|
|
3
|
+
*
|
|
4
|
+
* Every predicate that needs a tolerance accepts one per call and falls back
|
|
5
|
+
* here only when none is given. Users may mutate these fields freely at
|
|
6
|
+
* runtime.
|
|
7
|
+
*
|
|
8
|
+
* The split between a linear and an angular tolerance follows the CAD kernels —
|
|
9
|
+
* OpenCASCADE's `Precision::Confusion()` and `Precision::Angular()`, ACIS's
|
|
10
|
+
* `SPAresabs` and `SPAresnor` — because the two quantities are not
|
|
11
|
+
* interchangeable: one is a length in the caller's units, the other is
|
|
12
|
+
* dimensionless.
|
|
13
|
+
*
|
|
14
|
+
* ```ts
|
|
15
|
+
* import { geometryConfig } from "@ac-kit/math-geometry";
|
|
16
|
+
*
|
|
17
|
+
* // Working in millimetres rather than metres
|
|
18
|
+
* geometryConfig.defaultLinearTolerance = 1e-6;
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* These are process-global and mutable: two libraries sharing one process
|
|
22
|
+
* cannot disagree, and a change applies to every later call. Pass a tolerance
|
|
23
|
+
* explicitly wherever that matters.
|
|
24
|
+
*/
|
|
25
|
+
export const geometryConfig = {
|
|
26
|
+
defaultLinearTolerance: 1e-9,
|
|
27
|
+
defaultAngularTolerance: 1e-10,
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=globals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"globals.js","sourceRoot":"","sources":["../src/globals.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,MAAM,cAAc,GAqBvB;IACH,sBAAsB,EAAE,IAAI;IAC5B,uBAAuB,EAAE,KAAK;CAC9B,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export * from "./angles.js";
|
|
2
|
+
export * from "./box3.js";
|
|
3
|
+
export * from "./box4.js";
|
|
4
|
+
export * from "./circle2.js";
|
|
5
|
+
export * from "./coordinate-spaces.js";
|
|
6
|
+
export * from "./coordinates-vec2.js";
|
|
7
|
+
export * from "./coordinates-vec3.js";
|
|
8
|
+
export * from "./coordinates.js";
|
|
9
|
+
export * from "./euler-angles-quaternion.js";
|
|
10
|
+
export * from "./euler-angles.js";
|
|
11
|
+
export * from "./geometry-vectors.js";
|
|
12
|
+
export * from "./globals.js";
|
|
13
|
+
export * from "./line2.js";
|
|
14
|
+
export * from "./line3.js";
|
|
15
|
+
export * from "./mesh3.js";
|
|
16
|
+
export * from "./plane3.js";
|
|
17
|
+
export * from "./point2.js";
|
|
18
|
+
export * from "./point3.js";
|
|
19
|
+
export * from "./point4.js";
|
|
20
|
+
export * from "./polygon2.js";
|
|
21
|
+
export * from "./polygon3.js";
|
|
22
|
+
export * from "./ray2.js";
|
|
23
|
+
export * from "./ray3.js";
|
|
24
|
+
export * from "./rect2.js";
|
|
25
|
+
export * from "./segment2.js";
|
|
26
|
+
export * from "./segment3.js";
|
|
27
|
+
export * from "./size2.js";
|
|
28
|
+
export * from "./size3.js";
|
|
29
|
+
export * from "./size4.js";
|
|
30
|
+
export * from "./sphere3.js";
|
|
31
|
+
export * from "./triangle2.js";
|
|
32
|
+
export * from "./triangle3.js";
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export * from "./angles.js";
|
|
2
|
+
export * from "./box3.js";
|
|
3
|
+
export * from "./box4.js";
|
|
4
|
+
export * from "./circle2.js";
|
|
5
|
+
export * from "./coordinate-spaces.js";
|
|
6
|
+
export * from "./coordinates-vec2.js";
|
|
7
|
+
export * from "./coordinates-vec3.js";
|
|
8
|
+
export * from "./coordinates.js";
|
|
9
|
+
export * from "./euler-angles-quaternion.js";
|
|
10
|
+
export * from "./euler-angles.js";
|
|
11
|
+
export * from "./geometry-vectors.js";
|
|
12
|
+
export * from "./globals.js";
|
|
13
|
+
export * from "./line2.js";
|
|
14
|
+
export * from "./line3.js";
|
|
15
|
+
export * from "./mesh3.js";
|
|
16
|
+
export * from "./plane3.js";
|
|
17
|
+
export * from "./point2.js";
|
|
18
|
+
export * from "./point3.js";
|
|
19
|
+
export * from "./point4.js";
|
|
20
|
+
export * from "./polygon2.js";
|
|
21
|
+
export * from "./polygon3.js";
|
|
22
|
+
export * from "./ray2.js";
|
|
23
|
+
export * from "./ray3.js";
|
|
24
|
+
export * from "./rect2.js";
|
|
25
|
+
export * from "./segment2.js";
|
|
26
|
+
export * from "./segment3.js";
|
|
27
|
+
export * from "./size2.js";
|
|
28
|
+
export * from "./size3.js";
|
|
29
|
+
export * from "./size4.js";
|
|
30
|
+
export * from "./sphere3.js";
|
|
31
|
+
export * from "./triangle2.js";
|
|
32
|
+
export * from "./triangle3.js";
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC"}
|