kaabalah 6.6.4 → 6.8.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/dist/astrology/index.js +54 -54
- package/dist/astrology/index.js.map +1 -1
- package/dist/astrology/index.mjs +3 -3
- package/dist/astrology/index.mjs.map +1 -1
- package/dist/chunk-2WCC2KCJ.js +1 -1
- package/dist/chunk-2WCC2KCJ.js.map +1 -1
- package/dist/{chunk-XTE5DSDO.js → chunk-36XZ5WR2.js} +23 -23
- package/dist/chunk-36XZ5WR2.js.map +1 -0
- package/dist/{chunk-6P2CJUTH.mjs → chunk-3UJPBUY4.mjs} +8 -6
- package/dist/chunk-3UJPBUY4.mjs.map +1 -0
- package/dist/{chunk-FM7WUVZV.js → chunk-4337NVKS.js} +8 -4
- package/dist/chunk-4337NVKS.js.map +1 -0
- package/dist/{chunk-3TBUVMHV.mjs → chunk-5HXSHALQ.mjs} +1210 -272
- package/dist/chunk-5HXSHALQ.mjs.map +1 -0
- package/dist/{chunk-EFZUZI22.mjs → chunk-5K4OQ4UB.mjs} +5 -4
- package/dist/chunk-5K4OQ4UB.mjs.map +1 -0
- package/dist/{chunk-ZKIJAZ6B.mjs → chunk-6N5YC2WD.mjs} +338 -10
- package/dist/chunk-6N5YC2WD.mjs.map +1 -0
- package/dist/{chunk-PWYOHULD.mjs → chunk-7YU7TRCG.mjs} +80 -42
- package/dist/chunk-7YU7TRCG.mjs.map +1 -0
- package/dist/{chunk-6O7MTBZN.js → chunk-BEFGGHIJ.js} +84 -46
- package/dist/chunk-BEFGGHIJ.js.map +1 -0
- package/dist/{chunk-MTI2SOQ6.mjs → chunk-ITESL6GR.mjs} +4 -4
- package/dist/chunk-ITESL6GR.mjs.map +1 -0
- package/dist/{chunk-UG6HZK3Z.js → chunk-K33NFXSD.js} +109 -109
- package/dist/chunk-K33NFXSD.js.map +1 -0
- package/dist/{chunk-OKZUVGA3.js → chunk-LQX6PW35.js} +349 -15
- package/dist/chunk-LQX6PW35.js.map +1 -0
- package/dist/{chunk-WY6NIR2V.mjs → chunk-NPQZ2DOY.mjs} +8 -4
- package/dist/chunk-NPQZ2DOY.mjs.map +1 -0
- package/dist/{chunk-WIKUOEOB.mjs → chunk-QS5XAAAG.mjs} +31 -19
- package/dist/chunk-QS5XAAAG.mjs.map +1 -0
- package/dist/{chunk-UN7QMOMX.mjs → chunk-SHKAAZHT.mjs} +8 -8
- package/dist/chunk-SHKAAZHT.mjs.map +1 -0
- package/dist/{chunk-COPYH3O2.js → chunk-SYLFUBAB.js} +51 -39
- package/dist/chunk-SYLFUBAB.js.map +1 -0
- package/dist/chunk-URDMOQRN.mjs +1 -1
- package/dist/chunk-URDMOQRN.mjs.map +1 -1
- package/dist/{chunk-PAKYKIZH.js → chunk-UZ42PN5T.js} +10 -8
- package/dist/chunk-UZ42PN5T.js.map +1 -0
- package/dist/{chunk-S6KNERP7.js → chunk-VJ6RW5H4.js} +8 -7
- package/dist/chunk-VJ6RW5H4.js.map +1 -0
- package/dist/{chunk-NRAAMI6I.js → chunk-WLML6SVX.js} +1228 -275
- package/dist/chunk-WLML6SVX.js.map +1 -0
- package/dist/cli.js +2367 -657
- package/dist/cli.js.map +1 -1
- package/dist/core/index.d.mts +1 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +69 -45
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +4 -4
- package/dist/core/index.mjs.map +1 -1
- package/dist/gematria/index.js +7 -7
- package/dist/gematria/index.js.map +1 -1
- package/dist/gematria/index.mjs +4 -4
- package/dist/gematria/index.mjs.map +1 -1
- package/dist/ifa/index.js +2 -2
- package/dist/ifa/index.js.map +1 -1
- package/dist/ifa/index.mjs +2 -2
- package/dist/ifa/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +314 -230
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -10
- package/dist/index.mjs.map +1 -1
- package/dist/numerology/index.js +20 -20
- package/dist/numerology/index.js.map +1 -1
- package/dist/numerology/index.mjs +5 -5
- package/dist/numerology/index.mjs.map +1 -1
- package/dist/semantic/index.js +28 -28
- package/dist/semantic/index.js.map +1 -1
- package/dist/semantic/index.mjs +9 -9
- package/dist/semantic/index.mjs.map +1 -1
- package/dist/{wasm/build/swisseph.node-6H4ISR7M.mjs → swisseph.node-2PWBQLWG.mjs} +270 -156
- package/dist/swisseph.node-2PWBQLWG.mjs.map +1 -0
- package/dist/{wasm/build/swisseph.node-UD2JYYLE.js → swisseph.node-NWM75JF3.js} +283 -169
- package/dist/swisseph.node-NWM75JF3.js.map +1 -0
- package/dist/{wasm/build/swisseph.web-TSFJI7DQ.mjs → swisseph.web-CK57WSU3.mjs} +264 -153
- package/dist/swisseph.web-CK57WSU3.mjs.map +1 -0
- package/dist/{wasm/build/swisseph.web-MXYBWOOS.js → swisseph.web-GPTWPXKT.js} +277 -166
- package/dist/swisseph.web-GPTWPXKT.js.map +1 -0
- package/dist/tarot/index.js +25 -25
- package/dist/tarot/index.js.map +1 -1
- package/dist/tarot/index.mjs +5 -5
- package/dist/tarot/index.mjs.map +1 -1
- package/dist/topology-Bbgniegh.d.ts +102 -0
- package/dist/topology-CSSfYL2c.d.mts +102 -0
- package/dist/visual/index.d.mts +177 -2
- package/dist/visual/index.d.ts +177 -2
- package/dist/visual/index.js +91 -31
- package/dist/visual/index.js.map +1 -1
- package/dist/visual/index.mjs +5 -5
- package/dist/visual/index.mjs.map +1 -1
- package/dist/{swisseph.node-6H4ISR7M.mjs → wasm/build/swisseph.node-2PWBQLWG.mjs} +270 -156
- package/dist/wasm/build/swisseph.node-2PWBQLWG.mjs.map +1 -0
- package/dist/{swisseph.node-UD2JYYLE.js → wasm/build/swisseph.node-NWM75JF3.js} +283 -169
- package/dist/wasm/build/swisseph.node-NWM75JF3.js.map +1 -0
- package/dist/{swisseph.web-TSFJI7DQ.mjs → wasm/build/swisseph.web-CK57WSU3.mjs} +264 -153
- package/dist/wasm/build/swisseph.web-CK57WSU3.mjs.map +1 -0
- package/dist/{swisseph.web-MXYBWOOS.js → wasm/build/swisseph.web-GPTWPXKT.js} +277 -166
- package/dist/wasm/build/swisseph.web-GPTWPXKT.js.map +1 -0
- package/package.json +9 -8
- package/dist/chunk-3TBUVMHV.mjs.map +0 -1
- package/dist/chunk-6O7MTBZN.js.map +0 -1
- package/dist/chunk-6P2CJUTH.mjs.map +0 -1
- package/dist/chunk-COPYH3O2.js.map +0 -1
- package/dist/chunk-EFZUZI22.mjs.map +0 -1
- package/dist/chunk-FM7WUVZV.js.map +0 -1
- package/dist/chunk-MTI2SOQ6.mjs.map +0 -1
- package/dist/chunk-NRAAMI6I.js.map +0 -1
- package/dist/chunk-OKZUVGA3.js.map +0 -1
- package/dist/chunk-PAKYKIZH.js.map +0 -1
- package/dist/chunk-PWYOHULD.mjs.map +0 -1
- package/dist/chunk-S6KNERP7.js.map +0 -1
- package/dist/chunk-UG6HZK3Z.js.map +0 -1
- package/dist/chunk-UN7QMOMX.mjs.map +0 -1
- package/dist/chunk-WIKUOEOB.mjs.map +0 -1
- package/dist/chunk-WY6NIR2V.mjs.map +0 -1
- package/dist/chunk-XTE5DSDO.js.map +0 -1
- package/dist/chunk-ZKIJAZ6B.mjs.map +0 -1
- package/dist/swisseph.node-6H4ISR7M.mjs.map +0 -1
- package/dist/swisseph.node-UD2JYYLE.js.map +0 -1
- package/dist/swisseph.web-MXYBWOOS.js.map +0 -1
- package/dist/swisseph.web-TSFJI7DQ.mjs.map +0 -1
- package/dist/wasm/build/swisseph.node-6H4ISR7M.mjs.map +0 -1
- package/dist/wasm/build/swisseph.node-UD2JYYLE.js.map +0 -1
- package/dist/wasm/build/swisseph.web-MXYBWOOS.js.map +0 -1
- package/dist/wasm/build/swisseph.web-TSFJI7DQ.mjs.map +0 -1
|
@@ -1,4 +1,840 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TREE_TOPOLOGY_SPHERE_NAMES, TREE_TOPOLOGY_SPHERE_IDS, TREE_TOPOLOGY_PATH_IDS } from './chunk-6N5YC2WD.mjs';
|
|
2
|
+
import { id, createTree } from './chunk-5K4OQ4UB.mjs';
|
|
3
|
+
|
|
4
|
+
// src/visual/archeometer.ts
|
|
5
|
+
var TAU = Math.PI * 2;
|
|
6
|
+
var ARCHEOMETER_DEFAULT_VIEWBOX = {
|
|
7
|
+
minX: 0,
|
|
8
|
+
minY: 0,
|
|
9
|
+
width: 912,
|
|
10
|
+
height: 912
|
|
11
|
+
};
|
|
12
|
+
var ARCHEOMETER_OUTER_CROWN_BLEED = 22;
|
|
13
|
+
var DEFAULT_LAYERS = {
|
|
14
|
+
degreeCrown: true,
|
|
15
|
+
zodiacUtterance: true,
|
|
16
|
+
planetaryUtterance: true,
|
|
17
|
+
cosmologicalMusic: true,
|
|
18
|
+
astralZodiac: true,
|
|
19
|
+
astralPlanetary: true,
|
|
20
|
+
chromicRays: true,
|
|
21
|
+
whiteRays: true,
|
|
22
|
+
solarCenter: true
|
|
23
|
+
};
|
|
24
|
+
var COLOR_RING_FILLS = {
|
|
25
|
+
degreeOuter: "#fff8ef",
|
|
26
|
+
degreeInner: "#fff2e1",
|
|
27
|
+
zodiacUtterance: "#eba0be",
|
|
28
|
+
planetaryUtterance: "#fffaf1",
|
|
29
|
+
cosmologicalMusic: "#fffaf0",
|
|
30
|
+
astralZodiac: "#efc0bc",
|
|
31
|
+
astralPlanetary: "#d2e8df",
|
|
32
|
+
chromicRays: "#fff3d4",
|
|
33
|
+
whiteRays: "#eef1ec",
|
|
34
|
+
solarCenter: "#f7d65b"
|
|
35
|
+
};
|
|
36
|
+
var COLOR_PALETTE = {
|
|
37
|
+
paper: "#fffaf1",
|
|
38
|
+
ink: "#151515",
|
|
39
|
+
subtleInk: "#605a54",
|
|
40
|
+
ringStroke: "#171717",
|
|
41
|
+
degreeTick: "#171717",
|
|
42
|
+
degreeLabel: "#171717",
|
|
43
|
+
whiteRay: "#25395a",
|
|
44
|
+
ringFills: COLOR_RING_FILLS
|
|
45
|
+
};
|
|
46
|
+
var DEFAULT_ARCHEOMETER_SECTOR_CORRESPONDENCES = [
|
|
47
|
+
{
|
|
48
|
+
degree: 0,
|
|
49
|
+
utterance: { id: "ph", degree: 0, letter: "P, Ph", number: 80, color: "#f2d54c", triangleId: "wordJesus", gloss: "Utterance / light" },
|
|
50
|
+
triangleLabel: { degree: 0, label: "S, Sh", number: 300 },
|
|
51
|
+
musicalNote: { degree: 0, note: "Si" },
|
|
52
|
+
zodiacSign: { degree: 0, name: "Capricorn", glyph: "\u2651" },
|
|
53
|
+
planetaryPoint: { degree: 0, name: "Saturn", glyph: "\u2644", phase: "diurnal" }
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
degree: 30,
|
|
57
|
+
utterance: { id: "za", degree: 30, letter: "W, OU", number: 70, color: "#b7d56a", triangleId: "ether", gloss: "Ether" },
|
|
58
|
+
triangleLabel: { degree: 30, label: "D", number: 4 },
|
|
59
|
+
musicalNote: { degree: 30, note: "Do" },
|
|
60
|
+
zodiacSign: { degree: 30, name: "Sagittarius", glyph: "\u2650" },
|
|
61
|
+
planetaryPoint: { degree: 30, name: "Jupiter", glyph: "\u2643", phase: "diurnal" }
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
degree: 60,
|
|
65
|
+
utterance: { id: "ma", degree: 60, letter: "M", number: 40, color: "#79bf6a", triangleId: "mary", gloss: "Mary" },
|
|
66
|
+
triangleLabel: { degree: 60, label: "C", number: 20 },
|
|
67
|
+
musicalNote: { degree: 60, note: "R\xE9" },
|
|
68
|
+
zodiacSign: { degree: 60, name: "Scorpio", glyph: "\u264F" },
|
|
69
|
+
planetaryPoint: { degree: 60, name: "Mars", glyph: "\u2642", phase: "diurnal" }
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
degree: 90,
|
|
73
|
+
utterance: { id: "u", degree: 90, letter: "L", number: 30, color: "#69ad74", triangleId: "divineFire", gloss: "Fire" },
|
|
74
|
+
triangleLabel: { degree: 90, label: "" },
|
|
75
|
+
musicalNote: { degree: 90, note: "Mi" },
|
|
76
|
+
zodiacSign: { degree: 90, name: "Libra", glyph: "\u264E" },
|
|
77
|
+
planetaryPoint: { degree: 90, name: "Venus", glyph: "\u2640", phase: "diurnal" }
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
degree: 120,
|
|
81
|
+
utterance: { id: "o", degree: 120, letter: "I, Y, J", number: 10, color: "#efb83e", triangleId: "wordJesus", gloss: "Voice / sound" },
|
|
82
|
+
triangleLabel: { degree: 120, label: "Ts", number: 90 },
|
|
83
|
+
musicalNote: { degree: 120, note: "Fa" },
|
|
84
|
+
zodiacSign: { degree: 120, name: "Virgo", glyph: "\u264D" },
|
|
85
|
+
planetaryPoint: { degree: 120, name: "Mercury", glyph: "\u263F", phase: "diurnal" }
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
degree: 150,
|
|
89
|
+
utterance: { id: "la", degree: 150, letter: "T", number: 9, color: "#ec8d3f", triangleId: "ether", gloss: "Ether" },
|
|
90
|
+
triangleLabel: { degree: 150, label: "N", number: 50 },
|
|
91
|
+
musicalNote: { degree: 150, note: "Sol" },
|
|
92
|
+
zodiacSign: { degree: 150, name: "Leo", glyph: "\u264C" },
|
|
93
|
+
planetaryPoint: { degree: 150, name: "Sun", glyph: "\u2609", phase: "diurnal" }
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
degree: 180,
|
|
97
|
+
utterance: { id: "ri", degree: 180, letter: "E, H", number: 8, color: "#df4d43", triangleId: "mary", gloss: "Descending R" },
|
|
98
|
+
triangleLabel: { degree: 180, label: "B", number: 2 },
|
|
99
|
+
musicalNote: { degree: 180, note: "La" },
|
|
100
|
+
zodiacSign: { degree: 180, name: "Cancer", glyph: "\u264B" },
|
|
101
|
+
planetaryPoint: { degree: 180, name: "Moon", glyph: "\u263E", phase: "nocturnal" }
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
degree: 210,
|
|
105
|
+
utterance: { id: "t", degree: 210, letter: "Z", number: 7, color: "#8b54ad", triangleId: "divineFire", gloss: "Divine fire" },
|
|
106
|
+
triangleLabel: { degree: 210, label: "Ts", number: 90 },
|
|
107
|
+
musicalNote: { degree: 210, note: "Si" },
|
|
108
|
+
zodiacSign: { degree: 210, name: "Gemini", glyph: "\u264A" },
|
|
109
|
+
planetaryPoint: { degree: 210, name: "Mercury", glyph: "\u263F", phase: "nocturnal" }
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
degree: 240,
|
|
113
|
+
utterance: { id: "y", degree: 240, letter: "V, OU", number: 6, color: "#d85c43", triangleId: "wordJesus", gloss: "Word / JeShU" },
|
|
114
|
+
triangleLabel: { degree: 240, label: "G", number: 3 },
|
|
115
|
+
musicalNote: { degree: 240, note: "Do" },
|
|
116
|
+
zodiacSign: { degree: 240, name: "Taurus", glyph: "\u2649" },
|
|
117
|
+
planetaryPoint: { degree: 240, name: "Venus", glyph: "\u2640", phase: "nocturnal" }
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
degree: 270,
|
|
121
|
+
utterance: { id: "ka", degree: 270, letter: "H, E", number: 5, color: "#3c82c2", triangleId: "ether", gloss: "Etheric power" },
|
|
122
|
+
triangleLabel: { degree: 270, label: "C", number: 20 },
|
|
123
|
+
musicalNote: { degree: 270, note: "R\xE9" },
|
|
124
|
+
zodiacSign: { degree: 270, name: "Aries", glyph: "\u2648" },
|
|
125
|
+
planetaryPoint: { degree: 270, name: "Mars", glyph: "\u2642", phase: "nocturnal" }
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
degree: 300,
|
|
129
|
+
utterance: { id: "h", degree: 300, letter: "R", number: 200, color: "#d4579c", triangleId: "mary", gloss: "Living waters" },
|
|
130
|
+
triangleLabel: { degree: 300, label: "D", number: 4 },
|
|
131
|
+
musicalNote: { degree: 300, note: "Mi" },
|
|
132
|
+
zodiacSign: { degree: 300, name: "Pisces", glyph: "\u2653" },
|
|
133
|
+
planetaryPoint: { degree: 300, name: "Jupiter", glyph: "\u2643", phase: "nocturnal" }
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
degree: 330,
|
|
137
|
+
utterance: { id: "hou", degree: 330, letter: "K", number: 100, color: "#7963b8", triangleId: "divineFire", gloss: "Divine fire" },
|
|
138
|
+
triangleLabel: { degree: 330, label: "S, Sh", number: 300 },
|
|
139
|
+
musicalNote: { degree: 330, note: "Fa" },
|
|
140
|
+
zodiacSign: { degree: 330, name: "Aquarius", glyph: "\u2652" },
|
|
141
|
+
planetaryPoint: { degree: 330, name: "Saturn", glyph: "\u2644", phase: "nocturnal" }
|
|
142
|
+
}
|
|
143
|
+
];
|
|
144
|
+
var DEFAULT_ARCHEOMETER_UTTERANCE = DEFAULT_ARCHEOMETER_SECTOR_CORRESPONDENCES.map((sector) => sector.utterance);
|
|
145
|
+
var DEFAULT_ARCHEOMETER_TRIANGLE_LABELS = DEFAULT_ARCHEOMETER_SECTOR_CORRESPONDENCES.map((sector) => sector.triangleLabel);
|
|
146
|
+
var DEFAULT_ARCHEOMETER_TRIANGLES = [
|
|
147
|
+
{ id: "wordJesus", title: "Triangle of the Word / JeShU", phrase: "Y-PhO", apex: "north", vertices: [0, 120, 240], fill: "#f2cf45", vertexFills: ["#f2cf45", "#5470a5", "#dd3e38"], stroke: "#171717" },
|
|
148
|
+
{ id: "mary", title: "Triangle of Mary / Living Waters", phrase: "Ma-Ri-H", apex: "south", vertices: [180, 300, 60], fill: "#e25b61", vertexFills: ["#cc58a1", "#f28a32", "#78bd79"], stroke: "#171717" },
|
|
149
|
+
{ id: "ether", title: "Triangle of the Ether", phrase: "La-Ka-Za", apex: "west", vertices: [270, 30, 150], fill: "#78bd79", vertexFills: ["#e96836", "#b7bd58", "#8f69a3"], stroke: "#171717" },
|
|
150
|
+
{ id: "divineFire", title: "Triangle of Divine Fire", phrase: "Hou-U-T", apex: "east", vertices: [90, 210, 330], fill: "#cc58a1", vertexFills: ["#63a890", "#d45375", "#f0b33f"], stroke: "#171717" }
|
|
151
|
+
];
|
|
152
|
+
var DEFAULT_ARCHEOMETER_MUSICAL_NOTES = DEFAULT_ARCHEOMETER_SECTOR_CORRESPONDENCES.map((sector) => sector.musicalNote);
|
|
153
|
+
var DEFAULT_ARCHEOMETER_ZODIAC = DEFAULT_ARCHEOMETER_SECTOR_CORRESPONDENCES.map((sector) => sector.zodiacSign);
|
|
154
|
+
var DEFAULT_ARCHEOMETER_PLANETS = DEFAULT_ARCHEOMETER_SECTOR_CORRESPONDENCES.map((sector) => sector.planetaryPoint);
|
|
155
|
+
function getArcheometerRenderModel(options = {}) {
|
|
156
|
+
const viewBox = normalizeViewBox(options.viewBox);
|
|
157
|
+
const scale = Math.min(viewBox.width / ARCHEOMETER_DEFAULT_VIEWBOX.width, viewBox.height / ARCHEOMETER_DEFAULT_VIEWBOX.height);
|
|
158
|
+
const padding = options.padding ?? 0;
|
|
159
|
+
const center = {
|
|
160
|
+
x: round(viewBox.minX + viewBox.width / 2),
|
|
161
|
+
y: round(viewBox.minY + viewBox.height / 2)
|
|
162
|
+
};
|
|
163
|
+
const frameRadius = round(Math.max(0, Math.min(viewBox.width, viewBox.height) / 2 - padding));
|
|
164
|
+
const outerRadius = round(Math.max(0, frameRadius - ARCHEOMETER_OUTER_CROWN_BLEED * scale));
|
|
165
|
+
return {
|
|
166
|
+
viewBox,
|
|
167
|
+
center,
|
|
168
|
+
outerRadius,
|
|
169
|
+
scale,
|
|
170
|
+
rings: buildRings(outerRadius, frameRadius),
|
|
171
|
+
palette: resolvePalette(options.palette),
|
|
172
|
+
rotationDegrees: options.rotationDegrees ?? 0,
|
|
173
|
+
layers: { ...DEFAULT_LAYERS, ...options.layers ?? {} },
|
|
174
|
+
degreeLabelEvery: options.degreeLabelEvery ?? 15,
|
|
175
|
+
utterance: options.utterance ?? DEFAULT_ARCHEOMETER_UTTERANCE,
|
|
176
|
+
triangles: options.triangles ?? DEFAULT_ARCHEOMETER_TRIANGLES,
|
|
177
|
+
triangleLabels: options.triangleLabels ?? DEFAULT_ARCHEOMETER_TRIANGLE_LABELS,
|
|
178
|
+
musicalNotes: options.musicalNotes ?? DEFAULT_ARCHEOMETER_MUSICAL_NOTES,
|
|
179
|
+
zodiacSigns: options.zodiacSigns ?? DEFAULT_ARCHEOMETER_ZODIAC,
|
|
180
|
+
planetaryPoints: options.planetaryPoints ?? DEFAULT_ARCHEOMETER_PLANETS
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
var DEFAULT_ARCHETYPE_UTTERANCE = DEFAULT_ARCHEOMETER_UTTERANCE;
|
|
184
|
+
var DEFAULT_ARCHETYPE_TRIANGLES = DEFAULT_ARCHEOMETER_TRIANGLES;
|
|
185
|
+
var DEFAULT_ARCHETYPE_MUSICAL_NOTES = DEFAULT_ARCHEOMETER_MUSICAL_NOTES;
|
|
186
|
+
var DEFAULT_ARCHETYPE_ZODIAC = DEFAULT_ARCHEOMETER_ZODIAC;
|
|
187
|
+
var DEFAULT_ARCHETYPE_PLANETS = DEFAULT_ARCHEOMETER_PLANETS;
|
|
188
|
+
function generateArcheometerSvg(options = {}) {
|
|
189
|
+
const model = getArcheometerRenderModel(options);
|
|
190
|
+
const { viewBox, center, outerRadius, palette } = model;
|
|
191
|
+
const background = options.background ?? "transparent";
|
|
192
|
+
const lines = [];
|
|
193
|
+
const push = (line) => lines.push(line);
|
|
194
|
+
const title = options.title ?? "The Cosmological Archeometer";
|
|
195
|
+
const attrs = [
|
|
196
|
+
`xmlns="http://www.w3.org/2000/svg"`,
|
|
197
|
+
options.width !== void 0 ? `width="${escapeAttr(String(options.width))}"` : "",
|
|
198
|
+
options.height !== void 0 ? `height="${escapeAttr(String(options.height))}"` : "",
|
|
199
|
+
`viewBox="${fmt(viewBox.minX)} ${fmt(viewBox.minY)} ${fmt(viewBox.width)} ${fmt(viewBox.height)}"`,
|
|
200
|
+
`preserveAspectRatio="xMidYMid meet"`,
|
|
201
|
+
`role="img"`,
|
|
202
|
+
`aria-label="${escapeAttr(title)}"`
|
|
203
|
+
].filter(Boolean);
|
|
204
|
+
push(`<svg ${attrs.join(" ")}>`);
|
|
205
|
+
push(`<title>${escapeText(title)}</title>`);
|
|
206
|
+
if (background !== "transparent") {
|
|
207
|
+
push(`<rect x="${fmt(viewBox.minX)}" y="${fmt(viewBox.minY)}" width="${fmt(viewBox.width)}" height="${fmt(viewBox.height)}" fill="${escapeAttr(background)}"/>`);
|
|
208
|
+
}
|
|
209
|
+
push(`<circle cx="${fmt(center.x)}" cy="${fmt(center.y)}" r="${fmt(outerRadius)}" fill="${escapeAttr(palette.paper)}"/>`);
|
|
210
|
+
renderDefs(push, model);
|
|
211
|
+
renderRingGrounds(push, model);
|
|
212
|
+
if (model.layers.chromicRays)
|
|
213
|
+
renderChromicRays(push, model);
|
|
214
|
+
if (model.layers.planetaryUtterance)
|
|
215
|
+
renderPlanetaryUtterance(push, model);
|
|
216
|
+
if (model.layers.zodiacUtterance)
|
|
217
|
+
renderZodiacUtterance(push, model);
|
|
218
|
+
if (model.layers.cosmologicalMusic)
|
|
219
|
+
renderCosmologicalMusic(push, model);
|
|
220
|
+
if (model.layers.astralZodiac)
|
|
221
|
+
renderAstralZodiac(push, model);
|
|
222
|
+
if (model.layers.astralPlanetary)
|
|
223
|
+
renderAstralPlanetary(push, model);
|
|
224
|
+
if (model.layers.solarCenter)
|
|
225
|
+
renderSolarCenter(push, model);
|
|
226
|
+
if (model.layers.whiteRays)
|
|
227
|
+
renderWhiteRays(push, model);
|
|
228
|
+
if (model.layers.degreeCrown)
|
|
229
|
+
renderDegreeCrown(push, model);
|
|
230
|
+
renderFrame(push, model);
|
|
231
|
+
push(`</svg>`);
|
|
232
|
+
return lines.join("\n");
|
|
233
|
+
}
|
|
234
|
+
function renderDefs(push, model) {
|
|
235
|
+
const { rings, center } = model;
|
|
236
|
+
const planetaryClipOuter = planetaryTriangleClipOuterRadius(rings);
|
|
237
|
+
const planetaryClipInner = planetaryTriangleClipInnerRadius(rings);
|
|
238
|
+
const chromicClipOuter = chromicCoreOuterRadius(rings);
|
|
239
|
+
const chromicClipInner = chromicCoreInnerRadius(rings);
|
|
240
|
+
push(`<defs>`);
|
|
241
|
+
push(
|
|
242
|
+
`<clipPath id="archeometer-planetary-clip"><path d="${annulusPath(
|
|
243
|
+
center,
|
|
244
|
+
planetaryClipInner,
|
|
245
|
+
planetaryClipOuter
|
|
246
|
+
)}" fill-rule="evenodd" clip-rule="evenodd"/></clipPath>`
|
|
247
|
+
);
|
|
248
|
+
push(
|
|
249
|
+
`<clipPath id="archeometer-chromic-clip"><path d="${annulusPath(
|
|
250
|
+
center,
|
|
251
|
+
chromicClipInner,
|
|
252
|
+
chromicClipOuter
|
|
253
|
+
)}" fill-rule="evenodd" clip-rule="evenodd"/></clipPath>`
|
|
254
|
+
);
|
|
255
|
+
push(`</defs>`);
|
|
256
|
+
}
|
|
257
|
+
function renderRingGrounds(push, model) {
|
|
258
|
+
const { rings, center, palette } = model;
|
|
259
|
+
const order = [
|
|
260
|
+
"degreeOuter",
|
|
261
|
+
"degreeInner",
|
|
262
|
+
"zodiacUtterance",
|
|
263
|
+
"planetaryUtterance",
|
|
264
|
+
"cosmologicalMusic",
|
|
265
|
+
"astralZodiac",
|
|
266
|
+
"astralPlanetary",
|
|
267
|
+
"chromicRays",
|
|
268
|
+
"whiteRays"
|
|
269
|
+
];
|
|
270
|
+
push(`<g id="archeometer-ring-grounds">`);
|
|
271
|
+
for (const id2 of order) {
|
|
272
|
+
const ring = rings[id2];
|
|
273
|
+
push(`<path id="archeometer-ring-${id2}" d="${annulusPath(center, ring.r1, ring.r2)}" fill="${escapeAttr(palette.ringFills[id2])}" fill-rule="evenodd" stroke="none"/>`);
|
|
274
|
+
}
|
|
275
|
+
push(`</g>`);
|
|
276
|
+
}
|
|
277
|
+
function renderDegreeCrown(push, model) {
|
|
278
|
+
const { center, rings, palette, scale } = model;
|
|
279
|
+
const outer = rings.degreeOuter;
|
|
280
|
+
const inner = rings.degreeInner;
|
|
281
|
+
push(`<g id="archeometer-degree-crown" aria-label="dual 360 degree differential numerical protractor">`);
|
|
282
|
+
for (let degree = 0; degree < 360; degree += 30) {
|
|
283
|
+
const angle = angleOf(model, degree);
|
|
284
|
+
const pOuter = polarToXY(center, (outer.r1 + outer.r2) / 2, angle);
|
|
285
|
+
const pInner = polarToXY(center, (inner.r1 + inner.r2) / 2, angle);
|
|
286
|
+
const rot = tangentRotation(angle);
|
|
287
|
+
const outerText = String(normalizeDegrees(345 + degree) || 360);
|
|
288
|
+
const innerText = String(normalizeDegrees(15 - degree) || 360);
|
|
289
|
+
push(textSvg(outerText, pOuter, 8.4 * scale, palette.degreeLabel, rot, "middle"));
|
|
290
|
+
push(textSvg(innerText, pInner, 7.6 * scale, palette.degreeLabel, rot, "middle"));
|
|
291
|
+
}
|
|
292
|
+
push(`</g>`);
|
|
293
|
+
}
|
|
294
|
+
function renderZodiacUtterance(push, model) {
|
|
295
|
+
const { center, rings, palette, scale } = model;
|
|
296
|
+
const ring = rings.zodiacUtterance;
|
|
297
|
+
const sorted = sortedByDegree(model.utterance);
|
|
298
|
+
push(`<g id="archeometer-zodiacal-utterance" aria-label="zodiacal crown of the utterance">`);
|
|
299
|
+
for (let i = 0; i < 12; i++) {
|
|
300
|
+
const degree = i * 30;
|
|
301
|
+
const sector = annularSectorPath(
|
|
302
|
+
center,
|
|
303
|
+
ring.r1,
|
|
304
|
+
ring.r2,
|
|
305
|
+
angleOf(model, degree - 15),
|
|
306
|
+
angleOf(model, degree + 15),
|
|
307
|
+
30
|
|
308
|
+
);
|
|
309
|
+
push(
|
|
310
|
+
`<path d="${sector}" fill="${escapeAttr(palette.ringFills.zodiacUtterance)}" fill-opacity="1" stroke="${escapeAttr(
|
|
311
|
+
palette.ringStroke
|
|
312
|
+
)}" stroke-opacity="0.34" stroke-width="${fmt(0.7 * scale)}"/>`
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
for (const point of sorted) {
|
|
316
|
+
const a = angleOf(model, point.degree);
|
|
317
|
+
const p = polarToXY(center, ring.r1 + (ring.r2 - ring.r1) * 0.58, a);
|
|
318
|
+
const shieldR = (ring.r2 - ring.r1) * 0.22;
|
|
319
|
+
const letterParts = point.letter.split(",").map((part) => part.trim()).filter(Boolean);
|
|
320
|
+
const isStacked = letterParts.length > 1;
|
|
321
|
+
const letterFontSize = (isStacked ? letterParts.length > 2 ? 8.3 : 10.6 : 14) * scale;
|
|
322
|
+
const letterLineHeight = letterFontSize * (isStacked ? 1.02 : 1);
|
|
323
|
+
const numberFontSize = (isStacked ? 6.6 : 7.1) * scale;
|
|
324
|
+
const numberGap = (isStacked ? 4.8 : 0) * scale;
|
|
325
|
+
const stackedNumberY = p.y + (letterParts.length - 1) * letterLineHeight / 2 + numberGap + numberFontSize * 0.42;
|
|
326
|
+
const singleLetterY = p.y - shieldR * 0.48;
|
|
327
|
+
const firstLineY = isStacked ? p.y - (letterParts.length - 1) * letterLineHeight / 2 - numberFontSize * 0.42 : singleLetterY;
|
|
328
|
+
const numberY = isStacked ? stackedNumberY : p.y + shieldR * 0.72;
|
|
329
|
+
push(
|
|
330
|
+
`<g class="archeometer-utterance-point" data-degree="${fmt(normalizeDegrees(point.degree))}" data-letter="${escapeAttr(
|
|
331
|
+
point.letter
|
|
332
|
+
)}">`
|
|
333
|
+
);
|
|
334
|
+
for (const [index, part] of letterParts.entries()) {
|
|
335
|
+
push(textSvg(part, { x: p.x, y: firstLineY + index * letterLineHeight }, letterFontSize, palette.ink, 0, "middle", 700));
|
|
336
|
+
}
|
|
337
|
+
push(textSvg(String(point.number), { x: p.x, y: numberY }, numberFontSize, palette.ink, 0, "middle"));
|
|
338
|
+
push(`</g>`);
|
|
339
|
+
}
|
|
340
|
+
push(`</g>`);
|
|
341
|
+
}
|
|
342
|
+
function renderPlanetaryUtterance(push, model) {
|
|
343
|
+
const { center, rings, palette, scale } = model;
|
|
344
|
+
const ring = rings.planetaryUtterance;
|
|
345
|
+
const clipOuter = planetaryTriangleClipOuterRadius(rings);
|
|
346
|
+
const vertexRadius = clipOuter;
|
|
347
|
+
push(`<g id="archeometer-planetary-utterance" aria-label="four trigones of the planetary utterance">`);
|
|
348
|
+
push(`<g clip-path="url(#archeometer-planetary-clip)">`);
|
|
349
|
+
for (const triangle of model.triangles) {
|
|
350
|
+
const vertices = triangle.vertices.map((degree) => polarToXY(center, vertexRadius, angleOf(model, degree)));
|
|
351
|
+
if (triangle.vertexFills) {
|
|
352
|
+
const centroid = polygonCentroid(vertices);
|
|
353
|
+
const midpoints = vertices.map((vertex, index) => midpoint(vertex, vertices[(index + 1) % vertices.length]));
|
|
354
|
+
for (const [index, vertex] of vertices.entries()) {
|
|
355
|
+
const previousMidpoint = midpoints[(index + vertices.length - 1) % vertices.length];
|
|
356
|
+
const nextMidpoint = midpoints[index];
|
|
357
|
+
push(`<path class="archeometer-trigone-vertex-fill" data-triangle="${escapeAttr(triangle.id)}" data-degree="${fmt(normalizeDegrees(triangle.vertices[index]))}" d="${polygonPath([vertex, nextMidpoint, centroid, previousMidpoint])}" fill="${escapeAttr(triangle.vertexFills[index])}" fill-opacity="0.54" stroke="none"/>`);
|
|
358
|
+
}
|
|
359
|
+
push(`<path class="archeometer-trigone" data-triangle="${escapeAttr(triangle.id)}" d="${polygonPath(vertices)}" fill="none" stroke="${escapeAttr(palette.ink)}" stroke-opacity="0.82" stroke-width="${fmt(1.35 * scale)}"/>`);
|
|
360
|
+
} else {
|
|
361
|
+
push(`<path class="archeometer-trigone" data-triangle="${escapeAttr(triangle.id)}" d="${polygonPath(vertices)}" fill="${escapeAttr(triangle.fill)}" fill-opacity="0.52" stroke="${escapeAttr(palette.ink)}" stroke-opacity="0.82" stroke-width="${fmt(1.35 * scale)}"/>`);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
push(`</g>`);
|
|
365
|
+
for (const label of sortedByDegree(model.triangleLabels)) {
|
|
366
|
+
if (!label.label)
|
|
367
|
+
continue;
|
|
368
|
+
const a = angleOf(model, label.degree);
|
|
369
|
+
const labelPoint = polarToXY(center, ring.r1 + (clipOuter - ring.r1) * 0.56, a);
|
|
370
|
+
push(textSvg(label.label, labelPoint, 12 * scale, palette.ink, 0, "middle", 700));
|
|
371
|
+
if (label.number !== void 0) {
|
|
372
|
+
const numberPoint = polarToXY(center, ring.r1 + (clipOuter - ring.r1) * 0.8, a);
|
|
373
|
+
push(textSvg(String(label.number), numberPoint, 7.5 * scale, palette.ink, 0, "middle", 600));
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
push(`</g>`);
|
|
377
|
+
}
|
|
378
|
+
function renderCosmologicalMusic(push, model) {
|
|
379
|
+
const { center, rings, palette, scale } = model;
|
|
380
|
+
const ring = rings.cosmologicalMusic;
|
|
381
|
+
const notes = sortedByDegree(model.musicalNotes);
|
|
382
|
+
push(`<g id="archeometer-cosmological-music" aria-label="cosmological musical crown">`);
|
|
383
|
+
push(`<path id="archeometer-music-backing" d="${annulusPath(center, ring.r1, ring.r2)}" fill="${escapeAttr(palette.paper)}" stroke="${escapeAttr(palette.ringStroke)}" stroke-opacity="0.58" stroke-width="${fmt(0.8 * scale)}" fill-rule="evenodd"/>`);
|
|
384
|
+
for (const note of notes) {
|
|
385
|
+
const point = nearestUtterance(note.degree, model.utterance);
|
|
386
|
+
const start = angleOf(model, note.degree - 15);
|
|
387
|
+
const end = angleOf(model, note.degree + 15);
|
|
388
|
+
const sector = annularSectorPath(center, ring.r1, ring.r2, start, end, 30);
|
|
389
|
+
push(`<path d="${sector}" fill="${escapeAttr(note.color ?? point?.color ?? palette.ringFills.cosmologicalMusic)}" fill-opacity="0.24" stroke="${escapeAttr(palette.ringStroke)}" stroke-opacity="0.3" stroke-width="${fmt(0.55 * scale)}"/>`);
|
|
390
|
+
}
|
|
391
|
+
for (const note of notes) {
|
|
392
|
+
const start = angleOf(model, note.degree - 5.5);
|
|
393
|
+
const end = angleOf(model, note.degree + 5.5);
|
|
394
|
+
for (let i = 1; i <= 5; i++) {
|
|
395
|
+
const r = ring.r1 + (ring.r2 - ring.r1) * i / 6;
|
|
396
|
+
push(`<path class="archeometer-music-staff-line" data-degree="${fmt(normalizeDegrees(note.degree))}" d="${arcSegmentPath(center, r, start, end)}" fill="none" stroke="${escapeAttr(palette.ink)}" stroke-opacity="0.58" stroke-width="${fmt(0.48 * scale)}" stroke-linecap="round"/>`);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
for (const note of notes) {
|
|
400
|
+
if (!note.note)
|
|
401
|
+
continue;
|
|
402
|
+
const p = polarToXY(center, (ring.r1 + ring.r2) / 2, angleOf(model, note.degree));
|
|
403
|
+
push(textSvg(note.note, p, 11.8 * scale, palette.ink, tangentRotation(angleOf(model, note.degree)), "middle", 700));
|
|
404
|
+
}
|
|
405
|
+
push(`</g>`);
|
|
406
|
+
}
|
|
407
|
+
function renderAstralZodiac(push, model) {
|
|
408
|
+
const { center, rings, palette, scale } = model;
|
|
409
|
+
const ring = rings.astralZodiac;
|
|
410
|
+
const ringWidth = ring.r2 - ring.r1;
|
|
411
|
+
push(`<g id="archeometer-astral-zodiac" aria-label="astral zodiacal crown">`);
|
|
412
|
+
for (const sign of sortedByDegree(model.zodiacSigns)) {
|
|
413
|
+
const sector = annularSectorPath(
|
|
414
|
+
center,
|
|
415
|
+
ring.r1,
|
|
416
|
+
ring.r2,
|
|
417
|
+
angleOf(model, sign.degree - 15),
|
|
418
|
+
angleOf(model, sign.degree + 15),
|
|
419
|
+
30
|
|
420
|
+
);
|
|
421
|
+
const pointColor = triangleVertexFillForDegree(model, sign.degree) ?? sign.color ?? nearestUtterance(sign.degree, model.utterance)?.color ?? palette.ringFills.astralZodiac;
|
|
422
|
+
push(
|
|
423
|
+
`<path d="${sector}" fill="${escapeAttr(pointColor)}" fill-opacity="0.40" stroke="${escapeAttr(
|
|
424
|
+
palette.ringStroke
|
|
425
|
+
)}" stroke-opacity="0.32" stroke-width="${fmt(0.6 * scale)}"/>`
|
|
426
|
+
);
|
|
427
|
+
}
|
|
428
|
+
const markerRadius = Math.min(ringWidth * 0.33, 13 * scale);
|
|
429
|
+
const glyphSize = 17.5 * scale;
|
|
430
|
+
for (const sign of sortedByDegree(model.zodiacSigns)) {
|
|
431
|
+
const pointColor = triangleVertexFillForDegree(model, sign.degree) ?? sign.color ?? nearestUtterance(sign.degree, model.utterance)?.color ?? palette.ringFills.astralZodiac;
|
|
432
|
+
const p = polarToXY(center, (ring.r1 + ring.r2) / 2, angleOf(model, sign.degree));
|
|
433
|
+
push(
|
|
434
|
+
`<g class="archeometer-zodiac-sign" data-sign="${escapeAttr(sign.name)}" data-degree="${fmt(
|
|
435
|
+
normalizeDegrees(sign.degree)
|
|
436
|
+
)}">`
|
|
437
|
+
);
|
|
438
|
+
push(
|
|
439
|
+
`<circle cx="${fmt(p.x)}" cy="${fmt(p.y)}" r="${fmt(markerRadius)}" fill="${escapeAttr(
|
|
440
|
+
pointColor
|
|
441
|
+
)}" fill-opacity="0.48" stroke="${escapeAttr(palette.ink)}" stroke-width="${fmt(0.75 * scale)}"/>`
|
|
442
|
+
);
|
|
443
|
+
push(textSvg(sign.glyph, p, glyphSize, palette.ink, 0, "middle"));
|
|
444
|
+
push(`</g>`);
|
|
445
|
+
}
|
|
446
|
+
push(`</g>`);
|
|
447
|
+
}
|
|
448
|
+
function renderAstralPlanetary(push, model) {
|
|
449
|
+
const { center, rings, palette, scale } = model;
|
|
450
|
+
const ring = rings.astralPlanetary;
|
|
451
|
+
const ringWidth = ring.r2 - ring.r1;
|
|
452
|
+
push(`<g id="archeometer-astral-planetary" aria-label="astral planetary crown">`);
|
|
453
|
+
for (const planet of sortedByDegree(model.planetaryPoints)) {
|
|
454
|
+
const pointColor = triangleVertexFillForDegree(model, planet.degree) ?? planet.color ?? nearestUtterance(planet.degree, model.utterance)?.color ?? palette.ringFills.astralPlanetary;
|
|
455
|
+
const sector = annularSectorPath(
|
|
456
|
+
center,
|
|
457
|
+
ring.r1,
|
|
458
|
+
ring.r2,
|
|
459
|
+
angleOf(model, planet.degree - 15),
|
|
460
|
+
angleOf(model, planet.degree + 15),
|
|
461
|
+
30
|
|
462
|
+
);
|
|
463
|
+
push(
|
|
464
|
+
`<path class="archeometer-astral-planetary-sector" data-degree="${fmt(
|
|
465
|
+
normalizeDegrees(planet.degree)
|
|
466
|
+
)}" d="${sector}" fill="${escapeAttr(pointColor)}" fill-opacity="0.36" stroke="none"/>`
|
|
467
|
+
);
|
|
468
|
+
}
|
|
469
|
+
for (let degree = 15; degree < 360; degree += 30) {
|
|
470
|
+
const line = lineFromPolar(center, ring.r1, ring.r2, angleOf(model, degree));
|
|
471
|
+
push(lineSvg(line, palette.ringStroke, 0.6 * scale, 0.42, "archeometer-astral-planetary-divider", ` data-degree="${fmt(degree)}"`));
|
|
472
|
+
}
|
|
473
|
+
const markerRadius = Math.min(ringWidth * 0.33, 13 * scale);
|
|
474
|
+
for (const planet of sortedByDegree(model.planetaryPoints)) {
|
|
475
|
+
const p = polarToXY(center, (ring.r1 + ring.r2) / 2, angleOf(model, planet.degree));
|
|
476
|
+
const color = triangleVertexFillForDegree(model, planet.degree) ?? planet.color ?? nearestUtterance(planet.degree, model.utterance)?.color ?? palette.ink;
|
|
477
|
+
const glyphSize = (planet.name === "Moon" ? 17 : 18.5) * scale;
|
|
478
|
+
push(
|
|
479
|
+
`<g class="archeometer-planet" data-planet="${escapeAttr(planet.name)}" data-degree="${fmt(
|
|
480
|
+
normalizeDegrees(planet.degree)
|
|
481
|
+
)}">`
|
|
482
|
+
);
|
|
483
|
+
push(
|
|
484
|
+
`<circle cx="${fmt(p.x)}" cy="${fmt(p.y)}" r="${fmt(markerRadius)}" fill="${escapeAttr(
|
|
485
|
+
color
|
|
486
|
+
)}" fill-opacity="0.44" stroke="${escapeAttr(palette.ink)}" stroke-width="${fmt(0.8 * scale)}"/>`
|
|
487
|
+
);
|
|
488
|
+
push(textSvg(planet.glyph, p, glyphSize, palette.ink, 0, "middle"));
|
|
489
|
+
push(`</g>`);
|
|
490
|
+
}
|
|
491
|
+
push(`</g>`);
|
|
492
|
+
}
|
|
493
|
+
function renderChromicRays(push, model) {
|
|
494
|
+
push(`<g id="archeometer-chromic-rays" aria-label="dodecagonal crown of chromic circum-solar rays">`);
|
|
495
|
+
push(`<g clip-path="url(#archeometer-chromic-clip)">`);
|
|
496
|
+
renderChromicTriangleCore(push, model);
|
|
497
|
+
push(`</g>`);
|
|
498
|
+
push(`</g>`);
|
|
499
|
+
}
|
|
500
|
+
function renderChromicTriangleCore(push, model) {
|
|
501
|
+
const { center, rings, palette, scale } = model;
|
|
502
|
+
const trianglesById = new Map(model.triangles.map((triangle) => [triangle.id, triangle]));
|
|
503
|
+
const wordJesus = trianglesById.get("wordJesus");
|
|
504
|
+
const mary = trianglesById.get("mary");
|
|
505
|
+
const ether = trianglesById.get("ether");
|
|
506
|
+
const divineFire = trianglesById.get("divineFire");
|
|
507
|
+
const chromicOuter = chromicCoreOuterRadius(rings);
|
|
508
|
+
const chromic = (x, y) => scaleArcheometerReferencePoint(center, chromicOuter, x, y);
|
|
509
|
+
const path = (...commands) => commands.join(" ");
|
|
510
|
+
const move = (x, y) => {
|
|
511
|
+
const p = chromic(x, y);
|
|
512
|
+
return `M ${fmt(p.x)} ${fmt(p.y)}`;
|
|
513
|
+
};
|
|
514
|
+
const line = (x, y) => {
|
|
515
|
+
const p = chromic(x, y);
|
|
516
|
+
return `L ${fmt(p.x)} ${fmt(p.y)}`;
|
|
517
|
+
};
|
|
518
|
+
const cubic = (x1, y1, x2, y2, x, y) => {
|
|
519
|
+
const c1 = chromic(x1, y1);
|
|
520
|
+
const c2 = chromic(x2, y2);
|
|
521
|
+
const p = chromic(x, y);
|
|
522
|
+
return `C ${fmt(c1.x)} ${fmt(c1.y)} ${fmt(c2.x)} ${fmt(c2.y)} ${fmt(p.x)} ${fmt(p.y)}`;
|
|
523
|
+
};
|
|
524
|
+
const strokeWidth = fmt(1.4 * scale);
|
|
525
|
+
const facetStrokeWidth = fmt(0.85 * scale);
|
|
526
|
+
const primaryFacetStrokeWidth = fmt(0.95 * scale);
|
|
527
|
+
const primaryStroke = wordJesus?.stroke ?? palette.ink;
|
|
528
|
+
push(`<g id="archeometer-chromic-triangle-core" aria-label="inner chromic primary triangle core">`);
|
|
529
|
+
push(`<path class="archeometer-chromic-foundation" data-triangle="ether" d="${path(move(1.3999, 137.047), line(204.875, 19.5703), line(204.875, 254.523), "Z")}" fill="${escapeAttr(ether?.fill ?? "#78BD79")}" stroke="${escapeAttr(palette.ink)}" stroke-width="${strokeWidth}"/>`);
|
|
530
|
+
push(`<path class="archeometer-chromic-foundation" data-triangle="divineFire" d="${path(move(272.7, 137.047), line(69.2251, 254.523), line(69.2251, 19.5703), "Z")}" fill="${escapeAttr(divineFire?.fill ?? "#CC58A1")}" stroke="${escapeAttr(palette.ink)}" stroke-width="${strokeWidth}"/>`);
|
|
531
|
+
push(`<path class="archeometer-chromic-foundation" data-triangle="mary" d="${path(move(137.05, 272.702), line(19.5737, 69.2266), line(254.527, 69.2266), "Z")}" fill="${escapeAttr(mary?.fill ?? "#E25B61")}" stroke="${escapeAttr(palette.ink)}" stroke-width="${strokeWidth}"/>`);
|
|
532
|
+
for (const triangle of [ether, divineFire, mary]) {
|
|
533
|
+
if (!triangle?.vertexFills)
|
|
534
|
+
continue;
|
|
535
|
+
const vertices = triangle.vertices.map((degree) => polarToXY(center, chromicOuter, angleOf(model, degree)));
|
|
536
|
+
const centroid = polygonCentroid(vertices);
|
|
537
|
+
const midpoints = vertices.map((vertex, index) => midpoint(vertex, vertices[(index + 1) % vertices.length]));
|
|
538
|
+
for (const [index, vertex] of vertices.entries()) {
|
|
539
|
+
const previousMidpoint = midpoints[(index + vertices.length - 1) % vertices.length];
|
|
540
|
+
const nextMidpoint = midpoints[index];
|
|
541
|
+
push(`<path class="archeometer-chromic-trigone-facet" data-triangle="${escapeAttr(triangle.id)}" data-degree="${fmt(normalizeDegrees(triangle.vertices[index]))}" d="${polygonPath([vertex, nextMidpoint, centroid, previousMidpoint])}" fill="${escapeAttr(triangle.vertexFills[index])}" stroke="${escapeAttr(palette.ink)}" stroke-opacity="0.72" stroke-width="${facetStrokeWidth}"/>`);
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
push(`<path class="archeometer-chromic-primary-facet" data-triangle="wordJesus" data-degree="120" d="${path(move(137.05, 204.874), line(254.527, 204.874), line(195.789, 103.136), cubic(195.789, 103.136, 215.377, 136.525, 195.789, 170.699), cubic(176.2, 204.874, 137.05, 204.874, 137.05, 204.874), "Z")}" fill="${escapeAttr(wordJesus?.vertexFills?.[1] ?? "#5470A5")}" stroke="${escapeAttr(palette.ink)}" stroke-opacity="0.78" stroke-width="${primaryFacetStrokeWidth}"/>`);
|
|
545
|
+
push(`<path class="archeometer-chromic-primary-facet" data-triangle="wordJesus" data-degree="240" d="${path(move(19.5737, 204.874), line(137.05, 204.874), cubic(137.05, 204.874, 94.7002, 203.927, 78.312, 170.699), cubic(61.9238, 137.472, 78.312, 103.136, 78.312, 103.136), line(19.5737, 204.874), "Z")}" fill="${escapeAttr(wordJesus?.vertexFills?.[2] ?? "#DD3E38")}" stroke="${escapeAttr(palette.ink)}" stroke-opacity="0.78" stroke-width="${primaryFacetStrokeWidth}"/>`);
|
|
546
|
+
push(`<path class="archeometer-chromic-primary-facet" data-triangle="wordJesus" data-degree="0" fill-rule="evenodd" clip-rule="evenodd" d="${path(move(195.789, 103.136), line(137.05, 1.39844), line(78.312, 103.136), cubic(78.312, 103.136, 100.9, 71.1992, 137.05, 71.1992), cubic(173.2, 71.1992, 195.789, 103.136, 195.789, 103.136), "Z")}" fill="${escapeAttr(wordJesus?.vertexFills?.[0] ?? "#F2CF45")}" stroke="${escapeAttr(palette.ink)}" stroke-opacity="0.78" stroke-width="${primaryFacetStrokeWidth}"/>`);
|
|
547
|
+
push(`<path class="archeometer-chromic-primary-outline" data-triangle="wordJesus" d="${path(
|
|
548
|
+
move(137.05, 204.874),
|
|
549
|
+
line(254.527, 204.874),
|
|
550
|
+
line(195.789, 103.136),
|
|
551
|
+
move(137.05, 204.874),
|
|
552
|
+
line(19.5737, 204.874),
|
|
553
|
+
line(78.312, 103.136),
|
|
554
|
+
move(137.05, 204.874),
|
|
555
|
+
cubic(137.05, 204.874, 94.7002, 203.927, 78.312, 170.699),
|
|
556
|
+
cubic(61.9238, 137.472, 78.312, 103.136, 78.312, 103.136),
|
|
557
|
+
move(137.05, 204.874),
|
|
558
|
+
cubic(137.05, 204.874, 176.2, 204.874, 195.789, 170.699),
|
|
559
|
+
cubic(215.377, 136.525, 195.789, 103.136, 195.789, 103.136),
|
|
560
|
+
move(195.789, 103.136),
|
|
561
|
+
line(137.05, 1.39844),
|
|
562
|
+
line(78.312, 103.136),
|
|
563
|
+
move(195.789, 103.136),
|
|
564
|
+
cubic(195.789, 103.136, 173.2, 71.1992, 137.05, 71.1992),
|
|
565
|
+
cubic(100.9, 71.1992, 78.312, 103.136, 78.312, 103.136)
|
|
566
|
+
)}" fill="none" stroke="${escapeAttr(primaryStroke)}" stroke-width="${strokeWidth}"/>`);
|
|
567
|
+
push(`</g>`);
|
|
568
|
+
}
|
|
569
|
+
function renderWhiteRays(push, model) {
|
|
570
|
+
const { center, rings, palette, scale } = model;
|
|
571
|
+
const solarRadius = rings.solarCenter.r2;
|
|
572
|
+
const sunCenterCircleRadiusWithPadding = 3 + 0.3;
|
|
573
|
+
push(`<g id="archeometer-white-rays" aria-label="crown of white rays and musical staff">`);
|
|
574
|
+
for (let degree = 0; degree < 180; degree += 30) {
|
|
575
|
+
if (degree === 90 || degree === 270)
|
|
576
|
+
continue;
|
|
577
|
+
push(lineSvg(lineFromPolar(center, solarRadius, sunCenterCircleRadiusWithPadding, angleOf(model, degree)), palette.whiteRay, 1.55 * scale, 0.92));
|
|
578
|
+
push(lineSvg(lineFromPolar(center, solarRadius, sunCenterCircleRadiusWithPadding, angleOf(model, degree + 180)), palette.whiteRay, 1.55 * scale, 0.92));
|
|
579
|
+
}
|
|
580
|
+
push(`</g>`);
|
|
581
|
+
}
|
|
582
|
+
function renderSolarCenter(push, model) {
|
|
583
|
+
const { center, rings, palette, scale } = model;
|
|
584
|
+
const r = rings.solarCenter.r2;
|
|
585
|
+
const innerR = r * 0.68;
|
|
586
|
+
const arcStart = polarToXY(center, innerR * 0.72, deg2rad(240));
|
|
587
|
+
const arcEnd = polarToXY(center, innerR * 0.72, deg2rad(300));
|
|
588
|
+
const paddingTop = 22;
|
|
589
|
+
const sunCenterCircleRadius = 3;
|
|
590
|
+
push(`<g id="archeometer-solar-center" aria-label="solar center Mi">`);
|
|
591
|
+
push(`<circle cx="${fmt(center.x)}" cy="${fmt(center.y)}" r="${fmt(r)}" fill="none" stroke="${escapeAttr(palette.ink)}" stroke-width="${fmt(1.2 * scale)}"/>`);
|
|
592
|
+
push(lineSvg({ x1: center.x - innerR - 13, x2: center.x + innerR + 13, y1: center.y - 1.5, y2: center.y - 1.5 }, palette.whiteRay, 1.55 * scale, 0.92));
|
|
593
|
+
push(lineSvg({ x1: center.x - innerR - 13, x2: center.x + innerR + 13, y1: center.y, y2: center.y }, palette.whiteRay, 1.55 * scale, 0.92));
|
|
594
|
+
push(lineSvg({ x1: center.x - innerR - 13, x2: center.x + innerR + 13, y1: center.y + 1.5, y2: center.y + 1.5 }, palette.whiteRay, 1.55 * scale, 0.92));
|
|
595
|
+
push(`<line x1="${fmt(center.x - innerR - 2.5)}" y1="${fmt(center.y + 8 + paddingTop)}" x2="${fmt(center.x + innerR + 2.5)}" y2="${fmt(center.y + 8 + paddingTop)}" stroke="${escapeAttr(palette.ink)}" stroke-width="${fmt(1.1 * scale)}"/>`);
|
|
596
|
+
push(`<line x1="${fmt(center.x - innerR - 7.5)}" y1="${fmt(center.y + paddingTop)}" x2="${fmt(center.x + innerR + 7.5)}" y2="${fmt(center.y + paddingTop)}" stroke="${escapeAttr(palette.ink)}" stroke-width="${fmt(1.1 * scale)}"/>`);
|
|
597
|
+
push(`<line x1="${fmt(center.x - innerR - 11)}" y1="${fmt(center.y - 8 + paddingTop)}" x2="${fmt(center.x + innerR + 11)}" y2="${fmt(center.y - 8 + paddingTop)}" stroke="${escapeAttr(palette.ink)}" stroke-width="${fmt(1.1 * scale)}"/>`);
|
|
598
|
+
push(`<path d="M ${fmt(arcStart.x)} ${fmt(arcStart.y)} A ${fmt(innerR * 0.72)} ${fmt(innerR * 0.72)} 0 0 1 ${fmt(arcEnd.x)} ${fmt(arcEnd.y)}" fill="none" stroke="${escapeAttr(palette.ink)}" stroke-width="${fmt(1.1 * scale)}"/>`);
|
|
599
|
+
push(`<circle cx="${fmt(center.x)}" cy="${fmt(center.y)}" r="${fmt(sunCenterCircleRadius)}" fill="${escapeAttr(palette.paper)}" stroke="${escapeAttr(palette.ink)}" stroke-width="${fmt(0.5 * scale)}"/>`);
|
|
600
|
+
push(`</g>`);
|
|
601
|
+
}
|
|
602
|
+
function renderFrame(push, model) {
|
|
603
|
+
const { center, rings, palette, scale } = model;
|
|
604
|
+
const radii = Array.from(
|
|
605
|
+
new Map(
|
|
606
|
+
[
|
|
607
|
+
rings.degreeOuter.r2,
|
|
608
|
+
rings.degreeOuter.r1,
|
|
609
|
+
rings.degreeInner.r1,
|
|
610
|
+
rings.zodiacUtterance.r1,
|
|
611
|
+
rings.planetaryUtterance.r1,
|
|
612
|
+
rings.cosmologicalMusic.r1,
|
|
613
|
+
rings.astralZodiac.r1,
|
|
614
|
+
rings.astralPlanetary.r1,
|
|
615
|
+
rings.chromicRays.r1,
|
|
616
|
+
rings.solarCenter.r2
|
|
617
|
+
].map((radius) => [fmt(radius), radius])
|
|
618
|
+
).values()
|
|
619
|
+
);
|
|
620
|
+
push(`<g id="archeometer-frame" aria-hidden="true">`);
|
|
621
|
+
for (const radius of radii) {
|
|
622
|
+
if (radius <= 0)
|
|
623
|
+
continue;
|
|
624
|
+
push(
|
|
625
|
+
`<circle cx="${fmt(center.x)}" cy="${fmt(center.y)}" r="${fmt(radius)}" fill="none" stroke="${escapeAttr(
|
|
626
|
+
palette.ringStroke
|
|
627
|
+
)}" stroke-opacity="0.82" stroke-width="${fmt(0.85 * scale)}"/>`
|
|
628
|
+
);
|
|
629
|
+
}
|
|
630
|
+
push(
|
|
631
|
+
`<circle cx="${fmt(center.x)}" cy="${fmt(center.y)}" r="${fmt(
|
|
632
|
+
rings.degreeOuter.r2
|
|
633
|
+
)}" fill="none" stroke="${escapeAttr(palette.ringStroke)}" stroke-width="${fmt(2.2 * scale)}"/>`
|
|
634
|
+
);
|
|
635
|
+
push(`</g>`);
|
|
636
|
+
}
|
|
637
|
+
function buildRings(contentRadius, frameRadius = contentRadius) {
|
|
638
|
+
const ring = (id2, r1, r2, radius = contentRadius) => ({
|
|
639
|
+
id: id2,
|
|
640
|
+
r1: round(radius * r1),
|
|
641
|
+
r2: round(radius * r2)
|
|
642
|
+
});
|
|
643
|
+
return {
|
|
644
|
+
degreeOuter: ring("degreeOuter", 0.955, 1, frameRadius),
|
|
645
|
+
degreeInner: {
|
|
646
|
+
id: "degreeInner",
|
|
647
|
+
r1: round(contentRadius * 0.955),
|
|
648
|
+
r2: round(frameRadius * 0.955)
|
|
649
|
+
},
|
|
650
|
+
zodiacUtterance: ring("zodiacUtterance", 0.8, 0.955),
|
|
651
|
+
planetaryUtterance: ring("planetaryUtterance", 0.461, 0.8),
|
|
652
|
+
cosmologicalMusic: ring("cosmologicalMusic", 0.395, 0.461),
|
|
653
|
+
astralZodiac: ring("astralZodiac", 0.297, 0.395),
|
|
654
|
+
astralPlanetary: ring("astralPlanetary", 0.198, 0.297),
|
|
655
|
+
chromicRays: ring("chromicRays", 0.198, 0.395),
|
|
656
|
+
whiteRays: ring("whiteRays", 0.12, 0.198),
|
|
657
|
+
solarCenter: ring("solarCenter", 0, 0.099)
|
|
658
|
+
};
|
|
659
|
+
}
|
|
660
|
+
function planetaryTriangleClipInnerRadius(rings) {
|
|
661
|
+
return rings.planetaryUtterance.r1;
|
|
662
|
+
}
|
|
663
|
+
function planetaryTriangleClipOuterRadius(rings) {
|
|
664
|
+
return rings.planetaryUtterance.r2;
|
|
665
|
+
}
|
|
666
|
+
function chromicCoreInnerRadius(rings) {
|
|
667
|
+
return rings.solarCenter.r2;
|
|
668
|
+
}
|
|
669
|
+
function chromicCoreOuterRadius(rings) {
|
|
670
|
+
return rings.whiteRays.r2;
|
|
671
|
+
}
|
|
672
|
+
function resolvePalette(palette) {
|
|
673
|
+
const base = COLOR_PALETTE;
|
|
674
|
+
const overrides = typeof palette === "object" ? palette : {};
|
|
675
|
+
return {
|
|
676
|
+
paper: overrides.paper ?? base.paper,
|
|
677
|
+
ink: overrides.ink ?? base.ink,
|
|
678
|
+
subtleInk: overrides.subtleInk ?? base.subtleInk,
|
|
679
|
+
ringStroke: overrides.ringStroke ?? base.ringStroke,
|
|
680
|
+
degreeTick: overrides.degreeTick ?? base.degreeTick,
|
|
681
|
+
degreeLabel: overrides.degreeLabel ?? base.degreeLabel,
|
|
682
|
+
whiteRay: overrides.whiteRay ?? base.whiteRay,
|
|
683
|
+
ringFills: { ...base.ringFills, ...overrides.ringFills ?? {} }
|
|
684
|
+
};
|
|
685
|
+
}
|
|
686
|
+
function normalizeViewBox(viewBox) {
|
|
687
|
+
return {
|
|
688
|
+
minX: viewBox?.minX ?? ARCHEOMETER_DEFAULT_VIEWBOX.minX,
|
|
689
|
+
minY: viewBox?.minY ?? ARCHEOMETER_DEFAULT_VIEWBOX.minY,
|
|
690
|
+
width: viewBox?.width ?? ARCHEOMETER_DEFAULT_VIEWBOX.width,
|
|
691
|
+
height: viewBox?.height ?? ARCHEOMETER_DEFAULT_VIEWBOX.height
|
|
692
|
+
};
|
|
693
|
+
}
|
|
694
|
+
function angleOf(model, degree) {
|
|
695
|
+
return deg2rad(degree + model.rotationDegrees - 90);
|
|
696
|
+
}
|
|
697
|
+
function polarToXY(center, radius, angleRad) {
|
|
698
|
+
return {
|
|
699
|
+
x: round(center.x + Math.cos(angleRad) * radius),
|
|
700
|
+
y: round(center.y + Math.sin(angleRad) * radius)
|
|
701
|
+
};
|
|
702
|
+
}
|
|
703
|
+
function scaleArcheometerReferencePoint(center, radius, x, y) {
|
|
704
|
+
const referenceCenter = 137.05;
|
|
705
|
+
const referenceRadius = 135.652;
|
|
706
|
+
const scale = radius / referenceRadius;
|
|
707
|
+
return {
|
|
708
|
+
x: round(center.x + (x - referenceCenter) * scale),
|
|
709
|
+
y: round(center.y + (y - referenceCenter) * scale)
|
|
710
|
+
};
|
|
711
|
+
}
|
|
712
|
+
function lineFromPolar(center, r1, r2, angleRad) {
|
|
713
|
+
const p1 = polarToXY(center, r1, angleRad);
|
|
714
|
+
const p2 = polarToXY(center, r2, angleRad);
|
|
715
|
+
return { x1: p1.x, y1: p1.y, x2: p2.x, y2: p2.y };
|
|
716
|
+
}
|
|
717
|
+
function lineSvg(line, color, strokeWidth, opacity = 1, className, attributes = "") {
|
|
718
|
+
const classAttr = className ? ` class="${escapeAttr(className)}"` : "";
|
|
719
|
+
return `<line${classAttr}${attributes} x1="${fmt(line.x1)}" y1="${fmt(line.y1)}" x2="${fmt(line.x2)}" y2="${fmt(line.y2)}" stroke="${escapeAttr(color)}" stroke-opacity="${fmt(opacity)}" stroke-width="${fmt(strokeWidth)}" stroke-linecap="round"/>`;
|
|
720
|
+
}
|
|
721
|
+
function textSvg(value, p, fontSize, color, rotation = 0, anchor = "middle", weight, className, attributes = "") {
|
|
722
|
+
const transform = rotation ? ` transform="rotate(${fmt(rotation)} ${fmt(p.x)} ${fmt(p.y)})"` : "";
|
|
723
|
+
const weightAttr = weight ? ` font-weight="${weight}"` : "";
|
|
724
|
+
const classAttr = "";
|
|
725
|
+
return `<text${classAttr}${attributes} x="${fmt(p.x)}" y="${fmt(p.y)}"${transform} font-family="${textFontFamily()}" font-size="${fmt(fontSize)}" text-anchor="${anchor}" dominant-baseline="middle" fill="${escapeAttr(color)}"${weightAttr}>${escapeText(value)}</text>`;
|
|
726
|
+
}
|
|
727
|
+
function annulusPath(center, r1, r2) {
|
|
728
|
+
return [
|
|
729
|
+
`M ${fmt(center.x)} ${fmt(center.y - r2)}`,
|
|
730
|
+
`A ${fmt(r2)} ${fmt(r2)} 0 1 1 ${fmt(center.x)} ${fmt(center.y + r2)}`,
|
|
731
|
+
`A ${fmt(r2)} ${fmt(r2)} 0 1 1 ${fmt(center.x)} ${fmt(center.y - r2)}`,
|
|
732
|
+
`M ${fmt(center.x)} ${fmt(center.y - r1)}`,
|
|
733
|
+
`A ${fmt(r1)} ${fmt(r1)} 0 1 0 ${fmt(center.x)} ${fmt(center.y + r1)}`,
|
|
734
|
+
`A ${fmt(r1)} ${fmt(r1)} 0 1 0 ${fmt(center.x)} ${fmt(center.y - r1)}`,
|
|
735
|
+
`Z`
|
|
736
|
+
].join(" ");
|
|
737
|
+
}
|
|
738
|
+
function annularSectorPath(center, r1, r2, startAngle, endAngle, spanDegrees) {
|
|
739
|
+
const outerStart = polarToXY(center, r2, startAngle);
|
|
740
|
+
const outerEnd = polarToXY(center, r2, endAngle);
|
|
741
|
+
const innerEnd = polarToXY(center, r1, endAngle);
|
|
742
|
+
const innerStart = polarToXY(center, r1, startAngle);
|
|
743
|
+
const largeArc = Math.abs(spanDegrees) > 180 ? 1 : 0;
|
|
744
|
+
const sweep = 1 ;
|
|
745
|
+
const inverseSweep = 0 ;
|
|
746
|
+
return [
|
|
747
|
+
`M ${fmt(outerStart.x)} ${fmt(outerStart.y)}`,
|
|
748
|
+
`A ${fmt(r2)} ${fmt(r2)} 0 ${largeArc} ${sweep} ${fmt(outerEnd.x)} ${fmt(outerEnd.y)}`,
|
|
749
|
+
`L ${fmt(innerEnd.x)} ${fmt(innerEnd.y)}`,
|
|
750
|
+
`A ${fmt(r1)} ${fmt(r1)} 0 ${largeArc} ${inverseSweep} ${fmt(innerStart.x)} ${fmt(innerStart.y)}`,
|
|
751
|
+
`Z`
|
|
752
|
+
].join(" ");
|
|
753
|
+
}
|
|
754
|
+
function arcSegmentPath(center, radius, startAngle, endAngle) {
|
|
755
|
+
const start = polarToXY(center, radius, startAngle);
|
|
756
|
+
const end = polarToXY(center, radius, endAngle);
|
|
757
|
+
return `M ${fmt(start.x)} ${fmt(start.y)} A ${fmt(radius)} ${fmt(radius)} 0 0 1 ${fmt(end.x)} ${fmt(end.y)}`;
|
|
758
|
+
}
|
|
759
|
+
function polygonPath(points) {
|
|
760
|
+
if (points.length === 0)
|
|
761
|
+
return "";
|
|
762
|
+
const [first, ...rest] = points;
|
|
763
|
+
return [`M ${fmt(first.x)} ${fmt(first.y)}`, ...rest.map((p) => `L ${fmt(p.x)} ${fmt(p.y)}`), "Z"].join(" ");
|
|
764
|
+
}
|
|
765
|
+
function midpoint(a, b) {
|
|
766
|
+
return { x: round((a.x + b.x) / 2), y: round((a.y + b.y) / 2) };
|
|
767
|
+
}
|
|
768
|
+
function polygonCentroid(points) {
|
|
769
|
+
const total = points.reduce(
|
|
770
|
+
(sum, point) => ({ x: sum.x + point.x, y: sum.y + point.y }),
|
|
771
|
+
{ x: 0, y: 0 }
|
|
772
|
+
);
|
|
773
|
+
return { x: round(total.x / points.length), y: round(total.y / points.length) };
|
|
774
|
+
}
|
|
775
|
+
function sortedByDegree(items) {
|
|
776
|
+
return [...items].sort((a, b) => normalizeDegrees(a.degree) - normalizeDegrees(b.degree));
|
|
777
|
+
}
|
|
778
|
+
function nearestUtterance(degree, utterance) {
|
|
779
|
+
let best;
|
|
780
|
+
let bestDelta = Number.POSITIVE_INFINITY;
|
|
781
|
+
for (const point of utterance) {
|
|
782
|
+
const delta = Math.abs(shortestAngularDistance(degree, point.degree));
|
|
783
|
+
if (delta < bestDelta) {
|
|
784
|
+
best = point;
|
|
785
|
+
bestDelta = delta;
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
return best;
|
|
789
|
+
}
|
|
790
|
+
function triangleVertexFillForDegree(model, degree) {
|
|
791
|
+
for (const triangle of model.triangles) {
|
|
792
|
+
if (!triangle.vertexFills)
|
|
793
|
+
continue;
|
|
794
|
+
for (const [index, vertexDegree] of triangle.vertices.entries()) {
|
|
795
|
+
if (Math.abs(shortestAngularDistance(degree, vertexDegree)) < 1e-3) {
|
|
796
|
+
return triangle.vertexFills[index];
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
return void 0;
|
|
801
|
+
}
|
|
802
|
+
function tangentRotation(angleRad) {
|
|
803
|
+
let degrees = rad2deg(angleRad) + 90;
|
|
804
|
+
degrees = (degrees % 360 + 360) % 360;
|
|
805
|
+
if (degrees > 90 && degrees < 270)
|
|
806
|
+
degrees += 180;
|
|
807
|
+
return (degrees % 360 + 360) % 360;
|
|
808
|
+
}
|
|
809
|
+
function shortestAngularDistance(a, b) {
|
|
810
|
+
return (normalizeDegrees(a) - normalizeDegrees(b) + 540) % 360 - 180;
|
|
811
|
+
}
|
|
812
|
+
function normalizeDegrees(value) {
|
|
813
|
+
return (value % 360 + 360) % 360;
|
|
814
|
+
}
|
|
815
|
+
function deg2rad(degrees) {
|
|
816
|
+
return degrees * (TAU / 360);
|
|
817
|
+
}
|
|
818
|
+
function rad2deg(radians) {
|
|
819
|
+
return radians * (360 / TAU);
|
|
820
|
+
}
|
|
821
|
+
function round(value) {
|
|
822
|
+
return Math.round(value * 1e3) / 1e3;
|
|
823
|
+
}
|
|
824
|
+
function fmt(value) {
|
|
825
|
+
if (!Number.isFinite(value))
|
|
826
|
+
return "0";
|
|
827
|
+
return Number.isInteger(value) ? String(value) : value.toFixed(3).replace(/0+$/, "").replace(/\.$/, "");
|
|
828
|
+
}
|
|
829
|
+
function escapeAttr(value) {
|
|
830
|
+
return escapeText(value).replace(/"/g, """);
|
|
831
|
+
}
|
|
832
|
+
function escapeText(value) {
|
|
833
|
+
return String(value).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
834
|
+
}
|
|
835
|
+
function textFontFamily() {
|
|
836
|
+
return "Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans Symbols 2', 'Noto Sans Symbols', 'Segoe UI Symbol', 'Apple Symbols', sans-serif";
|
|
837
|
+
}
|
|
2
838
|
|
|
3
839
|
// src/visual/astro-glyph-assets.ts
|
|
4
840
|
var rawGlyph = (markup) => [
|
|
@@ -219,7 +1055,8 @@ function listAstroGlyphs(category) {
|
|
|
219
1055
|
const seen = /* @__PURE__ */ new Set();
|
|
220
1056
|
return Object.values(ASTRO_GLYPHS).filter((glyph) => {
|
|
221
1057
|
const id2 = `${glyph.category}:${glyph.key}`;
|
|
222
|
-
if (seen.has(id2))
|
|
1058
|
+
if (seen.has(id2))
|
|
1059
|
+
return false;
|
|
223
1060
|
seen.add(id2);
|
|
224
1061
|
return category ? glyph.category === category : true;
|
|
225
1062
|
});
|
|
@@ -248,8 +1085,15 @@ function titleCaseGlyphKey(value) {
|
|
|
248
1085
|
}
|
|
249
1086
|
|
|
250
1087
|
// src/visual/astro-wheel.ts
|
|
251
|
-
var
|
|
1088
|
+
var TAU2 = Math.PI * 2;
|
|
252
1089
|
var GLYPH_OUTLINE_FILTER_ID = "astro-wheel-glyph-outline";
|
|
1090
|
+
var DEFAULT_ASTRO_WHEEL_RING_FRACTIONS = {
|
|
1091
|
+
houses: 7,
|
|
1092
|
+
zodiac: 13,
|
|
1093
|
+
planets: 27,
|
|
1094
|
+
aspects: 53
|
|
1095
|
+
};
|
|
1096
|
+
var DEFAULT_POINT_DISPLACEMENT_DEGREES = 20;
|
|
253
1097
|
var ASTRO_WHEEL_DEFAULT_VIEWBOX = {
|
|
254
1098
|
minX: 0,
|
|
255
1099
|
minY: 0,
|
|
@@ -392,10 +1236,10 @@ function generateGlyphSvg(primitives, options = {}) {
|
|
|
392
1236
|
const push = (s) => lines.push(s);
|
|
393
1237
|
push(`<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">`);
|
|
394
1238
|
if (bg !== "transparent") {
|
|
395
|
-
push(`<rect width="${size}" height="${size}" fill="${
|
|
1239
|
+
push(`<rect width="${size}" height="${size}" fill="${escapeAttr2(bg)}"/>`);
|
|
396
1240
|
}
|
|
397
1241
|
const glyphFill = bg === "transparent" ? "#fff" : bg;
|
|
398
|
-
push(`<g transform="translate(${cx} ${cy}) scale(${
|
|
1242
|
+
push(`<g transform="translate(${cx} ${cy}) scale(${fmt2(scale)})" color="${escapeAttr2(color)}" fill="${escapeAttr2(fillVal)}" stroke="${escapeAttr2(color)}" stroke-width="${fmt2(sw)}" stroke-linecap="round" stroke-linejoin="round">`);
|
|
399
1243
|
renderGlyphPrimitives(push, primitives, { color, glyphFill });
|
|
400
1244
|
push(`</g>`);
|
|
401
1245
|
push(`</svg>`);
|
|
@@ -407,39 +1251,41 @@ function generateAstroGlyphSvg(keyOrGlyph, options = {}) {
|
|
|
407
1251
|
throw new Error(`Unknown astrology glyph: ${String(keyOrGlyph)}`);
|
|
408
1252
|
}
|
|
409
1253
|
const svg = generateGlyphSvg(glyph.primitives, options);
|
|
410
|
-
return svg.replace("<svg ", `<svg data-astro-glyph="${
|
|
1254
|
+
return svg.replace("<svg ", `<svg data-astro-glyph="${escapeAttr2(glyph.key)}" data-astro-glyph-category="${glyph.category}" `);
|
|
411
1255
|
}
|
|
412
1256
|
function getAstroWheelRenderModel(chart, options = {}) {
|
|
413
|
-
const viewBox =
|
|
414
|
-
const palette =
|
|
1257
|
+
const viewBox = normalizeViewBox2(options.viewBox);
|
|
1258
|
+
const palette = resolvePalette2(options.palette, options.background ?? "transparent");
|
|
415
1259
|
const excludedBodies = resolveExcludedBodies(options.excludeBodies);
|
|
416
1260
|
const scale = Math.min(
|
|
417
1261
|
viewBox.width / ASTRO_WHEEL_DEFAULT_VIEWBOX.width,
|
|
418
1262
|
viewBox.height / ASTRO_WHEEL_DEFAULT_VIEWBOX.height
|
|
419
1263
|
);
|
|
420
|
-
const padding = options.padding ??
|
|
1264
|
+
const padding = options.padding ?? round2(18 * scale + getExternalPointPadding(options, scale));
|
|
421
1265
|
const center = {
|
|
422
|
-
x:
|
|
423
|
-
y:
|
|
1266
|
+
x: round2(viewBox.minX + viewBox.width / 2),
|
|
1267
|
+
y: round2(viewBox.minY + viewBox.height / 2)
|
|
424
1268
|
};
|
|
425
|
-
const outerRadius =
|
|
426
|
-
const
|
|
427
|
-
const rings =
|
|
1269
|
+
const outerRadius = round2(Math.max(0, Math.min(viewBox.width, viewBox.height) / 2 - padding));
|
|
1270
|
+
const angleOf2 = (longitude) => deg2rad2(clamp360(180 + chart.houses.ascendant.longitude - longitude));
|
|
1271
|
+
const rings = buildRings2(outerRadius, options.layout?.rings);
|
|
1272
|
+
const pointConnectorMode = options.layout?.pointConnectors ?? "auto";
|
|
1273
|
+
const maxPointDisplacementDegrees = options.layout?.maxPointDisplacementDegrees ?? DEFAULT_POINT_DISPLACEMENT_DEGREES;
|
|
428
1274
|
const resolvedPoints = resolvePointOptions(options.points);
|
|
429
1275
|
const resolvedHouses = resolveHouseOptions(options.houses);
|
|
430
1276
|
const resolvedAspects = resolveAspectOptions(options.aspects);
|
|
431
|
-
const zodiacSegments = buildZodiacSegments({ center, angleOf, rings, scale, palette });
|
|
1277
|
+
const zodiacSegments = buildZodiacSegments({ center, angleOf: angleOf2, rings, scale, palette });
|
|
432
1278
|
const houseCusps = resolvedHouses.cuspLines || resolvedHouses.labels ? buildHouseCusps({
|
|
433
1279
|
houses: chart.houses.houses,
|
|
434
1280
|
center,
|
|
435
|
-
angleOf,
|
|
1281
|
+
angleOf: angleOf2,
|
|
436
1282
|
rings,
|
|
437
1283
|
scale
|
|
438
1284
|
}) : [];
|
|
439
1285
|
const angleMarkers = resolvedHouses.angles ? buildAngleMarkers({
|
|
440
1286
|
chart,
|
|
441
1287
|
center,
|
|
442
|
-
angleOf,
|
|
1288
|
+
angleOf: angleOf2,
|
|
443
1289
|
rings,
|
|
444
1290
|
scale
|
|
445
1291
|
}) : [];
|
|
@@ -456,21 +1302,25 @@ function getAstroWheelRenderModel(chart, options = {}) {
|
|
|
456
1302
|
collisionThresholdDegrees: resolvedPoints.collisionThresholdDegrees
|
|
457
1303
|
},
|
|
458
1304
|
center,
|
|
459
|
-
angleOf,
|
|
1305
|
+
angleOf: angleOf2,
|
|
460
1306
|
rings,
|
|
461
1307
|
scale,
|
|
462
1308
|
palette,
|
|
463
|
-
excludedBodies
|
|
1309
|
+
excludedBodies,
|
|
1310
|
+
pointConnectorMode,
|
|
1311
|
+
maxDisplacementDegrees: maxPointDisplacementDegrees
|
|
464
1312
|
});
|
|
465
1313
|
const extraPointLayers = (options.pointLayers ?? []).map(
|
|
466
1314
|
(layer) => buildPointLayer({
|
|
467
1315
|
layer,
|
|
468
1316
|
center,
|
|
469
|
-
angleOf,
|
|
1317
|
+
angleOf: angleOf2,
|
|
470
1318
|
rings,
|
|
471
1319
|
scale,
|
|
472
1320
|
palette,
|
|
473
|
-
excludedBodies
|
|
1321
|
+
excludedBodies,
|
|
1322
|
+
pointConnectorMode,
|
|
1323
|
+
maxDisplacementDegrees: maxPointDisplacementDegrees
|
|
474
1324
|
})
|
|
475
1325
|
);
|
|
476
1326
|
const pointLayers = [
|
|
@@ -490,7 +1340,7 @@ function getAstroWheelRenderModel(chart, options = {}) {
|
|
|
490
1340
|
chart,
|
|
491
1341
|
pointByKey,
|
|
492
1342
|
center,
|
|
493
|
-
angleOf,
|
|
1343
|
+
angleOf: angleOf2,
|
|
494
1344
|
rings,
|
|
495
1345
|
palette,
|
|
496
1346
|
excludedBodies
|
|
@@ -501,7 +1351,7 @@ function getAstroWheelRenderModel(chart, options = {}) {
|
|
|
501
1351
|
chart: layer.chart ?? chart,
|
|
502
1352
|
pointByKey,
|
|
503
1353
|
center,
|
|
504
|
-
angleOf,
|
|
1354
|
+
angleOf: angleOf2,
|
|
505
1355
|
rings,
|
|
506
1356
|
palette,
|
|
507
1357
|
excludedBodies
|
|
@@ -540,19 +1390,19 @@ function generateAstroWheelSvg(chart, options = {}) {
|
|
|
540
1390
|
const push = (line) => lines.push(line);
|
|
541
1391
|
const svgAttributes = [
|
|
542
1392
|
`xmlns="http://www.w3.org/2000/svg"`,
|
|
543
|
-
options.width !== void 0 ? `width="${
|
|
544
|
-
options.height !== void 0 ? `height="${
|
|
545
|
-
`viewBox="${
|
|
1393
|
+
options.width !== void 0 ? `width="${escapeAttr2(String(options.width))}"` : "",
|
|
1394
|
+
options.height !== void 0 ? `height="${escapeAttr2(String(options.height))}"` : "",
|
|
1395
|
+
`viewBox="${fmt2(viewBox.minX)} ${fmt2(viewBox.minY)} ${fmt2(viewBox.width)} ${fmt2(viewBox.height)}"`,
|
|
546
1396
|
`preserveAspectRatio="xMidYMid meet"`,
|
|
547
1397
|
`role="img"`,
|
|
548
|
-
`aria-label="${
|
|
1398
|
+
`aria-label="${escapeAttr2(options.title ?? "Astrological birth chart wheel")}"`
|
|
549
1399
|
].filter(Boolean);
|
|
550
1400
|
push(`<svg ${svgAttributes.join(" ")}>`);
|
|
551
|
-
push(`<title>${
|
|
1401
|
+
push(`<title>${escapeText2(options.title ?? "Astrological birth chart wheel")}</title>`);
|
|
552
1402
|
renderSvgDefs(push, model);
|
|
553
1403
|
if (background !== "transparent") {
|
|
554
1404
|
push(
|
|
555
|
-
`<rect x="${
|
|
1405
|
+
`<rect x="${fmt2(viewBox.minX)}" y="${fmt2(viewBox.minY)}" width="${fmt2(viewBox.width)}" height="${fmt2(viewBox.height)}" fill="${escapeAttr2(background)}"/>`
|
|
556
1406
|
);
|
|
557
1407
|
}
|
|
558
1408
|
renderAspects(push, model);
|
|
@@ -569,10 +1419,10 @@ function renderSvgDefs(push, model) {
|
|
|
569
1419
|
`<filter id="${GLYPH_OUTLINE_FILTER_ID}" x="-45%" y="-45%" width="190%" height="190%">`
|
|
570
1420
|
);
|
|
571
1421
|
push(
|
|
572
|
-
`<feMorphology in="SourceAlpha" operator="dilate" radius="${
|
|
1422
|
+
`<feMorphology in="SourceAlpha" operator="dilate" radius="${fmt2(1.75 * model.scale)}" result="dilated"/>`
|
|
573
1423
|
);
|
|
574
1424
|
push(
|
|
575
|
-
`<feFlood flood-color="${
|
|
1425
|
+
`<feFlood flood-color="${escapeAttr2(model.palette.glyphHalo)}" result="haloColor"/>`
|
|
576
1426
|
);
|
|
577
1427
|
push(
|
|
578
1428
|
`<feComposite in="haloColor" in2="dilated" operator="in" result="outline"/>`
|
|
@@ -592,22 +1442,22 @@ function renderAspects(push, model) {
|
|
|
592
1442
|
const innerGuideRadius = guideRadius * 0.52;
|
|
593
1443
|
push(`<g id="astro-wheel-aspects" aria-label="aspects">`);
|
|
594
1444
|
push(
|
|
595
|
-
`<circle cx="${
|
|
1445
|
+
`<circle cx="${fmt2(model.center.x)}" cy="${fmt2(model.center.y)}" r="${fmt2(guideRadius)}" fill="none" stroke="${escapeAttr2(model.palette.aspectGuide)}" stroke-opacity="0.9" stroke-width="${fmt2(1.25 * model.scale)}"/>`
|
|
596
1446
|
);
|
|
597
1447
|
push(
|
|
598
|
-
`<circle cx="${
|
|
1448
|
+
`<circle cx="${fmt2(model.center.x)}" cy="${fmt2(model.center.y)}" r="${fmt2(innerGuideRadius)}" fill="none" stroke="${escapeAttr2(model.palette.aspectGuide)}" stroke-opacity="0.28" stroke-width="${fmt2(model.scale)}"/>`
|
|
599
1449
|
);
|
|
600
1450
|
for (const layer of model.aspectLayers) {
|
|
601
|
-
push(`<g class="astro-wheel-aspect-layer" data-aspect-layer="${
|
|
1451
|
+
push(`<g class="astro-wheel-aspect-layer" data-aspect-layer="${escapeAttr2(layer.id)}"${layer.label ? ` aria-label="${escapeAttr2(layer.label)}"` : ""}>`);
|
|
602
1452
|
for (const aspect of layer.aspectLines) {
|
|
603
1453
|
push(
|
|
604
|
-
`<line data-aspect-layer="${
|
|
1454
|
+
`<line data-aspect-layer="${escapeAttr2(aspect.layerId)}" data-aspect="${escapeAttr2(aspect.aspect)}" data-planet-a="${escapeAttr2(aspect.planetA)}" data-planet-b="${escapeAttr2(aspect.planetB)}" x1="${fmt2(aspect.line.x1)}" y1="${fmt2(aspect.line.y1)}" x2="${fmt2(aspect.line.x2)}" y2="${fmt2(aspect.line.y2)}" stroke="${escapeAttr2(aspect.color)}" stroke-opacity="${fmt2(aspect.opacity)}" stroke-width="${fmt2(aspect.strokeWidth * model.scale)}" stroke-linecap="round"/>`
|
|
605
1455
|
);
|
|
606
1456
|
}
|
|
607
1457
|
push(`</g>`);
|
|
608
1458
|
}
|
|
609
1459
|
push(
|
|
610
|
-
`<circle cx="${
|
|
1460
|
+
`<circle cx="${fmt2(model.center.x)}" cy="${fmt2(model.center.y)}" r="${fmt2(4 * model.scale)}" fill="${escapeAttr2(model.palette.aspectGuide)}" fill-opacity="0.75" stroke="none"/>`
|
|
611
1461
|
);
|
|
612
1462
|
push(`</g>`);
|
|
613
1463
|
}
|
|
@@ -618,12 +1468,12 @@ function renderZodiac(push, model, options) {
|
|
|
618
1468
|
const tickEvery = 1;
|
|
619
1469
|
const { center, rings, palette, scale } = model;
|
|
620
1470
|
const thickness = rings.zodiac.r2 - rings.zodiac.r1;
|
|
621
|
-
const
|
|
1471
|
+
const angleOf2 = (longitude) => deg2rad2(clamp360(180 + model.ascendantLongitude - longitude));
|
|
622
1472
|
push(`<g id="astro-wheel-zodiac" aria-label="zodiac">`);
|
|
623
1473
|
if (options.segments) {
|
|
624
1474
|
for (const segment of model.zodiacSegments) {
|
|
625
1475
|
push(
|
|
626
|
-
`<path data-zodiac-sign="${
|
|
1476
|
+
`<path data-zodiac-sign="${escapeAttr2(segment.sign)}" data-zodiac-element="${escapeAttr2(segment.element)}" d="${segment.path}" fill="${escapeAttr2(segment.fill)}" fill-opacity="0.82" stroke="${escapeAttr2(palette.zodiacStroke)}" stroke-width="${fmt2(model.scale)}"/>`
|
|
627
1477
|
);
|
|
628
1478
|
}
|
|
629
1479
|
}
|
|
@@ -636,17 +1486,17 @@ function renderZodiac(push, model, options) {
|
|
|
636
1486
|
for (let index = 0; index < 360 / tickEvery; index++) {
|
|
637
1487
|
const longitude = index * tickEvery;
|
|
638
1488
|
const signDegree = longitude % 30;
|
|
639
|
-
const angle =
|
|
1489
|
+
const angle = angleOf2(longitude);
|
|
640
1490
|
const isSignBoundary = signDegree === 0;
|
|
641
1491
|
const isTen = signDegree % 10 === 0;
|
|
642
1492
|
const isFive = signDegree % 5 === 0;
|
|
643
1493
|
const length = isSignBoundary ? thickness * 0.58 : isTen ? thickness * 0.42 : isFive ? thickness * 0.29 : thickness * 0.18;
|
|
644
1494
|
const strokeWidth = isSignBoundary ? 2.2 * scale : isTen ? 1.55 * scale : isFive ? 1.1 * scale : 0.75 * scale;
|
|
645
1495
|
const opacity = isSignBoundary ? 0.95 : isFive ? 0.82 : 0.62;
|
|
646
|
-
const inner =
|
|
647
|
-
const outer =
|
|
1496
|
+
const inner = polarToXY2(center.x, center.y, rings.zodiac.r2 - length, angle);
|
|
1497
|
+
const outer = polarToXY2(center.x, center.y, rings.zodiac.r2, angle);
|
|
648
1498
|
push(
|
|
649
|
-
`<line data-zodiac-tick="${longitude}" x1="${
|
|
1499
|
+
`<line data-zodiac-tick="${longitude}" x1="${fmt2(inner.x)}" y1="${fmt2(inner.y)}" x2="${fmt2(outer.x)}" y2="${fmt2(outer.y)}" stroke="${escapeAttr2(palette.zodiacStroke)}" stroke-opacity="${fmt2(opacity)}" stroke-width="${fmt2(strokeWidth)}"/>`
|
|
650
1500
|
);
|
|
651
1501
|
}
|
|
652
1502
|
}
|
|
@@ -657,9 +1507,9 @@ function renderZodiacGlyph(push, segment, palette) {
|
|
|
657
1507
|
const glyphScale = segment.labelFontSize * 0.72;
|
|
658
1508
|
const strokeWidth = clamp(0.11 / Math.max(glyphScale / 10, 0.6), 0.08, 0.16);
|
|
659
1509
|
push(
|
|
660
|
-
`<g class="astro-wheel-glyph" data-astro-glyph="${
|
|
1510
|
+
`<g class="astro-wheel-glyph" data-astro-glyph="${escapeAttr2(glyph.key)}" data-astro-glyph-category="${glyph.category}" data-zodiac-glyph="${escapeAttr2(segment.sign)}" data-zodiac-symbol="${escapeAttr2(segment.glyph)}" transform="translate(${fmt2(segment.labelPosition.x)} ${fmt2(segment.labelPosition.y)}) scale(${fmt2(glyphScale)})" color="${escapeAttr2(palette.zodiacGlyph)}" fill="none" stroke="${escapeAttr2(palette.zodiacGlyph)}" stroke-width="${fmt2(strokeWidth)}" stroke-linecap="round" stroke-linejoin="round">`
|
|
661
1511
|
);
|
|
662
|
-
push(`<title>${
|
|
1512
|
+
push(`<title>${escapeText2(`${segment.sign} ${segment.glyph}`)}</title>`);
|
|
663
1513
|
renderGlyphPrimitives(push, glyph.primitives, { color: palette.zodiacGlyph });
|
|
664
1514
|
push(`</g>`);
|
|
665
1515
|
}
|
|
@@ -672,14 +1522,14 @@ function renderHouses(push, model, options) {
|
|
|
672
1522
|
for (const cusp of model.houseCusps) {
|
|
673
1523
|
const isAngleHouse = cusp.house === 1 || cusp.house === 4 || cusp.house === 7 || cusp.house === 10;
|
|
674
1524
|
push(
|
|
675
|
-
`<line data-house-cusp="${cusp.house}" x1="${
|
|
1525
|
+
`<line data-house-cusp="${cusp.house}" x1="${fmt2(cusp.line.x1)}" y1="${fmt2(cusp.line.y1)}" x2="${fmt2(cusp.line.x2)}" y2="${fmt2(cusp.line.y2)}" stroke="${escapeAttr2(model.palette.houseLine)}" stroke-opacity="${fmt2(isAngleHouse ? 0.72 : 0.42)}" stroke-width="${fmt2(isAngleHouse ? 1.8 * model.scale : 0.95 * model.scale)}"/>`
|
|
676
1526
|
);
|
|
677
1527
|
}
|
|
678
1528
|
}
|
|
679
1529
|
if (options.labels) {
|
|
680
1530
|
for (const cusp of model.houseCusps) {
|
|
681
1531
|
push(
|
|
682
|
-
`<text data-house-label="${cusp.house}" x="${
|
|
1532
|
+
`<text data-house-label="${cusp.house}" x="${fmt2(cusp.labelPosition.x)}" y="${fmt2(cusp.labelPosition.y)}" font-family="${textFontFamily2()}" font-size="${fmt2(cusp.labelFontSize)}" text-anchor="middle" dominant-baseline="middle" fill="${escapeAttr2(model.palette.houseLabel)}">${cusp.house}</text>`
|
|
683
1533
|
);
|
|
684
1534
|
}
|
|
685
1535
|
}
|
|
@@ -687,7 +1537,7 @@ function renderHouses(push, model, options) {
|
|
|
687
1537
|
for (const marker of model.angleMarkers) {
|
|
688
1538
|
push(`<g data-angle-marker="${marker.key}">`);
|
|
689
1539
|
push(
|
|
690
|
-
`<line x1="${
|
|
1540
|
+
`<line x1="${fmt2(marker.line.x1)}" y1="${fmt2(marker.line.y1)}" x2="${fmt2(marker.line.x2)}" y2="${fmt2(marker.line.y2)}" stroke="${escapeAttr2(model.palette.angleLine)}" stroke-width="${fmt2(2 * model.scale)}"/>`
|
|
691
1541
|
);
|
|
692
1542
|
push(`</g>`);
|
|
693
1543
|
}
|
|
@@ -703,18 +1553,22 @@ function renderPlanets(push, model) {
|
|
|
703
1553
|
renderPointLayerGuide(push, layer, model);
|
|
704
1554
|
}
|
|
705
1555
|
for (const layer of model.pointLayers) {
|
|
706
|
-
push(`<g class="astro-wheel-point-layer" data-point-layer="${
|
|
1556
|
+
push(`<g class="astro-wheel-point-layer" data-point-layer="${escapeAttr2(layer.id)}"${layer.label ? ` aria-label="${escapeAttr2(layer.label)}"` : ""}>`);
|
|
707
1557
|
for (const point of layer.points) {
|
|
708
1558
|
push(
|
|
709
|
-
`<g class="astro-wheel-point" data-point-layer="${
|
|
1559
|
+
`<g class="astro-wheel-point" data-point-layer="${escapeAttr2(point.layerId)}" data-point-key="${escapeAttr2(point.key)}" data-point-name="${escapeAttr2(point.name)}" data-point-kind="${point.kind}" data-longitude="${fmt2(point.longitude)}">`
|
|
710
1560
|
);
|
|
711
|
-
push(`<title>${
|
|
1561
|
+
push(`<title>${escapeText2(point.name)} ${fmt2(point.longitude)}\xB0</title>`);
|
|
712
1562
|
push(
|
|
713
|
-
`<line x1="${
|
|
1563
|
+
`<line x1="${fmt2(point.tickLine.x1)}" y1="${fmt2(point.tickLine.y1)}" x2="${fmt2(point.tickLine.x2)}" y2="${fmt2(point.tickLine.y2)}" stroke="${escapeAttr2(point.tickColor)}" stroke-opacity="0.82" stroke-width="${fmt2(model.scale)}" stroke-linecap="round"/>`
|
|
714
1564
|
);
|
|
715
|
-
if (point.
|
|
1565
|
+
if (point.leaderArc) {
|
|
716
1566
|
push(
|
|
717
|
-
`<
|
|
1567
|
+
`<path class="astro-wheel-point-leader" d="${escapeAttr2(point.leaderArc.path)}" fill="none" stroke="${escapeAttr2(point.tickColor)}" stroke-opacity="0.52" stroke-width="${fmt2(0.9 * model.scale)}" stroke-linecap="round" stroke-linejoin="round"/>`
|
|
1568
|
+
);
|
|
1569
|
+
} else if (point.leaderLine) {
|
|
1570
|
+
push(
|
|
1571
|
+
`<line class="astro-wheel-point-leader" x1="${fmt2(point.leaderLine.x1)}" y1="${fmt2(point.leaderLine.y1)}" x2="${fmt2(point.leaderLine.x2)}" y2="${fmt2(point.leaderLine.y2)}" stroke="${escapeAttr2(point.tickColor)}" stroke-opacity="0.52" stroke-width="${fmt2(0.9 * model.scale)}" stroke-linecap="round"/>`
|
|
718
1572
|
);
|
|
719
1573
|
}
|
|
720
1574
|
push(`</g>`);
|
|
@@ -729,7 +1583,7 @@ function renderPointLayerGuide(push, layer, model) {
|
|
|
729
1583
|
return;
|
|
730
1584
|
}
|
|
731
1585
|
push(
|
|
732
|
-
`<circle class="astro-wheel-external-point-ring" data-point-layer="${
|
|
1586
|
+
`<circle class="astro-wheel-external-point-ring" data-point-layer="${escapeAttr2(layer.id)}" cx="${fmt2(model.center.x)}" cy="${fmt2(model.center.y)}" r="${fmt2(layer.radius)}" fill="none" stroke="${escapeAttr2(layer.tickColor)}" stroke-opacity="0.32" stroke-width="${fmt2(1.15 * model.scale)}"/>`
|
|
733
1587
|
);
|
|
734
1588
|
}
|
|
735
1589
|
function renderGlyphOverlay(push, model) {
|
|
@@ -747,7 +1601,7 @@ function renderGlyphOverlay(push, model) {
|
|
|
747
1601
|
if (model.pointLayers.length > 0) {
|
|
748
1602
|
push(`<g id="astro-wheel-point-glyphs" aria-label="planet glyphs">`);
|
|
749
1603
|
for (const layer of model.pointLayers) {
|
|
750
|
-
push(`<g class="astro-wheel-point-glyph-layer" data-point-layer="${
|
|
1604
|
+
push(`<g class="astro-wheel-point-glyph-layer" data-point-layer="${escapeAttr2(layer.id)}"${layer.label ? ` aria-label="${escapeAttr2(layer.label)} glyphs"` : ""}>`);
|
|
751
1605
|
for (const point of layer.points) {
|
|
752
1606
|
renderPointLabelGroup(push, point, model);
|
|
753
1607
|
}
|
|
@@ -774,14 +1628,14 @@ function renderAngleGlyph(push, marker, model) {
|
|
|
774
1628
|
const signX = degreeX + degreeWidth + gap + signScale / 2;
|
|
775
1629
|
const minutesX = signX + signScale / 2 + gap;
|
|
776
1630
|
push(
|
|
777
|
-
`<g class="astro-wheel-angle-glyph-label" data-angle-marker="${marker.key}" data-longitude="${
|
|
1631
|
+
`<g class="astro-wheel-angle-glyph-label" data-angle-marker="${marker.key}" data-longitude="${fmt2(marker.longitude)}" transform="translate(${fmt2(marker.labelPosition.x)} ${fmt2(marker.labelPosition.y)}) rotate(${fmt2(marker.labelRotation)})" filter="url(#${GLYPH_OUTLINE_FILTER_ID})">`
|
|
778
1632
|
);
|
|
779
|
-
push(`<title>${
|
|
1633
|
+
push(`<title>${escapeText2(`${label} ${position.degreesText} ${position.sign} ${position.minutesText}`)}</title>`);
|
|
780
1634
|
push(
|
|
781
|
-
`<text class="astro-wheel-angle-label" x="${
|
|
1635
|
+
`<text class="astro-wheel-angle-label" x="${fmt2(labelX)}" y="0" font-family="${textFontFamily2()}" font-size="${fmt2(labelFontSize)}" text-anchor="start" dominant-baseline="middle" fill="${escapeAttr2(model.palette.angleLabel)}" font-weight="700">${escapeText2(label)}</text>`
|
|
782
1636
|
);
|
|
783
1637
|
push(
|
|
784
|
-
`<text class="astro-wheel-angle-degree" x="${
|
|
1638
|
+
`<text class="astro-wheel-angle-degree" x="${fmt2(degreeX)}" y="0" font-family="${textFontFamily2()}" font-size="${fmt2(positionFontSize)}" text-anchor="start" dominant-baseline="middle" fill="${escapeAttr2(model.palette.angleLabel)}">${escapeText2(position.degreesText)}</text>`
|
|
785
1639
|
);
|
|
786
1640
|
renderInlineSignGlyph(
|
|
787
1641
|
push,
|
|
@@ -792,22 +1646,24 @@ function renderAngleGlyph(push, marker, model) {
|
|
|
792
1646
|
model.palette.angleLabel
|
|
793
1647
|
);
|
|
794
1648
|
push(
|
|
795
|
-
`<text class="astro-wheel-angle-minutes" x="${
|
|
1649
|
+
`<text class="astro-wheel-angle-minutes" x="${fmt2(minutesX)}" y="0" font-family="${textFontFamily2()}" font-size="${fmt2(positionFontSize)}" text-anchor="start" dominant-baseline="middle" fill="${escapeAttr2(model.palette.angleLabel)}">${escapeText2(position.minutesText)}</text>`
|
|
796
1650
|
);
|
|
797
1651
|
push(`</g>`);
|
|
798
1652
|
}
|
|
799
1653
|
function angleDisplayLabel(key) {
|
|
800
|
-
if (key === "ASC")
|
|
801
|
-
|
|
1654
|
+
if (key === "ASC")
|
|
1655
|
+
return "AC";
|
|
1656
|
+
if (key === "DSC")
|
|
1657
|
+
return "DC";
|
|
802
1658
|
return key;
|
|
803
1659
|
}
|
|
804
1660
|
function renderPointLabelGroup(push, point, model) {
|
|
805
1661
|
const layout = getPointLabelLayout(point, model.scale);
|
|
806
|
-
const boundsAttr = point.labelBounds ? ` data-label-bounds="${
|
|
1662
|
+
const boundsAttr = point.labelBounds ? ` data-label-bounds="${escapeAttr2(formatLabelBounds(point.labelBounds))}"` : "";
|
|
807
1663
|
push(
|
|
808
|
-
`<g class="astro-wheel-point-label" data-point-layer="${
|
|
1664
|
+
`<g class="astro-wheel-point-label" data-point-layer="${escapeAttr2(point.layerId)}" data-point-key="${escapeAttr2(point.key)}" data-point-name="${escapeAttr2(point.name)}" data-point-kind="${point.kind}" data-longitude="${fmt2(point.longitude)}"${boundsAttr} transform="translate(${fmt2(point.glyphPosition.x)} ${fmt2(point.glyphPosition.y)})" filter="url(#${GLYPH_OUTLINE_FILTER_ID})">`
|
|
809
1665
|
);
|
|
810
|
-
push(`<title>${
|
|
1666
|
+
push(`<title>${escapeText2(pointLabelTitle(point))}</title>`);
|
|
811
1667
|
renderPointGlyph(push, point, layout.glyphX, layout.glyphY, layout.glyphScale, model.palette.glyphHalo);
|
|
812
1668
|
if (point.retrograde) {
|
|
813
1669
|
renderRetrogradeMarker(
|
|
@@ -826,13 +1682,13 @@ function renderPointGlyph(push, point, x, y, glyphScale, glyphFill) {
|
|
|
826
1682
|
if (glyph) {
|
|
827
1683
|
const strokeWidth = clamp(0.12 / Math.max(glyphScale / 10, 0.6), 0.1, 0.18);
|
|
828
1684
|
push(
|
|
829
|
-
`<g class="astro-wheel-glyph" data-astro-glyph="${
|
|
1685
|
+
`<g class="astro-wheel-glyph" data-astro-glyph="${escapeAttr2(glyph.key)}" data-astro-glyph-category="${glyph.category}" data-point-glyph="${escapeAttr2(point.name)}" transform="translate(${fmt2(x)} ${fmt2(y)}) scale(${fmt2(glyphScale)})" color="${escapeAttr2(point.color)}" fill="none" stroke="${escapeAttr2(point.color)}" stroke-width="${fmt2(strokeWidth)}" stroke-linecap="round" stroke-linejoin="round">`
|
|
830
1686
|
);
|
|
831
1687
|
renderGlyphPrimitives(push, glyph.primitives, { color: point.color, glyphFill });
|
|
832
1688
|
push(`</g>`);
|
|
833
1689
|
} else {
|
|
834
1690
|
push(
|
|
835
|
-
`<text class="astro-wheel-glyph" data-point-glyph="${
|
|
1691
|
+
`<text class="astro-wheel-glyph" data-point-glyph="${escapeAttr2(point.name)}" x="${fmt2(x)}" y="${fmt2(y)}" font-family="${symbolFontFamily()}" font-size="${fmt2(point.glyphFontSize)}" text-anchor="middle" dominant-baseline="middle" fill="${escapeAttr2(point.color)}">${escapeText2(point.glyph)}</text>`
|
|
836
1692
|
);
|
|
837
1693
|
}
|
|
838
1694
|
}
|
|
@@ -842,14 +1698,14 @@ function renderRetrogradeMarker(push, x, y, fontSize, color) {
|
|
|
842
1698
|
const glyphScale = fontSize * 0.62;
|
|
843
1699
|
const strokeWidth = clamp(0.12 / Math.max(glyphScale / 10, 0.6), 0.1, 0.18);
|
|
844
1700
|
push(
|
|
845
|
-
`<g class="astro-wheel-point-retrograde" data-astro-glyph="${
|
|
1701
|
+
`<g class="astro-wheel-point-retrograde" data-astro-glyph="${escapeAttr2(glyph.key)}" data-astro-glyph-category="${glyph.category}" transform="translate(${fmt2(x)} ${fmt2(y)}) scale(${fmt2(glyphScale)})" color="${escapeAttr2(color)}" fill="none" stroke="${escapeAttr2(color)}" stroke-width="${fmt2(strokeWidth)}" stroke-linecap="round" stroke-linejoin="round">`
|
|
846
1702
|
);
|
|
847
1703
|
renderGlyphPrimitives(push, glyph.primitives, { color });
|
|
848
1704
|
push(`</g>`);
|
|
849
1705
|
return;
|
|
850
1706
|
}
|
|
851
1707
|
push(
|
|
852
|
-
`<text class="astro-wheel-point-retrograde" x="${
|
|
1708
|
+
`<text class="astro-wheel-point-retrograde" x="${fmt2(x)}" y="${fmt2(y)}" font-family="${textFontFamily2()}" font-size="${fmt2(fontSize)}" text-anchor="middle" dominant-baseline="middle" fill="${escapeAttr2(color)}" font-weight="700">R</text>`
|
|
853
1709
|
);
|
|
854
1710
|
}
|
|
855
1711
|
function renderPointInlineDegreeLabel(push, point, layout) {
|
|
@@ -857,11 +1713,11 @@ function renderPointInlineDegreeLabel(push, point, layout) {
|
|
|
857
1713
|
return;
|
|
858
1714
|
}
|
|
859
1715
|
push(
|
|
860
|
-
`<text class="astro-wheel-point-degree" x="${
|
|
1716
|
+
`<text class="astro-wheel-point-degree" x="${fmt2(layout.degreeX)}" y="${fmt2(layout.degreeY)}" font-family="${textFontFamily2()}" font-size="${fmt2(layout.fontSize)}" text-anchor="start" dominant-baseline="middle" fill="${escapeAttr2(point.color)}" fill-opacity="0.9">${escapeText2(layout.position.degreesText)}</text>`
|
|
861
1717
|
);
|
|
862
1718
|
renderInlineSignGlyph(push, layout.position.sign, layout.signX, layout.signY, layout.signScale, point.color);
|
|
863
1719
|
push(
|
|
864
|
-
`<text class="astro-wheel-point-minutes" x="${
|
|
1720
|
+
`<text class="astro-wheel-point-minutes" x="${fmt2(layout.minutesX)}" y="${fmt2(layout.minutesY)}" font-family="${textFontFamily2()}" font-size="${fmt2(layout.fontSize)}" text-anchor="start" dominant-baseline="middle" fill="${escapeAttr2(point.color)}" fill-opacity="0.9">${escapeText2(layout.position.minutesText)}</text>`
|
|
865
1721
|
);
|
|
866
1722
|
}
|
|
867
1723
|
function renderInlineSignGlyph(push, sign, x, y, glyphScale, color) {
|
|
@@ -869,14 +1725,14 @@ function renderInlineSignGlyph(push, sign, x, y, glyphScale, color) {
|
|
|
869
1725
|
if (glyph) {
|
|
870
1726
|
const strokeWidth = clamp(0.11 / Math.max(glyphScale / 10, 0.6), 0.08, 0.16);
|
|
871
1727
|
push(
|
|
872
|
-
`<g class="astro-wheel-point-sign-glyph" data-astro-glyph="${
|
|
1728
|
+
`<g class="astro-wheel-point-sign-glyph" data-astro-glyph="${escapeAttr2(glyph.key)}" data-astro-glyph-category="${glyph.category}" data-zodiac-glyph="${escapeAttr2(sign)}" transform="translate(${fmt2(x)} ${fmt2(y)}) scale(${fmt2(glyphScale)})" color="${escapeAttr2(color)}" fill="none" stroke="${escapeAttr2(color)}" stroke-width="${fmt2(strokeWidth)}" stroke-linecap="round" stroke-linejoin="round">`
|
|
873
1729
|
);
|
|
874
1730
|
renderGlyphPrimitives(push, glyph.primitives, { color });
|
|
875
1731
|
push(`</g>`);
|
|
876
1732
|
return;
|
|
877
1733
|
}
|
|
878
1734
|
push(
|
|
879
|
-
`<text class="astro-wheel-point-sign-glyph" x="${
|
|
1735
|
+
`<text class="astro-wheel-point-sign-glyph" x="${fmt2(x)}" y="${fmt2(y)}" font-family="${symbolFontFamily()}" font-size="${fmt2(glyphScale)}" text-anchor="middle" dominant-baseline="middle" fill="${escapeAttr2(color)}">${escapeText2(sign.charAt(0).toUpperCase())}</text>`
|
|
880
1736
|
);
|
|
881
1737
|
}
|
|
882
1738
|
function getPointLabelLayout(point, scale) {
|
|
@@ -978,7 +1834,7 @@ function formatInlinePosition(position) {
|
|
|
978
1834
|
function pointLabelTitle(point) {
|
|
979
1835
|
const position = point.zodiacPosition ? formatInlinePosition(point.zodiacPosition) : null;
|
|
980
1836
|
if (!position) {
|
|
981
|
-
return `${point.name} ${
|
|
1837
|
+
return `${point.name} ${fmt2(point.longitude)}\xB0`;
|
|
982
1838
|
}
|
|
983
1839
|
const retrograde = point.retrograde ? " Rx" : "";
|
|
984
1840
|
return `${point.name} ${position.degreesText} ${position.sign} ${position.minutesText}${retrograde}`;
|
|
@@ -990,10 +1846,10 @@ function labelBoundsFor(position, layout, padding) {
|
|
|
990
1846
|
const width = layout.width + padding * 2;
|
|
991
1847
|
const height = layout.height + padding * 2;
|
|
992
1848
|
return {
|
|
993
|
-
x:
|
|
994
|
-
y:
|
|
995
|
-
width:
|
|
996
|
-
height:
|
|
1849
|
+
x: round2(position.x + layout.boundsX - padding),
|
|
1850
|
+
y: round2(position.y + layout.boundsY - padding),
|
|
1851
|
+
width: round2(width),
|
|
1852
|
+
height: round2(height)
|
|
997
1853
|
};
|
|
998
1854
|
}
|
|
999
1855
|
function constrainLabelInsideCircle(params) {
|
|
@@ -1017,8 +1873,8 @@ function constrainLabelInsideCircle(params) {
|
|
|
1017
1873
|
const dy = position.y - center.y;
|
|
1018
1874
|
const distance = Math.max(Math.hypot(dx, dy), 1);
|
|
1019
1875
|
position = {
|
|
1020
|
-
x:
|
|
1021
|
-
y:
|
|
1876
|
+
x: round2(position.x - dx / distance * (overflow + 0.75)),
|
|
1877
|
+
y: round2(position.y - dy / distance * (overflow + 0.75))
|
|
1022
1878
|
};
|
|
1023
1879
|
moved = true;
|
|
1024
1880
|
}
|
|
@@ -1043,7 +1899,7 @@ function labelBoundsCircleOverflow(center, bounds, maxRadius) {
|
|
|
1043
1899
|
return farthestCorner - maxRadius;
|
|
1044
1900
|
}
|
|
1045
1901
|
function formatLabelBounds(bounds) {
|
|
1046
|
-
return `${
|
|
1902
|
+
return `${fmt2(bounds.x)} ${fmt2(bounds.y)} ${fmt2(bounds.width)} ${fmt2(bounds.height)}`;
|
|
1047
1903
|
}
|
|
1048
1904
|
function projectedLabelWidthAlongTangent(angleRad, bounds) {
|
|
1049
1905
|
const tangentX = -Math.sin(angleRad);
|
|
@@ -1093,11 +1949,11 @@ function getExternalPointPadding(options, scale) {
|
|
|
1093
1949
|
);
|
|
1094
1950
|
}
|
|
1095
1951
|
function buildZodiacSegments(params) {
|
|
1096
|
-
const { center, angleOf, rings, scale, palette } = params;
|
|
1952
|
+
const { center, angleOf: angleOf2, rings, scale, palette } = params;
|
|
1097
1953
|
const boundaries = unwrapAngles(
|
|
1098
1954
|
Array.from(
|
|
1099
1955
|
{ length: ASTRO_WHEEL_ZODIAC_SIGNS.length + 1 },
|
|
1100
|
-
(_, index) =>
|
|
1956
|
+
(_, index) => angleOf2(index * 30)
|
|
1101
1957
|
),
|
|
1102
1958
|
"dec"
|
|
1103
1959
|
);
|
|
@@ -1106,11 +1962,11 @@ function buildZodiacSegments(params) {
|
|
|
1106
1962
|
return ASTRO_WHEEL_ZODIAC_SIGNS.map((entry, index) => {
|
|
1107
1963
|
const angleStart = boundaries[index];
|
|
1108
1964
|
const angleEnd = boundaries[index + 1];
|
|
1109
|
-
const labelPosition =
|
|
1965
|
+
const labelPosition = polarToXY2(
|
|
1110
1966
|
center.x,
|
|
1111
1967
|
center.y,
|
|
1112
1968
|
(rings.zodiac.r1 + rings.zodiac.r2) / 2,
|
|
1113
|
-
|
|
1969
|
+
angleOf2(index * 30 + 15)
|
|
1114
1970
|
);
|
|
1115
1971
|
return {
|
|
1116
1972
|
sign: entry.sign,
|
|
@@ -1128,14 +1984,14 @@ function buildZodiacSegments(params) {
|
|
|
1128
1984
|
});
|
|
1129
1985
|
}
|
|
1130
1986
|
function buildHouseCusps(params) {
|
|
1131
|
-
const { houses, center, angleOf, rings, scale } = params;
|
|
1987
|
+
const { houses, center, angleOf: angleOf2, rings, scale } = params;
|
|
1132
1988
|
const ring = rings.houses;
|
|
1133
1989
|
const spokeInnerRadius = rings.aspects.r2;
|
|
1134
1990
|
const spokeOuterRadius = ring.r2 + 4 * scale;
|
|
1135
1991
|
const labelRadius = ring.r2 + 12 * scale;
|
|
1136
1992
|
const labelFontSize = clamp((ring.r2 - ring.r1) * 0.48, 10 * scale, 19 * scale);
|
|
1137
1993
|
return houses.map((house, index) => {
|
|
1138
|
-
const angle =
|
|
1994
|
+
const angle = angleOf2(house.longitude);
|
|
1139
1995
|
const next = houses[(index + 1) % houses.length];
|
|
1140
1996
|
const span = clamp360(next.longitude - house.longitude);
|
|
1141
1997
|
const labelLongitude = clamp360(house.longitude + span / 2);
|
|
@@ -1143,16 +1999,20 @@ function buildHouseCusps(params) {
|
|
|
1143
1999
|
house: index + 1,
|
|
1144
2000
|
longitude: normalizeAngle(house.longitude),
|
|
1145
2001
|
sign: house.sign,
|
|
1146
|
-
line:
|
|
1147
|
-
labelPosition:
|
|
2002
|
+
line: lineFromPolar2(center, spokeInnerRadius, spokeOuterRadius, angle),
|
|
2003
|
+
labelPosition: polarToXY2(center.x, center.y, labelRadius, angleOf2(labelLongitude)),
|
|
1148
2004
|
labelFontSize
|
|
1149
2005
|
};
|
|
1150
2006
|
});
|
|
1151
2007
|
}
|
|
1152
2008
|
function buildAngleMarkers(params) {
|
|
1153
|
-
const { chart, center, angleOf, rings, scale } = params;
|
|
2009
|
+
const { chart, center, angleOf: angleOf2, rings, scale } = params;
|
|
1154
2010
|
const ring = rings.houses;
|
|
1155
2011
|
const labelFontSize = clamp((ring.r2 - ring.r1) * 0.32, 8 * scale, 18 * scale);
|
|
2012
|
+
const labelRadius = Math.min(
|
|
2013
|
+
ring.r2 + 9 * scale,
|
|
2014
|
+
ring.r2 - Math.max(10 * scale, labelFontSize * 0.6)
|
|
2015
|
+
);
|
|
1156
2016
|
const markers = [
|
|
1157
2017
|
{ key: "ASC", position: chart.houses.ascendant },
|
|
1158
2018
|
{ key: "MC", position: chart.houses.mc },
|
|
@@ -1160,7 +2020,7 @@ function buildAngleMarkers(params) {
|
|
|
1160
2020
|
{ key: "IC", position: chart.houses.ic }
|
|
1161
2021
|
];
|
|
1162
2022
|
return markers.map((marker) => {
|
|
1163
|
-
const angle =
|
|
2023
|
+
const angle = angleOf2(marker.position.longitude);
|
|
1164
2024
|
const angleDeg = clamp360(angle * (180 / Math.PI));
|
|
1165
2025
|
let labelRotation = angleDeg;
|
|
1166
2026
|
if (labelRotation > 90 && labelRotation < 270) {
|
|
@@ -1170,11 +2030,11 @@ function buildAngleMarkers(params) {
|
|
|
1170
2030
|
key: marker.key,
|
|
1171
2031
|
longitude: normalizeAngle(marker.position.longitude),
|
|
1172
2032
|
zodiacPosition: marker.position,
|
|
1173
|
-
line:
|
|
2033
|
+
line: lineFromPolar2(center, ring.r1 + 4 * scale, ring.r2 - 4 * scale, angle),
|
|
1174
2034
|
labelPosition: polarWithNudge(
|
|
1175
2035
|
center.x,
|
|
1176
2036
|
center.y,
|
|
1177
|
-
|
|
2037
|
+
labelRadius,
|
|
1178
2038
|
angle,
|
|
1179
2039
|
0,
|
|
1180
2040
|
0
|
|
@@ -1185,7 +2045,17 @@ function buildAngleMarkers(params) {
|
|
|
1185
2045
|
});
|
|
1186
2046
|
}
|
|
1187
2047
|
function buildPointLayer(params) {
|
|
1188
|
-
const {
|
|
2048
|
+
const {
|
|
2049
|
+
layer,
|
|
2050
|
+
center,
|
|
2051
|
+
angleOf: angleOf2,
|
|
2052
|
+
rings,
|
|
2053
|
+
scale,
|
|
2054
|
+
palette,
|
|
2055
|
+
excludedBodies,
|
|
2056
|
+
pointConnectorMode,
|
|
2057
|
+
maxDisplacementDegrees
|
|
2058
|
+
} = params;
|
|
1189
2059
|
const ring = rings.planets;
|
|
1190
2060
|
const requestedRadius = resolvePointLayerRadius(layer, rings);
|
|
1191
2061
|
const requestedExternalLayer = requestedRadius > rings.houses.r2 + scale;
|
|
@@ -1206,7 +2076,7 @@ function buildPointLayer(params) {
|
|
|
1206
2076
|
const color = layer.color ?? palette.planetGlyph;
|
|
1207
2077
|
const tickColor = layer.tickColor ?? color;
|
|
1208
2078
|
const pointIntents = seeds.map((seed) => {
|
|
1209
|
-
const tickAngle =
|
|
2079
|
+
const tickAngle = angleOf2(seed.longitude);
|
|
1210
2080
|
const pointGlyphFontSize = seed.kind === "vertex" ? glyphFontSize * 0.82 : glyphFontSize;
|
|
1211
2081
|
const rawGlyphRadius = radius;
|
|
1212
2082
|
const glyphRadius = isExternalLayer ? rawGlyphRadius : clamp(
|
|
@@ -1214,21 +2084,23 @@ function buildPointLayer(params) {
|
|
|
1214
2084
|
rings.aspects.r2 + pointGlyphFontSize * 0.65,
|
|
1215
2085
|
labelMaxRadius - pointGlyphFontSize * 0.5
|
|
1216
2086
|
);
|
|
1217
|
-
const
|
|
2087
|
+
const connectorRadius = glyphRadius;
|
|
2088
|
+
const tickLine = isExternalLayer ? lineFromPolar2(
|
|
1218
2089
|
center,
|
|
1219
2090
|
rings.houses.r2 + 2 * scale,
|
|
1220
|
-
|
|
2091
|
+
connectorRadius,
|
|
2092
|
+
tickAngle
|
|
2093
|
+
) : lineFromPolar2(
|
|
2094
|
+
center,
|
|
2095
|
+
Math.min(ring.r2, connectorRadius + tickLength),
|
|
2096
|
+
connectorRadius,
|
|
1221
2097
|
tickAngle
|
|
1222
|
-
)
|
|
1223
|
-
const
|
|
1224
|
-
const leaderStart = polarToXY(center.x, center.y, leaderStartRadius, tickAngle);
|
|
1225
|
-
const idealPosition = polarToXY(center.x, center.y, glyphRadius, tickAngle);
|
|
2098
|
+
);
|
|
2099
|
+
const idealPosition = polarToXY2(center.x, center.y, glyphRadius, tickAngle);
|
|
1226
2100
|
const point = makeAstroWheelPoint({
|
|
1227
2101
|
layer,
|
|
1228
2102
|
seed,
|
|
1229
2103
|
tickLine,
|
|
1230
|
-
leaderStart,
|
|
1231
|
-
tickAngle,
|
|
1232
2104
|
labelAngle: tickAngle,
|
|
1233
2105
|
glyphPosition: idealPosition,
|
|
1234
2106
|
glyphFontSize: pointGlyphFontSize,
|
|
@@ -1238,13 +2110,13 @@ function buildPointLayer(params) {
|
|
|
1238
2110
|
const layout = getPointLabelLayout(point, scale);
|
|
1239
2111
|
const labelBounds = labelBoundsFor(idealPosition, layout, collisionPadding);
|
|
1240
2112
|
const labelTangentDemandPx = projectedLabelWidthAlongTangent(tickAngle, labelBounds);
|
|
1241
|
-
const configuredTangentDemandPx = layer.collisionThresholdDegrees ?
|
|
2113
|
+
const configuredTangentDemandPx = layer.collisionThresholdDegrees ? deg2rad2(clamp(layer.collisionThresholdDegrees, 0, 30)) * glyphRadius : 0;
|
|
1242
2114
|
const tangentDemandPx = Math.max(labelTangentDemandPx, configuredTangentDemandPx);
|
|
1243
2115
|
return {
|
|
1244
2116
|
seed,
|
|
1245
2117
|
tickAngle,
|
|
1246
2118
|
tickLine,
|
|
1247
|
-
|
|
2119
|
+
connectorRadius,
|
|
1248
2120
|
glyphRadius,
|
|
1249
2121
|
pointGlyphFontSize,
|
|
1250
2122
|
tangentDemandPx
|
|
@@ -1257,20 +2129,21 @@ function buildPointLayer(params) {
|
|
|
1257
2129
|
radius: intent.glyphRadius,
|
|
1258
2130
|
tangentDemandPx: intent.tangentDemandPx
|
|
1259
2131
|
})),
|
|
1260
|
-
|
|
2132
|
+
{
|
|
2133
|
+
paddingPx: collisionPadding,
|
|
2134
|
+
maxDisplacementRad: deg2rad2(clamp(maxDisplacementDegrees, 0, 180))
|
|
2135
|
+
}
|
|
1261
2136
|
);
|
|
1262
2137
|
const visualAngleByKey = Object.fromEntries(
|
|
1263
2138
|
solvedLabels.map(({ item, visualAngle }) => [item.seed.key, visualAngle])
|
|
1264
2139
|
);
|
|
1265
2140
|
const points = pointIntents.map((intent) => {
|
|
1266
2141
|
const visualAngle = visualAngleByKey[intent.seed.key] ?? intent.tickAngle;
|
|
1267
|
-
let glyphPosition =
|
|
2142
|
+
let glyphPosition = polarToXY2(center.x, center.y, intent.glyphRadius, visualAngle);
|
|
1268
2143
|
let point = makeAstroWheelPoint({
|
|
1269
2144
|
layer,
|
|
1270
2145
|
seed: intent.seed,
|
|
1271
2146
|
tickLine: intent.tickLine,
|
|
1272
|
-
leaderStart: intent.leaderStart,
|
|
1273
|
-
tickAngle: intent.tickAngle,
|
|
1274
2147
|
labelAngle: visualAngle,
|
|
1275
2148
|
glyphPosition,
|
|
1276
2149
|
glyphFontSize: intent.pointGlyphFontSize,
|
|
@@ -1290,14 +2163,20 @@ function buildPointLayer(params) {
|
|
|
1290
2163
|
point = {
|
|
1291
2164
|
...point,
|
|
1292
2165
|
glyphPosition,
|
|
1293
|
-
leaderLine:
|
|
1294
|
-
x1: intent.leaderStart.x,
|
|
1295
|
-
y1: intent.leaderStart.y,
|
|
1296
|
-
x2: glyphPosition.x,
|
|
1297
|
-
y2: glyphPosition.y
|
|
1298
|
-
}
|
|
2166
|
+
leaderLine: void 0
|
|
1299
2167
|
};
|
|
1300
2168
|
}
|
|
2169
|
+
point = {
|
|
2170
|
+
...point,
|
|
2171
|
+
leaderArc: buildPointConnector({
|
|
2172
|
+
center,
|
|
2173
|
+
tickAngle: intent.tickAngle,
|
|
2174
|
+
labelAngle: visualAngle,
|
|
2175
|
+
connectorRadius: intent.connectorRadius,
|
|
2176
|
+
glyphPosition,
|
|
2177
|
+
mode: pointConnectorMode
|
|
2178
|
+
})
|
|
2179
|
+
};
|
|
1301
2180
|
return {
|
|
1302
2181
|
...point,
|
|
1303
2182
|
labelBounds: constrainedLabel.bounds
|
|
@@ -1317,15 +2196,12 @@ function makeAstroWheelPoint(params) {
|
|
|
1317
2196
|
layer,
|
|
1318
2197
|
seed,
|
|
1319
2198
|
tickLine,
|
|
1320
|
-
leaderStart,
|
|
1321
|
-
tickAngle,
|
|
1322
2199
|
labelAngle,
|
|
1323
2200
|
glyphPosition,
|
|
1324
2201
|
glyphFontSize,
|
|
1325
2202
|
color,
|
|
1326
2203
|
tickColor
|
|
1327
2204
|
} = params;
|
|
1328
|
-
const labelDisplaced = circularAngleDistance(labelAngle, tickAngle) > 1e-4;
|
|
1329
2205
|
return {
|
|
1330
2206
|
layerId: layer.id,
|
|
1331
2207
|
key: seed.key,
|
|
@@ -1338,12 +2214,8 @@ function makeAstroWheelPoint(params) {
|
|
|
1338
2214
|
zodiacPosition: seed.zodiacPosition,
|
|
1339
2215
|
tickLine,
|
|
1340
2216
|
labelAngle,
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
y1: leaderStart.y,
|
|
1344
|
-
x2: glyphPosition.x,
|
|
1345
|
-
y2: glyphPosition.y
|
|
1346
|
-
} : void 0,
|
|
2217
|
+
leaderArc: void 0,
|
|
2218
|
+
leaderLine: void 0,
|
|
1347
2219
|
glyphPosition,
|
|
1348
2220
|
glyphFontSize,
|
|
1349
2221
|
retrograde: seed.retrograde,
|
|
@@ -1352,7 +2224,7 @@ function makeAstroWheelPoint(params) {
|
|
|
1352
2224
|
};
|
|
1353
2225
|
}
|
|
1354
2226
|
function buildAspectLayer(params) {
|
|
1355
|
-
const { layer, chart, pointByKey, center, angleOf, rings, palette, excludedBodies } = params;
|
|
2227
|
+
const { layer, chart, pointByKey, center, angleOf: angleOf2, rings, palette, excludedBodies } = params;
|
|
1356
2228
|
const sourceEdges = getSourceAspectEdges(chart, {
|
|
1357
2229
|
edges: layer.edges,
|
|
1358
2230
|
aspectSpecs: layer.aspectSpecs
|
|
@@ -1375,8 +2247,8 @@ function buildAspectLayer(params) {
|
|
|
1375
2247
|
const spec = findAspectSpec(edge.aspect, layer.aspectSpecs);
|
|
1376
2248
|
const maxOrb = spec?.orb ?? 8;
|
|
1377
2249
|
const opacity = clamp((1 - edge.orb / Math.max(maxOrb, 1e-3)) * (layer.opacityScale ?? 1), 0.25, 0.92);
|
|
1378
|
-
const a =
|
|
1379
|
-
const b =
|
|
2250
|
+
const a = polarToXY2(center.x, center.y, aspectRadius, angleOf2(planetA.longitude));
|
|
2251
|
+
const b = polarToXY2(center.x, center.y, aspectRadius, angleOf2(planetB.longitude));
|
|
1380
2252
|
return [{
|
|
1381
2253
|
layerId: layer.id,
|
|
1382
2254
|
planetA: planetA.name,
|
|
@@ -1472,7 +2344,8 @@ function pointSeed(point, layerId) {
|
|
|
1472
2344
|
zodiacPosition: point.zodiacPosition
|
|
1473
2345
|
};
|
|
1474
2346
|
}
|
|
1475
|
-
function solveCircularLabelAngles(items,
|
|
2347
|
+
function solveCircularLabelAngles(items, options) {
|
|
2348
|
+
const { paddingPx, maxDisplacementRad } = options;
|
|
1476
2349
|
if (items.length === 0) {
|
|
1477
2350
|
return [];
|
|
1478
2351
|
}
|
|
@@ -1488,7 +2361,7 @@ function solveCircularLabelAngles(items, paddingPx) {
|
|
|
1488
2361
|
for (let i = 0; i < normalized.length; i++) {
|
|
1489
2362
|
const current = normalized[i];
|
|
1490
2363
|
const next = normalized[(i + 1) % normalized.length];
|
|
1491
|
-
const nextAngle = i === normalized.length - 1 ? next.idealAngle +
|
|
2364
|
+
const nextAngle = i === normalized.length - 1 ? next.idealAngle + TAU2 : next.idealAngle;
|
|
1492
2365
|
const gap = nextAngle - current.idealAngle;
|
|
1493
2366
|
if (gap > largestGap) {
|
|
1494
2367
|
largestGap = gap;
|
|
@@ -1502,14 +2375,14 @@ function solveCircularLabelAngles(items, paddingPx) {
|
|
|
1502
2375
|
const wrapped = seamIndex > 0 && index >= normalized.length - seamIndex;
|
|
1503
2376
|
return {
|
|
1504
2377
|
...item,
|
|
1505
|
-
idealAngle: item.idealAngle + (wrapped ?
|
|
2378
|
+
idealAngle: item.idealAngle + (wrapped ? TAU2 : 0)
|
|
1506
2379
|
};
|
|
1507
2380
|
});
|
|
1508
2381
|
for (let i = 1; i < linear.length; i++) {
|
|
1509
2382
|
while (linear[i].idealAngle <= linear[i - 1].idealAngle) {
|
|
1510
2383
|
linear[i] = {
|
|
1511
2384
|
...linear[i],
|
|
1512
|
-
idealAngle: linear[i].idealAngle +
|
|
2385
|
+
idealAngle: linear[i].idealAngle + TAU2
|
|
1513
2386
|
};
|
|
1514
2387
|
}
|
|
1515
2388
|
}
|
|
@@ -1517,20 +2390,41 @@ function solveCircularLabelAngles(items, paddingPx) {
|
|
|
1517
2390
|
...item,
|
|
1518
2391
|
visualAngle: item.idealAngle
|
|
1519
2392
|
}));
|
|
1520
|
-
for (let
|
|
1521
|
-
const
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
current
|
|
2393
|
+
for (let iteration = 0; iteration < 50; iteration++) {
|
|
2394
|
+
const forces = new Array(solved.length).fill(0);
|
|
2395
|
+
let maxForce = 0;
|
|
2396
|
+
for (let i = 0; i < solved.length; i++) {
|
|
2397
|
+
const j = (i + 1) % solved.length;
|
|
2398
|
+
const current = solved[i];
|
|
2399
|
+
const next = solved[j];
|
|
2400
|
+
const nextAngle = j === 0 ? next.visualAngle + TAU2 : next.visualAngle;
|
|
2401
|
+
const gap = nextAngle - current.visualAngle;
|
|
2402
|
+
const minGap = labelAngularHalfDemand(current, paddingPx) + labelAngularHalfDemand(next, paddingPx);
|
|
2403
|
+
if (gap >= minGap) {
|
|
2404
|
+
continue;
|
|
2405
|
+
}
|
|
2406
|
+
const push = (minGap - gap) / 2;
|
|
2407
|
+
forces[i] -= push;
|
|
2408
|
+
forces[j] += push;
|
|
2409
|
+
maxForce = Math.max(maxForce, push);
|
|
1526
2410
|
}
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
2411
|
+
if (maxForce < 1e-4) {
|
|
2412
|
+
break;
|
|
2413
|
+
}
|
|
2414
|
+
for (let i = 0; i < solved.length; i++) {
|
|
2415
|
+
const movement = clamp(forces[i], -deg2rad2(2), deg2rad2(2));
|
|
2416
|
+
const moved = solved[i].visualAngle + movement;
|
|
2417
|
+
solved[i].visualAngle = clampAngleAroundIdeal(
|
|
2418
|
+
moved,
|
|
2419
|
+
solved[i].idealAngle,
|
|
2420
|
+
maxDisplacementRad
|
|
2421
|
+
);
|
|
2422
|
+
}
|
|
2423
|
+
solved.sort((a, b) => a.visualAngle - b.visualAngle);
|
|
2424
|
+
for (let i = 1; i < solved.length; i++) {
|
|
2425
|
+
while (solved[i].visualAngle <= solved[i - 1].visualAngle) {
|
|
2426
|
+
solved[i].visualAngle += TAU2;
|
|
2427
|
+
}
|
|
1534
2428
|
}
|
|
1535
2429
|
}
|
|
1536
2430
|
return solved.map((item) => ({
|
|
@@ -1538,15 +2432,51 @@ function solveCircularLabelAngles(items, paddingPx) {
|
|
|
1538
2432
|
visualAngle: clampRad(item.visualAngle)
|
|
1539
2433
|
}));
|
|
1540
2434
|
}
|
|
2435
|
+
function clampAngleAroundIdeal(value, ideal, maxDistance) {
|
|
2436
|
+
if (!Number.isFinite(maxDistance) || maxDistance >= Math.PI) {
|
|
2437
|
+
return value;
|
|
2438
|
+
}
|
|
2439
|
+
const delta = signedAngleDelta(ideal, value);
|
|
2440
|
+
return ideal + clamp(delta, -maxDistance, maxDistance);
|
|
2441
|
+
}
|
|
2442
|
+
function signedAngleDelta(from, to) {
|
|
2443
|
+
let delta = clampRad(to) - clampRad(from);
|
|
2444
|
+
if (delta > Math.PI) {
|
|
2445
|
+
delta -= TAU2;
|
|
2446
|
+
} else if (delta < -Math.PI) {
|
|
2447
|
+
delta += TAU2;
|
|
2448
|
+
}
|
|
2449
|
+
return delta;
|
|
2450
|
+
}
|
|
1541
2451
|
function labelAngularHalfDemand(item, paddingPx) {
|
|
1542
2452
|
return (item.tangentDemandPx / 2 + paddingPx) / Math.max(item.radius, 1);
|
|
1543
2453
|
}
|
|
1544
2454
|
function clampRad(value) {
|
|
1545
|
-
return (value %
|
|
2455
|
+
return (value % TAU2 + TAU2) % TAU2;
|
|
1546
2456
|
}
|
|
1547
2457
|
function circularAngleDistance(a, b) {
|
|
1548
2458
|
const delta = Math.abs(clampRad(a) - clampRad(b));
|
|
1549
|
-
return Math.min(delta,
|
|
2459
|
+
return Math.min(delta, TAU2 - delta);
|
|
2460
|
+
}
|
|
2461
|
+
function buildPointConnector(params) {
|
|
2462
|
+
const { center, tickAngle, labelAngle, connectorRadius, glyphPosition, mode } = params;
|
|
2463
|
+
const displacement = circularAngleDistance(tickAngle, labelAngle);
|
|
2464
|
+
if (mode === "never" || mode === "auto" && displacement < deg2rad2(0.35)) {
|
|
2465
|
+
return void 0;
|
|
2466
|
+
}
|
|
2467
|
+
const path = arcConnectorPath({
|
|
2468
|
+
center,
|
|
2469
|
+
startAngle: tickAngle,
|
|
2470
|
+
endAngle: labelAngle,
|
|
2471
|
+
radius: connectorRadius,
|
|
2472
|
+
end: glyphPosition
|
|
2473
|
+
});
|
|
2474
|
+
return {
|
|
2475
|
+
startAngle: tickAngle,
|
|
2476
|
+
endAngle: labelAngle,
|
|
2477
|
+
radius: connectorRadius,
|
|
2478
|
+
path
|
|
2479
|
+
};
|
|
1550
2480
|
}
|
|
1551
2481
|
function getSourceAspectEdges(chart, options) {
|
|
1552
2482
|
if (options.edges) {
|
|
@@ -1598,12 +2528,16 @@ function getAspectMatch(lonA, lonB, specs) {
|
|
|
1598
2528
|
function findAspectSpec(aspect, specs = ASTRO_WHEEL_DEFAULT_ASPECT_SPECS) {
|
|
1599
2529
|
return specs.find((spec) => spec.name === aspect);
|
|
1600
2530
|
}
|
|
1601
|
-
function
|
|
2531
|
+
function buildRings2(outerRadius, ringFractions = {}) {
|
|
2532
|
+
const fractions = {
|
|
2533
|
+
...DEFAULT_ASTRO_WHEEL_RING_FRACTIONS,
|
|
2534
|
+
...ringFractions
|
|
2535
|
+
};
|
|
1602
2536
|
const ringMap = buildRingMap(outerRadius, [
|
|
1603
|
-
{ id: "houses", fr:
|
|
1604
|
-
{ id: "zodiac", fr:
|
|
1605
|
-
{ id: "planets", fr:
|
|
1606
|
-
{ id: "aspects", fr:
|
|
2537
|
+
{ id: "houses", fr: fractions.houses },
|
|
2538
|
+
{ id: "zodiac", fr: fractions.zodiac },
|
|
2539
|
+
{ id: "planets", fr: fractions.planets },
|
|
2540
|
+
{ id: "aspects", fr: fractions.aspects }
|
|
1607
2541
|
]);
|
|
1608
2542
|
return {
|
|
1609
2543
|
aspects: ringMap.aspects,
|
|
@@ -1613,23 +2547,27 @@ function buildRings(outerRadius) {
|
|
|
1613
2547
|
};
|
|
1614
2548
|
}
|
|
1615
2549
|
function buildRingMap(radius, defs) {
|
|
1616
|
-
const
|
|
2550
|
+
const normalizedDefs = defs.map((def) => ({
|
|
2551
|
+
...def,
|
|
2552
|
+
fr: Number.isFinite(def.fr) && def.fr > 0 ? def.fr : DEFAULT_ASTRO_WHEEL_RING_FRACTIONS[def.id]
|
|
2553
|
+
}));
|
|
2554
|
+
const frTotal = normalizedDefs.reduce((sum, def) => sum + def.fr, 0);
|
|
1617
2555
|
let cursor = radius;
|
|
1618
2556
|
const result = {};
|
|
1619
|
-
for (const def of
|
|
2557
|
+
for (const def of normalizedDefs) {
|
|
1620
2558
|
const thickness = radius * def.fr / frTotal;
|
|
1621
2559
|
const r2 = cursor;
|
|
1622
2560
|
const r1 = cursor - thickness;
|
|
1623
2561
|
result[def.id] = {
|
|
1624
2562
|
id: def.id,
|
|
1625
|
-
r1:
|
|
1626
|
-
r2:
|
|
2563
|
+
r1: round2(r1),
|
|
2564
|
+
r2: round2(r2)
|
|
1627
2565
|
};
|
|
1628
2566
|
cursor = r1;
|
|
1629
2567
|
}
|
|
1630
2568
|
return result;
|
|
1631
2569
|
}
|
|
1632
|
-
function
|
|
2570
|
+
function resolvePalette2(palette = "default", background = "transparent") {
|
|
1633
2571
|
const base = palette === "monochrome" ? MONOCHROME_PALETTE : DEFAULT_PALETTE;
|
|
1634
2572
|
if (palette === "default" || palette === "monochrome") {
|
|
1635
2573
|
return {
|
|
@@ -1728,7 +2666,7 @@ function resolvePointLayerRadius(layer, rings) {
|
|
|
1728
2666
|
const radius = layer.radius === "inner" ? ring.r1 : layer.radius === "outer" ? ring.r2 : typeof layer.radius === "number" ? layer.radius : base;
|
|
1729
2667
|
return radius + (layer.radiusOffset ?? 0);
|
|
1730
2668
|
}
|
|
1731
|
-
function
|
|
2669
|
+
function normalizeViewBox2(viewBox) {
|
|
1732
2670
|
return {
|
|
1733
2671
|
minX: viewBox?.minX ?? ASTRO_WHEEL_DEFAULT_VIEWBOX.minX,
|
|
1734
2672
|
minY: viewBox?.minY ?? ASTRO_WHEEL_DEFAULT_VIEWBOX.minY,
|
|
@@ -1762,16 +2700,16 @@ function pointKeyPrefix(layerId) {
|
|
|
1762
2700
|
function renderGlyphPrimitives(push, primitives, options) {
|
|
1763
2701
|
for (const p of primitives) {
|
|
1764
2702
|
if (p.kind === "path") {
|
|
1765
|
-
push(`<path d="${
|
|
2703
|
+
push(`<path d="${escapeAttr2(p.d)}"/>`);
|
|
1766
2704
|
} else if (p.kind === "circle") {
|
|
1767
|
-
push(`<circle cx="${
|
|
2705
|
+
push(`<circle cx="${fmt2(p.cx)}" cy="${fmt2(p.cy)}" r="${fmt2(p.r)}"/>`);
|
|
1768
2706
|
} else if (p.kind === "line") {
|
|
1769
|
-
push(`<line x1="${
|
|
2707
|
+
push(`<line x1="${fmt2(p.x1)}" y1="${fmt2(p.y1)}" x2="${fmt2(p.x2)}" y2="${fmt2(p.y2)}"/>`);
|
|
1770
2708
|
} else if (p.kind === "polyline") {
|
|
1771
|
-
push(`<polyline points="${
|
|
2709
|
+
push(`<polyline points="${escapeAttr2(p.points)}"/>`);
|
|
1772
2710
|
} else if (p.kind === "text") {
|
|
1773
2711
|
push(
|
|
1774
|
-
`<text x="${
|
|
2712
|
+
`<text x="${fmt2(p.x ?? 0)}" y="${fmt2(p.y ?? 0)}" font-family="${textFontFamily2()}" font-size="${fmt2(p.fontSize ?? 0.72)}" font-weight="${escapeAttr2(String(p.fontWeight ?? 500))}" text-anchor="middle" dominant-baseline="middle" fill="${escapeAttr2(options.color)}" stroke="none">${escapeText2(p.text)}</text>`
|
|
1775
2713
|
);
|
|
1776
2714
|
} else {
|
|
1777
2715
|
let markup = p.markup;
|
|
@@ -1788,16 +2726,16 @@ function normalizeAngle(value) {
|
|
|
1788
2726
|
function clamp360(value) {
|
|
1789
2727
|
return (value % 360 + 360) % 360;
|
|
1790
2728
|
}
|
|
1791
|
-
function
|
|
2729
|
+
function deg2rad2(degrees) {
|
|
1792
2730
|
return degrees * Math.PI / 180;
|
|
1793
2731
|
}
|
|
1794
2732
|
function clamp(value, min, max) {
|
|
1795
2733
|
return Math.max(min, Math.min(max, value));
|
|
1796
2734
|
}
|
|
1797
|
-
function
|
|
2735
|
+
function polarToXY2(cx, cy, radius, angleRad) {
|
|
1798
2736
|
return {
|
|
1799
|
-
x:
|
|
1800
|
-
y:
|
|
2737
|
+
x: round2(cx + radius * Math.cos(angleRad)),
|
|
2738
|
+
y: round2(cy + radius * Math.sin(angleRad))
|
|
1801
2739
|
};
|
|
1802
2740
|
}
|
|
1803
2741
|
function polarWithNudge(cx, cy, radius, angleRad, radialOffset = 0, tangentOffset = 0) {
|
|
@@ -1806,13 +2744,13 @@ function polarWithNudge(cx, cy, radius, angleRad, radialOffset = 0, tangentOffse
|
|
|
1806
2744
|
const tangentX = -Math.sin(angleRad);
|
|
1807
2745
|
const tangentY = Math.cos(angleRad);
|
|
1808
2746
|
return {
|
|
1809
|
-
x:
|
|
1810
|
-
y:
|
|
2747
|
+
x: round2(x + tangentX * tangentOffset),
|
|
2748
|
+
y: round2(y + tangentY * tangentOffset)
|
|
1811
2749
|
};
|
|
1812
2750
|
}
|
|
1813
|
-
function
|
|
1814
|
-
const p1 =
|
|
1815
|
-
const p2 =
|
|
2751
|
+
function lineFromPolar2(center, r1, r2, angleRad) {
|
|
2752
|
+
const p1 = polarToXY2(center.x, center.y, r1, angleRad);
|
|
2753
|
+
const p2 = polarToXY2(center.x, center.y, r2, angleRad);
|
|
1816
2754
|
return {
|
|
1817
2755
|
x1: p1.x,
|
|
1818
2756
|
y1: p1.y,
|
|
@@ -1821,20 +2759,36 @@ function lineFromPolar(center, r1, r2, angleRad) {
|
|
|
1821
2759
|
};
|
|
1822
2760
|
}
|
|
1823
2761
|
function arcPath(cx, cy, innerRadius, outerRadius, angleStart, angleEnd) {
|
|
1824
|
-
const p0 =
|
|
1825
|
-
const p1 =
|
|
1826
|
-
const p2 =
|
|
1827
|
-
const p3 =
|
|
1828
|
-
const large = Math.abs(angleEnd - angleStart) %
|
|
2762
|
+
const p0 = polarToXY2(cx, cy, outerRadius, angleStart);
|
|
2763
|
+
const p1 = polarToXY2(cx, cy, outerRadius, angleEnd);
|
|
2764
|
+
const p2 = polarToXY2(cx, cy, innerRadius, angleEnd);
|
|
2765
|
+
const p3 = polarToXY2(cx, cy, innerRadius, angleStart);
|
|
2766
|
+
const large = Math.abs(angleEnd - angleStart) % TAU2 > Math.PI ? 1 : 0;
|
|
1829
2767
|
const sweep = angleEnd > angleStart ? 1 : 0;
|
|
1830
2768
|
return [
|
|
1831
|
-
`M ${
|
|
1832
|
-
`A ${
|
|
1833
|
-
`L ${
|
|
1834
|
-
`A ${
|
|
2769
|
+
`M ${fmt2(p0.x)},${fmt2(p0.y)}`,
|
|
2770
|
+
`A ${fmt2(outerRadius)},${fmt2(outerRadius)} 0 ${large} ${sweep} ${fmt2(p1.x)},${fmt2(p1.y)}`,
|
|
2771
|
+
`L ${fmt2(p2.x)},${fmt2(p2.y)}`,
|
|
2772
|
+
`A ${fmt2(innerRadius)},${fmt2(innerRadius)} 0 ${large} ${sweep ? 0 : 1} ${fmt2(p3.x)},${fmt2(p3.y)}`,
|
|
1835
2773
|
"Z"
|
|
1836
2774
|
].join(" ");
|
|
1837
2775
|
}
|
|
2776
|
+
function arcConnectorPath(params) {
|
|
2777
|
+
const { center, startAngle, endAngle, radius, end } = params;
|
|
2778
|
+
const start = polarToXY2(center.x, center.y, radius, startAngle);
|
|
2779
|
+
const arcEnd = polarToXY2(center.x, center.y, radius, endAngle);
|
|
2780
|
+
const delta = signedAngleDelta(startAngle, endAngle);
|
|
2781
|
+
const large = Math.abs(delta) > Math.PI ? 1 : 0;
|
|
2782
|
+
const sweep = delta >= 0 ? 1 : 0;
|
|
2783
|
+
const commands = [
|
|
2784
|
+
`M ${fmt2(start.x)},${fmt2(start.y)}`,
|
|
2785
|
+
`A ${fmt2(radius)},${fmt2(radius)} 0 ${large} ${sweep} ${fmt2(arcEnd.x)},${fmt2(arcEnd.y)}`
|
|
2786
|
+
];
|
|
2787
|
+
if (Math.hypot(arcEnd.x - end.x, arcEnd.y - end.y) > 0.5) {
|
|
2788
|
+
commands.push(`L ${fmt2(end.x)},${fmt2(end.y)}`);
|
|
2789
|
+
}
|
|
2790
|
+
return commands.join(" ");
|
|
2791
|
+
}
|
|
1838
2792
|
function unwrapAngles(angles, direction = "inc") {
|
|
1839
2793
|
const unwrapped = [];
|
|
1840
2794
|
if (angles.length === 0) {
|
|
@@ -1845,41 +2799,41 @@ function unwrapAngles(angles, direction = "inc") {
|
|
|
1845
2799
|
let angle = angles[index];
|
|
1846
2800
|
if (direction === "inc") {
|
|
1847
2801
|
while (angle <= unwrapped[index - 1]) {
|
|
1848
|
-
angle +=
|
|
2802
|
+
angle += TAU2;
|
|
1849
2803
|
}
|
|
1850
2804
|
} else {
|
|
1851
2805
|
while (angle >= unwrapped[index - 1]) {
|
|
1852
|
-
angle -=
|
|
2806
|
+
angle -= TAU2;
|
|
1853
2807
|
}
|
|
1854
2808
|
}
|
|
1855
2809
|
unwrapped.push(angle);
|
|
1856
2810
|
}
|
|
1857
2811
|
return unwrapped;
|
|
1858
2812
|
}
|
|
1859
|
-
function
|
|
2813
|
+
function round2(value) {
|
|
1860
2814
|
return Math.round((value + Number.EPSILON) * 100) / 100;
|
|
1861
2815
|
}
|
|
1862
|
-
function
|
|
1863
|
-
const rounded =
|
|
2816
|
+
function fmt2(value) {
|
|
2817
|
+
const rounded = round2(value);
|
|
1864
2818
|
if (Object.is(rounded, -0)) {
|
|
1865
2819
|
return "0";
|
|
1866
2820
|
}
|
|
1867
2821
|
return String(rounded);
|
|
1868
2822
|
}
|
|
1869
|
-
function
|
|
2823
|
+
function escapeAttr2(value) {
|
|
1870
2824
|
return value.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
1871
2825
|
}
|
|
1872
|
-
function
|
|
2826
|
+
function escapeText2(value) {
|
|
1873
2827
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
1874
2828
|
}
|
|
1875
2829
|
function symbolFontFamily() {
|
|
1876
|
-
return
|
|
2830
|
+
return escapeAttr2("'Apple Symbols', 'Arial Unicode MS', 'Noto Sans Symbols 2', 'Noto Sans Symbols', 'Segoe UI Symbol', serif, sans-serif");
|
|
1877
2831
|
}
|
|
1878
|
-
function
|
|
1879
|
-
return
|
|
2832
|
+
function textFontFamily2() {
|
|
2833
|
+
return escapeAttr2("Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif");
|
|
1880
2834
|
}
|
|
1881
2835
|
|
|
1882
|
-
// src/visual/tree
|
|
2836
|
+
// src/visual/tree.ts
|
|
1883
2837
|
var TREE_SVG_DEFAULT_VIEWBOX = {
|
|
1884
2838
|
minX: 0,
|
|
1885
2839
|
minY: 0,
|
|
@@ -1887,19 +2841,8 @@ var TREE_SVG_DEFAULT_VIEWBOX = {
|
|
|
1887
2841
|
height: 561
|
|
1888
2842
|
};
|
|
1889
2843
|
var TREE_SPHERE_NAMES = [
|
|
1890
|
-
|
|
1891
|
-
"Chokhmah",
|
|
1892
|
-
"Binah",
|
|
1893
|
-
"Daath",
|
|
1894
|
-
"Chesed",
|
|
1895
|
-
"Geburah",
|
|
1896
|
-
"Tiphareth",
|
|
1897
|
-
"Netzach",
|
|
1898
|
-
"Hod",
|
|
1899
|
-
"Yesod",
|
|
1900
|
-
"Malkuth"
|
|
2844
|
+
...TREE_TOPOLOGY_SPHERE_NAMES
|
|
1901
2845
|
];
|
|
1902
|
-
var TREE_PATH_NUMBERS = Array.from({ length: 22 }, (_, index) => index + 1);
|
|
1903
2846
|
var CANONICAL_X_PERCENTAGES = { left: 13.25, mid: 49.94, right: 86.66 };
|
|
1904
2847
|
var CANONICAL_ROW_Y_PERCENTAGES = [
|
|
1905
2848
|
6.83,
|
|
@@ -1919,13 +2862,8 @@ var DEFAULT_SPHERE_HIT_RADIUS = DEFAULT_SPHERE_RADIUS + 8;
|
|
|
1919
2862
|
var DEFAULT_PATH_HIT_STROKE_WIDTH = DEFAULT_PATH_EDGE_WIDTH + 8;
|
|
1920
2863
|
var MUTED_TARGET_COLOR = "#AAA";
|
|
1921
2864
|
var sphereId = (name) => id("sphere" /* SPHERE */, name);
|
|
1922
|
-
var
|
|
1923
|
-
var
|
|
1924
|
-
(name) => sphereId(name)
|
|
1925
|
-
);
|
|
1926
|
-
var TREE_PATH_IDS = TREE_PATH_NUMBERS.map(
|
|
1927
|
-
(pathNumber) => pathId(pathNumber)
|
|
1928
|
-
);
|
|
2865
|
+
var TREE_SPHERE_IDS = [...TREE_TOPOLOGY_SPHERE_IDS];
|
|
2866
|
+
var TREE_PATH_IDS = [...TREE_TOPOLOGY_PATH_IDS];
|
|
1929
2867
|
var CANONICAL_SPHERE_PERCENTAGES = {
|
|
1930
2868
|
[sphereId("Kether")]: { x: CANONICAL_X_PERCENTAGES.mid, y: CANONICAL_ROW_Y_PERCENTAGES[0] },
|
|
1931
2869
|
[sphereId("Chokhmah")]: { x: CANONICAL_X_PERCENTAGES.right, y: CANONICAL_ROW_Y_PERCENTAGES[1] },
|
|
@@ -1958,8 +2896,8 @@ function getTreeLayout(system = "kaabalah") {
|
|
|
1958
2896
|
function getTreeRenderModel(options = {}) {
|
|
1959
2897
|
const system = options.system ?? "kaabalah";
|
|
1960
2898
|
const tree = createTree({ system, parts: ["colors"] });
|
|
1961
|
-
const viewBox =
|
|
1962
|
-
const palette =
|
|
2899
|
+
const viewBox = normalizeViewBox3(options.viewBox);
|
|
2900
|
+
const palette = resolvePalette3(options.palette);
|
|
1963
2901
|
const highlights = resolveHighlights(options.highlights);
|
|
1964
2902
|
const activationMap = resolveActivationMap(options.activations);
|
|
1965
2903
|
const layout = getTreeLayout(system);
|
|
@@ -1969,12 +2907,12 @@ function getTreeRenderModel(options = {}) {
|
|
|
1969
2907
|
viewBox.width / TREE_SVG_DEFAULT_VIEWBOX.width,
|
|
1970
2908
|
viewBox.height / TREE_SVG_DEFAULT_VIEWBOX.height
|
|
1971
2909
|
);
|
|
1972
|
-
const radius =
|
|
1973
|
-
const pathEdgeWidth =
|
|
1974
|
-
const pathMainWidth =
|
|
1975
|
-
const pathHighlightWidth =
|
|
1976
|
-
const sphereHitRadius =
|
|
1977
|
-
const pathHitStrokeWidth =
|
|
2910
|
+
const radius = round3(DEFAULT_SPHERE_RADIUS * scale);
|
|
2911
|
+
const pathEdgeWidth = round3(DEFAULT_PATH_EDGE_WIDTH * scale);
|
|
2912
|
+
const pathMainWidth = round3(DEFAULT_PATH_MAIN_WIDTH * scale);
|
|
2913
|
+
const pathHighlightWidth = round3(DEFAULT_PATH_HIGHLIGHT_WIDTH * scale);
|
|
2914
|
+
const sphereHitRadius = round3(DEFAULT_SPHERE_HIT_RADIUS * scale);
|
|
2915
|
+
const pathHitStrokeWidth = round3(DEFAULT_PATH_HIT_STROKE_WIDTH * scale);
|
|
1978
2916
|
const layers = [
|
|
1979
2917
|
{ name: "background", order: 0, description: "Background rectangle when requested." },
|
|
1980
2918
|
...options.daathLayer === "back" ? [{ name: "spheres-behind-paths", order: 1, description: "Daath behind the paths." }] : [],
|
|
@@ -2108,8 +3046,8 @@ function generateTreeSvg(options = {}) {
|
|
|
2108
3046
|
const system = options.system ?? "kaabalah";
|
|
2109
3047
|
const daathLayer = options.daathLayer ?? "front";
|
|
2110
3048
|
const tree = createTree({ system, parts: ["colors"] });
|
|
2111
|
-
const viewBox =
|
|
2112
|
-
const palette =
|
|
3049
|
+
const viewBox = normalizeViewBox3(options.viewBox);
|
|
3050
|
+
const palette = resolvePalette3(options.palette);
|
|
2113
3051
|
const highlights = resolveHighlights(options.highlights);
|
|
2114
3052
|
const activationMap = resolveActivationMap(options.activations);
|
|
2115
3053
|
const spherePositions = scaleCoordinates(CANONICAL_SPHERE_PERCENTAGES, viewBox);
|
|
@@ -2118,17 +3056,17 @@ function generateTreeSvg(options = {}) {
|
|
|
2118
3056
|
viewBox.width / TREE_SVG_DEFAULT_VIEWBOX.width,
|
|
2119
3057
|
viewBox.height / TREE_SVG_DEFAULT_VIEWBOX.height
|
|
2120
3058
|
);
|
|
2121
|
-
const radius =
|
|
2122
|
-
const pathEdgeWidth =
|
|
2123
|
-
const pathMainWidth =
|
|
2124
|
-
const pathHighlightWidth =
|
|
2125
|
-
const sphereStrokeWidth = palette.sphereStrokeWidth ?
|
|
3059
|
+
const radius = round3(DEFAULT_SPHERE_RADIUS * scale);
|
|
3060
|
+
const pathEdgeWidth = round3(DEFAULT_PATH_EDGE_WIDTH * scale);
|
|
3061
|
+
const pathMainWidth = round3(DEFAULT_PATH_MAIN_WIDTH * scale);
|
|
3062
|
+
const pathHighlightWidth = round3(DEFAULT_PATH_HIGHLIGHT_WIDTH * scale);
|
|
3063
|
+
const sphereStrokeWidth = palette.sphereStrokeWidth ? round3(palette.sphereStrokeWidth * scale) : void 0;
|
|
2126
3064
|
const lines = [];
|
|
2127
3065
|
const push = (line) => lines.push(line);
|
|
2128
3066
|
const svgAttributes = [
|
|
2129
3067
|
`xmlns="http://www.w3.org/2000/svg"`,
|
|
2130
|
-
options.width !== void 0 ? `width="${
|
|
2131
|
-
options.height !== void 0 ? `height="${
|
|
3068
|
+
options.width !== void 0 ? `width="${escapeAttr3(String(options.width))}"` : "",
|
|
3069
|
+
options.height !== void 0 ? `height="${escapeAttr3(String(options.height))}"` : "",
|
|
2132
3070
|
`viewBox="${viewBox.minX} ${viewBox.minY} ${viewBox.width} ${viewBox.height}"`,
|
|
2133
3071
|
`preserveAspectRatio="xMidYMid meet"`
|
|
2134
3072
|
].filter(Boolean);
|
|
@@ -2182,7 +3120,7 @@ function generateTreeSvg(options = {}) {
|
|
|
2182
3120
|
const background = options.background ?? "white";
|
|
2183
3121
|
if (background !== "transparent") {
|
|
2184
3122
|
push(
|
|
2185
|
-
`<rect x="${viewBox.minX}" y="${viewBox.minY}" width="${viewBox.width}" height="${viewBox.height}" fill="${
|
|
3123
|
+
`<rect x="${viewBox.minX}" y="${viewBox.minY}" width="${viewBox.width}" height="${viewBox.height}" fill="${escapeAttr3(background)}"/>`
|
|
2186
3124
|
);
|
|
2187
3125
|
}
|
|
2188
3126
|
if (daathLayer === "back") {
|
|
@@ -2232,18 +3170,18 @@ function generateTreeSvg(options = {}) {
|
|
|
2232
3170
|
pathColor: color
|
|
2233
3171
|
});
|
|
2234
3172
|
push(
|
|
2235
|
-
`<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${
|
|
3173
|
+
`<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr3(edgeColor)}" stroke-width="${pathEdgeWidth}" stroke-linecap="round"${palette.pathEdgeUseFilter ? ` filter="url(#pathDarken)"` : ""}/>`
|
|
2236
3174
|
);
|
|
2237
3175
|
if (activation?.visible && activation.emphasis > 0) {
|
|
2238
3176
|
push(
|
|
2239
|
-
`<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${
|
|
3177
|
+
`<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr3(color)}" stroke-opacity="${round3(0.18 + activation.emphasis * 0.28)}" stroke-width="${round3(pathEdgeWidth + activation.emphasis * 10)}" stroke-linecap="round"/>`
|
|
2240
3178
|
);
|
|
2241
3179
|
}
|
|
2242
3180
|
push(
|
|
2243
|
-
`<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${
|
|
3181
|
+
`<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr3(color)}" stroke-width="${pathMainWidth}" stroke-linecap="round"/>`
|
|
2244
3182
|
);
|
|
2245
3183
|
push(
|
|
2246
|
-
`<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${
|
|
3184
|
+
`<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr3(palette.pathHighlightColor)}" stroke-opacity="${palette.pathHighlightOpacity}" stroke-width="${pathHighlightWidth}" stroke-linecap="round"/>`
|
|
2247
3185
|
);
|
|
2248
3186
|
}
|
|
2249
3187
|
push(`</g>`);
|
|
@@ -2300,11 +3238,11 @@ function renderSphere(push, params) {
|
|
|
2300
3238
|
activation: params.activation
|
|
2301
3239
|
});
|
|
2302
3240
|
if (params.activation?.visible && params.activation.emphasis > 0) {
|
|
2303
|
-
const haloStrokeWidth =
|
|
2304
|
-
const haloRadius =
|
|
3241
|
+
const haloStrokeWidth = round3(3.2 + params.activation.emphasis * 4.8);
|
|
3242
|
+
const haloRadius = round3(params.radius + haloStrokeWidth / 2 + 0.7);
|
|
2305
3243
|
const haloColor = params.activation.displayColor;
|
|
2306
3244
|
push(
|
|
2307
|
-
`<circle cx="${point.x}" cy="${point.y}" r="${haloRadius}" fill="none" stroke="${
|
|
3245
|
+
`<circle cx="${point.x}" cy="${point.y}" r="${haloRadius}" fill="none" stroke="${escapeAttr3(haloColor)}" stroke-opacity="${round3(0.24 + params.activation.emphasis * 0.28)}" stroke-width="${haloStrokeWidth}"/>`
|
|
2308
3246
|
);
|
|
2309
3247
|
}
|
|
2310
3248
|
push(`<g id="sphere-${slug}" clip-path="url(#clip-${slug})">`);
|
|
@@ -2332,12 +3270,12 @@ function renderSphere(push, params) {
|
|
|
2332
3270
|
renderSlicedSphere(push, point, params.radius, slicedColors, -135);
|
|
2333
3271
|
} else {
|
|
2334
3272
|
push(
|
|
2335
|
-
`<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="${
|
|
3273
|
+
`<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="${escapeAttr3(toPrimaryFill(activeFill, params.palette.defaultSphereFill))}"/>`
|
|
2336
3274
|
);
|
|
2337
3275
|
}
|
|
2338
3276
|
} else {
|
|
2339
3277
|
push(
|
|
2340
|
-
`<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="${
|
|
3278
|
+
`<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="${escapeAttr3(toPrimaryFill(activeFill, params.palette.defaultSphereFill))}"/>`
|
|
2341
3279
|
);
|
|
2342
3280
|
}
|
|
2343
3281
|
push(
|
|
@@ -2351,7 +3289,7 @@ function renderSphere(push, params) {
|
|
|
2351
3289
|
push(`</g>`);
|
|
2352
3290
|
if (params.palette.sphereStrokeColor && params.sphereStrokeWidth) {
|
|
2353
3291
|
push(
|
|
2354
|
-
`<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="none" stroke="${
|
|
3292
|
+
`<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="none" stroke="${escapeAttr3(params.palette.sphereStrokeColor)}" stroke-width="${params.sphereStrokeWidth}"/>`
|
|
2355
3293
|
);
|
|
2356
3294
|
}
|
|
2357
3295
|
}
|
|
@@ -2396,13 +3334,13 @@ function scaleCoordinates(coordinates, viewBox) {
|
|
|
2396
3334
|
for (const currentSphereId of TREE_SPHERE_IDS) {
|
|
2397
3335
|
const point = coordinates[currentSphereId];
|
|
2398
3336
|
scaled[currentSphereId] = {
|
|
2399
|
-
x:
|
|
2400
|
-
y:
|
|
3337
|
+
x: round3(viewBox.minX + point.x / 100 * viewBox.width),
|
|
3338
|
+
y: round3(viewBox.minY + point.y / 100 * viewBox.height)
|
|
2401
3339
|
};
|
|
2402
3340
|
}
|
|
2403
3341
|
return scaled;
|
|
2404
3342
|
}
|
|
2405
|
-
function
|
|
3343
|
+
function normalizeViewBox3(viewBox) {
|
|
2406
3344
|
return {
|
|
2407
3345
|
minX: viewBox?.minX ?? TREE_SVG_DEFAULT_VIEWBOX.minX,
|
|
2408
3346
|
minY: viewBox?.minY ?? TREE_SVG_DEFAULT_VIEWBOX.minY,
|
|
@@ -2503,17 +3441,17 @@ function getViewBoxAnchor(point, viewBox) {
|
|
|
2503
3441
|
};
|
|
2504
3442
|
}
|
|
2505
3443
|
function getPercentagePathAnchor(path) {
|
|
2506
|
-
const y =
|
|
3444
|
+
const y = round3((path.from.y + path.to.y) / 2);
|
|
2507
3445
|
return {
|
|
2508
|
-
x:
|
|
3446
|
+
x: round3((path.from.x + path.to.x) / 2),
|
|
2509
3447
|
y,
|
|
2510
3448
|
vertical: y < 18 ? "below" : "above"
|
|
2511
3449
|
};
|
|
2512
3450
|
}
|
|
2513
3451
|
function getViewBoxPathAnchor(path, viewBox) {
|
|
2514
|
-
const y =
|
|
3452
|
+
const y = round3((path.from.y + path.to.y) / 2);
|
|
2515
3453
|
return {
|
|
2516
|
-
x:
|
|
3454
|
+
x: round3((path.from.x + path.to.x) / 2),
|
|
2517
3455
|
y,
|
|
2518
3456
|
vertical: y - viewBox.minY < viewBox.height * 0.18 ? "below" : "above"
|
|
2519
3457
|
};
|
|
@@ -2564,7 +3502,7 @@ function getSphereMaterial(params) {
|
|
|
2564
3502
|
function clamp01(value) {
|
|
2565
3503
|
return Math.max(0, Math.min(1, value));
|
|
2566
3504
|
}
|
|
2567
|
-
function
|
|
3505
|
+
function resolvePalette3(palette) {
|
|
2568
3506
|
if (palette === void 0 || palette === "color") {
|
|
2569
3507
|
return {
|
|
2570
3508
|
mode: "color",
|
|
@@ -2670,14 +3608,14 @@ function expandColors(fill, count, fallbackColors) {
|
|
|
2670
3608
|
}
|
|
2671
3609
|
return Array.from({ length: count }, () => fill);
|
|
2672
3610
|
}
|
|
2673
|
-
function
|
|
3611
|
+
function round3(value) {
|
|
2674
3612
|
return Math.round(value * 100) / 100;
|
|
2675
3613
|
}
|
|
2676
3614
|
function polarToCartesian(cx, cy, radius, degrees) {
|
|
2677
3615
|
const radians = Math.PI / 180 * degrees;
|
|
2678
3616
|
return {
|
|
2679
|
-
x:
|
|
2680
|
-
y:
|
|
3617
|
+
x: round3(cx + radius * Math.cos(radians)),
|
|
3618
|
+
y: round3(cy + radius * Math.sin(radians))
|
|
2681
3619
|
};
|
|
2682
3620
|
}
|
|
2683
3621
|
function arcPath2(cx, cy, radius, startDegrees, endDegrees) {
|
|
@@ -2688,24 +3626,24 @@ function arcPath2(cx, cy, radius, startDegrees, endDegrees) {
|
|
|
2688
3626
|
}
|
|
2689
3627
|
function renderKether(push, point, radius, baseFill = "#e0e0e0") {
|
|
2690
3628
|
push(
|
|
2691
|
-
`<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="${
|
|
3629
|
+
`<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="${escapeAttr3(baseFill)}"/>`
|
|
2692
3630
|
);
|
|
2693
3631
|
push(`<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="url(#kether-glow)"/>`);
|
|
2694
3632
|
const spokes = 16;
|
|
2695
|
-
const innerRadius =
|
|
2696
|
-
const outerRadius =
|
|
2697
|
-
const innerWidth =
|
|
3633
|
+
const innerRadius = round3(radius * 0.18);
|
|
3634
|
+
const outerRadius = round3(radius * 0.92);
|
|
3635
|
+
const innerWidth = round3(radius * 0.04);
|
|
2698
3636
|
const angleStep = 360 / spokes;
|
|
2699
3637
|
push(`<g opacity="0.85">`);
|
|
2700
3638
|
for (let index = 0; index < spokes; index++) {
|
|
2701
3639
|
const angle = index * angleStep;
|
|
2702
3640
|
push(`<g transform="rotate(${angle} ${point.x} ${point.y})">`);
|
|
2703
|
-
const x0 =
|
|
2704
|
-
const y0 =
|
|
3641
|
+
const x0 = round3(point.x - innerWidth);
|
|
3642
|
+
const y0 = round3(point.y - innerRadius);
|
|
2705
3643
|
const x1 = point.x;
|
|
2706
|
-
const y1 =
|
|
2707
|
-
const x2 =
|
|
2708
|
-
const y2 =
|
|
3644
|
+
const y1 = round3(point.y - outerRadius);
|
|
3645
|
+
const x2 = round3(point.x + innerWidth);
|
|
3646
|
+
const y2 = round3(point.y - innerRadius);
|
|
2709
3647
|
push(
|
|
2710
3648
|
`<polygon points="${x0},${y0} ${x1},${y1} ${x2},${y2} ${point.x},${point.y}" fill="url(#kether-facet)"/>`
|
|
2711
3649
|
);
|
|
@@ -2720,7 +3658,7 @@ function renderSlicedSphere(push, point, radius, colors, startAngle) {
|
|
|
2720
3658
|
let currentAngle = startAngle;
|
|
2721
3659
|
for (let index = 0; index < segmentCount; index++) {
|
|
2722
3660
|
const path = arcPath2(point.x, point.y, radius * 0.96, currentAngle, currentAngle + step);
|
|
2723
|
-
push(`<path d="${path}" fill="${
|
|
3661
|
+
push(`<path d="${path}" fill="${escapeAttr3(colors[index])}" stroke="none"/>`);
|
|
2724
3662
|
currentAngle += step;
|
|
2725
3663
|
}
|
|
2726
3664
|
}
|
|
@@ -2737,7 +3675,7 @@ function renderIridescent(push, point, radius) {
|
|
|
2737
3675
|
[1, "#F0E8EE"]
|
|
2738
3676
|
];
|
|
2739
3677
|
const slices = 72;
|
|
2740
|
-
const sphereRadius =
|
|
3678
|
+
const sphereRadius = round3(radius * 0.96);
|
|
2741
3679
|
for (let index = 0; index < slices; index++) {
|
|
2742
3680
|
const t = index / slices;
|
|
2743
3681
|
const color = interpolateColorStops(stops, t);
|
|
@@ -2776,28 +3714,28 @@ function interpolateColor(start, end, factor) {
|
|
|
2776
3714
|
}
|
|
2777
3715
|
function renderYinYang(push, point, radius, fill) {
|
|
2778
3716
|
const scale = radius / 50;
|
|
2779
|
-
const circleRadius =
|
|
2780
|
-
const halfRadius =
|
|
2781
|
-
const dotRadius =
|
|
3717
|
+
const circleRadius = round3(48 * scale);
|
|
3718
|
+
const halfRadius = round3(24 * scale);
|
|
3719
|
+
const dotRadius = round3(6 * scale);
|
|
2782
3720
|
const [lightFill, darkFill] = resolveDualToneFill(fill);
|
|
2783
3721
|
push(`<g transform="rotate(180 ${point.x} ${point.y})">`);
|
|
2784
3722
|
push(
|
|
2785
|
-
`<circle cx="${point.x}" cy="${point.y}" r="${circleRadius}" fill="${
|
|
3723
|
+
`<circle cx="${point.x}" cy="${point.y}" r="${circleRadius}" fill="${escapeAttr3(lightFill)}"/>`
|
|
2786
3724
|
);
|
|
2787
3725
|
push(
|
|
2788
|
-
`<path d="M${point.x},${
|
|
3726
|
+
`<path d="M${point.x},${round3(point.y - circleRadius)} A${circleRadius},${circleRadius} 0 1,1 ${point.x},${round3(point.y + circleRadius)} A${halfRadius},${halfRadius} 0 1,0 ${point.x},${point.y} A${halfRadius},${halfRadius} 0 1,1 ${point.x},${round3(point.y - circleRadius)}" fill="${escapeAttr3(darkFill)}"/>`
|
|
2789
3727
|
);
|
|
2790
3728
|
push(
|
|
2791
|
-
`<circle cx="${point.x}" cy="${
|
|
3729
|
+
`<circle cx="${point.x}" cy="${round3(point.y - halfRadius)}" r="${dotRadius}" fill="${escapeAttr3(lightFill)}"/>`
|
|
2792
3730
|
);
|
|
2793
3731
|
push(
|
|
2794
|
-
`<circle cx="${point.x}" cy="${
|
|
3732
|
+
`<circle cx="${point.x}" cy="${round3(point.y + halfRadius)}" r="${dotRadius}" fill="${escapeAttr3(darkFill)}"/>`
|
|
2795
3733
|
);
|
|
2796
3734
|
push(`</g>`);
|
|
2797
3735
|
}
|
|
2798
3736
|
function renderSphereTintOverlay(push, point, radius, fill, opacity) {
|
|
2799
3737
|
push(
|
|
2800
|
-
`<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="${
|
|
3738
|
+
`<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="${escapeAttr3(toPrimaryFill(fill, "#ffffff"))}" fill-opacity="${opacity}"/>`
|
|
2801
3739
|
);
|
|
2802
3740
|
}
|
|
2803
3741
|
function resolveDualToneFill(fill) {
|
|
@@ -2809,10 +3747,10 @@ function resolveDualToneFill(fill) {
|
|
|
2809
3747
|
}
|
|
2810
3748
|
return ["white", "black"];
|
|
2811
3749
|
}
|
|
2812
|
-
function
|
|
3750
|
+
function escapeAttr3(value) {
|
|
2813
3751
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
2814
3752
|
}
|
|
2815
3753
|
|
|
2816
|
-
export { ANGLE_GLYPHS, ANGLE_GLYPH_PRIMITIVES, ASPECT_GLYPHS, ASPECT_GLYPH_PRIMITIVES, ASTRO_GLYPHS, ASTRO_WHEEL_DEFAULT_ASPECT_SPECS, ASTRO_WHEEL_DEFAULT_VIEWBOX, ASTRO_WHEEL_POINT_GLYPHS, ASTRO_WHEEL_ZODIAC_SIGNS, PLANET_GLYPHS, PLANET_GLYPH_PRIMITIVES, TREE_PATH_IDS, TREE_SPHERE_IDS, TREE_SPHERE_NAMES, TREE_SVG_DEFAULT_VIEWBOX, ZODIAC_GLYPHS, ZODIAC_GLYPH_PRIMITIVES, generateAstroGlyphSvg, generateAstroWheelSvg, generateGlyphSvg, generateTreeSvg, getAstroGlyph, getAstroWheelRenderModel, getTreeLayout, getTreeRenderModel, listAstroGlyphs };
|
|
2817
|
-
//# sourceMappingURL=
|
|
2818
|
-
//# sourceMappingURL=chunk-
|
|
3754
|
+
export { ANGLE_GLYPHS, ANGLE_GLYPH_PRIMITIVES, ARCHEOMETER_DEFAULT_VIEWBOX, ASPECT_GLYPHS, ASPECT_GLYPH_PRIMITIVES, ASTRO_GLYPHS, ASTRO_WHEEL_DEFAULT_ASPECT_SPECS, ASTRO_WHEEL_DEFAULT_VIEWBOX, ASTRO_WHEEL_POINT_GLYPHS, ASTRO_WHEEL_ZODIAC_SIGNS, DEFAULT_ARCHEOMETER_MUSICAL_NOTES, DEFAULT_ARCHEOMETER_PLANETS, DEFAULT_ARCHEOMETER_SECTOR_CORRESPONDENCES, DEFAULT_ARCHEOMETER_TRIANGLES, DEFAULT_ARCHEOMETER_TRIANGLE_LABELS, DEFAULT_ARCHEOMETER_UTTERANCE, DEFAULT_ARCHEOMETER_ZODIAC, DEFAULT_ARCHETYPE_MUSICAL_NOTES, DEFAULT_ARCHETYPE_PLANETS, DEFAULT_ARCHETYPE_TRIANGLES, DEFAULT_ARCHETYPE_UTTERANCE, DEFAULT_ARCHETYPE_ZODIAC, PLANET_GLYPHS, PLANET_GLYPH_PRIMITIVES, TREE_PATH_IDS, TREE_SPHERE_IDS, TREE_SPHERE_NAMES, TREE_SVG_DEFAULT_VIEWBOX, ZODIAC_GLYPHS, ZODIAC_GLYPH_PRIMITIVES, generateArcheometerSvg, generateAstroGlyphSvg, generateAstroWheelSvg, generateGlyphSvg, generateTreeSvg, getArcheometerRenderModel, getAstroGlyph, getAstroWheelRenderModel, getTreeLayout, getTreeRenderModel, listAstroGlyphs };
|
|
3755
|
+
//# sourceMappingURL=out.js.map
|
|
3756
|
+
//# sourceMappingURL=chunk-5HXSHALQ.mjs.map
|