@dice-o-rolla/dice-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/LICENSE +202 -0
- package/NOTICE +4 -0
- package/README.md +15 -0
- package/THIRD_PARTY_NOTICES.md +18 -0
- package/dist/define-polyhedron.d.ts +2 -0
- package/dist/define-polyhedron.js +25 -0
- package/dist/define-reference-polyhedron.d.ts +11 -0
- package/dist/define-reference-polyhedron.js +38 -0
- package/dist/definitions/d10.d.ts +1 -0
- package/dist/definitions/d10.js +24 -0
- package/dist/definitions/d12.d.ts +1 -0
- package/dist/definitions/d12.js +38 -0
- package/dist/definitions/d20.d.ts +1 -0
- package/dist/definitions/d20.js +37 -0
- package/dist/definitions/d4.d.ts +1 -0
- package/dist/definitions/d4.js +12 -0
- package/dist/definitions/d6.d.ts +2 -0
- package/dist/definitions/d6.js +31 -0
- package/dist/definitions/d8.d.ts +1 -0
- package/dist/definitions/d8.js +18 -0
- package/dist/face-normal.d.ts +2 -0
- package/dist/face-normal.js +26 -0
- package/dist/geometry-registry.d.ts +5 -0
- package/dist/geometry-registry.js +22 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +10 -0
- package/dist/resolve-face.d.ts +3 -0
- package/dist/resolve-face.js +44 -0
- package/dist/types.d.ts +16 -0
- package/dist/types.js +0 -0
- package/dist/validation.d.ts +3 -0
- package/dist/validation.js +56 -0
- package/dist/vector-math.d.ts +6 -0
- package/dist/vector-math.js +23 -0
- package/package.json +39 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/NOTICE
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# `@dice-o-rolla/dice-geometry`
|
|
2
|
+
|
|
3
|
+
Immutable geometry definitions and settled-face resolution for standard polyhedral dice, d10
|
|
4
|
+
percentile dice, and d6-based d66 rolls.
|
|
5
|
+
|
|
6
|
+
Most browser applications should install `@dice-o-rolla/dice-engine` instead. This lower-level
|
|
7
|
+
package is intended for custom physics or rendering adapters.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { getDieGeometry } from '@dice-o-rolla/dice-geometry';
|
|
11
|
+
|
|
12
|
+
const d20 = getDieGeometry('d20');
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Licensed under Apache-2.0. See `LICENSE`, `NOTICE`, and `THIRD_PARTY_NOTICES.md` in the package.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
## 3DDiceRoller
|
|
4
|
+
|
|
5
|
+
The geometry model and physical dice behavior were informed by 3DDiceRoller by MajorVictory,
|
|
6
|
+
released under The Unlicense.
|
|
7
|
+
|
|
8
|
+
- Source: <https://github.com/MajorVictory/3DDiceRoller>
|
|
9
|
+
- License: <https://unlicense.org/>
|
|
10
|
+
|
|
11
|
+
## Runtime dependencies
|
|
12
|
+
|
|
13
|
+
- Three.js is distributed under the MIT License: <https://github.com/mrdoob/three.js>.
|
|
14
|
+
- Rapier is distributed under the Apache License 2.0:
|
|
15
|
+
<https://github.com/dimforge/rapier.js>.
|
|
16
|
+
|
|
17
|
+
The UNLICENSED anvil-dice-engine project was used only for architectural comparison. No source code,
|
|
18
|
+
assets, sounds, shaders, or textures from that project are included in this distribution.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { assertValidPolyhedronDefinition } from './validation.js';
|
|
2
|
+
function freezeVector(vector) {
|
|
3
|
+
return Object.freeze([vector[0], vector[1], vector[2]]);
|
|
4
|
+
}
|
|
5
|
+
function freezePolygon(face) {
|
|
6
|
+
return Object.freeze({
|
|
7
|
+
indices: Object.freeze(Array.from(face.indices)),
|
|
8
|
+
value: face.value,
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
function freezeFaceDefinition(face) {
|
|
12
|
+
return Object.freeze({
|
|
13
|
+
value: face.value,
|
|
14
|
+
normal: freezeVector(face.normal),
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
export function definePolyhedron(definition) {
|
|
18
|
+
assertValidPolyhedronDefinition(definition);
|
|
19
|
+
return Object.freeze({
|
|
20
|
+
id: definition.id,
|
|
21
|
+
vertices: Object.freeze(definition.vertices.map(freezeVector)),
|
|
22
|
+
faces: Object.freeze(definition.faces.map(freezePolygon)),
|
|
23
|
+
faceDefinitions: Object.freeze(definition.faceDefinitions.map(freezeFaceDefinition)),
|
|
24
|
+
});
|
|
25
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DieType } from '@dice-o-rolla/dice-core';
|
|
2
|
+
import type { PolyhedronDefinition, Vector3Tuple } from './types.js';
|
|
3
|
+
interface ReferenceFace {
|
|
4
|
+
readonly indices: readonly number[];
|
|
5
|
+
readonly value: number;
|
|
6
|
+
}
|
|
7
|
+
interface ReferencePolyhedronOptions {
|
|
8
|
+
readonly invertResultNormals?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function defineReferencePolyhedron(id: DieType, sourceVertices: readonly Vector3Tuple[], referenceFaces: readonly ReferenceFace[], options?: ReferencePolyhedronOptions): PolyhedronDefinition;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { definePolyhedron } from './define-polyhedron.js';
|
|
2
|
+
import { calculateFaceNormal } from './face-normal.js';
|
|
3
|
+
import { dot, normalize } from './vector-math.js';
|
|
4
|
+
function convertVertex([sourceX, sourceY, sourceZ]) {
|
|
5
|
+
return normalize([sourceX, sourceZ, -sourceY]);
|
|
6
|
+
}
|
|
7
|
+
function outwardNormal(definition, face) {
|
|
8
|
+
const calculated = calculateFaceNormal(definition, face);
|
|
9
|
+
const centroid = face.indices.reduce((sum, index) => {
|
|
10
|
+
const vertex = definition.vertices[index];
|
|
11
|
+
if (vertex === undefined)
|
|
12
|
+
throw new RangeError(`Face references missing vertex ${index}`);
|
|
13
|
+
return [sum[0] + vertex[0], sum[1] + vertex[1], sum[2] + vertex[2]];
|
|
14
|
+
}, [0, 0, 0]);
|
|
15
|
+
return dot(calculated, centroid) < 0
|
|
16
|
+
? [-calculated[0], -calculated[1], -calculated[2]]
|
|
17
|
+
: calculated;
|
|
18
|
+
}
|
|
19
|
+
export function defineReferencePolyhedron(id, sourceVertices, referenceFaces, options = {}) {
|
|
20
|
+
const vertices = sourceVertices.map(convertVertex);
|
|
21
|
+
const faces = referenceFaces.map(({ indices, value }) => ({ indices, value }));
|
|
22
|
+
const shell = {
|
|
23
|
+
id,
|
|
24
|
+
vertices,
|
|
25
|
+
faces,
|
|
26
|
+
faceDefinitions: [],
|
|
27
|
+
};
|
|
28
|
+
const faceDefinitions = faces.map((face) => {
|
|
29
|
+
const normal = outwardNormal(shell, face);
|
|
30
|
+
return {
|
|
31
|
+
value: face.value,
|
|
32
|
+
normal: options.invertResultNormals
|
|
33
|
+
? [-normal[0], -normal[1], -normal[2]]
|
|
34
|
+
: normal,
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
return definePolyhedron({ id, vertices, faces, faceDefinitions });
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const D10_DEFINITION: import("../types.js").PolyhedronDefinition;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { defineReferencePolyhedron } from '../define-reference-polyhedron.js';
|
|
2
|
+
const ring = [];
|
|
3
|
+
const angle = (Math.PI * 2) / 10;
|
|
4
|
+
// Corrects the reference's rounded 0.105 so normalized kite faces remain planar.
|
|
5
|
+
const halfHeight = 0.10616611026445441;
|
|
6
|
+
for (let index = 0; index < 10; index += 1) {
|
|
7
|
+
ring.push([
|
|
8
|
+
Math.cos(index * angle),
|
|
9
|
+
Math.sin(index * angle),
|
|
10
|
+
halfHeight * (index % 2 === 0 ? -1 : 1),
|
|
11
|
+
]);
|
|
12
|
+
}
|
|
13
|
+
export const D10_DEFINITION = defineReferencePolyhedron('d10', [...ring, [0, 0, -1], [0, 0, 1]], [
|
|
14
|
+
{ indices: [5, 6, 7, 11], value: 1 },
|
|
15
|
+
{ indices: [4, 3, 2, 10], value: 2 },
|
|
16
|
+
{ indices: [1, 2, 3, 11], value: 3 },
|
|
17
|
+
{ indices: [0, 9, 8, 10], value: 4 },
|
|
18
|
+
{ indices: [7, 8, 9, 11], value: 5 },
|
|
19
|
+
{ indices: [8, 7, 6, 10], value: 6 },
|
|
20
|
+
{ indices: [9, 0, 1, 11], value: 7 },
|
|
21
|
+
{ indices: [2, 1, 0, 10], value: 8 },
|
|
22
|
+
{ indices: [3, 4, 5, 11], value: 9 },
|
|
23
|
+
{ indices: [6, 5, 4, 10], value: 10 },
|
|
24
|
+
]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const D12_DEFINITION: import("../types.js").PolyhedronDefinition;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { defineReferencePolyhedron } from '../define-reference-polyhedron.js';
|
|
2
|
+
const phi = (1 + Math.sqrt(5)) / 2;
|
|
3
|
+
const inversePhi = 1 / phi;
|
|
4
|
+
export const D12_DEFINITION = defineReferencePolyhedron('d12', [
|
|
5
|
+
[0, inversePhi, phi],
|
|
6
|
+
[0, inversePhi, -phi],
|
|
7
|
+
[0, -inversePhi, phi],
|
|
8
|
+
[0, -inversePhi, -phi],
|
|
9
|
+
[phi, 0, inversePhi],
|
|
10
|
+
[phi, 0, -inversePhi],
|
|
11
|
+
[-phi, 0, inversePhi],
|
|
12
|
+
[-phi, 0, -inversePhi],
|
|
13
|
+
[inversePhi, phi, 0],
|
|
14
|
+
[inversePhi, -phi, 0],
|
|
15
|
+
[-inversePhi, phi, 0],
|
|
16
|
+
[-inversePhi, -phi, 0],
|
|
17
|
+
[1, 1, 1],
|
|
18
|
+
[1, 1, -1],
|
|
19
|
+
[1, -1, 1],
|
|
20
|
+
[1, -1, -1],
|
|
21
|
+
[-1, 1, 1],
|
|
22
|
+
[-1, 1, -1],
|
|
23
|
+
[-1, -1, 1],
|
|
24
|
+
[-1, -1, -1],
|
|
25
|
+
], [
|
|
26
|
+
{ indices: [2, 14, 4, 12, 0], value: 1 },
|
|
27
|
+
{ indices: [15, 9, 11, 19, 3], value: 2 },
|
|
28
|
+
{ indices: [16, 10, 17, 7, 6], value: 3 },
|
|
29
|
+
{ indices: [6, 7, 19, 11, 18], value: 4 },
|
|
30
|
+
{ indices: [6, 18, 2, 0, 16], value: 5 },
|
|
31
|
+
{ indices: [18, 11, 9, 14, 2], value: 6 },
|
|
32
|
+
{ indices: [1, 17, 10, 8, 13], value: 7 },
|
|
33
|
+
{ indices: [1, 13, 5, 15, 3], value: 8 },
|
|
34
|
+
{ indices: [13, 8, 12, 4, 5], value: 9 },
|
|
35
|
+
{ indices: [5, 4, 14, 9, 15], value: 10 },
|
|
36
|
+
{ indices: [0, 12, 8, 10, 16], value: 11 },
|
|
37
|
+
{ indices: [3, 19, 7, 17, 1], value: 12 },
|
|
38
|
+
]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const D20_DEFINITION: import("../types.js").PolyhedronDefinition;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { defineReferencePolyhedron } from '../define-reference-polyhedron.js';
|
|
2
|
+
const phi = (1 + Math.sqrt(5)) / 2;
|
|
3
|
+
export const D20_DEFINITION = defineReferencePolyhedron('d20', [
|
|
4
|
+
[-1, phi, 0],
|
|
5
|
+
[1, phi, 0],
|
|
6
|
+
[-1, -phi, 0],
|
|
7
|
+
[1, -phi, 0],
|
|
8
|
+
[0, -1, phi],
|
|
9
|
+
[0, 1, phi],
|
|
10
|
+
[0, -1, -phi],
|
|
11
|
+
[0, 1, -phi],
|
|
12
|
+
[phi, 0, -1],
|
|
13
|
+
[phi, 0, 1],
|
|
14
|
+
[-phi, 0, -1],
|
|
15
|
+
[-phi, 0, 1],
|
|
16
|
+
], [
|
|
17
|
+
{ indices: [0, 11, 5], value: 1 },
|
|
18
|
+
{ indices: [0, 5, 1], value: 2 },
|
|
19
|
+
{ indices: [0, 1, 7], value: 3 },
|
|
20
|
+
{ indices: [0, 7, 10], value: 4 },
|
|
21
|
+
{ indices: [0, 10, 11], value: 5 },
|
|
22
|
+
{ indices: [1, 5, 9], value: 6 },
|
|
23
|
+
{ indices: [5, 11, 4], value: 7 },
|
|
24
|
+
{ indices: [11, 10, 2], value: 8 },
|
|
25
|
+
{ indices: [10, 7, 6], value: 9 },
|
|
26
|
+
{ indices: [7, 1, 8], value: 10 },
|
|
27
|
+
{ indices: [3, 9, 4], value: 11 },
|
|
28
|
+
{ indices: [3, 4, 2], value: 12 },
|
|
29
|
+
{ indices: [3, 2, 6], value: 13 },
|
|
30
|
+
{ indices: [3, 6, 8], value: 14 },
|
|
31
|
+
{ indices: [3, 8, 9], value: 15 },
|
|
32
|
+
{ indices: [4, 9, 5], value: 16 },
|
|
33
|
+
{ indices: [2, 4, 11], value: 17 },
|
|
34
|
+
{ indices: [6, 2, 10], value: 18 },
|
|
35
|
+
{ indices: [8, 6, 7], value: 19 },
|
|
36
|
+
{ indices: [9, 8, 1], value: 20 },
|
|
37
|
+
]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const D4_DEFINITION: import("../types.js").PolyhedronDefinition;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineReferencePolyhedron } from '../define-reference-polyhedron.js';
|
|
2
|
+
export const D4_DEFINITION = defineReferencePolyhedron('d4', [
|
|
3
|
+
[1, 1, 1],
|
|
4
|
+
[-1, -1, 1],
|
|
5
|
+
[-1, 1, -1],
|
|
6
|
+
[1, -1, -1],
|
|
7
|
+
], [
|
|
8
|
+
{ indices: [1, 0, 2], value: 1 },
|
|
9
|
+
{ indices: [0, 1, 3], value: 2 },
|
|
10
|
+
{ indices: [0, 3, 2], value: 3 },
|
|
11
|
+
{ indices: [1, 2, 3], value: 4 },
|
|
12
|
+
], { invertResultNormals: true });
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { definePolyhedron } from '../define-polyhedron.js';
|
|
2
|
+
const coordinate = 1 / Math.sqrt(3);
|
|
3
|
+
export const D6_DEFINITION = definePolyhedron({
|
|
4
|
+
id: 'd6',
|
|
5
|
+
vertices: Object.freeze([
|
|
6
|
+
[-coordinate, -coordinate, coordinate],
|
|
7
|
+
[coordinate, -coordinate, coordinate],
|
|
8
|
+
[coordinate, -coordinate, -coordinate],
|
|
9
|
+
[-coordinate, -coordinate, -coordinate],
|
|
10
|
+
[-coordinate, coordinate, coordinate],
|
|
11
|
+
[coordinate, coordinate, coordinate],
|
|
12
|
+
[coordinate, coordinate, -coordinate],
|
|
13
|
+
[-coordinate, coordinate, -coordinate],
|
|
14
|
+
]),
|
|
15
|
+
faces: Object.freeze([
|
|
16
|
+
{ indices: [0, 3, 2, 1], value: 1 },
|
|
17
|
+
{ indices: [1, 2, 6, 5], value: 2 },
|
|
18
|
+
{ indices: [0, 1, 5, 4], value: 3 },
|
|
19
|
+
{ indices: [3, 7, 6, 2], value: 4 },
|
|
20
|
+
{ indices: [0, 4, 7, 3], value: 5 },
|
|
21
|
+
{ indices: [4, 5, 6, 7], value: 6 },
|
|
22
|
+
]),
|
|
23
|
+
faceDefinitions: Object.freeze([
|
|
24
|
+
{ value: 1, normal: [0, -1, 0] },
|
|
25
|
+
{ value: 2, normal: [1, 0, 0] },
|
|
26
|
+
{ value: 3, normal: [0, 0, 1] },
|
|
27
|
+
{ value: 4, normal: [0, 0, -1] },
|
|
28
|
+
{ value: 5, normal: [-1, 0, 0] },
|
|
29
|
+
{ value: 6, normal: [0, 1, 0] },
|
|
30
|
+
]),
|
|
31
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const D8_DEFINITION: import("../types.js").PolyhedronDefinition;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineReferencePolyhedron } from '../define-reference-polyhedron.js';
|
|
2
|
+
export const D8_DEFINITION = defineReferencePolyhedron('d8', [
|
|
3
|
+
[1, 0, 0],
|
|
4
|
+
[-1, 0, 0],
|
|
5
|
+
[0, 1, 0],
|
|
6
|
+
[0, -1, 0],
|
|
7
|
+
[0, 0, 1],
|
|
8
|
+
[0, 0, -1],
|
|
9
|
+
], [
|
|
10
|
+
{ indices: [0, 2, 4], value: 1 },
|
|
11
|
+
{ indices: [0, 4, 3], value: 2 },
|
|
12
|
+
{ indices: [0, 3, 5], value: 3 },
|
|
13
|
+
{ indices: [0, 5, 2], value: 4 },
|
|
14
|
+
{ indices: [1, 3, 4], value: 5 },
|
|
15
|
+
{ indices: [1, 4, 2], value: 6 },
|
|
16
|
+
{ indices: [1, 2, 5], value: 7 },
|
|
17
|
+
{ indices: [1, 5, 3], value: 8 },
|
|
18
|
+
]);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { cross, length, normalize, subtract } from './vector-math.js';
|
|
2
|
+
export function calculateFaceNormal(definition, face) {
|
|
3
|
+
const firstIndex = face.indices[0];
|
|
4
|
+
if (firstIndex === undefined) {
|
|
5
|
+
throw new RangeError('A polygon must contain at least three vertex indices');
|
|
6
|
+
}
|
|
7
|
+
const origin = definition.vertices[firstIndex];
|
|
8
|
+
if (origin === undefined) {
|
|
9
|
+
throw new RangeError(`Face references missing vertex ${firstIndex}`);
|
|
10
|
+
}
|
|
11
|
+
for (let offset = 1; offset < face.indices.length - 1; offset += 1) {
|
|
12
|
+
const secondIndex = face.indices[offset];
|
|
13
|
+
const thirdIndex = face.indices[offset + 1];
|
|
14
|
+
if (secondIndex === undefined || thirdIndex === undefined)
|
|
15
|
+
continue;
|
|
16
|
+
const second = definition.vertices[secondIndex];
|
|
17
|
+
const third = definition.vertices[thirdIndex];
|
|
18
|
+
if (second === undefined || third === undefined) {
|
|
19
|
+
throw new RangeError('Face references a missing vertex');
|
|
20
|
+
}
|
|
21
|
+
const normal = cross(subtract(second, origin), subtract(third, origin));
|
|
22
|
+
if (length(normal) > Number.EPSILON)
|
|
23
|
+
return normalize(normal);
|
|
24
|
+
}
|
|
25
|
+
throw new RangeError('A polygon must contain three non-collinear vertices');
|
|
26
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { DieType } from '@dice-o-rolla/dice-core';
|
|
2
|
+
import type { PolyhedronDefinition } from './types.js';
|
|
3
|
+
export declare function hasDieGeometry(type: DieType): boolean;
|
|
4
|
+
export declare function getDieGeometry(type: DieType): PolyhedronDefinition;
|
|
5
|
+
export declare function getRegisteredDieTypes(): readonly DieType[];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { D4_DEFINITION } from './definitions/d4.js';
|
|
2
|
+
import { D6_DEFINITION } from './definitions/d6.js';
|
|
3
|
+
import { D8_DEFINITION } from './definitions/d8.js';
|
|
4
|
+
import { D10_DEFINITION } from './definitions/d10.js';
|
|
5
|
+
import { D12_DEFINITION } from './definitions/d12.js';
|
|
6
|
+
import { D20_DEFINITION } from './definitions/d20.js';
|
|
7
|
+
import { assertValidPolyhedronDefinition } from './validation.js';
|
|
8
|
+
const definitions = new Map([D4_DEFINITION, D6_DEFINITION, D8_DEFINITION, D10_DEFINITION, D12_DEFINITION, D20_DEFINITION].map((definition) => [definition.id, definition]));
|
|
9
|
+
for (const definition of definitions.values())
|
|
10
|
+
assertValidPolyhedronDefinition(definition);
|
|
11
|
+
export function hasDieGeometry(type) {
|
|
12
|
+
return definitions.has(type);
|
|
13
|
+
}
|
|
14
|
+
export function getDieGeometry(type) {
|
|
15
|
+
const definition = definitions.get(type);
|
|
16
|
+
if (definition === undefined)
|
|
17
|
+
throw new RangeError(`Geometry is not registered for ${type}`);
|
|
18
|
+
return definition;
|
|
19
|
+
}
|
|
20
|
+
export function getRegisteredDieTypes() {
|
|
21
|
+
return Object.freeze(Array.from(definitions.keys()));
|
|
22
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { D4_DEFINITION } from './definitions/d4.js';
|
|
2
|
+
export { D6_DEFINITION } from './definitions/d6.js';
|
|
3
|
+
export { D8_DEFINITION } from './definitions/d8.js';
|
|
4
|
+
export { D10_DEFINITION } from './definitions/d10.js';
|
|
5
|
+
export { D12_DEFINITION } from './definitions/d12.js';
|
|
6
|
+
export { D20_DEFINITION } from './definitions/d20.js';
|
|
7
|
+
export { calculateFaceNormal } from './face-normal.js';
|
|
8
|
+
export { getDieGeometry, getRegisteredDieTypes, hasDieGeometry } from './geometry-registry.js';
|
|
9
|
+
export { resolveFace } from './resolve-face.js';
|
|
10
|
+
export type { FaceDefinition, PolygonDefinition, PolyhedronDefinition, Vector3Tuple, } from './types.js';
|
|
11
|
+
export { assertValidPolyhedronDefinition, getPolyhedronDefinitionIssues } from './validation.js';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { D4_DEFINITION } from './definitions/d4.js';
|
|
2
|
+
export { D6_DEFINITION } from './definitions/d6.js';
|
|
3
|
+
export { D8_DEFINITION } from './definitions/d8.js';
|
|
4
|
+
export { D10_DEFINITION } from './definitions/d10.js';
|
|
5
|
+
export { D12_DEFINITION } from './definitions/d12.js';
|
|
6
|
+
export { D20_DEFINITION } from './definitions/d20.js';
|
|
7
|
+
export { calculateFaceNormal } from './face-normal.js';
|
|
8
|
+
export { getDieGeometry, getRegisteredDieTypes, hasDieGeometry } from './geometry-registry.js';
|
|
9
|
+
export { resolveFace } from './resolve-face.js';
|
|
10
|
+
export { assertValidPolyhedronDefinition, getPolyhedronDefinitionIssues } from './validation.js';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { dot } from './vector-math.js';
|
|
2
|
+
const WORLD_UP = [0, 1, 0];
|
|
3
|
+
function normalizeQuaternion(orientation) {
|
|
4
|
+
const magnitude = Math.hypot(orientation.x, orientation.y, orientation.z, orientation.w);
|
|
5
|
+
if (!Number.isFinite(magnitude) || magnitude <= Number.EPSILON) {
|
|
6
|
+
throw new RangeError('Die orientation must be a finite, non-zero quaternion');
|
|
7
|
+
}
|
|
8
|
+
return {
|
|
9
|
+
x: orientation.x / magnitude,
|
|
10
|
+
y: orientation.y / magnitude,
|
|
11
|
+
z: orientation.z / magnitude,
|
|
12
|
+
w: orientation.w / magnitude,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function rotateVector(vector, orientation) {
|
|
16
|
+
const { x, y, z, w } = orientation;
|
|
17
|
+
const twiceCrossX = 2 * (y * vector[2] - z * vector[1]);
|
|
18
|
+
const twiceCrossY = 2 * (z * vector[0] - x * vector[2]);
|
|
19
|
+
const twiceCrossZ = 2 * (x * vector[1] - y * vector[0]);
|
|
20
|
+
return [
|
|
21
|
+
vector[0] + w * twiceCrossX + (y * twiceCrossZ - z * twiceCrossY),
|
|
22
|
+
vector[1] + w * twiceCrossY + (z * twiceCrossX - x * twiceCrossZ),
|
|
23
|
+
vector[2] + w * twiceCrossZ + (x * twiceCrossY - y * twiceCrossX),
|
|
24
|
+
];
|
|
25
|
+
}
|
|
26
|
+
export function resolveFace(definition, orientation) {
|
|
27
|
+
const firstFace = definition.faceDefinitions[0];
|
|
28
|
+
if (firstFace === undefined)
|
|
29
|
+
throw new RangeError(`${definition.id} has no logical faces`);
|
|
30
|
+
const normalizedOrientation = normalizeQuaternion(orientation);
|
|
31
|
+
let bestValue = firstFace.value;
|
|
32
|
+
let bestAlignment = dot(rotateVector(firstFace.normal, normalizedOrientation), WORLD_UP);
|
|
33
|
+
for (let index = 1; index < definition.faceDefinitions.length; index += 1) {
|
|
34
|
+
const face = definition.faceDefinitions[index];
|
|
35
|
+
if (face === undefined)
|
|
36
|
+
continue;
|
|
37
|
+
const alignment = dot(rotateVector(face.normal, normalizedOrientation), WORLD_UP);
|
|
38
|
+
if (alignment > bestAlignment) {
|
|
39
|
+
bestAlignment = alignment;
|
|
40
|
+
bestValue = face.value;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return bestValue;
|
|
44
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { DieType } from '@dice-o-rolla/dice-core';
|
|
2
|
+
export type Vector3Tuple = readonly [x: number, y: number, z: number];
|
|
3
|
+
export interface PolygonDefinition {
|
|
4
|
+
readonly indices: readonly number[];
|
|
5
|
+
readonly value: number;
|
|
6
|
+
}
|
|
7
|
+
export interface FaceDefinition {
|
|
8
|
+
readonly value: number;
|
|
9
|
+
readonly normal: Vector3Tuple;
|
|
10
|
+
}
|
|
11
|
+
export interface PolyhedronDefinition {
|
|
12
|
+
readonly id: DieType;
|
|
13
|
+
readonly vertices: readonly Vector3Tuple[];
|
|
14
|
+
readonly faces: readonly PolygonDefinition[];
|
|
15
|
+
readonly faceDefinitions: readonly FaceDefinition[];
|
|
16
|
+
}
|
package/dist/types.js
ADDED
|
File without changes
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { length } from './vector-math.js';
|
|
2
|
+
const UNIT_TOLERANCE = 1e-9;
|
|
3
|
+
function isFiniteVector(vector) {
|
|
4
|
+
return vector.every((component) => Number.isFinite(component));
|
|
5
|
+
}
|
|
6
|
+
export function getPolyhedronDefinitionIssues(definition) {
|
|
7
|
+
const issues = [];
|
|
8
|
+
if (definition.vertices.length < 4)
|
|
9
|
+
issues.push('A polyhedron must have at least four vertices');
|
|
10
|
+
if (definition.faces.length < 4)
|
|
11
|
+
issues.push('A polyhedron must have at least four faces');
|
|
12
|
+
if (definition.faces.length !== definition.faceDefinitions.length) {
|
|
13
|
+
issues.push('Polygon faces and logical face definitions must have equal lengths');
|
|
14
|
+
}
|
|
15
|
+
definition.vertices.forEach((vertex, index) => {
|
|
16
|
+
if (!isFiniteVector(vertex))
|
|
17
|
+
issues.push(`Vertex ${index} contains a non-finite component`);
|
|
18
|
+
});
|
|
19
|
+
const values = new Set();
|
|
20
|
+
definition.faces.forEach((face, faceIndex) => {
|
|
21
|
+
if (face.indices.length < 3)
|
|
22
|
+
issues.push(`Face ${faceIndex} has fewer than three vertices`);
|
|
23
|
+
if (new Set(face.indices).size !== face.indices.length) {
|
|
24
|
+
issues.push(`Face ${faceIndex} repeats a vertex index`);
|
|
25
|
+
}
|
|
26
|
+
for (const index of face.indices) {
|
|
27
|
+
if (!Number.isInteger(index) || index < 0 || index >= definition.vertices.length) {
|
|
28
|
+
issues.push(`Face ${faceIndex} references invalid vertex ${index}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (!Number.isSafeInteger(face.value))
|
|
32
|
+
issues.push(`Face ${faceIndex} has an invalid value`);
|
|
33
|
+
if (values.has(face.value))
|
|
34
|
+
issues.push(`Face value ${face.value} is duplicated`);
|
|
35
|
+
values.add(face.value);
|
|
36
|
+
const logicalFace = definition.faceDefinitions[faceIndex];
|
|
37
|
+
if (logicalFace === undefined || logicalFace.value !== face.value) {
|
|
38
|
+
issues.push(`Face ${faceIndex} does not align with its logical face definition`);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
definition.faceDefinitions.forEach((face, faceIndex) => {
|
|
42
|
+
if (!isFiniteVector(face.normal)) {
|
|
43
|
+
issues.push(`Logical face ${faceIndex} contains a non-finite normal`);
|
|
44
|
+
}
|
|
45
|
+
else if (Math.abs(length(face.normal) - 1) > UNIT_TOLERANCE) {
|
|
46
|
+
issues.push(`Logical face ${faceIndex} normal is not normalized`);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
return issues;
|
|
50
|
+
}
|
|
51
|
+
export function assertValidPolyhedronDefinition(definition) {
|
|
52
|
+
const issues = getPolyhedronDefinitionIssues(definition);
|
|
53
|
+
if (issues.length > 0) {
|
|
54
|
+
throw new TypeError(`Invalid ${definition.id} definition:\n- ${issues.join('\n- ')}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Vector3Tuple } from './types.js';
|
|
2
|
+
export declare function cross(left: Vector3Tuple, right: Vector3Tuple): Vector3Tuple;
|
|
3
|
+
export declare function dot(left: Vector3Tuple, right: Vector3Tuple): number;
|
|
4
|
+
export declare function length(vector: Vector3Tuple): number;
|
|
5
|
+
export declare function normalize(vector: Vector3Tuple): Vector3Tuple;
|
|
6
|
+
export declare function subtract(left: Vector3Tuple, right: Vector3Tuple): Vector3Tuple;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export function cross(left, right) {
|
|
2
|
+
return [
|
|
3
|
+
left[1] * right[2] - left[2] * right[1],
|
|
4
|
+
left[2] * right[0] - left[0] * right[2],
|
|
5
|
+
left[0] * right[1] - left[1] * right[0],
|
|
6
|
+
];
|
|
7
|
+
}
|
|
8
|
+
export function dot(left, right) {
|
|
9
|
+
return left[0] * right[0] + left[1] * right[1] + left[2] * right[2];
|
|
10
|
+
}
|
|
11
|
+
export function length(vector) {
|
|
12
|
+
return Math.hypot(vector[0], vector[1], vector[2]);
|
|
13
|
+
}
|
|
14
|
+
export function normalize(vector) {
|
|
15
|
+
const magnitude = length(vector);
|
|
16
|
+
if (!Number.isFinite(magnitude) || magnitude <= Number.EPSILON) {
|
|
17
|
+
throw new RangeError('Cannot normalize a zero-length or non-finite vector');
|
|
18
|
+
}
|
|
19
|
+
return [vector[0] / magnitude, vector[1] / magnitude, vector[2] / magnitude];
|
|
20
|
+
}
|
|
21
|
+
export function subtract(left, right) {
|
|
22
|
+
return [left[0] - right[0], left[1] - right[1], left[2] - right[2]];
|
|
23
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dice-o-rolla/dice-geometry",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Immutable polyhedral dice geometry and settled-face resolution.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"dice",
|
|
7
|
+
"geometry",
|
|
8
|
+
"polyhedra",
|
|
9
|
+
"typescript"
|
|
10
|
+
],
|
|
11
|
+
"license": "Apache-2.0",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"README.md",
|
|
15
|
+
"LICENSE",
|
|
16
|
+
"NOTICE",
|
|
17
|
+
"THIRD_PARTY_NOTICES.md"
|
|
18
|
+
],
|
|
19
|
+
"type": "module",
|
|
20
|
+
"sideEffects": false,
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"import": "./dist/index.js",
|
|
26
|
+
"default": "./dist/index.js"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public",
|
|
31
|
+
"registry": "https://registry.npmjs.org/"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@dice-o-rolla/dice-core": "0.1.0"
|
|
35
|
+
},
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=20.0.0"
|
|
38
|
+
}
|
|
39
|
+
}
|