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