@glyphcss/core 0.0.1 → 0.0.2
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 +2 -2
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +988 -38
- package/dist/index.d.ts +988 -38
- package/dist/index.js +3 -3
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -13,7 +13,7 @@ type MeshResolution = "lossless" | "lossy";
|
|
|
13
13
|
* and the difference adds up. Destructure with `const [x, y, z] = v` when
|
|
14
14
|
* you need named axes.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
16
|
+
* Glyphcss world space convention: +X right, +Y forward, +Z up.
|
|
17
17
|
*/
|
|
18
18
|
type Vec3 = [number, number, number];
|
|
19
19
|
/**
|
|
@@ -35,7 +35,7 @@ interface TextureTriangle {
|
|
|
35
35
|
* scene-local coords and does not need to be pre-normalized.
|
|
36
36
|
* Mirrors three.js's `DirectionalLight`.
|
|
37
37
|
*/
|
|
38
|
-
interface
|
|
38
|
+
interface GlyphDirectionalLight {
|
|
39
39
|
/** Direction the light shines TOWARD (typical convention). */
|
|
40
40
|
direction: Vec3;
|
|
41
41
|
/** Light tint, hex string. White by default. */
|
|
@@ -49,7 +49,7 @@ interface GlyphcssDirectionalLight {
|
|
|
49
49
|
* directional contribution: the two add independently rather than
|
|
50
50
|
* splitting a fixed energy budget.
|
|
51
51
|
*/
|
|
52
|
-
interface
|
|
52
|
+
interface GlyphAmbientLight {
|
|
53
53
|
/** Tint, hex string. White by default. */
|
|
54
54
|
color?: string;
|
|
55
55
|
/** Scalar multiplier on the ambient contribution. Default 0.4. */
|
|
@@ -60,7 +60,7 @@ interface GlyphcssAmbientLight {
|
|
|
60
60
|
*
|
|
61
61
|
* In CSS terms, a material bundles the `background-image` source plus paint
|
|
62
62
|
* config. When a polygon references a material AND its UVs form an
|
|
63
|
-
* axis-aligned rectangle,
|
|
63
|
+
* axis-aligned rectangle, glyphcss renders the polygon as an <i> with
|
|
64
64
|
* `background-image: url(material.texture)` directly — no per-polygon canvas
|
|
65
65
|
* rasterization, browser-cached texture, mounting / unmounting one polygon
|
|
66
66
|
* does not affect any other.
|
|
@@ -72,13 +72,13 @@ interface GlyphcssAmbientLight {
|
|
|
72
72
|
interface PolyMaterial {
|
|
73
73
|
/** Image source. Anything `background-image: url(...)` can use. */
|
|
74
74
|
texture: string;
|
|
75
|
-
/** Optional unique key (used by
|
|
75
|
+
/** Optional unique key (used by glyphcss to dedupe / cache). Caller can
|
|
76
76
|
* pass a stable string; if omitted, the material's identity is its object
|
|
77
77
|
* reference. */
|
|
78
78
|
key?: string;
|
|
79
79
|
}
|
|
80
80
|
/**
|
|
81
|
-
* The single polygon type for
|
|
81
|
+
* The single polygon type for glyphcss. N coplanar vertices in 3D space,
|
|
82
82
|
* CCW winding from outside. No bbox field, no shape discriminator, no
|
|
83
83
|
* input/output distinction — one type, used by parsers, by the merge
|
|
84
84
|
* pass, and by the renderer.
|
|
@@ -100,7 +100,7 @@ interface Polygon {
|
|
|
100
100
|
/**
|
|
101
101
|
* Shared material. When set, `material.texture` takes precedence over the
|
|
102
102
|
* inline `texture` field. If the polygon's UVs form an axis-aligned
|
|
103
|
-
* rectangle,
|
|
103
|
+
* rectangle, glyphcss uses the direct CSS background-image path (no per-
|
|
104
104
|
* polygon canvas rasterization). Falls back to the atlas path otherwise.
|
|
105
105
|
*/
|
|
106
106
|
material?: PolyMaterial;
|
|
@@ -273,7 +273,7 @@ declare function polygonFaces(p: Polygon): PolygonFace[];
|
|
|
273
273
|
|
|
274
274
|
/**
|
|
275
275
|
* Apply CSS-style chained `rotateX(rx) rotateY(ry) rotateZ(rz)` rotation
|
|
276
|
-
* to a 3D vector. Matches the matrix composition used by
|
|
276
|
+
* to a 3D vector. Matches the matrix composition used by glyphcss mesh
|
|
277
277
|
* wrapper transforms (see `buildTransform` in each PolyMesh implementation).
|
|
278
278
|
*
|
|
279
279
|
* CSS composes `transform: rotateX(rx) rotateY(ry) rotateZ(rz)` as the
|
|
@@ -345,7 +345,7 @@ declare function quatFromEulerXYZ(eulerDeg: Vec3): Quat;
|
|
|
345
345
|
declare function eulerXYZFromQuat(q: Quat): Vec3;
|
|
346
346
|
|
|
347
347
|
/**
|
|
348
|
-
* Base tile size in CSS pixels. One
|
|
348
|
+
* Base tile size in CSS pixels. One glyphcss world unit = BASE_TILE CSS
|
|
349
349
|
* pixels (pre-scale). Used to convert world-coordinate target values to
|
|
350
350
|
* CSS translations in the transform string.
|
|
351
351
|
*/
|
|
@@ -360,7 +360,7 @@ type AutoRotateOption = boolean | number | AutoRotateConfig;
|
|
|
360
360
|
* World-coordinate camera state (Three.js-style).
|
|
361
361
|
*
|
|
362
362
|
* `target` is the world point that should appear at the viewport centre.
|
|
363
|
-
*
|
|
363
|
+
* Glyphcss world axes: [0]=X (rows/south), [1]=Y (cols/east), [2]=Z (up).
|
|
364
364
|
*
|
|
365
365
|
* `pan`, `tilt`, and `depthOffset` are gone. Translations now live inside
|
|
366
366
|
* `target` so they happen BEFORE rotations — enabling correct world-space
|
|
@@ -427,7 +427,7 @@ declare function shadeColor(base: string, delta: number): string;
|
|
|
427
427
|
* (top-down white directional with intensity 1, white ambient with
|
|
428
428
|
* intensity 0.4) — useful for static SSR/validator renders.
|
|
429
429
|
*/
|
|
430
|
-
declare function computeShapeLighting(normal: Vec3, baseColor: string, directional?:
|
|
430
|
+
declare function computeShapeLighting(normal: Vec3, baseColor: string, directional?: GlyphDirectionalLight, ambient?: GlyphAmbientLight): string;
|
|
431
431
|
|
|
432
432
|
/**
|
|
433
433
|
* Merge coplanar same-color adjacent triangles into N-vertex polygons.
|
|
@@ -632,7 +632,7 @@ declare function cameraCullVisibleSignature(groups: readonly CameraCullNormalGro
|
|
|
632
632
|
* cuboids stretching along world-X, world-Y and world-Z. Mirrors the
|
|
633
633
|
* convention `red=X, green=Y, blue=Z`.
|
|
634
634
|
*
|
|
635
|
-
* Returned polygons are in the standard
|
|
635
|
+
* Returned polygons are in the standard glyphcss world-space convention
|
|
636
636
|
* (`+X right, +Y forward, +Z up`). Wrap with the framework's PolyMesh /
|
|
637
637
|
* PolyScene equivalent to render.
|
|
638
638
|
*/
|
|
@@ -665,7 +665,7 @@ declare function axesHelperPolygons(options?: AxesHelperOptions): Polygon[];
|
|
|
665
665
|
* drag handle for `<TransformControls>` — same primitive recipe as
|
|
666
666
|
* `axesHelperPolygons`, plus an arrowhead.
|
|
667
667
|
*
|
|
668
|
-
* Returned polygons are in standard
|
|
668
|
+
* Returned polygons are in standard glyphcss world space and intended
|
|
669
669
|
* to be wrapped in the framework's PolyMesh equivalent for rendering.
|
|
670
670
|
*/
|
|
671
671
|
|
|
@@ -704,7 +704,7 @@ declare function arrowPolygons(options: ArrowPolygonsOptions): Polygon[];
|
|
|
704
704
|
* "rotation circle" and keeps the polygon count proportional to the
|
|
705
705
|
* `segments` knob.
|
|
706
706
|
*
|
|
707
|
-
* Returned polygons are in standard
|
|
707
|
+
* Returned polygons are in standard glyphcss world space and intended
|
|
708
708
|
* to be wrapped in the framework's PolyMesh equivalent for rendering.
|
|
709
709
|
*/
|
|
710
710
|
|
|
@@ -762,7 +762,7 @@ declare function ringQuadPolygons(options: RingQuadPolygonsOptions): Polygon[];
|
|
|
762
762
|
* attached mesh along two axes simultaneously (XY, XZ, or YZ), instead of
|
|
763
763
|
* the single-axis motion the arrow shafts provide.
|
|
764
764
|
*
|
|
765
|
-
* The polygon lives in standard
|
|
765
|
+
* The polygon lives in standard glyphcss world space; wrap it in the
|
|
766
766
|
* framework's PolyMesh equivalent for rendering.
|
|
767
767
|
*/
|
|
768
768
|
|
|
@@ -788,7 +788,7 @@ declare function planePolygons(options: PlanePolygonsOptions): Polygon[];
|
|
|
788
788
|
|
|
789
789
|
/**
|
|
790
790
|
* Geometry for a small solid-color octahedron — the marker shape used by
|
|
791
|
-
* `
|
|
791
|
+
* `GlyphDirectionalLightHelper` to indicate where a directional light is
|
|
792
792
|
* shining from. Eight CCW-from-outside triangular faces, vertices at
|
|
793
793
|
* `center ± (size, 0, 0)` etc.
|
|
794
794
|
*/
|
|
@@ -803,6 +803,956 @@ interface OctahedronPolygonsOptions {
|
|
|
803
803
|
}
|
|
804
804
|
declare function octahedronPolygons(options: OctahedronPolygonsOptions): Polygon[];
|
|
805
805
|
|
|
806
|
+
/**
|
|
807
|
+
* Geometry for a regular tetrahedron — 4 triangular faces. Vertices are
|
|
808
|
+
* placed at alternating corners of a unit cube so the edge length is uniform.
|
|
809
|
+
* Scaled so the solid fits inside a sphere of radius `size` (i.e. the
|
|
810
|
+
* circumradius equals `size`), centered on `center`.
|
|
811
|
+
*/
|
|
812
|
+
|
|
813
|
+
interface TetrahedronPolygonsOptions {
|
|
814
|
+
/** Center of the tetrahedron in world space. */
|
|
815
|
+
center: Vec3;
|
|
816
|
+
/** Circumradius — distance from center to each vertex. */
|
|
817
|
+
size: number;
|
|
818
|
+
/** Fill color applied to all four faces. */
|
|
819
|
+
color?: string;
|
|
820
|
+
}
|
|
821
|
+
declare function tetrahedronPolygons(options: TetrahedronPolygonsOptions): Polygon[];
|
|
822
|
+
|
|
823
|
+
/**
|
|
824
|
+
* Geometry for a solid-color cube — 6 square faces, one Polygon per face.
|
|
825
|
+
* Vertices sit at `center ± (size/2)` on each axis so the edge length equals
|
|
826
|
+
* `size` and the solid fits in a bounding box of `size × size × size`.
|
|
827
|
+
*/
|
|
828
|
+
|
|
829
|
+
interface CubePolygonsOptions {
|
|
830
|
+
/** Center of the cube in world space. */
|
|
831
|
+
center: Vec3;
|
|
832
|
+
/** Edge length of the cube. */
|
|
833
|
+
size: number;
|
|
834
|
+
/** Fill color applied to all six faces. */
|
|
835
|
+
color?: string;
|
|
836
|
+
}
|
|
837
|
+
declare function cubePolygons(options: CubePolygonsOptions): Polygon[];
|
|
838
|
+
|
|
839
|
+
/**
|
|
840
|
+
* Geometry for a regular dodecahedron — 12 pentagonal faces. Vertices are
|
|
841
|
+
* the standard golden-ratio form: (±1, ±1, ±1) and the three even
|
|
842
|
+
* permutations of (0, ±φ, ±1/φ). Scaled so the circumradius equals `size`.
|
|
843
|
+
*
|
|
844
|
+
* Vertex ordering (20 total):
|
|
845
|
+
* Indices 0–7: cube corners (±1, ±1, ±1)
|
|
846
|
+
* Indices 8–11: (0, ±φ, ±1/φ)
|
|
847
|
+
* Indices 12–15: (±1/φ, 0, ±φ)
|
|
848
|
+
* Indices 16–19: (±φ, ±1/φ, 0)
|
|
849
|
+
*
|
|
850
|
+
* Face table derived from the adjacency graph of the above vertices;
|
|
851
|
+
* each face is a CCW-from-outside pentagon.
|
|
852
|
+
*/
|
|
853
|
+
|
|
854
|
+
interface DodecahedronPolygonsOptions {
|
|
855
|
+
/** Center of the dodecahedron in world space. */
|
|
856
|
+
center: Vec3;
|
|
857
|
+
/** Circumradius — distance from center to each vertex. */
|
|
858
|
+
size: number;
|
|
859
|
+
/** Fill color applied to all twelve faces. */
|
|
860
|
+
color?: string;
|
|
861
|
+
}
|
|
862
|
+
declare function dodecahedronPolygons(options: DodecahedronPolygonsOptions): Polygon[];
|
|
863
|
+
|
|
864
|
+
/**
|
|
865
|
+
* Geometry for a regular icosahedron — 20 triangular faces. Vertices are
|
|
866
|
+
* the standard golden-ratio form: (0, ±1, ±φ) and even permutations.
|
|
867
|
+
* Scaled so the circumradius equals `size`.
|
|
868
|
+
*
|
|
869
|
+
* Vertex ordering (12 total):
|
|
870
|
+
* Indices 0–3: (0, ±1, ±φ)
|
|
871
|
+
* Indices 4–7: (±1, ±φ, 0)
|
|
872
|
+
* Indices 8–11: (±φ, 0, ±1)
|
|
873
|
+
*
|
|
874
|
+
* Face table derived from the adjacency graph of the above vertices;
|
|
875
|
+
* each face is a CCW-from-outside triangle.
|
|
876
|
+
*/
|
|
877
|
+
|
|
878
|
+
interface IcosahedronPolygonsOptions {
|
|
879
|
+
/** Center of the icosahedron in world space. */
|
|
880
|
+
center: Vec3;
|
|
881
|
+
/** Circumradius — distance from center to each vertex. */
|
|
882
|
+
size: number;
|
|
883
|
+
/** Fill color applied to all twenty faces. */
|
|
884
|
+
color?: string;
|
|
885
|
+
}
|
|
886
|
+
declare function icosahedronPolygons(options: IcosahedronPolygonsOptions): Polygon[];
|
|
887
|
+
|
|
888
|
+
/**
|
|
889
|
+
* Icosphere geometry — a sphere approximated by subdividing an icosahedron's
|
|
890
|
+
* 20 triangles. At each subdivision level every triangle is split into 4 by
|
|
891
|
+
* inserting edge midpoints, and every midpoint is projected back onto the
|
|
892
|
+
* circumscribed sphere of radius `size`. Shared edge midpoints are deduped
|
|
893
|
+
* with a `Map` keyed on sorted endpoint indices so no seam doubles occur.
|
|
894
|
+
*
|
|
895
|
+
* `subdivisions=0` → 20 triangles (bare icosahedron).
|
|
896
|
+
* `subdivisions=1` → 80 triangles (default).
|
|
897
|
+
* `subdivisions=2` → 320 triangles.
|
|
898
|
+
*
|
|
899
|
+
* Base vertices are the golden-ratio (0, ±1, ±φ) form and cyclic permutations,
|
|
900
|
+
* matching `icosahedronPolygons.ts`, scaled so circumradius equals `size`.
|
|
901
|
+
*/
|
|
902
|
+
|
|
903
|
+
interface SpherePolygonsOptions {
|
|
904
|
+
/** Center of the sphere in world space. */
|
|
905
|
+
center: Vec3;
|
|
906
|
+
/** Circumradius — distance from center to every surface vertex. */
|
|
907
|
+
size: number;
|
|
908
|
+
/** Subdivision level. 0 = icosahedron (20 tri), 1 = 80 tri (default). */
|
|
909
|
+
subdivisions?: number;
|
|
910
|
+
/** Fill color applied to all faces. */
|
|
911
|
+
color?: string;
|
|
912
|
+
}
|
|
913
|
+
declare function spherePolygons(options: SpherePolygonsOptions): Polygon[];
|
|
914
|
+
|
|
915
|
+
/**
|
|
916
|
+
* Geometry for a closed cylinder aligned to the Y axis. The cylinder is
|
|
917
|
+
* centered at `center`, with the bottom ring at `y - height/2` and the top
|
|
918
|
+
* ring at `y + height/2`. The circumference is approximated by `sides`
|
|
919
|
+
* evenly-spaced vertices.
|
|
920
|
+
*
|
|
921
|
+
* Output (sides + 2 polygons):
|
|
922
|
+
* - `sides` side quads — each connecting top_i → top_(i+1) → bottom_(i+1) → bottom_i (CCW from outside).
|
|
923
|
+
* - 1 top cap N-gon — CCW from +Y. Because the ring is generated going
|
|
924
|
+
* counter-clockwise in XZ (increasing θ winds X→+Z), the +Y-outward
|
|
925
|
+
* normal requires the REVERSED order.
|
|
926
|
+
* - 1 bottom cap N-gon — CCW from −Y. The same generation order (CCW in
|
|
927
|
+
* XZ) already produces a −Y-outward normal, so the bottom cap keeps the
|
|
928
|
+
* natural ring order.
|
|
929
|
+
*/
|
|
930
|
+
|
|
931
|
+
interface CylinderPolygonsOptions {
|
|
932
|
+
/** Center of the cylinder in world space. */
|
|
933
|
+
center: Vec3;
|
|
934
|
+
/** Radius of the circular cross-section. */
|
|
935
|
+
radius: number;
|
|
936
|
+
/** Total height along the Y axis. */
|
|
937
|
+
height: number;
|
|
938
|
+
/** Number of circumference divisions. Defaults to 16. */
|
|
939
|
+
sides?: number;
|
|
940
|
+
/** Fill color applied to all faces. */
|
|
941
|
+
color?: string;
|
|
942
|
+
}
|
|
943
|
+
declare function cylinderPolygons(options: CylinderPolygonsOptions): Polygon[];
|
|
944
|
+
|
|
945
|
+
/**
|
|
946
|
+
* Geometry for a closed cone along the Y axis. The apex sits at
|
|
947
|
+
* `y + height/2` and the base ring sits at `y - height/2`, relative to
|
|
948
|
+
* `center`. The base is a regular N-gon with circumradius `radius`.
|
|
949
|
+
*
|
|
950
|
+
* Output (sides + 1 polygons):
|
|
951
|
+
* - `sides` side triangles — each `[apex, base_(i+1), base_i]` (CCW from outside).
|
|
952
|
+
* - 1 base cap N-gon — CCW when viewed from −Y (reversed ring order).
|
|
953
|
+
*/
|
|
954
|
+
|
|
955
|
+
interface ConePolygonsOptions {
|
|
956
|
+
/** Center of the cone in world space. */
|
|
957
|
+
center: Vec3;
|
|
958
|
+
/** Circumradius of the base circle. */
|
|
959
|
+
radius: number;
|
|
960
|
+
/** Total height along the Y axis. */
|
|
961
|
+
height: number;
|
|
962
|
+
/** Number of base polygon sides. Defaults to 16. */
|
|
963
|
+
sides?: number;
|
|
964
|
+
/** Fill color applied to all faces. */
|
|
965
|
+
color?: string;
|
|
966
|
+
}
|
|
967
|
+
declare function conePolygons(options: ConePolygonsOptions): Polygon[];
|
|
968
|
+
|
|
969
|
+
/**
|
|
970
|
+
* Geometry for a torus (donut) centred at `center`, lying in the XZ plane
|
|
971
|
+
* with the tube axis parallel to Y. Parameterised by:
|
|
972
|
+
*
|
|
973
|
+
* θ = 2π * u / segments (around the donut ring)
|
|
974
|
+
* φ = 2π * v / sides (around the tube cross-section)
|
|
975
|
+
*
|
|
976
|
+
* x = (majorRadius + minorRadius * cos φ) * cos θ
|
|
977
|
+
* y = minorRadius * sin φ
|
|
978
|
+
* z = (majorRadius + minorRadius * cos φ) * sin θ
|
|
979
|
+
*
|
|
980
|
+
* Output: `segments × sides` quads, one per (u, v) cell, with modular
|
|
981
|
+
* index wrap and CCW-from-outside winding.
|
|
982
|
+
* Default segments=24, sides=12 → 288 quads.
|
|
983
|
+
*/
|
|
984
|
+
|
|
985
|
+
interface TorusPolygonsOptions {
|
|
986
|
+
/** Center of the torus in world space. */
|
|
987
|
+
center: Vec3;
|
|
988
|
+
/** Distance from the torus center to the center of the tube. */
|
|
989
|
+
majorRadius: number;
|
|
990
|
+
/** Radius of the tube cross-section. */
|
|
991
|
+
minorRadius: number;
|
|
992
|
+
/** Number of divisions around the donut ring. Defaults to 24. */
|
|
993
|
+
segments?: number;
|
|
994
|
+
/** Number of divisions around the tube cross-section. Defaults to 12. */
|
|
995
|
+
sides?: number;
|
|
996
|
+
/** Fill color applied to all quads. */
|
|
997
|
+
color?: string;
|
|
998
|
+
}
|
|
999
|
+
declare function torusPolygons(options: TorusPolygonsOptions): Polygon[];
|
|
1000
|
+
|
|
1001
|
+
/**
|
|
1002
|
+
* Geometry for a regular N-gonal pyramid along the Y axis. The base polygon
|
|
1003
|
+
* is centred at `y - height/2` with circumradius `radius`; the apex is at
|
|
1004
|
+
* `y + height/2`, both relative to `center`.
|
|
1005
|
+
*
|
|
1006
|
+
* Output (sides + 1 polygons):
|
|
1007
|
+
* - `sides` side triangles — each `[apex, base_(i+1), base_i]` (CCW from outside).
|
|
1008
|
+
* - 1 base cap N-gon — CCW when viewed from −Y (reversed ring order).
|
|
1009
|
+
*
|
|
1010
|
+
* Default sides=4 → square pyramid (5 polygons total).
|
|
1011
|
+
*/
|
|
1012
|
+
|
|
1013
|
+
interface PyramidPolygonsOptions {
|
|
1014
|
+
/** Center of the pyramid in world space. */
|
|
1015
|
+
center: Vec3;
|
|
1016
|
+
/** Circumradius of the base polygon. */
|
|
1017
|
+
radius: number;
|
|
1018
|
+
/** Total height along the Y axis. */
|
|
1019
|
+
height: number;
|
|
1020
|
+
/** Number of base polygon sides. Defaults to 4 (square pyramid). */
|
|
1021
|
+
sides?: number;
|
|
1022
|
+
/** Fill color applied to all faces. */
|
|
1023
|
+
color?: string;
|
|
1024
|
+
}
|
|
1025
|
+
declare function pyramidPolygons(options: PyramidPolygonsOptions): Polygon[];
|
|
1026
|
+
|
|
1027
|
+
/**
|
|
1028
|
+
* Geometry for a right N-gonal prism aligned to the Y axis. The prism is
|
|
1029
|
+
* centered at `center`, with the bottom cap at `y - height/2` and the top
|
|
1030
|
+
* cap at `y + height/2`. The N-gon cross-section has circumradius `radius`.
|
|
1031
|
+
*
|
|
1032
|
+
* Output (sides + 2 polygons):
|
|
1033
|
+
* - `sides` side quads — each `[top_i, top_(i+1), bottom_(i+1), bottom_i]` (CCW from outside).
|
|
1034
|
+
* - 1 top cap N-gon — CCW when viewed from +Y.
|
|
1035
|
+
* - 1 bottom cap N-gon — CCW when viewed from −Y (reversed ring order).
|
|
1036
|
+
*/
|
|
1037
|
+
|
|
1038
|
+
interface PrismPolygonsOptions {
|
|
1039
|
+
/** Center of the prism in world space. */
|
|
1040
|
+
center: Vec3;
|
|
1041
|
+
/** Circumradius of the N-gon cross-section. */
|
|
1042
|
+
radius: number;
|
|
1043
|
+
/** Total height along the Y axis. */
|
|
1044
|
+
height: number;
|
|
1045
|
+
/** Number of sides on the N-gon cross-section. Defaults to 6. */
|
|
1046
|
+
sides?: number;
|
|
1047
|
+
/** Fill color applied to all faces. */
|
|
1048
|
+
color?: string;
|
|
1049
|
+
}
|
|
1050
|
+
declare function prismPolygons(options: PrismPolygonsOptions): Polygon[];
|
|
1051
|
+
|
|
1052
|
+
/**
|
|
1053
|
+
* Geometry for an N-gonal antiprism aligned to the Y axis. The antiprism is
|
|
1054
|
+
* centered at `center`, with the bottom cap at `y - height/2` and the top
|
|
1055
|
+
* cap at `y + height/2`. The top N-gon is rotated by π/sides relative to the
|
|
1056
|
+
* bottom, and the side strip consists of 2·sides alternating triangles.
|
|
1057
|
+
*
|
|
1058
|
+
* Output (2·sides + 2 polygons):
|
|
1059
|
+
* - `2 * sides` side triangles — alternating "up" and "down" triangles, CCW from outside.
|
|
1060
|
+
* - 1 top cap N-gon — CCW when viewed from +Y.
|
|
1061
|
+
* - 1 bottom cap N-gon — CCW when viewed from −Y (reversed ring order).
|
|
1062
|
+
*/
|
|
1063
|
+
|
|
1064
|
+
interface AntiprismPolygonsOptions {
|
|
1065
|
+
/** Center of the antiprism in world space. */
|
|
1066
|
+
center: Vec3;
|
|
1067
|
+
/** Circumradius of the N-gon cross-sections. */
|
|
1068
|
+
radius: number;
|
|
1069
|
+
/** Total height along the Y axis. */
|
|
1070
|
+
height: number;
|
|
1071
|
+
/** Number of sides on each N-gon cap. Defaults to 6. */
|
|
1072
|
+
sides?: number;
|
|
1073
|
+
/** Fill color applied to all faces. */
|
|
1074
|
+
color?: string;
|
|
1075
|
+
}
|
|
1076
|
+
declare function antiprismPolygons(options: AntiprismPolygonsOptions): Polygon[];
|
|
1077
|
+
|
|
1078
|
+
/**
|
|
1079
|
+
* Geometry for an N-gonal bipyramid (two pyramids glued base-to-base along Y).
|
|
1080
|
+
* The equatorial ring of `sides` vertices lies at y = `center.y`, the top apex
|
|
1081
|
+
* at y = `center.y + halfHeight`, and the bottom apex at y = `center.y - halfHeight`.
|
|
1082
|
+
* `radius` is the circumradius of the equatorial ring.
|
|
1083
|
+
*
|
|
1084
|
+
* Output (2·sides polygons):
|
|
1085
|
+
* - `sides` upper triangles — each `[topApex, ring_(i+1), ring_i]` (CCW from outside).
|
|
1086
|
+
* - `sides` lower triangles — each `[bottomApex, ring_i, ring_(i+1)]` (CCW from outside).
|
|
1087
|
+
*/
|
|
1088
|
+
|
|
1089
|
+
interface BipyramidPolygonsOptions {
|
|
1090
|
+
/** Center of the bipyramid in world space. */
|
|
1091
|
+
center: Vec3;
|
|
1092
|
+
/** Circumradius of the equatorial N-gon ring. */
|
|
1093
|
+
radius: number;
|
|
1094
|
+
/** Half the total height — distance from equator to each apex. */
|
|
1095
|
+
halfHeight: number;
|
|
1096
|
+
/** Number of sides on the equatorial ring. Defaults to 6. */
|
|
1097
|
+
sides?: number;
|
|
1098
|
+
/** Fill color applied to all faces. */
|
|
1099
|
+
color?: string;
|
|
1100
|
+
}
|
|
1101
|
+
declare function bipyramidPolygons(options: BipyramidPolygonsOptions): Polygon[];
|
|
1102
|
+
|
|
1103
|
+
/**
|
|
1104
|
+
* Geometry for an N-gonal trapezohedron (kite-faced solid, dual of the N-gonal
|
|
1105
|
+
* antiprism). The solid has `2 * sides` kite (quadrilateral) faces, a top apex
|
|
1106
|
+
* at y = `+halfHeight`, a bottom apex at y = `−halfHeight`, and two interleaved
|
|
1107
|
+
* rings of `sides` vertices each at y = ±`zRing`.
|
|
1108
|
+
*
|
|
1109
|
+
* The belt ring elevation is derived analytically so that every kite face is
|
|
1110
|
+
* exactly planar. Setting zR = halfHeight × (1 − cos(π/sides)) / (1 + cos(π/sides))
|
|
1111
|
+
* is the unique value that places all four vertices of each kite in the same plane
|
|
1112
|
+
* (derived by requiring the fourth vertex to satisfy the plane equation of the
|
|
1113
|
+
* first three).
|
|
1114
|
+
*
|
|
1115
|
+
* The top ring sits at y = +zR; the bottom ring sits at y = −zR, rotated by
|
|
1116
|
+
* π/sides so the two rings interleave like an antiprism.
|
|
1117
|
+
*
|
|
1118
|
+
* Output (2·sides polygons):
|
|
1119
|
+
* - `sides` upper kites around the top apex (CCW from outside).
|
|
1120
|
+
* - `sides` lower kites around the bottom apex (CCW from outside).
|
|
1121
|
+
*/
|
|
1122
|
+
|
|
1123
|
+
interface TrapezohedronPolygonsOptions {
|
|
1124
|
+
/** Center of the trapezohedron in world space. */
|
|
1125
|
+
center: Vec3;
|
|
1126
|
+
/** Circumradius of each belt ring. */
|
|
1127
|
+
radius: number;
|
|
1128
|
+
/** Half the total height — distance from equator to each apex. */
|
|
1129
|
+
halfHeight: number;
|
|
1130
|
+
/** Number of kite faces per hemisphere (= number of antiprism sides). Defaults to 5. */
|
|
1131
|
+
sides?: number;
|
|
1132
|
+
/** Fill color applied to all faces. */
|
|
1133
|
+
color?: string;
|
|
1134
|
+
}
|
|
1135
|
+
declare function trapezohedronPolygons(options: TrapezohedronPolygonsOptions): Polygon[];
|
|
1136
|
+
|
|
1137
|
+
/**
|
|
1138
|
+
* Geometry for a small stellated dodecahedron — Schläfli symbol {5/2, 5}.
|
|
1139
|
+
* 12 pentagram faces on the 12 icosahedron vertices; each pentagram is
|
|
1140
|
+
* decomposed into 5 triangles fanned from the face centroid (60 triangles
|
|
1141
|
+
* total). Using star-polygon faces directly would fan-triangulate into a
|
|
1142
|
+
* convex pentagon; the fan-from-centroid approach produces the correct
|
|
1143
|
+
* 5-pointed-star silhouette.
|
|
1144
|
+
*
|
|
1145
|
+
* Vertices: the 12 standard icosahedron vertices (circumradius = `size`).
|
|
1146
|
+
* Each pentagram face: centroid + 5 outer points picked from the icosahedron
|
|
1147
|
+
* vertex set and ordered angularly in the plane perpendicular to the face
|
|
1148
|
+
* axis; the [0,2,4,1,3] permutation of that angular order produces the
|
|
1149
|
+
* every-other-vertex (pentagram) skip that makes a star.
|
|
1150
|
+
*/
|
|
1151
|
+
|
|
1152
|
+
interface SmallStellatedDodecahedronPolygonsOptions {
|
|
1153
|
+
/** Center of the polyhedron in world space. */
|
|
1154
|
+
center: Vec3;
|
|
1155
|
+
/** Circumradius — distance from center to each vertex. */
|
|
1156
|
+
size: number;
|
|
1157
|
+
/** Fill color applied to all faces. */
|
|
1158
|
+
color?: string;
|
|
1159
|
+
}
|
|
1160
|
+
declare function smallStellatedDodecahedronPolygons(options: SmallStellatedDodecahedronPolygonsOptions): Polygon[];
|
|
1161
|
+
|
|
1162
|
+
/**
|
|
1163
|
+
* Geometry for a great dodecahedron — Schläfli symbol {5, 5/2}.
|
|
1164
|
+
* 12 convex pentagonal faces on the 12 icosahedron vertices; each face is the
|
|
1165
|
+
* convex pentagon formed by the 5 nearest vertices to one icosahedron vertex
|
|
1166
|
+
* (same vertex group as the small stellated dodecahedron, but the 5 outer
|
|
1167
|
+
* points are emitted in natural angular order rather than pentagram-skip
|
|
1168
|
+
* order). The rasterizer fan-triangulates convex pentagons correctly from
|
|
1169
|
+
* vertex 0 without any special decomposition.
|
|
1170
|
+
*
|
|
1171
|
+
* Vertices: the 12 standard icosahedron vertices (circumradius = `size`).
|
|
1172
|
+
*/
|
|
1173
|
+
|
|
1174
|
+
interface GreatDodecahedronPolygonsOptions {
|
|
1175
|
+
/** Center of the polyhedron in world space. */
|
|
1176
|
+
center: Vec3;
|
|
1177
|
+
/** Circumradius — distance from center to each vertex. */
|
|
1178
|
+
size: number;
|
|
1179
|
+
/** Fill color applied to all faces. */
|
|
1180
|
+
color?: string;
|
|
1181
|
+
}
|
|
1182
|
+
declare function greatDodecahedronPolygons(options: GreatDodecahedronPolygonsOptions): Polygon[];
|
|
1183
|
+
|
|
1184
|
+
/**
|
|
1185
|
+
* Geometry for a great stellated dodecahedron — Schläfli symbol {5/2, 3}.
|
|
1186
|
+
* 12 pentagram faces on the 20 dodecahedron vertices; each pentagram uses
|
|
1187
|
+
* the same 5-vertex grouping as the dodecahedron faces but reordered into
|
|
1188
|
+
* pentagram (every-other-vertex) skip order before being decomposed into
|
|
1189
|
+
* 5 triangles fanned from the face centroid (60 triangles total).
|
|
1190
|
+
*
|
|
1191
|
+
* Vertices: the 20 standard dodecahedron vertices (circumradius = `size`).
|
|
1192
|
+
* Face groups: same 12 pentagonal groupings as dodecahedronPolygons.ts;
|
|
1193
|
+
* the [0,2,4,1,3] permutation of the convex-pentagon order produces the
|
|
1194
|
+
* pentagram skip that makes each face a 5-pointed star.
|
|
1195
|
+
*/
|
|
1196
|
+
|
|
1197
|
+
interface GreatStellatedDodecahedronPolygonsOptions {
|
|
1198
|
+
/** Center of the polyhedron in world space. */
|
|
1199
|
+
center: Vec3;
|
|
1200
|
+
/** Circumradius — distance from center to each vertex. */
|
|
1201
|
+
size: number;
|
|
1202
|
+
/** Fill color applied to all faces. */
|
|
1203
|
+
color?: string;
|
|
1204
|
+
}
|
|
1205
|
+
declare function greatStellatedDodecahedronPolygons(options: GreatStellatedDodecahedronPolygonsOptions): Polygon[];
|
|
1206
|
+
|
|
1207
|
+
/**
|
|
1208
|
+
* Geometry for a great icosahedron — Schläfli symbol {3, 5/2}.
|
|
1209
|
+
* 20 triangular faces on the 12 icosahedron vertices in a non-convex
|
|
1210
|
+
* configuration. Each face is derived from the corresponding icosahedron face
|
|
1211
|
+
* by replacing every vertex with its antipode (the diametrically opposite
|
|
1212
|
+
* vertex on the circumscribed sphere), then reversing the winding to restore
|
|
1213
|
+
* CCW orientation (antipode-flipping mirrors the original CCW winding to CW).
|
|
1214
|
+
*
|
|
1215
|
+
* Vertices: the 12 standard icosahedron vertices (circumradius = `size`).
|
|
1216
|
+
* Face table: antipode-flipped icosahedron faces with winding reversed —
|
|
1217
|
+
* yields 20 distinct, non-degenerate triangles with correct outward normals.
|
|
1218
|
+
*/
|
|
1219
|
+
|
|
1220
|
+
interface GreatIcosahedronPolygonsOptions {
|
|
1221
|
+
/** Center of the polyhedron in world space. */
|
|
1222
|
+
center: Vec3;
|
|
1223
|
+
/** Circumradius — distance from center to each vertex. */
|
|
1224
|
+
size: number;
|
|
1225
|
+
/** Fill color applied to all faces. */
|
|
1226
|
+
color?: string;
|
|
1227
|
+
}
|
|
1228
|
+
declare function greatIcosahedronPolygons(options: GreatIcosahedronPolygonsOptions): Polygon[];
|
|
1229
|
+
|
|
1230
|
+
/**
|
|
1231
|
+
* Geometry for a regular cuboctahedron — 8 triangular faces + 6 square faces
|
|
1232
|
+
* (14 faces total, 12 vertices). Vertices are all permutations of (±1, ±1, 0).
|
|
1233
|
+
* Scaled so the circumradius equals `size`.
|
|
1234
|
+
*
|
|
1235
|
+
* Vertex ordering (12 total):
|
|
1236
|
+
* Indices 0–3: (±1, ±1, 0)
|
|
1237
|
+
* Indices 4–7: (±1, 0, ±1)
|
|
1238
|
+
* Indices 8–11: (0, ±1, ±1)
|
|
1239
|
+
*
|
|
1240
|
+
* Face decomposition: 8 equilateral triangles (one per octant) + 6 squares
|
|
1241
|
+
* (one per cube face — edge midpoints of a cube). Each face is CCW-from-outside.
|
|
1242
|
+
*/
|
|
1243
|
+
|
|
1244
|
+
interface CuboctahedronPolygonsOptions {
|
|
1245
|
+
/** Center of the cuboctahedron in world space. */
|
|
1246
|
+
center: Vec3;
|
|
1247
|
+
/** Circumradius — distance from center to each vertex. */
|
|
1248
|
+
size: number;
|
|
1249
|
+
/** Fill color applied to all fourteen faces. */
|
|
1250
|
+
color?: string;
|
|
1251
|
+
}
|
|
1252
|
+
declare function cuboctahedronPolygons(options: CuboctahedronPolygonsOptions): Polygon[];
|
|
1253
|
+
|
|
1254
|
+
/**
|
|
1255
|
+
* Geometry for a regular icosidodecahedron — 20 triangular faces + 12 pentagonal
|
|
1256
|
+
* faces (32 faces total, 30 vertices). Constructed via the edge-midpoint method
|
|
1257
|
+
* from the icosahedron: the 30 vertices are the midpoints of the icosahedron's 30
|
|
1258
|
+
* edges. Scaled so the circumradius equals `size`.
|
|
1259
|
+
*
|
|
1260
|
+
* Face decomposition:
|
|
1261
|
+
* 20 triangles — one per icosahedron face (3 edge midpoints per face).
|
|
1262
|
+
* 12 pentagons — one per icosahedron vertex (5 incident-edge midpoints per vertex).
|
|
1263
|
+
*
|
|
1264
|
+
* Each face is CCW-from-outside.
|
|
1265
|
+
*/
|
|
1266
|
+
|
|
1267
|
+
interface IcosidodecahedronPolygonsOptions {
|
|
1268
|
+
/** Center of the icosidodecahedron in world space. */
|
|
1269
|
+
center: Vec3;
|
|
1270
|
+
/** Circumradius — distance from center to each vertex. */
|
|
1271
|
+
size: number;
|
|
1272
|
+
/** Fill color applied to all thirty-two faces. */
|
|
1273
|
+
color?: string;
|
|
1274
|
+
}
|
|
1275
|
+
declare function icosidodecahedronPolygons(options: IcosidodecahedronPolygonsOptions): Polygon[];
|
|
1276
|
+
|
|
1277
|
+
/**
|
|
1278
|
+
* Geometry for a truncated tetrahedron — 4 triangular faces + 4 hexagonal faces
|
|
1279
|
+
* (8 faces total, 12 vertices). Constructed by cutting each corner of a regular
|
|
1280
|
+
* tetrahedron at 1/3 of the edge length from the vertex.
|
|
1281
|
+
* Scaled so the circumradius equals `size`.
|
|
1282
|
+
*
|
|
1283
|
+
* Vertex ordering (12 total):
|
|
1284
|
+
* For each of the 4 tetrahedron vertices v[i], 3 truncation points are produced
|
|
1285
|
+
* at p_ij = (2/3)v[i] + (1/3)v[j] for each of the 3 incident edges.
|
|
1286
|
+
*
|
|
1287
|
+
* Face decomposition:
|
|
1288
|
+
* 4 triangles — one per original tetrahedron vertex (corner caps).
|
|
1289
|
+
* 4 hexagons — one per original tetrahedron face (expanded from triangle to hexagon).
|
|
1290
|
+
*
|
|
1291
|
+
* Each face is CCW-from-outside.
|
|
1292
|
+
*/
|
|
1293
|
+
|
|
1294
|
+
interface TruncatedTetrahedronPolygonsOptions {
|
|
1295
|
+
/** Center of the truncated tetrahedron in world space. */
|
|
1296
|
+
center: Vec3;
|
|
1297
|
+
/** Circumradius — distance from center to each vertex. */
|
|
1298
|
+
size: number;
|
|
1299
|
+
/** Fill color applied to all eight faces. */
|
|
1300
|
+
color?: string;
|
|
1301
|
+
}
|
|
1302
|
+
declare function truncatedTetrahedronPolygons(options: TruncatedTetrahedronPolygonsOptions): Polygon[];
|
|
1303
|
+
|
|
1304
|
+
/**
|
|
1305
|
+
* Geometry for a truncated cube — 8 triangular faces + 6 octagonal faces
|
|
1306
|
+
* (14 faces total, 24 vertices). Constructed by cutting each corner of a unit
|
|
1307
|
+
* cube at depth t = (2 − √2)/2 along each of its 3 incident edges.
|
|
1308
|
+
* This truncation depth produces regular octagons on the original square faces.
|
|
1309
|
+
* Scaled so the circumradius equals `size`.
|
|
1310
|
+
*
|
|
1311
|
+
* Face decomposition:
|
|
1312
|
+
* 8 triangles — one per original cube vertex (corner caps).
|
|
1313
|
+
* 6 octagons — one per original cube face (expanded from square to octagon).
|
|
1314
|
+
*
|
|
1315
|
+
* Each face is CCW-from-outside.
|
|
1316
|
+
*/
|
|
1317
|
+
|
|
1318
|
+
interface TruncatedCubePolygonsOptions {
|
|
1319
|
+
/** Center of the truncated cube in world space. */
|
|
1320
|
+
center: Vec3;
|
|
1321
|
+
/** Circumradius — distance from center to each vertex. */
|
|
1322
|
+
size: number;
|
|
1323
|
+
/** Fill color applied to all fourteen faces. */
|
|
1324
|
+
color?: string;
|
|
1325
|
+
}
|
|
1326
|
+
declare function truncatedCubePolygons(options: TruncatedCubePolygonsOptions): Polygon[];
|
|
1327
|
+
|
|
1328
|
+
/**
|
|
1329
|
+
* Geometry for a truncated octahedron (permutohedron) — 6 square faces + 8 hexagonal
|
|
1330
|
+
* faces (14 faces total, 24 vertices). Vertices are all permutations of (0, ±1, ±2).
|
|
1331
|
+
* Scaled so the circumradius equals `size`.
|
|
1332
|
+
*
|
|
1333
|
+
* Vertex ordering (24 total):
|
|
1334
|
+
* All ordered triples using one 0, one ±1, one ±2 (3! × 4 = 24 vertices).
|
|
1335
|
+
*
|
|
1336
|
+
* Face decomposition:
|
|
1337
|
+
* 6 squares — one per axis direction ±x/±y/±z, lying in the plane where one
|
|
1338
|
+
* coordinate equals ±2.
|
|
1339
|
+
* 8 hexagons — one per octant normal (±1,±1,±1); vertices satisfy x+y+z = ±3
|
|
1340
|
+
* (for all-positive/all-negative octants) or mixed-sign combinations.
|
|
1341
|
+
*
|
|
1342
|
+
* Each face is CCW-from-outside.
|
|
1343
|
+
*/
|
|
1344
|
+
|
|
1345
|
+
interface TruncatedOctahedronPolygonsOptions {
|
|
1346
|
+
/** Center of the truncated octahedron in world space. */
|
|
1347
|
+
center: Vec3;
|
|
1348
|
+
/** Circumradius — distance from center to each vertex. */
|
|
1349
|
+
size: number;
|
|
1350
|
+
/** Fill color applied to all fourteen faces. */
|
|
1351
|
+
color?: string;
|
|
1352
|
+
}
|
|
1353
|
+
declare function truncatedOctahedronPolygons(options: TruncatedOctahedronPolygonsOptions): Polygon[];
|
|
1354
|
+
|
|
1355
|
+
/**
|
|
1356
|
+
* Geometry for a truncated dodecahedron — 20 triangular faces + 12 decagonal
|
|
1357
|
+
* faces (32 faces total, 60 vertices). Constructed by truncating each vertex of
|
|
1358
|
+
* a regular dodecahedron at parameter t = (3 − √5)/4 ≈ 0.191, the fraction along
|
|
1359
|
+
* each incident edge that produces regular decagons on the original pentagonal faces.
|
|
1360
|
+
* Scaled so the circumradius equals `size`.
|
|
1361
|
+
*
|
|
1362
|
+
* Face decomposition:
|
|
1363
|
+
* 20 triangles — one per truncated dodecahedron vertex (corner caps).
|
|
1364
|
+
* 12 decagons — one per original dodecahedron face (expanded pentagon → decagon).
|
|
1365
|
+
*
|
|
1366
|
+
* Each face is CCW-from-outside.
|
|
1367
|
+
*/
|
|
1368
|
+
|
|
1369
|
+
interface TruncatedDodecahedronPolygonsOptions {
|
|
1370
|
+
/** Center of the truncated dodecahedron in world space. */
|
|
1371
|
+
center: Vec3;
|
|
1372
|
+
/** Circumradius — distance from center to each vertex. */
|
|
1373
|
+
size: number;
|
|
1374
|
+
/** Fill color applied to all thirty-two faces. */
|
|
1375
|
+
color?: string;
|
|
1376
|
+
}
|
|
1377
|
+
declare function truncatedDodecahedronPolygons(options: TruncatedDodecahedronPolygonsOptions): Polygon[];
|
|
1378
|
+
|
|
1379
|
+
/**
|
|
1380
|
+
* Geometry for a truncated icosahedron (soccer ball / Buckminster fullerene) —
|
|
1381
|
+
* 12 pentagonal faces + 20 hexagonal faces (32 faces total, 60 vertices).
|
|
1382
|
+
* Constructed by truncating each vertex of a regular icosahedron at t = 1/3
|
|
1383
|
+
* (the unique rational truncation fraction for Archimedean solids — makes the
|
|
1384
|
+
* hexagons regular). Scaled so the circumradius equals `size`.
|
|
1385
|
+
*
|
|
1386
|
+
* Face decomposition:
|
|
1387
|
+
* 12 pentagons — one per icosahedron vertex (5 truncation points on incident edges).
|
|
1388
|
+
* 20 hexagons — one per icosahedron face (6 truncation points around each triangle).
|
|
1389
|
+
*
|
|
1390
|
+
* Each face is CCW-from-outside.
|
|
1391
|
+
*/
|
|
1392
|
+
|
|
1393
|
+
interface TruncatedIcosahedronPolygonsOptions {
|
|
1394
|
+
/** Center of the truncated icosahedron in world space. */
|
|
1395
|
+
center: Vec3;
|
|
1396
|
+
/** Circumradius — distance from center to each vertex. */
|
|
1397
|
+
size: number;
|
|
1398
|
+
/** Fill color applied to all thirty-two faces. */
|
|
1399
|
+
color?: string;
|
|
1400
|
+
}
|
|
1401
|
+
declare function truncatedIcosahedronPolygons(options: TruncatedIcosahedronPolygonsOptions): Polygon[];
|
|
1402
|
+
|
|
1403
|
+
/**
|
|
1404
|
+
* Geometry for a truncated cuboctahedron (great rhombicuboctahedron) —
|
|
1405
|
+
* 12 square faces + 8 hexagonal faces + 6 octagonal faces (26 faces total,
|
|
1406
|
+
* 48 vertices). Vertices are all distinct ordered permutations of
|
|
1407
|
+
* (±1, ±(1+√2), ±(1+2√2)) — 3! orderings × 2³ sign combinations = 48 vertices.
|
|
1408
|
+
* Scaled so the circumradius equals `size`.
|
|
1409
|
+
*
|
|
1410
|
+
* Face decomposition:
|
|
1411
|
+
* 12 squares — one per edge of the parent cuboctahedron.
|
|
1412
|
+
* 8 hexagons — one per triangular face of the parent cuboctahedron.
|
|
1413
|
+
* 6 octagons — one per square face of the parent cuboctahedron.
|
|
1414
|
+
*
|
|
1415
|
+
* Faces discovered via edge-graph enumeration (all planar, outward-facing
|
|
1416
|
+
* cycles of length 4, 6, 8). Each face is CCW-from-outside.
|
|
1417
|
+
*/
|
|
1418
|
+
|
|
1419
|
+
interface TruncatedCuboctahedronPolygonsOptions {
|
|
1420
|
+
/** Center of the truncated cuboctahedron in world space. */
|
|
1421
|
+
center: Vec3;
|
|
1422
|
+
/** Circumradius — distance from center to each vertex. */
|
|
1423
|
+
size: number;
|
|
1424
|
+
/** Fill color applied to all twenty-six faces. */
|
|
1425
|
+
color?: string;
|
|
1426
|
+
}
|
|
1427
|
+
declare function truncatedCuboctahedronPolygons(options: TruncatedCuboctahedronPolygonsOptions): Polygon[];
|
|
1428
|
+
|
|
1429
|
+
/**
|
|
1430
|
+
* Geometry for a truncated icosidodecahedron (great rhombicosidodecahedron) —
|
|
1431
|
+
* 30 square faces + 20 hexagonal faces + 12 decagonal faces (62 faces total,
|
|
1432
|
+
* 120 vertices). Vertices are all even-permutation (cyclic) sign combinations
|
|
1433
|
+
* of five base triples involving the golden ratio φ = (1+√5)/2.
|
|
1434
|
+
* Scaled so the circumradius equals `size`.
|
|
1435
|
+
*
|
|
1436
|
+
* Vertex construction: 5 base triples × 3 cyclic permutations × 8 sign
|
|
1437
|
+
* combinations = 120 vertices. All lie on a common sphere.
|
|
1438
|
+
*
|
|
1439
|
+
* Face decomposition:
|
|
1440
|
+
* 30 squares — one per edge of the parent icosidodecahedron.
|
|
1441
|
+
* 20 hexagons — one per triangular face of the parent icosidodecahedron.
|
|
1442
|
+
* 12 decagons — one per pentagonal face of the parent icosidodecahedron.
|
|
1443
|
+
*
|
|
1444
|
+
* Faces discovered via edge-graph enumeration (planar, outward-facing cycles of
|
|
1445
|
+
* length 4, 6, 10). Each face is CCW-from-outside.
|
|
1446
|
+
*/
|
|
1447
|
+
|
|
1448
|
+
interface TruncatedIcosidodecahedronPolygonsOptions {
|
|
1449
|
+
/** Center of the truncated icosidodecahedron in world space. */
|
|
1450
|
+
center: Vec3;
|
|
1451
|
+
/** Circumradius — distance from center to each vertex. */
|
|
1452
|
+
size: number;
|
|
1453
|
+
/** Fill color applied to all sixty-two faces. */
|
|
1454
|
+
color?: string;
|
|
1455
|
+
}
|
|
1456
|
+
declare function truncatedIcosidodecahedronPolygons(options: TruncatedIcosidodecahedronPolygonsOptions): Polygon[];
|
|
1457
|
+
|
|
1458
|
+
/**
|
|
1459
|
+
* Geometry for a rhombicuboctahedron — 8 triangular faces + 18 square faces
|
|
1460
|
+
* (26 faces total, 24 vertices). Vertices are all permutations of
|
|
1461
|
+
* (±1, ±1, ±(1+√2)) — 3 axis choices × 8 sign combinations = 24 vertices.
|
|
1462
|
+
* Scaled so the circumradius equals `size`.
|
|
1463
|
+
*
|
|
1464
|
+
* Face decomposition:
|
|
1465
|
+
* 8 triangles — the 8 corner faces (one per octant).
|
|
1466
|
+
* 18 squares — 6 axial squares + 12 edge squares.
|
|
1467
|
+
*
|
|
1468
|
+
* Faces discovered via edge-graph enumeration (planar, outward-facing cycles of
|
|
1469
|
+
* length 3 and 4). Each face is CCW-from-outside.
|
|
1470
|
+
*/
|
|
1471
|
+
|
|
1472
|
+
interface RhombicuboctahedronPolygonsOptions {
|
|
1473
|
+
/** Center of the rhombicuboctahedron in world space. */
|
|
1474
|
+
center: Vec3;
|
|
1475
|
+
/** Circumradius — distance from center to each vertex. */
|
|
1476
|
+
size: number;
|
|
1477
|
+
/** Fill color applied to all twenty-six faces. */
|
|
1478
|
+
color?: string;
|
|
1479
|
+
}
|
|
1480
|
+
declare function rhombicuboctahedronPolygons(options: RhombicuboctahedronPolygonsOptions): Polygon[];
|
|
1481
|
+
|
|
1482
|
+
/**
|
|
1483
|
+
* Geometry for a rhombicosidodecahedron — 20 triangular faces + 30 square faces
|
|
1484
|
+
* + 12 pentagonal faces (62 faces total, 60 vertices). Vertices fall into three
|
|
1485
|
+
* families of cyclic-permutation + sign-combination groups:
|
|
1486
|
+
*
|
|
1487
|
+
* (±1, ±1, ±φ³) — 3 cyclic perms × 8 signs = 24 vertices
|
|
1488
|
+
* (±φ², ±φ, ±2φ) — 3 cyclic perms × 8 signs = 24 vertices
|
|
1489
|
+
* (±(2+φ), 0, ±φ²) — 3 cyclic perms × 4 signs = 12 vertices
|
|
1490
|
+
*
|
|
1491
|
+
* where φ = (1+√5)/2. Total: 60 vertices. Scaled so the circumradius equals `size`.
|
|
1492
|
+
*
|
|
1493
|
+
* Face decomposition:
|
|
1494
|
+
* 20 triangles — corner faces (one per icosahedron vertex).
|
|
1495
|
+
* 30 squares — edge faces (one per icosahedron edge).
|
|
1496
|
+
* 12 pentagons — cap faces (one per dodecahedron face).
|
|
1497
|
+
*
|
|
1498
|
+
* Faces discovered via edge-graph enumeration (planar, outward-facing cycles of
|
|
1499
|
+
* length 3, 4, 5). Each face is CCW-from-outside.
|
|
1500
|
+
*/
|
|
1501
|
+
|
|
1502
|
+
interface RhombicosidodecahedronPolygonsOptions {
|
|
1503
|
+
/** Center of the rhombicosidodecahedron in world space. */
|
|
1504
|
+
center: Vec3;
|
|
1505
|
+
/** Circumradius — distance from center to each vertex. */
|
|
1506
|
+
size: number;
|
|
1507
|
+
/** Fill color applied to all sixty-two faces. */
|
|
1508
|
+
color?: string;
|
|
1509
|
+
}
|
|
1510
|
+
declare function rhombicosidodecahedronPolygons(options: RhombicosidodecahedronPolygonsOptions): Polygon[];
|
|
1511
|
+
|
|
1512
|
+
/**
|
|
1513
|
+
* Geometry for a snub cube — 32 triangular faces + 6 square faces (38 faces
|
|
1514
|
+
* total, 24 vertices). This is a chiral Archimedean solid; the right-handed
|
|
1515
|
+
* enantiomorph is produced here (see chirality note below).
|
|
1516
|
+
*
|
|
1517
|
+
* The 24 vertices involve the tribonacci constant t ≈ 1.83929, the real root of
|
|
1518
|
+
* t³ = t² + t + 1. The vertex set is:
|
|
1519
|
+
* - even cyclic permutations of (±1, ±1/t, ±t) with an even number of minuses, AND
|
|
1520
|
+
* - odd (anti-cyclic) permutations of (±1, ±1/t, ±t) with an odd number of minuses.
|
|
1521
|
+
*
|
|
1522
|
+
* Chirality: the right-handed convention is fixed by the choice of
|
|
1523
|
+
* "even-perm × even-sign + odd-perm × odd-sign" — the alternative pairing
|
|
1524
|
+
* produces the left-handed mirror image.
|
|
1525
|
+
*
|
|
1526
|
+
* Face decomposition:
|
|
1527
|
+
* 32 triangles — 8 sets of 4 snub triangles (filling the gaps between squares).
|
|
1528
|
+
* 6 squares — one per face of the parent cube.
|
|
1529
|
+
*
|
|
1530
|
+
* Faces discovered via edge-graph enumeration (planar, outward-facing cycles of
|
|
1531
|
+
* length 3 and 4). Each face is CCW-from-outside.
|
|
1532
|
+
*/
|
|
1533
|
+
|
|
1534
|
+
interface SnubCubePolygonsOptions {
|
|
1535
|
+
/** Center of the snub cube in world space. */
|
|
1536
|
+
center: Vec3;
|
|
1537
|
+
/** Circumradius — distance from center to each vertex. */
|
|
1538
|
+
size: number;
|
|
1539
|
+
/** Fill color applied to all thirty-eight faces. */
|
|
1540
|
+
color?: string;
|
|
1541
|
+
}
|
|
1542
|
+
declare function snubCubePolygons(options: SnubCubePolygonsOptions): Polygon[];
|
|
1543
|
+
|
|
1544
|
+
/**
|
|
1545
|
+
* Geometry for a snub dodecahedron — 80 triangular faces + 12 pentagonal faces
|
|
1546
|
+
* (92 faces total, 60 vertices). This is a chiral Archimedean solid; the
|
|
1547
|
+
* right-handed enantiomorph is produced here.
|
|
1548
|
+
*
|
|
1549
|
+
* Construction (numerical snub operation on the icosahedron):
|
|
1550
|
+
* For each of the 60 directed icosahedron edges (i→j), one snub vertex is placed at:
|
|
1551
|
+
*
|
|
1552
|
+
* v_ij = normalise((1−t)·ico[i] + t·ico[j] + s·normalise(ico[i] × ico[j]))
|
|
1553
|
+
*
|
|
1554
|
+
* where t ≈ 0.3554 and s ≈ 0.1342 are the unique snub parameters satisfying two
|
|
1555
|
+
* simultaneous conditions:
|
|
1556
|
+
* (a) inner-triangle edge length = cross-edge length (v_ij to v_ji)
|
|
1557
|
+
* (b) inner-triangle edge length = pentagon edge length (v_ij to v_ik for adjacent k)
|
|
1558
|
+
*
|
|
1559
|
+
* These parameters are solved numerically via Newton's method to machine precision.
|
|
1560
|
+
* All 60 vertices lie exactly on the unit sphere before scaling.
|
|
1561
|
+
*
|
|
1562
|
+
* Chirality: the right-handed enantiomorph is produced. The chirality is fixed
|
|
1563
|
+
* by the sign of the s component: positive s causes the snub vertices to be
|
|
1564
|
+
* displaced in the direction of ico[i] × ico[j] (the right-hand cross product).
|
|
1565
|
+
* The opposite sign produces the left-handed mirror image.
|
|
1566
|
+
*
|
|
1567
|
+
* Face decomposition:
|
|
1568
|
+
* 80 triangles — inner snub triangles (one per icosahedron face) plus outer
|
|
1569
|
+
* snub triangles connecting adjacent face pairs.
|
|
1570
|
+
* 12 pentagons — one per icosahedron vertex (5 snub vertices surrounding each).
|
|
1571
|
+
*
|
|
1572
|
+
* Faces discovered via edge-graph enumeration (planar, outward-facing cycles of
|
|
1573
|
+
* length 3 and 5). Each face is CCW-from-outside.
|
|
1574
|
+
*/
|
|
1575
|
+
|
|
1576
|
+
interface SnubDodecahedronPolygonsOptions {
|
|
1577
|
+
/** Center of the snub dodecahedron in world space. */
|
|
1578
|
+
center: Vec3;
|
|
1579
|
+
/** Circumradius — distance from center to each vertex. */
|
|
1580
|
+
size: number;
|
|
1581
|
+
/** Fill color applied to all ninety-two faces. */
|
|
1582
|
+
color?: string;
|
|
1583
|
+
}
|
|
1584
|
+
declare function snubDodecahedronPolygons(options: SnubDodecahedronPolygonsOptions): Polygon[];
|
|
1585
|
+
|
|
1586
|
+
/**
|
|
1587
|
+
* Geometry for a rhombic dodecahedron — 12 rhombic faces (24 vertices of the dual).
|
|
1588
|
+
* The dual of the cuboctahedron.
|
|
1589
|
+
*/
|
|
1590
|
+
|
|
1591
|
+
interface RhombicDodecahedronPolygonsOptions {
|
|
1592
|
+
center: Vec3;
|
|
1593
|
+
size: number;
|
|
1594
|
+
color?: string;
|
|
1595
|
+
}
|
|
1596
|
+
declare function rhombicDodecahedronPolygons(options: RhombicDodecahedronPolygonsOptions): Polygon[];
|
|
1597
|
+
|
|
1598
|
+
/**
|
|
1599
|
+
* Geometry for a rhombic triacontahedron — 30 rhombic faces.
|
|
1600
|
+
* The dual of the icosidodecahedron.
|
|
1601
|
+
*/
|
|
1602
|
+
|
|
1603
|
+
interface RhombicTriacontahedronPolygonsOptions {
|
|
1604
|
+
center: Vec3;
|
|
1605
|
+
size: number;
|
|
1606
|
+
color?: string;
|
|
1607
|
+
}
|
|
1608
|
+
declare function rhombicTriacontahedronPolygons(options: RhombicTriacontahedronPolygonsOptions): Polygon[];
|
|
1609
|
+
|
|
1610
|
+
/**
|
|
1611
|
+
* Geometry for a triakis tetrahedron — 12 isosceles-triangle faces.
|
|
1612
|
+
* The dual of the truncated tetrahedron.
|
|
1613
|
+
*/
|
|
1614
|
+
|
|
1615
|
+
interface TriakisTetrahedronPolygonsOptions {
|
|
1616
|
+
center: Vec3;
|
|
1617
|
+
size: number;
|
|
1618
|
+
color?: string;
|
|
1619
|
+
}
|
|
1620
|
+
declare function triakisTetrahedronPolygons(options: TriakisTetrahedronPolygonsOptions): Polygon[];
|
|
1621
|
+
|
|
1622
|
+
/**
|
|
1623
|
+
* Geometry for a triakis octahedron — 24 isosceles-triangle faces.
|
|
1624
|
+
* The dual of the truncated cube.
|
|
1625
|
+
*/
|
|
1626
|
+
|
|
1627
|
+
interface TriakisOctahedronPolygonsOptions {
|
|
1628
|
+
center: Vec3;
|
|
1629
|
+
size: number;
|
|
1630
|
+
color?: string;
|
|
1631
|
+
}
|
|
1632
|
+
declare function triakisOctahedronPolygons(options: TriakisOctahedronPolygonsOptions): Polygon[];
|
|
1633
|
+
|
|
1634
|
+
/**
|
|
1635
|
+
* Geometry for a tetrakis hexahedron — 24 isosceles-triangle faces.
|
|
1636
|
+
* The dual of the truncated octahedron.
|
|
1637
|
+
*/
|
|
1638
|
+
|
|
1639
|
+
interface TetrakisHexahedronPolygonsOptions {
|
|
1640
|
+
center: Vec3;
|
|
1641
|
+
size: number;
|
|
1642
|
+
color?: string;
|
|
1643
|
+
}
|
|
1644
|
+
declare function tetrakisHexahedronPolygons(options: TetrakisHexahedronPolygonsOptions): Polygon[];
|
|
1645
|
+
|
|
1646
|
+
/**
|
|
1647
|
+
* Geometry for a triakis icosahedron — 60 isosceles-triangle faces.
|
|
1648
|
+
* The dual of the truncated dodecahedron.
|
|
1649
|
+
*/
|
|
1650
|
+
|
|
1651
|
+
interface TriakisIcosahedronPolygonsOptions {
|
|
1652
|
+
center: Vec3;
|
|
1653
|
+
size: number;
|
|
1654
|
+
color?: string;
|
|
1655
|
+
}
|
|
1656
|
+
declare function triakisIcosahedronPolygons(options: TriakisIcosahedronPolygonsOptions): Polygon[];
|
|
1657
|
+
|
|
1658
|
+
/**
|
|
1659
|
+
* Geometry for a pentakis dodecahedron — 60 isosceles-triangle faces.
|
|
1660
|
+
* The dual of the truncated icosahedron.
|
|
1661
|
+
*/
|
|
1662
|
+
|
|
1663
|
+
interface PentakisDodecahedronPolygonsOptions {
|
|
1664
|
+
center: Vec3;
|
|
1665
|
+
size: number;
|
|
1666
|
+
color?: string;
|
|
1667
|
+
}
|
|
1668
|
+
declare function pentakisDodecahedronPolygons(options: PentakisDodecahedronPolygonsOptions): Polygon[];
|
|
1669
|
+
|
|
1670
|
+
/**
|
|
1671
|
+
* Geometry for a disdyakis dodecahedron — 48 scalene-triangle faces.
|
|
1672
|
+
* The dual of the truncated cuboctahedron.
|
|
1673
|
+
*/
|
|
1674
|
+
|
|
1675
|
+
interface DisdyakisDodecahedronPolygonsOptions {
|
|
1676
|
+
center: Vec3;
|
|
1677
|
+
size: number;
|
|
1678
|
+
color?: string;
|
|
1679
|
+
}
|
|
1680
|
+
declare function disdyakisDodecahedronPolygons(options: DisdyakisDodecahedronPolygonsOptions): Polygon[];
|
|
1681
|
+
|
|
1682
|
+
/**
|
|
1683
|
+
* Geometry for a disdyakis triacontahedron — 120 scalene-triangle faces.
|
|
1684
|
+
* The dual of the truncated icosidodecahedron.
|
|
1685
|
+
*/
|
|
1686
|
+
|
|
1687
|
+
interface DisdyakisTriacontahedronPolygonsOptions {
|
|
1688
|
+
center: Vec3;
|
|
1689
|
+
size: number;
|
|
1690
|
+
color?: string;
|
|
1691
|
+
}
|
|
1692
|
+
declare function disdyakisTriacontahedronPolygons(options: DisdyakisTriacontahedronPolygonsOptions): Polygon[];
|
|
1693
|
+
|
|
1694
|
+
/**
|
|
1695
|
+
* Geometry for a deltoidal icositetrahedron — 24 kite faces.
|
|
1696
|
+
* The dual of the rhombicuboctahedron.
|
|
1697
|
+
*/
|
|
1698
|
+
|
|
1699
|
+
interface DeltoidalIcositetrahedronPolygonsOptions {
|
|
1700
|
+
center: Vec3;
|
|
1701
|
+
size: number;
|
|
1702
|
+
color?: string;
|
|
1703
|
+
}
|
|
1704
|
+
declare function deltoidalIcositetrahedronPolygons(options: DeltoidalIcositetrahedronPolygonsOptions): Polygon[];
|
|
1705
|
+
|
|
1706
|
+
/**
|
|
1707
|
+
* Geometry for a deltoidal hexecontahedron — 60 kite faces.
|
|
1708
|
+
* The dual of the rhombicosidodecahedron.
|
|
1709
|
+
*/
|
|
1710
|
+
|
|
1711
|
+
interface DeltoidalHexecontahedronPolygonsOptions {
|
|
1712
|
+
center: Vec3;
|
|
1713
|
+
size: number;
|
|
1714
|
+
color?: string;
|
|
1715
|
+
}
|
|
1716
|
+
declare function deltoidalHexecontahedronPolygons(options: DeltoidalHexecontahedronPolygonsOptions): Polygon[];
|
|
1717
|
+
|
|
1718
|
+
/**
|
|
1719
|
+
* Geometry for a pentagonal icositetrahedron — 24 irregular-pentagon faces.
|
|
1720
|
+
* The dual of the snub cube.
|
|
1721
|
+
*/
|
|
1722
|
+
|
|
1723
|
+
interface PentagonalIcositetrahedronPolygonsOptions {
|
|
1724
|
+
center: Vec3;
|
|
1725
|
+
size: number;
|
|
1726
|
+
color?: string;
|
|
1727
|
+
}
|
|
1728
|
+
declare function pentagonalIcositetrahedronPolygons(options: PentagonalIcositetrahedronPolygonsOptions): Polygon[];
|
|
1729
|
+
|
|
1730
|
+
/**
|
|
1731
|
+
* Geometry for a pentagonal hexecontahedron — 60 irregular-pentagon faces.
|
|
1732
|
+
* The dual of the snub dodecahedron.
|
|
1733
|
+
*/
|
|
1734
|
+
|
|
1735
|
+
interface PentagonalHexecontahedronPolygonsOptions {
|
|
1736
|
+
center: Vec3;
|
|
1737
|
+
size: number;
|
|
1738
|
+
color?: string;
|
|
1739
|
+
}
|
|
1740
|
+
declare function pentagonalHexecontahedronPolygons(options: PentagonalHexecontahedronPolygonsOptions): Polygon[];
|
|
1741
|
+
|
|
1742
|
+
type GlyphGeometryName = "tetrahedron" | "cube" | "octahedron" | "dodecahedron" | "icosahedron" | "smallStellatedDodecahedron" | "greatDodecahedron" | "greatStellatedDodecahedron" | "greatIcosahedron" | "cuboctahedron" | "icosidodecahedron" | "truncatedTetrahedron" | "truncatedCube" | "truncatedOctahedron" | "truncatedDodecahedron" | "truncatedIcosahedron" | "truncatedCuboctahedron" | "truncatedIcosidodecahedron" | "rhombicuboctahedron" | "rhombicosidodecahedron" | "snubCube" | "snubDodecahedron" | "rhombicDodecahedron" | "rhombicTriacontahedron" | "triakisTetrahedron" | "triakisOctahedron" | "triakisIcosahedron" | "tetrakisHexahedron" | "pentakisDodecahedron" | "disdyakisDodecahedron" | "disdyakisTriacontahedron" | "deltoidalIcositetrahedron" | "deltoidalHexecontahedron" | "pentagonalIcositetrahedron" | "pentagonalHexecontahedron" | "sphere" | "cylinder" | "cone" | "torus" | "pyramid" | "prism" | "antiprism" | "bipyramid" | "trapezohedron";
|
|
1743
|
+
interface GlyphGeometryOptions {
|
|
1744
|
+
center?: Vec3;
|
|
1745
|
+
size?: number;
|
|
1746
|
+
color?: string;
|
|
1747
|
+
}
|
|
1748
|
+
/**
|
|
1749
|
+
* Resolve a built-in geometry name to a `Polygon[]` list.
|
|
1750
|
+
*
|
|
1751
|
+
* Precedence for mesh sources: explicit `polygons` > `src` > `geometry`.
|
|
1752
|
+
* When both `src` and `geometry` are supplied, `src` wins silently.
|
|
1753
|
+
*/
|
|
1754
|
+
declare function resolveGeometry(name: GlyphGeometryName, opts?: GlyphGeometryOptions): Polygon[];
|
|
1755
|
+
|
|
806
1756
|
/**
|
|
807
1757
|
* Unified parser return type. All polygon-emitting parsers (parseObj,
|
|
808
1758
|
* parseGltf, the loadMesh dispatcher) return this exact shape.
|
|
@@ -835,7 +1785,7 @@ interface ParseAnimationController {
|
|
|
835
1785
|
sample: (clip: number | string, timeSeconds: number) => Polygon[];
|
|
836
1786
|
}
|
|
837
1787
|
interface ParseResult {
|
|
838
|
-
/** The mesh, as a flat polygon list. Already vertex-permuted to
|
|
1788
|
+
/** The mesh, as a flat polygon list. Already vertex-permuted to glyphcss space. */
|
|
839
1789
|
polygons: Polygon[];
|
|
840
1790
|
/** Optional animation sampler for formats that carry timeline data. */
|
|
841
1791
|
animation?: ParseAnimationController;
|
|
@@ -872,7 +1822,7 @@ interface ParseResult {
|
|
|
872
1822
|
}
|
|
873
1823
|
|
|
874
1824
|
/**
|
|
875
|
-
*
|
|
1825
|
+
* GlyphAnimationMixer — three.js-shaped animation API for glyphcss.
|
|
876
1826
|
*
|
|
877
1827
|
* Mirrors three.js's AnimationMixer + AnimationAction surface closely enough
|
|
878
1828
|
* that users familiar with drei's `useAnimations` can migrate without friction.
|
|
@@ -887,44 +1837,44 @@ declare const LoopPingPong: 2202;
|
|
|
887
1837
|
type LoopMode = typeof LoopOnce | typeof LoopRepeat | typeof LoopPingPong;
|
|
888
1838
|
|
|
889
1839
|
/**
|
|
890
|
-
* Minimal target interface the mixer requires. `
|
|
1840
|
+
* Minimal target interface the mixer requires. `GlyphMeshHandle` from both
|
|
891
1841
|
* the glyphcss vanilla API and the React/Vue frameworks satisfies this
|
|
892
1842
|
* structurally — no import needed.
|
|
893
1843
|
*/
|
|
894
|
-
interface
|
|
1844
|
+
interface GlyphAnimationTarget {
|
|
895
1845
|
setPolygons(polygons: Polygon[]): void;
|
|
896
1846
|
}
|
|
897
1847
|
/**
|
|
898
1848
|
* Per-clip playback action. Mirrors three.js `AnimationAction` method surface.
|
|
899
1849
|
* All mutating methods return `this` for chaining.
|
|
900
1850
|
*/
|
|
901
|
-
interface
|
|
1851
|
+
interface GlyphAnimationAction {
|
|
902
1852
|
/** Start playing (sets weight=1, resets time if not already playing). */
|
|
903
|
-
play():
|
|
1853
|
+
play(): GlyphAnimationAction;
|
|
904
1854
|
/** Stop playing and reset time to 0. */
|
|
905
|
-
stop():
|
|
1855
|
+
stop(): GlyphAnimationAction;
|
|
906
1856
|
/** Reset time to 0 without stopping. */
|
|
907
|
-
reset():
|
|
1857
|
+
reset(): GlyphAnimationAction;
|
|
908
1858
|
/** Fade weight from 0 to 1 over `durationSeconds`. */
|
|
909
|
-
fadeIn(durationSeconds: number):
|
|
1859
|
+
fadeIn(durationSeconds: number): GlyphAnimationAction;
|
|
910
1860
|
/** Fade weight from current to 0 over `durationSeconds`. */
|
|
911
|
-
fadeOut(durationSeconds: number):
|
|
1861
|
+
fadeOut(durationSeconds: number): GlyphAnimationAction;
|
|
912
1862
|
/**
|
|
913
1863
|
* Cross-fade from this action to `target` over `durationSeconds`.
|
|
914
1864
|
* Fades this out and target in simultaneously.
|
|
915
1865
|
*/
|
|
916
|
-
crossFadeTo(target:
|
|
1866
|
+
crossFadeTo(target: GlyphAnimationAction, durationSeconds: number): GlyphAnimationAction;
|
|
917
1867
|
/**
|
|
918
1868
|
* Cross-fade from `from` into this action over `durationSeconds`.
|
|
919
1869
|
* Sugar for `from.fadeOut(d); this.fadeIn(d)`.
|
|
920
1870
|
*/
|
|
921
|
-
crossFadeFrom(from:
|
|
1871
|
+
crossFadeFrom(from: GlyphAnimationAction, durationSeconds: number): GlyphAnimationAction;
|
|
922
1872
|
/** Set loop mode and repetition count. */
|
|
923
|
-
setLoop(mode: LoopMode, repetitions: number):
|
|
1873
|
+
setLoop(mode: LoopMode, repetitions: number): GlyphAnimationAction;
|
|
924
1874
|
/** Override the effective time scale. */
|
|
925
|
-
setEffectiveTimeScale(scale: number):
|
|
1875
|
+
setEffectiveTimeScale(scale: number): GlyphAnimationAction;
|
|
926
1876
|
/** Override the effective weight. */
|
|
927
|
-
setEffectiveWeight(weight: number):
|
|
1877
|
+
setEffectiveWeight(weight: number): GlyphAnimationAction;
|
|
928
1878
|
/** When true, the action freezes on the last frame after finishing. */
|
|
929
1879
|
clampWhenFinished: boolean;
|
|
930
1880
|
/** Playback speed multiplier. Default 1. */
|
|
@@ -947,20 +1897,20 @@ interface GlyphcssAnimationAction {
|
|
|
947
1897
|
readonly isRunning: boolean;
|
|
948
1898
|
}
|
|
949
1899
|
/**
|
|
950
|
-
* Drives one or more `
|
|
1900
|
+
* Drives one or more `GlyphAnimationAction`s against a single mesh target.
|
|
951
1901
|
* Mirrors the three.js `AnimationMixer` API.
|
|
952
1902
|
*/
|
|
953
|
-
interface
|
|
1903
|
+
interface GlyphAnimationMixer {
|
|
954
1904
|
/**
|
|
955
1905
|
* Return the action for a clip (by index or name). Creates the action if it
|
|
956
1906
|
* doesn't exist yet (lazy instantiation, same as three.js).
|
|
957
1907
|
*/
|
|
958
|
-
clipAction(clip: number | string):
|
|
1908
|
+
clipAction(clip: number | string): GlyphAnimationAction;
|
|
959
1909
|
/**
|
|
960
1910
|
* Return an existing action without creating one. Returns null if the
|
|
961
1911
|
* action hasn't been instantiated yet.
|
|
962
1912
|
*/
|
|
963
|
-
existingAction(clip: number | string):
|
|
1913
|
+
existingAction(clip: number | string): GlyphAnimationAction | null;
|
|
964
1914
|
/**
|
|
965
1915
|
* Advance all active actions by `deltaSeconds` and apply the resulting
|
|
966
1916
|
* polygon frame to the root target. Call this once per animation frame.
|
|
@@ -973,7 +1923,7 @@ interface GlyphcssAnimationMixer {
|
|
|
973
1923
|
/** Remove all cached actions for this mixer's root. */
|
|
974
1924
|
uncacheRoot(): void;
|
|
975
1925
|
}
|
|
976
|
-
declare function
|
|
1926
|
+
declare function createGlyphAnimationMixer(root: GlyphAnimationTarget, controller: ParseAnimationController): GlyphAnimationMixer;
|
|
977
1927
|
|
|
978
1928
|
interface ObjParseOptions {
|
|
979
1929
|
/**
|
|
@@ -1065,7 +2015,7 @@ interface GltfParseOptions {
|
|
|
1065
2015
|
/**
|
|
1066
2016
|
* Which axis is "up" in the source mesh.
|
|
1067
2017
|
* - "y" (default, glTF spec): cyclic permutation (x,y,z) → (z,x,y) so
|
|
1068
|
-
* +Y ends up on
|
|
2018
|
+
* +Y ends up on glyphcss's +Z (elevation).
|
|
1069
2019
|
* - "z" (Blender-style, FBX2glTF often emits this): identity, no swap.
|
|
1070
2020
|
* Pick "z" if the model lands on its side / lies down instead of
|
|
1071
2021
|
* standing.
|
|
@@ -1178,4 +2128,4 @@ declare function project(v: Vec3, cols: number, rows: number, cellAspect: number
|
|
|
1178
2128
|
/** Public: derive feature edges from a triangle list. `featureAngleDeg = 0` = all edges. */
|
|
1179
2129
|
declare function trianglesToFeatureEdges(triangles: TextureTriangle[], featureAngleDeg?: number): WireframeEdge[];
|
|
1180
2130
|
|
|
1181
|
-
export { type ApproximateMergeOptions, type ArrowPolygonsOptions, type AutoRotateConfig, type AutoRotateOption, type AxesHelperOptions, BASE_TILE, CAMERA_BACKFACE_CULL_EPS, type CameraCullNormalGroup, type CameraCullRotation, type CameraHandle, type CameraState, type CameraStyleInput, type CharRamp, type CoverPlanarPolygonsOptions, type CullInteriorOptions, DEFAULT_CAMERA_STATE, DEFAULT_PROJECTION, type DedupeOverlappingPolygonsOptions, type EdgeWeight, type GltfParseOptions, type
|
|
2131
|
+
export { type AntiprismPolygonsOptions, type ApproximateMergeOptions, type ArrowPolygonsOptions, type AutoRotateConfig, type AutoRotateOption, type AxesHelperOptions, BASE_TILE, type BipyramidPolygonsOptions, CAMERA_BACKFACE_CULL_EPS, type CameraCullNormalGroup, type CameraCullRotation, type CameraHandle, type CameraState, type CameraStyleInput, type CharRamp, type ConePolygonsOptions, type CoverPlanarPolygonsOptions, type CubePolygonsOptions, type CuboctahedronPolygonsOptions, type CullInteriorOptions, type CylinderPolygonsOptions, DEFAULT_CAMERA_STATE, DEFAULT_PROJECTION, type DedupeOverlappingPolygonsOptions, type DeltoidalHexecontahedronPolygonsOptions, type DeltoidalIcositetrahedronPolygonsOptions, type DisdyakisDodecahedronPolygonsOptions, type DisdyakisTriacontahedronPolygonsOptions, type DodecahedronPolygonsOptions, type EdgeWeight, type GltfParseOptions, type GlyphAmbientLight, type GlyphAnimationAction, type ParseAnimationClip as GlyphAnimationClip, type GlyphAnimationMixer, type GlyphAnimationTarget, type GlyphDirectionalLight, type GlyphGeometryName, type GlyphGeometryOptions, type GreatDodecahedronPolygonsOptions, type GreatIcosahedronPolygonsOptions, type GreatStellatedDodecahedronPolygonsOptions, type GridSize, type Hotspot, type HotspotCell, type IcosahedronPolygonsOptions, type IcosidodecahedronPolygonsOptions, type LoadMeshOptions, type LoopMode, LoopOnce, LoopPingPong, LoopRepeat, type MeshResolution, type MtlParseResult, type NormalizeResult, type ObjParseOptions, type OctahedronPolygonsOptions, type OptimizeMeshPolygonsOptions, type ParseAnimationClip, type ParseAnimationController, type ParseResult, type ParsedColor, type PentagonalHexecontahedronPolygonsOptions, type PentagonalIcositetrahedronPolygonsOptions, type PentakisDodecahedronPolygonsOptions, type PlanePolygonsOptions, type Polygon, type PolygonFace, type PrismPolygonsOptions, type PyramidPolygonsOptions, QUAT_IDENTITY, type Quat, type RenderMode, type RhombicDodecahedronPolygonsOptions, type RhombicTriacontahedronPolygonsOptions, type RhombicosidodecahedronPolygonsOptions, type RhombicuboctahedronPolygonsOptions, type RingPolygonsOptions, type RingQuadPolygonsOptions, type SceneBbox, type SceneContext, type SceneContextBuildArgs, type SceneContextBuildResult, type SmallStellatedDodecahedronPolygonsOptions, type SnubCubePolygonsOptions, type SnubDodecahedronPolygonsOptions, type SolidTextureSampleOptions, type SpherePolygonsOptions, type TetrahedronPolygonsOptions, type TetrakisHexahedronPolygonsOptions, type TextureTriangle, type TorusPolygonsOptions, type TrapezohedronPolygonsOptions, type TriakisIcosahedronPolygonsOptions, type TriakisOctahedronPolygonsOptions, type TriakisTetrahedronPolygonsOptions, type TruncatedCubePolygonsOptions, type TruncatedCuboctahedronPolygonsOptions, type TruncatedDodecahedronPolygonsOptions, type TruncatedIcosahedronPolygonsOptions, type TruncatedIcosidodecahedronPolygonsOptions, type TruncatedOctahedronPolygonsOptions, type TruncatedTetrahedronPolygonsOptions, VOXEL_CAMERA_CULL_AXIS_EPS, VOXEL_CAMERA_CULL_NORMAL_LIMIT, type Vec2, type Vec3, type VoxParseOptions, type WireframeEdge, antiprismPolygons, arrowPolygons, axesHelperPolygons, bakeSolidTextureSampledPolygons, bakeSolidTextureSamples, bipyramidPolygons, buildSceneContext, cameraCullNormalGroups, cameraCullNormalGroupsFromPolygons, cameraCullNormalKey, cameraCullVisibleSignature, cameraFacingDepth, clampChannel, computeSceneBbox, computeShapeLighting, conePolygons, coverPlanarPolygons, createGlyphAnimationMixer, createIsometricCamera, cubePolygons, cuboctahedronPolygons, cullInteriorPolygons, cylinderPolygons, dedupeOverlappingPolygons, deltoidalHexecontahedronPolygons, deltoidalIcositetrahedronPolygons, disdyakisDodecahedronPolygons, disdyakisTriacontahedronPolygons, dodecahedronPolygons, eulerXYZFromQuat, findOverlappingPolygonDuplicates, formatColor, greatDodecahedronPolygons, greatIcosahedronPolygons, greatStellatedDodecahedronPolygons, icosahedronPolygons, icosidodecahedronPolygons, inverseRotateVec3, isAxisAlignedSurfaceNormal, isVoxelCameraCullableNormalGroups, loadMesh, mergePolygons, normalFacesCamera, normalizeInvertMultiplier, normalizePolygons, octahedronPolygons, optimizeMeshPolygons, parseColor, parseGltf, parseHexColor, parseMtl, parseObj, parsePureColor, parseRgbColor, parseVox, pentagonalHexecontahedronPolygons, pentagonalIcositetrahedronPolygons, pentakisDodecahedronPolygons, planePolygons, polygonCssSurfaceNormal, polygonFaces, polygonFacesCamera, prismPolygons, project, pyramidPolygons, quatFromAxisAngle, quatFromEulerXYZ, quatMultiply, resolveGeometry, rhombicDodecahedronPolygons, rhombicTriacontahedronPolygons, rhombicosidodecahedronPolygons, rhombicuboctahedronPolygons, ringPolygons, ringQuadPolygons, rotateVec3, shadeColor, smallStellatedDodecahedronPolygons, snubCubePolygons, snubDodecahedronPolygons, spherePolygons, tetrahedronPolygons, tetrakisHexahedronPolygons, torusPolygons, trapezohedronPolygons, triakisIcosahedronPolygons, triakisOctahedronPolygons, triakisTetrahedronPolygons, trianglesToFeatureEdges, truncatedCubePolygons, truncatedCuboctahedronPolygons, truncatedDodecahedronPolygons, truncatedIcosahedronPolygons, truncatedIcosidodecahedronPolygons, truncatedOctahedronPolygons, truncatedTetrahedronPolygons };
|