kaabalah 6.6.3 → 6.7.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/{chunk-N4I74YCP.mjs → chunk-SFUCT6I2.mjs} +1340 -325
- package/dist/chunk-SFUCT6I2.mjs.map +1 -0
- package/dist/{chunk-ZDISHSMX.js → chunk-WCOGJKT7.js} +1354 -324
- package/dist/chunk-WCOGJKT7.js.map +1 -0
- package/dist/cli.js +1370 -332
- package/dist/cli.js.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +170 -110
- package/dist/index.mjs +2 -2
- package/dist/visual/index.d.mts +175 -1
- package/dist/visual/index.d.ts +175 -1
- package/dist/visual/index.js +87 -27
- package/dist/visual/index.mjs +1 -1
- package/package.json +3 -2
- package/dist/chunk-N4I74YCP.mjs.map +0 -1
- package/dist/chunk-ZDISHSMX.js.map +0 -1
|
@@ -2,6 +2,823 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkS6KNERP7_js = require('./chunk-S6KNERP7.js');
|
|
4
4
|
|
|
5
|
+
// src/visual/archeometer.ts
|
|
6
|
+
var TAU = Math.PI * 2;
|
|
7
|
+
var ARCHEOMETER_DEFAULT_VIEWBOX = {
|
|
8
|
+
minX: 0,
|
|
9
|
+
minY: 0,
|
|
10
|
+
width: 912,
|
|
11
|
+
height: 912
|
|
12
|
+
};
|
|
13
|
+
var ARCHEOMETER_OUTER_CROWN_BLEED = 22;
|
|
14
|
+
var DEFAULT_LAYERS = {
|
|
15
|
+
degreeCrown: true,
|
|
16
|
+
zodiacUtterance: true,
|
|
17
|
+
planetaryUtterance: true,
|
|
18
|
+
cosmologicalMusic: true,
|
|
19
|
+
astralZodiac: true,
|
|
20
|
+
astralPlanetary: true,
|
|
21
|
+
chromicRays: true,
|
|
22
|
+
whiteRays: true,
|
|
23
|
+
solarCenter: true
|
|
24
|
+
};
|
|
25
|
+
var COLOR_RING_FILLS = {
|
|
26
|
+
degreeOuter: "#fff8ef",
|
|
27
|
+
degreeInner: "#fff2e1",
|
|
28
|
+
zodiacUtterance: "#eba0be",
|
|
29
|
+
planetaryUtterance: "#fffaf1",
|
|
30
|
+
cosmologicalMusic: "#fffaf0",
|
|
31
|
+
astralZodiac: "#efc0bc",
|
|
32
|
+
astralPlanetary: "#d2e8df",
|
|
33
|
+
chromicRays: "#fff3d4",
|
|
34
|
+
whiteRays: "#eef1ec",
|
|
35
|
+
solarCenter: "#f7d65b"
|
|
36
|
+
};
|
|
37
|
+
var COLOR_PALETTE = {
|
|
38
|
+
paper: "#fffaf1",
|
|
39
|
+
ink: "#151515",
|
|
40
|
+
subtleInk: "#605a54",
|
|
41
|
+
ringStroke: "#171717",
|
|
42
|
+
degreeTick: "#171717",
|
|
43
|
+
degreeLabel: "#171717",
|
|
44
|
+
whiteRay: "#25395a",
|
|
45
|
+
ringFills: COLOR_RING_FILLS
|
|
46
|
+
};
|
|
47
|
+
var DEFAULT_ARCHEOMETER_SECTOR_CORRESPONDENCES = [
|
|
48
|
+
{
|
|
49
|
+
degree: 0,
|
|
50
|
+
utterance: { id: "ph", degree: 0, letter: "P, Ph", number: 80, color: "#f2d54c", triangleId: "wordJesus", gloss: "Utterance / light" },
|
|
51
|
+
triangleLabel: { degree: 0, label: "S, Sh", number: 300 },
|
|
52
|
+
musicalNote: { degree: 0, note: "Si" },
|
|
53
|
+
zodiacSign: { degree: 0, name: "Capricorn", glyph: "\u2651" },
|
|
54
|
+
planetaryPoint: { degree: 0, name: "Saturn", glyph: "\u2644", phase: "diurnal" }
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
degree: 30,
|
|
58
|
+
utterance: { id: "za", degree: 30, letter: "W, OU", number: 70, color: "#b7d56a", triangleId: "ether", gloss: "Ether" },
|
|
59
|
+
triangleLabel: { degree: 30, label: "D", number: 4 },
|
|
60
|
+
musicalNote: { degree: 30, note: "Do" },
|
|
61
|
+
zodiacSign: { degree: 30, name: "Sagittarius", glyph: "\u2650" },
|
|
62
|
+
planetaryPoint: { degree: 30, name: "Jupiter", glyph: "\u2643", phase: "diurnal" }
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
degree: 60,
|
|
66
|
+
utterance: { id: "ma", degree: 60, letter: "M", number: 40, color: "#79bf6a", triangleId: "mary", gloss: "Mary" },
|
|
67
|
+
triangleLabel: { degree: 60, label: "C", number: 20 },
|
|
68
|
+
musicalNote: { degree: 60, note: "R\xE9" },
|
|
69
|
+
zodiacSign: { degree: 60, name: "Scorpio", glyph: "\u264F" },
|
|
70
|
+
planetaryPoint: { degree: 60, name: "Mars", glyph: "\u2642", phase: "diurnal" }
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
degree: 90,
|
|
74
|
+
utterance: { id: "u", degree: 90, letter: "L", number: 30, color: "#69ad74", triangleId: "divineFire", gloss: "Fire" },
|
|
75
|
+
triangleLabel: { degree: 90, label: "" },
|
|
76
|
+
musicalNote: { degree: 90, note: "Mi" },
|
|
77
|
+
zodiacSign: { degree: 90, name: "Libra", glyph: "\u264E" },
|
|
78
|
+
planetaryPoint: { degree: 90, name: "Venus", glyph: "\u2640", phase: "diurnal" }
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
degree: 120,
|
|
82
|
+
utterance: { id: "o", degree: 120, letter: "I, Y, J", number: 10, color: "#efb83e", triangleId: "wordJesus", gloss: "Voice / sound" },
|
|
83
|
+
triangleLabel: { degree: 120, label: "Ts", number: 90 },
|
|
84
|
+
musicalNote: { degree: 120, note: "Fa" },
|
|
85
|
+
zodiacSign: { degree: 120, name: "Virgo", glyph: "\u264D" },
|
|
86
|
+
planetaryPoint: { degree: 120, name: "Mercury", glyph: "\u263F", phase: "diurnal" }
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
degree: 150,
|
|
90
|
+
utterance: { id: "la", degree: 150, letter: "T", number: 9, color: "#ec8d3f", triangleId: "ether", gloss: "Ether" },
|
|
91
|
+
triangleLabel: { degree: 150, label: "N", number: 50 },
|
|
92
|
+
musicalNote: { degree: 150, note: "Sol" },
|
|
93
|
+
zodiacSign: { degree: 150, name: "Leo", glyph: "\u264C" },
|
|
94
|
+
planetaryPoint: { degree: 150, name: "Sun", glyph: "\u2609", phase: "diurnal" }
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
degree: 180,
|
|
98
|
+
utterance: { id: "ri", degree: 180, letter: "E, H", number: 8, color: "#df4d43", triangleId: "mary", gloss: "Descending R" },
|
|
99
|
+
triangleLabel: { degree: 180, label: "B", number: 2 },
|
|
100
|
+
musicalNote: { degree: 180, note: "La" },
|
|
101
|
+
zodiacSign: { degree: 180, name: "Cancer", glyph: "\u264B" },
|
|
102
|
+
planetaryPoint: { degree: 180, name: "Moon", glyph: "\u263E", phase: "nocturnal" }
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
degree: 210,
|
|
106
|
+
utterance: { id: "t", degree: 210, letter: "Z", number: 7, color: "#8b54ad", triangleId: "divineFire", gloss: "Divine fire" },
|
|
107
|
+
triangleLabel: { degree: 210, label: "Ts", number: 90 },
|
|
108
|
+
musicalNote: { degree: 210, note: "Si" },
|
|
109
|
+
zodiacSign: { degree: 210, name: "Gemini", glyph: "\u264A" },
|
|
110
|
+
planetaryPoint: { degree: 210, name: "Mercury", glyph: "\u263F", phase: "nocturnal" }
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
degree: 240,
|
|
114
|
+
utterance: { id: "y", degree: 240, letter: "V, OU", number: 6, color: "#d85c43", triangleId: "wordJesus", gloss: "Word / JeShU" },
|
|
115
|
+
triangleLabel: { degree: 240, label: "G", number: 3 },
|
|
116
|
+
musicalNote: { degree: 240, note: "Do" },
|
|
117
|
+
zodiacSign: { degree: 240, name: "Taurus", glyph: "\u2649" },
|
|
118
|
+
planetaryPoint: { degree: 240, name: "Venus", glyph: "\u2640", phase: "nocturnal" }
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
degree: 270,
|
|
122
|
+
utterance: { id: "ka", degree: 270, letter: "H, E", number: 5, color: "#3c82c2", triangleId: "ether", gloss: "Etheric power" },
|
|
123
|
+
triangleLabel: { degree: 270, label: "C", number: 20 },
|
|
124
|
+
musicalNote: { degree: 270, note: "R\xE9" },
|
|
125
|
+
zodiacSign: { degree: 270, name: "Aries", glyph: "\u2648" },
|
|
126
|
+
planetaryPoint: { degree: 270, name: "Mars", glyph: "\u2642", phase: "nocturnal" }
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
degree: 300,
|
|
130
|
+
utterance: { id: "h", degree: 300, letter: "R", number: 200, color: "#d4579c", triangleId: "mary", gloss: "Living waters" },
|
|
131
|
+
triangleLabel: { degree: 300, label: "D", number: 4 },
|
|
132
|
+
musicalNote: { degree: 300, note: "Mi" },
|
|
133
|
+
zodiacSign: { degree: 300, name: "Pisces", glyph: "\u2653" },
|
|
134
|
+
planetaryPoint: { degree: 300, name: "Jupiter", glyph: "\u2643", phase: "nocturnal" }
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
degree: 330,
|
|
138
|
+
utterance: { id: "hou", degree: 330, letter: "K", number: 100, color: "#7963b8", triangleId: "divineFire", gloss: "Divine fire" },
|
|
139
|
+
triangleLabel: { degree: 330, label: "S, Sh", number: 300 },
|
|
140
|
+
musicalNote: { degree: 330, note: "Fa" },
|
|
141
|
+
zodiacSign: { degree: 330, name: "Aquarius", glyph: "\u2652" },
|
|
142
|
+
planetaryPoint: { degree: 330, name: "Saturn", glyph: "\u2644", phase: "nocturnal" }
|
|
143
|
+
}
|
|
144
|
+
];
|
|
145
|
+
var DEFAULT_ARCHEOMETER_UTTERANCE = DEFAULT_ARCHEOMETER_SECTOR_CORRESPONDENCES.map((sector) => sector.utterance);
|
|
146
|
+
var DEFAULT_ARCHEOMETER_TRIANGLE_LABELS = DEFAULT_ARCHEOMETER_SECTOR_CORRESPONDENCES.map((sector) => sector.triangleLabel);
|
|
147
|
+
var DEFAULT_ARCHEOMETER_TRIANGLES = [
|
|
148
|
+
{ 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" },
|
|
149
|
+
{ 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" },
|
|
150
|
+
{ 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" },
|
|
151
|
+
{ 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" }
|
|
152
|
+
];
|
|
153
|
+
var DEFAULT_ARCHEOMETER_MUSICAL_NOTES = DEFAULT_ARCHEOMETER_SECTOR_CORRESPONDENCES.map((sector) => sector.musicalNote);
|
|
154
|
+
var DEFAULT_ARCHEOMETER_ZODIAC = DEFAULT_ARCHEOMETER_SECTOR_CORRESPONDENCES.map((sector) => sector.zodiacSign);
|
|
155
|
+
var DEFAULT_ARCHEOMETER_PLANETS = DEFAULT_ARCHEOMETER_SECTOR_CORRESPONDENCES.map((sector) => sector.planetaryPoint);
|
|
156
|
+
function getArcheometerRenderModel(options = {}) {
|
|
157
|
+
const viewBox = normalizeViewBox(options.viewBox);
|
|
158
|
+
const scale = Math.min(viewBox.width / ARCHEOMETER_DEFAULT_VIEWBOX.width, viewBox.height / ARCHEOMETER_DEFAULT_VIEWBOX.height);
|
|
159
|
+
const padding = options.padding ?? 0;
|
|
160
|
+
const center = {
|
|
161
|
+
x: round(viewBox.minX + viewBox.width / 2),
|
|
162
|
+
y: round(viewBox.minY + viewBox.height / 2)
|
|
163
|
+
};
|
|
164
|
+
const frameRadius = round(Math.max(0, Math.min(viewBox.width, viewBox.height) / 2 - padding));
|
|
165
|
+
const outerRadius = round(Math.max(0, frameRadius - ARCHEOMETER_OUTER_CROWN_BLEED * scale));
|
|
166
|
+
return {
|
|
167
|
+
viewBox,
|
|
168
|
+
center,
|
|
169
|
+
outerRadius,
|
|
170
|
+
scale,
|
|
171
|
+
rings: buildRings(outerRadius, frameRadius),
|
|
172
|
+
palette: resolvePalette(options.palette),
|
|
173
|
+
rotationDegrees: options.rotationDegrees ?? 0,
|
|
174
|
+
layers: { ...DEFAULT_LAYERS, ...options.layers ?? {} },
|
|
175
|
+
degreeLabelEvery: options.degreeLabelEvery ?? 15,
|
|
176
|
+
utterance: options.utterance ?? DEFAULT_ARCHEOMETER_UTTERANCE,
|
|
177
|
+
triangles: options.triangles ?? DEFAULT_ARCHEOMETER_TRIANGLES,
|
|
178
|
+
triangleLabels: options.triangleLabels ?? DEFAULT_ARCHEOMETER_TRIANGLE_LABELS,
|
|
179
|
+
musicalNotes: options.musicalNotes ?? DEFAULT_ARCHEOMETER_MUSICAL_NOTES,
|
|
180
|
+
zodiacSigns: options.zodiacSigns ?? DEFAULT_ARCHEOMETER_ZODIAC,
|
|
181
|
+
planetaryPoints: options.planetaryPoints ?? DEFAULT_ARCHEOMETER_PLANETS
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
var DEFAULT_ARCHETYPE_UTTERANCE = DEFAULT_ARCHEOMETER_UTTERANCE;
|
|
185
|
+
var DEFAULT_ARCHETYPE_TRIANGLES = DEFAULT_ARCHEOMETER_TRIANGLES;
|
|
186
|
+
var DEFAULT_ARCHETYPE_MUSICAL_NOTES = DEFAULT_ARCHEOMETER_MUSICAL_NOTES;
|
|
187
|
+
var DEFAULT_ARCHETYPE_ZODIAC = DEFAULT_ARCHEOMETER_ZODIAC;
|
|
188
|
+
var DEFAULT_ARCHETYPE_PLANETS = DEFAULT_ARCHEOMETER_PLANETS;
|
|
189
|
+
function generateArcheometerSvg(options = {}) {
|
|
190
|
+
const model = getArcheometerRenderModel(options);
|
|
191
|
+
const { viewBox, center, outerRadius, palette } = model;
|
|
192
|
+
const background = options.background ?? "transparent";
|
|
193
|
+
const lines = [];
|
|
194
|
+
const push = (line) => lines.push(line);
|
|
195
|
+
const title = options.title ?? "The Cosmological Archeometer";
|
|
196
|
+
const attrs = [
|
|
197
|
+
`xmlns="http://www.w3.org/2000/svg"`,
|
|
198
|
+
options.width !== void 0 ? `width="${escapeAttr(String(options.width))}"` : "",
|
|
199
|
+
options.height !== void 0 ? `height="${escapeAttr(String(options.height))}"` : "",
|
|
200
|
+
`viewBox="${fmt(viewBox.minX)} ${fmt(viewBox.minY)} ${fmt(viewBox.width)} ${fmt(viewBox.height)}"`,
|
|
201
|
+
`preserveAspectRatio="xMidYMid meet"`,
|
|
202
|
+
`role="img"`,
|
|
203
|
+
`aria-label="${escapeAttr(title)}"`
|
|
204
|
+
].filter(Boolean);
|
|
205
|
+
push(`<svg ${attrs.join(" ")}>`);
|
|
206
|
+
push(`<title>${escapeText(title)}</title>`);
|
|
207
|
+
if (background !== "transparent") {
|
|
208
|
+
push(`<rect x="${fmt(viewBox.minX)}" y="${fmt(viewBox.minY)}" width="${fmt(viewBox.width)}" height="${fmt(viewBox.height)}" fill="${escapeAttr(background)}"/>`);
|
|
209
|
+
}
|
|
210
|
+
push(`<circle cx="${fmt(center.x)}" cy="${fmt(center.y)}" r="${fmt(outerRadius)}" fill="${escapeAttr(palette.paper)}"/>`);
|
|
211
|
+
renderDefs(push, model);
|
|
212
|
+
renderRingGrounds(push, model);
|
|
213
|
+
if (model.layers.chromicRays) renderChromicRays(push, model);
|
|
214
|
+
if (model.layers.planetaryUtterance) renderPlanetaryUtterance(push, model);
|
|
215
|
+
if (model.layers.zodiacUtterance) renderZodiacUtterance(push, model);
|
|
216
|
+
if (model.layers.cosmologicalMusic) renderCosmologicalMusic(push, model);
|
|
217
|
+
if (model.layers.astralZodiac) renderAstralZodiac(push, model);
|
|
218
|
+
if (model.layers.astralPlanetary) renderAstralPlanetary(push, model);
|
|
219
|
+
if (model.layers.solarCenter) renderSolarCenter(push, model);
|
|
220
|
+
if (model.layers.whiteRays) renderWhiteRays(push, model);
|
|
221
|
+
if (model.layers.degreeCrown) renderDegreeCrown(push, model);
|
|
222
|
+
renderFrame(push, model);
|
|
223
|
+
push(`</svg>`);
|
|
224
|
+
return lines.join("\n");
|
|
225
|
+
}
|
|
226
|
+
function renderDefs(push, model) {
|
|
227
|
+
const { rings, center } = model;
|
|
228
|
+
const planetaryClipOuter = planetaryTriangleClipOuterRadius(rings);
|
|
229
|
+
const planetaryClipInner = planetaryTriangleClipInnerRadius(rings);
|
|
230
|
+
const chromicClipOuter = chromicCoreOuterRadius(rings);
|
|
231
|
+
const chromicClipInner = chromicCoreInnerRadius(rings);
|
|
232
|
+
push(`<defs>`);
|
|
233
|
+
push(
|
|
234
|
+
`<clipPath id="archeometer-planetary-clip"><path d="${annulusPath(
|
|
235
|
+
center,
|
|
236
|
+
planetaryClipInner,
|
|
237
|
+
planetaryClipOuter
|
|
238
|
+
)}" fill-rule="evenodd" clip-rule="evenodd"/></clipPath>`
|
|
239
|
+
);
|
|
240
|
+
push(
|
|
241
|
+
`<clipPath id="archeometer-chromic-clip"><path d="${annulusPath(
|
|
242
|
+
center,
|
|
243
|
+
chromicClipInner,
|
|
244
|
+
chromicClipOuter
|
|
245
|
+
)}" fill-rule="evenodd" clip-rule="evenodd"/></clipPath>`
|
|
246
|
+
);
|
|
247
|
+
push(`</defs>`);
|
|
248
|
+
}
|
|
249
|
+
function renderRingGrounds(push, model) {
|
|
250
|
+
const { rings, center, palette } = model;
|
|
251
|
+
const order = [
|
|
252
|
+
"degreeOuter",
|
|
253
|
+
"degreeInner",
|
|
254
|
+
"zodiacUtterance",
|
|
255
|
+
"planetaryUtterance",
|
|
256
|
+
"cosmologicalMusic",
|
|
257
|
+
"astralZodiac",
|
|
258
|
+
"astralPlanetary",
|
|
259
|
+
"chromicRays",
|
|
260
|
+
"whiteRays"
|
|
261
|
+
];
|
|
262
|
+
push(`<g id="archeometer-ring-grounds">`);
|
|
263
|
+
for (const id2 of order) {
|
|
264
|
+
const ring = rings[id2];
|
|
265
|
+
push(`<path id="archeometer-ring-${id2}" d="${annulusPath(center, ring.r1, ring.r2)}" fill="${escapeAttr(palette.ringFills[id2])}" fill-rule="evenodd" stroke="none"/>`);
|
|
266
|
+
}
|
|
267
|
+
push(`</g>`);
|
|
268
|
+
}
|
|
269
|
+
function renderDegreeCrown(push, model) {
|
|
270
|
+
const { center, rings, palette, scale } = model;
|
|
271
|
+
const outer = rings.degreeOuter;
|
|
272
|
+
const inner = rings.degreeInner;
|
|
273
|
+
push(`<g id="archeometer-degree-crown" aria-label="dual 360 degree differential numerical protractor">`);
|
|
274
|
+
for (let degree = 0; degree < 360; degree += 30) {
|
|
275
|
+
const angle = angleOf(model, degree);
|
|
276
|
+
const pOuter = polarToXY(center, (outer.r1 + outer.r2) / 2, angle);
|
|
277
|
+
const pInner = polarToXY(center, (inner.r1 + inner.r2) / 2, angle);
|
|
278
|
+
const rot = tangentRotation(angle);
|
|
279
|
+
const outerText = String(normalizeDegrees(345 + degree) || 360);
|
|
280
|
+
const innerText = String(normalizeDegrees(15 - degree) || 360);
|
|
281
|
+
push(textSvg(outerText, pOuter, 8.4 * scale, palette.degreeLabel, rot, "middle"));
|
|
282
|
+
push(textSvg(innerText, pInner, 7.6 * scale, palette.degreeLabel, rot, "middle"));
|
|
283
|
+
}
|
|
284
|
+
push(`</g>`);
|
|
285
|
+
}
|
|
286
|
+
function renderZodiacUtterance(push, model) {
|
|
287
|
+
const { center, rings, palette, scale } = model;
|
|
288
|
+
const ring = rings.zodiacUtterance;
|
|
289
|
+
const sorted = sortedByDegree(model.utterance);
|
|
290
|
+
push(`<g id="archeometer-zodiacal-utterance" aria-label="zodiacal crown of the utterance">`);
|
|
291
|
+
for (let i = 0; i < 12; i++) {
|
|
292
|
+
const degree = i * 30;
|
|
293
|
+
const sector = annularSectorPath(
|
|
294
|
+
center,
|
|
295
|
+
ring.r1,
|
|
296
|
+
ring.r2,
|
|
297
|
+
angleOf(model, degree - 15),
|
|
298
|
+
angleOf(model, degree + 15),
|
|
299
|
+
30
|
|
300
|
+
);
|
|
301
|
+
push(
|
|
302
|
+
`<path d="${sector}" fill="${escapeAttr(palette.ringFills.zodiacUtterance)}" fill-opacity="1" stroke="${escapeAttr(
|
|
303
|
+
palette.ringStroke
|
|
304
|
+
)}" stroke-opacity="0.34" stroke-width="${fmt(0.7 * scale)}"/>`
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
for (const point of sorted) {
|
|
308
|
+
const a = angleOf(model, point.degree);
|
|
309
|
+
const p = polarToXY(center, ring.r1 + (ring.r2 - ring.r1) * 0.58, a);
|
|
310
|
+
const shieldR = (ring.r2 - ring.r1) * 0.22;
|
|
311
|
+
const letterParts = point.letter.split(",").map((part) => part.trim()).filter(Boolean);
|
|
312
|
+
const isStacked = letterParts.length > 1;
|
|
313
|
+
const letterFontSize = (isStacked ? letterParts.length > 2 ? 8.3 : 10.6 : 14) * scale;
|
|
314
|
+
const letterLineHeight = letterFontSize * (isStacked ? 1.02 : 1);
|
|
315
|
+
const numberFontSize = (isStacked ? 6.6 : 7.1) * scale;
|
|
316
|
+
const numberGap = (isStacked ? 4.8 : 0) * scale;
|
|
317
|
+
const stackedNumberY = p.y + (letterParts.length - 1) * letterLineHeight / 2 + numberGap + numberFontSize * 0.42;
|
|
318
|
+
const singleLetterY = p.y - shieldR * 0.48;
|
|
319
|
+
const firstLineY = isStacked ? p.y - (letterParts.length - 1) * letterLineHeight / 2 - numberFontSize * 0.42 : singleLetterY;
|
|
320
|
+
const numberY = isStacked ? stackedNumberY : p.y + shieldR * 0.72;
|
|
321
|
+
push(
|
|
322
|
+
`<g class="archeometer-utterance-point" data-degree="${fmt(normalizeDegrees(point.degree))}" data-letter="${escapeAttr(
|
|
323
|
+
point.letter
|
|
324
|
+
)}">`
|
|
325
|
+
);
|
|
326
|
+
for (const [index, part] of letterParts.entries()) {
|
|
327
|
+
push(textSvg(part, { x: p.x, y: firstLineY + index * letterLineHeight }, letterFontSize, palette.ink, 0, "middle", 700));
|
|
328
|
+
}
|
|
329
|
+
push(textSvg(String(point.number), { x: p.x, y: numberY }, numberFontSize, palette.ink, 0, "middle"));
|
|
330
|
+
push(`</g>`);
|
|
331
|
+
}
|
|
332
|
+
push(`</g>`);
|
|
333
|
+
}
|
|
334
|
+
function renderPlanetaryUtterance(push, model) {
|
|
335
|
+
const { center, rings, palette, scale } = model;
|
|
336
|
+
const ring = rings.planetaryUtterance;
|
|
337
|
+
const clipOuter = planetaryTriangleClipOuterRadius(rings);
|
|
338
|
+
const vertexRadius = clipOuter;
|
|
339
|
+
push(`<g id="archeometer-planetary-utterance" aria-label="four trigones of the planetary utterance">`);
|
|
340
|
+
push(`<g clip-path="url(#archeometer-planetary-clip)">`);
|
|
341
|
+
for (const triangle of model.triangles) {
|
|
342
|
+
const vertices = triangle.vertices.map((degree) => polarToXY(center, vertexRadius, angleOf(model, degree)));
|
|
343
|
+
if (triangle.vertexFills) {
|
|
344
|
+
const centroid = polygonCentroid(vertices);
|
|
345
|
+
const midpoints = vertices.map((vertex, index) => midpoint(vertex, vertices[(index + 1) % vertices.length]));
|
|
346
|
+
for (const [index, vertex] of vertices.entries()) {
|
|
347
|
+
const previousMidpoint = midpoints[(index + vertices.length - 1) % vertices.length];
|
|
348
|
+
const nextMidpoint = midpoints[index];
|
|
349
|
+
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"/>`);
|
|
350
|
+
}
|
|
351
|
+
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)}"/>`);
|
|
352
|
+
} else {
|
|
353
|
+
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)}"/>`);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
push(`</g>`);
|
|
357
|
+
for (const label of sortedByDegree(model.triangleLabels)) {
|
|
358
|
+
if (!label.label) continue;
|
|
359
|
+
const a = angleOf(model, label.degree);
|
|
360
|
+
const labelPoint = polarToXY(center, ring.r1 + (clipOuter - ring.r1) * 0.56, a);
|
|
361
|
+
push(textSvg(label.label, labelPoint, 12 * scale, palette.ink, 0, "middle", 700));
|
|
362
|
+
if (label.number !== void 0) {
|
|
363
|
+
const numberPoint = polarToXY(center, ring.r1 + (clipOuter - ring.r1) * 0.8, a);
|
|
364
|
+
push(textSvg(String(label.number), numberPoint, 7.5 * scale, palette.ink, 0, "middle", 600));
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
push(`</g>`);
|
|
368
|
+
}
|
|
369
|
+
function renderCosmologicalMusic(push, model) {
|
|
370
|
+
const { center, rings, palette, scale } = model;
|
|
371
|
+
const ring = rings.cosmologicalMusic;
|
|
372
|
+
const notes = sortedByDegree(model.musicalNotes);
|
|
373
|
+
push(`<g id="archeometer-cosmological-music" aria-label="cosmological musical crown">`);
|
|
374
|
+
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"/>`);
|
|
375
|
+
for (const note of notes) {
|
|
376
|
+
const point = nearestUtterance(note.degree, model.utterance);
|
|
377
|
+
const start = angleOf(model, note.degree - 15);
|
|
378
|
+
const end = angleOf(model, note.degree + 15);
|
|
379
|
+
const sector = annularSectorPath(center, ring.r1, ring.r2, start, end, 30);
|
|
380
|
+
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)}"/>`);
|
|
381
|
+
}
|
|
382
|
+
for (const note of notes) {
|
|
383
|
+
const start = angleOf(model, note.degree - 5.5);
|
|
384
|
+
const end = angleOf(model, note.degree + 5.5);
|
|
385
|
+
for (let i = 1; i <= 5; i++) {
|
|
386
|
+
const r = ring.r1 + (ring.r2 - ring.r1) * i / 6;
|
|
387
|
+
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"/>`);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
for (const note of notes) {
|
|
391
|
+
if (!note.note) continue;
|
|
392
|
+
const p = polarToXY(center, (ring.r1 + ring.r2) / 2, angleOf(model, note.degree));
|
|
393
|
+
push(textSvg(note.note, p, 11.8 * scale, palette.ink, tangentRotation(angleOf(model, note.degree)), "middle", 700));
|
|
394
|
+
}
|
|
395
|
+
push(`</g>`);
|
|
396
|
+
}
|
|
397
|
+
function renderAstralZodiac(push, model) {
|
|
398
|
+
const { center, rings, palette, scale } = model;
|
|
399
|
+
const ring = rings.astralZodiac;
|
|
400
|
+
const ringWidth = ring.r2 - ring.r1;
|
|
401
|
+
push(`<g id="archeometer-astral-zodiac" aria-label="astral zodiacal crown">`);
|
|
402
|
+
for (const sign of sortedByDegree(model.zodiacSigns)) {
|
|
403
|
+
const sector = annularSectorPath(
|
|
404
|
+
center,
|
|
405
|
+
ring.r1,
|
|
406
|
+
ring.r2,
|
|
407
|
+
angleOf(model, sign.degree - 15),
|
|
408
|
+
angleOf(model, sign.degree + 15),
|
|
409
|
+
30
|
|
410
|
+
);
|
|
411
|
+
const pointColor = triangleVertexFillForDegree(model, sign.degree) ?? sign.color ?? nearestUtterance(sign.degree, model.utterance)?.color ?? palette.ringFills.astralZodiac;
|
|
412
|
+
push(
|
|
413
|
+
`<path d="${sector}" fill="${escapeAttr(pointColor)}" fill-opacity="0.40" stroke="${escapeAttr(
|
|
414
|
+
palette.ringStroke
|
|
415
|
+
)}" stroke-opacity="0.32" stroke-width="${fmt(0.6 * scale)}"/>`
|
|
416
|
+
);
|
|
417
|
+
}
|
|
418
|
+
const markerRadius = Math.min(ringWidth * 0.33, 13 * scale);
|
|
419
|
+
const glyphSize = 17.5 * scale;
|
|
420
|
+
for (const sign of sortedByDegree(model.zodiacSigns)) {
|
|
421
|
+
const pointColor = triangleVertexFillForDegree(model, sign.degree) ?? sign.color ?? nearestUtterance(sign.degree, model.utterance)?.color ?? palette.ringFills.astralZodiac;
|
|
422
|
+
const p = polarToXY(center, (ring.r1 + ring.r2) / 2, angleOf(model, sign.degree));
|
|
423
|
+
push(
|
|
424
|
+
`<g class="archeometer-zodiac-sign" data-sign="${escapeAttr(sign.name)}" data-degree="${fmt(
|
|
425
|
+
normalizeDegrees(sign.degree)
|
|
426
|
+
)}">`
|
|
427
|
+
);
|
|
428
|
+
push(
|
|
429
|
+
`<circle cx="${fmt(p.x)}" cy="${fmt(p.y)}" r="${fmt(markerRadius)}" fill="${escapeAttr(
|
|
430
|
+
pointColor
|
|
431
|
+
)}" fill-opacity="0.48" stroke="${escapeAttr(palette.ink)}" stroke-width="${fmt(0.75 * scale)}"/>`
|
|
432
|
+
);
|
|
433
|
+
push(textSvg(sign.glyph, p, glyphSize, palette.ink, 0, "middle"));
|
|
434
|
+
push(`</g>`);
|
|
435
|
+
}
|
|
436
|
+
push(`</g>`);
|
|
437
|
+
}
|
|
438
|
+
function renderAstralPlanetary(push, model) {
|
|
439
|
+
const { center, rings, palette, scale } = model;
|
|
440
|
+
const ring = rings.astralPlanetary;
|
|
441
|
+
const ringWidth = ring.r2 - ring.r1;
|
|
442
|
+
push(`<g id="archeometer-astral-planetary" aria-label="astral planetary crown">`);
|
|
443
|
+
for (const planet of sortedByDegree(model.planetaryPoints)) {
|
|
444
|
+
const pointColor = triangleVertexFillForDegree(model, planet.degree) ?? planet.color ?? nearestUtterance(planet.degree, model.utterance)?.color ?? palette.ringFills.astralPlanetary;
|
|
445
|
+
const sector = annularSectorPath(
|
|
446
|
+
center,
|
|
447
|
+
ring.r1,
|
|
448
|
+
ring.r2,
|
|
449
|
+
angleOf(model, planet.degree - 15),
|
|
450
|
+
angleOf(model, planet.degree + 15),
|
|
451
|
+
30
|
|
452
|
+
);
|
|
453
|
+
push(
|
|
454
|
+
`<path class="archeometer-astral-planetary-sector" data-degree="${fmt(
|
|
455
|
+
normalizeDegrees(planet.degree)
|
|
456
|
+
)}" d="${sector}" fill="${escapeAttr(pointColor)}" fill-opacity="0.36" stroke="none"/>`
|
|
457
|
+
);
|
|
458
|
+
}
|
|
459
|
+
for (let degree = 15; degree < 360; degree += 30) {
|
|
460
|
+
const line = lineFromPolar(center, ring.r1, ring.r2, angleOf(model, degree));
|
|
461
|
+
push(lineSvg(line, palette.ringStroke, 0.6 * scale, 0.42, "archeometer-astral-planetary-divider", ` data-degree="${fmt(degree)}"`));
|
|
462
|
+
}
|
|
463
|
+
const markerRadius = Math.min(ringWidth * 0.33, 13 * scale);
|
|
464
|
+
for (const planet of sortedByDegree(model.planetaryPoints)) {
|
|
465
|
+
const p = polarToXY(center, (ring.r1 + ring.r2) / 2, angleOf(model, planet.degree));
|
|
466
|
+
const color = triangleVertexFillForDegree(model, planet.degree) ?? planet.color ?? nearestUtterance(planet.degree, model.utterance)?.color ?? palette.ink;
|
|
467
|
+
const glyphSize = (planet.name === "Moon" ? 17 : 18.5) * scale;
|
|
468
|
+
push(
|
|
469
|
+
`<g class="archeometer-planet" data-planet="${escapeAttr(planet.name)}" data-degree="${fmt(
|
|
470
|
+
normalizeDegrees(planet.degree)
|
|
471
|
+
)}">`
|
|
472
|
+
);
|
|
473
|
+
push(
|
|
474
|
+
`<circle cx="${fmt(p.x)}" cy="${fmt(p.y)}" r="${fmt(markerRadius)}" fill="${escapeAttr(
|
|
475
|
+
color
|
|
476
|
+
)}" fill-opacity="0.44" stroke="${escapeAttr(palette.ink)}" stroke-width="${fmt(0.8 * scale)}"/>`
|
|
477
|
+
);
|
|
478
|
+
push(textSvg(planet.glyph, p, glyphSize, palette.ink, 0, "middle"));
|
|
479
|
+
push(`</g>`);
|
|
480
|
+
}
|
|
481
|
+
push(`</g>`);
|
|
482
|
+
}
|
|
483
|
+
function renderChromicRays(push, model) {
|
|
484
|
+
push(`<g id="archeometer-chromic-rays" aria-label="dodecagonal crown of chromic circum-solar rays">`);
|
|
485
|
+
push(`<g clip-path="url(#archeometer-chromic-clip)">`);
|
|
486
|
+
renderChromicTriangleCore(push, model);
|
|
487
|
+
push(`</g>`);
|
|
488
|
+
push(`</g>`);
|
|
489
|
+
}
|
|
490
|
+
function renderChromicTriangleCore(push, model) {
|
|
491
|
+
const { center, rings, palette, scale } = model;
|
|
492
|
+
const trianglesById = new Map(model.triangles.map((triangle) => [triangle.id, triangle]));
|
|
493
|
+
const wordJesus = trianglesById.get("wordJesus");
|
|
494
|
+
const mary = trianglesById.get("mary");
|
|
495
|
+
const ether = trianglesById.get("ether");
|
|
496
|
+
const divineFire = trianglesById.get("divineFire");
|
|
497
|
+
const chromicOuter = chromicCoreOuterRadius(rings);
|
|
498
|
+
const chromic = (x, y) => scaleArcheometerReferencePoint(center, chromicOuter, x, y);
|
|
499
|
+
const path = (...commands) => commands.join(" ");
|
|
500
|
+
const move = (x, y) => {
|
|
501
|
+
const p = chromic(x, y);
|
|
502
|
+
return `M ${fmt(p.x)} ${fmt(p.y)}`;
|
|
503
|
+
};
|
|
504
|
+
const line = (x, y) => {
|
|
505
|
+
const p = chromic(x, y);
|
|
506
|
+
return `L ${fmt(p.x)} ${fmt(p.y)}`;
|
|
507
|
+
};
|
|
508
|
+
const cubic = (x1, y1, x2, y2, x, y) => {
|
|
509
|
+
const c1 = chromic(x1, y1);
|
|
510
|
+
const c2 = chromic(x2, y2);
|
|
511
|
+
const p = chromic(x, y);
|
|
512
|
+
return `C ${fmt(c1.x)} ${fmt(c1.y)} ${fmt(c2.x)} ${fmt(c2.y)} ${fmt(p.x)} ${fmt(p.y)}`;
|
|
513
|
+
};
|
|
514
|
+
const strokeWidth = fmt(1.4 * scale);
|
|
515
|
+
const facetStrokeWidth = fmt(0.85 * scale);
|
|
516
|
+
const primaryFacetStrokeWidth = fmt(0.95 * scale);
|
|
517
|
+
const primaryStroke = wordJesus?.stroke ?? palette.ink;
|
|
518
|
+
push(`<g id="archeometer-chromic-triangle-core" aria-label="inner chromic primary triangle core">`);
|
|
519
|
+
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}"/>`);
|
|
520
|
+
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}"/>`);
|
|
521
|
+
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}"/>`);
|
|
522
|
+
for (const triangle of [ether, divineFire, mary]) {
|
|
523
|
+
if (!triangle?.vertexFills) continue;
|
|
524
|
+
const vertices = triangle.vertices.map((degree) => polarToXY(center, chromicOuter, angleOf(model, degree)));
|
|
525
|
+
const centroid = polygonCentroid(vertices);
|
|
526
|
+
const midpoints = vertices.map((vertex, index) => midpoint(vertex, vertices[(index + 1) % vertices.length]));
|
|
527
|
+
for (const [index, vertex] of vertices.entries()) {
|
|
528
|
+
const previousMidpoint = midpoints[(index + vertices.length - 1) % vertices.length];
|
|
529
|
+
const nextMidpoint = midpoints[index];
|
|
530
|
+
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}"/>`);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
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}"/>`);
|
|
534
|
+
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}"/>`);
|
|
535
|
+
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}"/>`);
|
|
536
|
+
push(`<path class="archeometer-chromic-primary-outline" data-triangle="wordJesus" d="${path(
|
|
537
|
+
move(137.05, 204.874),
|
|
538
|
+
line(254.527, 204.874),
|
|
539
|
+
line(195.789, 103.136),
|
|
540
|
+
move(137.05, 204.874),
|
|
541
|
+
line(19.5737, 204.874),
|
|
542
|
+
line(78.312, 103.136),
|
|
543
|
+
move(137.05, 204.874),
|
|
544
|
+
cubic(137.05, 204.874, 94.7002, 203.927, 78.312, 170.699),
|
|
545
|
+
cubic(61.9238, 137.472, 78.312, 103.136, 78.312, 103.136),
|
|
546
|
+
move(137.05, 204.874),
|
|
547
|
+
cubic(137.05, 204.874, 176.2, 204.874, 195.789, 170.699),
|
|
548
|
+
cubic(215.377, 136.525, 195.789, 103.136, 195.789, 103.136),
|
|
549
|
+
move(195.789, 103.136),
|
|
550
|
+
line(137.05, 1.39844),
|
|
551
|
+
line(78.312, 103.136),
|
|
552
|
+
move(195.789, 103.136),
|
|
553
|
+
cubic(195.789, 103.136, 173.2, 71.1992, 137.05, 71.1992),
|
|
554
|
+
cubic(100.9, 71.1992, 78.312, 103.136, 78.312, 103.136)
|
|
555
|
+
)}" fill="none" stroke="${escapeAttr(primaryStroke)}" stroke-width="${strokeWidth}"/>`);
|
|
556
|
+
push(`</g>`);
|
|
557
|
+
}
|
|
558
|
+
function renderWhiteRays(push, model) {
|
|
559
|
+
const { center, rings, palette, scale } = model;
|
|
560
|
+
const solarRadius = rings.solarCenter.r2;
|
|
561
|
+
const sunCenterCircleRadiusWithPadding = 3 + 0.3;
|
|
562
|
+
push(`<g id="archeometer-white-rays" aria-label="crown of white rays and musical staff">`);
|
|
563
|
+
for (let degree = 0; degree < 180; degree += 30) {
|
|
564
|
+
if (degree === 90 || degree === 270) continue;
|
|
565
|
+
push(lineSvg(lineFromPolar(center, solarRadius, sunCenterCircleRadiusWithPadding, angleOf(model, degree)), palette.whiteRay, 1.55 * scale, 0.92));
|
|
566
|
+
push(lineSvg(lineFromPolar(center, solarRadius, sunCenterCircleRadiusWithPadding, angleOf(model, degree + 180)), palette.whiteRay, 1.55 * scale, 0.92));
|
|
567
|
+
}
|
|
568
|
+
push(`</g>`);
|
|
569
|
+
}
|
|
570
|
+
function renderSolarCenter(push, model) {
|
|
571
|
+
const { center, rings, palette, scale } = model;
|
|
572
|
+
const r = rings.solarCenter.r2;
|
|
573
|
+
const innerR = r * 0.68;
|
|
574
|
+
const arcStart = polarToXY(center, innerR * 0.72, deg2rad(240));
|
|
575
|
+
const arcEnd = polarToXY(center, innerR * 0.72, deg2rad(300));
|
|
576
|
+
const paddingTop = 22;
|
|
577
|
+
const sunCenterCircleRadius = 3;
|
|
578
|
+
push(`<g id="archeometer-solar-center" aria-label="solar center Mi">`);
|
|
579
|
+
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)}"/>`);
|
|
580
|
+
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));
|
|
581
|
+
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));
|
|
582
|
+
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));
|
|
583
|
+
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)}"/>`);
|
|
584
|
+
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)}"/>`);
|
|
585
|
+
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)}"/>`);
|
|
586
|
+
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)}"/>`);
|
|
587
|
+
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)}"/>`);
|
|
588
|
+
push(`</g>`);
|
|
589
|
+
}
|
|
590
|
+
function renderFrame(push, model) {
|
|
591
|
+
const { center, rings, palette, scale } = model;
|
|
592
|
+
const radii = Array.from(
|
|
593
|
+
new Map(
|
|
594
|
+
[
|
|
595
|
+
rings.degreeOuter.r2,
|
|
596
|
+
rings.degreeOuter.r1,
|
|
597
|
+
rings.degreeInner.r1,
|
|
598
|
+
rings.zodiacUtterance.r1,
|
|
599
|
+
rings.planetaryUtterance.r1,
|
|
600
|
+
rings.cosmologicalMusic.r1,
|
|
601
|
+
rings.astralZodiac.r1,
|
|
602
|
+
rings.astralPlanetary.r1,
|
|
603
|
+
rings.chromicRays.r1,
|
|
604
|
+
rings.solarCenter.r2
|
|
605
|
+
].map((radius) => [fmt(radius), radius])
|
|
606
|
+
).values()
|
|
607
|
+
);
|
|
608
|
+
push(`<g id="archeometer-frame" aria-hidden="true">`);
|
|
609
|
+
for (const radius of radii) {
|
|
610
|
+
if (radius <= 0) continue;
|
|
611
|
+
push(
|
|
612
|
+
`<circle cx="${fmt(center.x)}" cy="${fmt(center.y)}" r="${fmt(radius)}" fill="none" stroke="${escapeAttr(
|
|
613
|
+
palette.ringStroke
|
|
614
|
+
)}" stroke-opacity="0.82" stroke-width="${fmt(0.85 * scale)}"/>`
|
|
615
|
+
);
|
|
616
|
+
}
|
|
617
|
+
push(
|
|
618
|
+
`<circle cx="${fmt(center.x)}" cy="${fmt(center.y)}" r="${fmt(
|
|
619
|
+
rings.degreeOuter.r2
|
|
620
|
+
)}" fill="none" stroke="${escapeAttr(palette.ringStroke)}" stroke-width="${fmt(2.2 * scale)}"/>`
|
|
621
|
+
);
|
|
622
|
+
push(`</g>`);
|
|
623
|
+
}
|
|
624
|
+
function buildRings(contentRadius, frameRadius = contentRadius) {
|
|
625
|
+
const ring = (id2, r1, r2, radius = contentRadius) => ({
|
|
626
|
+
id: id2,
|
|
627
|
+
r1: round(radius * r1),
|
|
628
|
+
r2: round(radius * r2)
|
|
629
|
+
});
|
|
630
|
+
return {
|
|
631
|
+
degreeOuter: ring("degreeOuter", 0.955, 1, frameRadius),
|
|
632
|
+
degreeInner: {
|
|
633
|
+
id: "degreeInner",
|
|
634
|
+
r1: round(contentRadius * 0.955),
|
|
635
|
+
r2: round(frameRadius * 0.955)
|
|
636
|
+
},
|
|
637
|
+
zodiacUtterance: ring("zodiacUtterance", 0.8, 0.955),
|
|
638
|
+
planetaryUtterance: ring("planetaryUtterance", 0.461, 0.8),
|
|
639
|
+
cosmologicalMusic: ring("cosmologicalMusic", 0.395, 0.461),
|
|
640
|
+
astralZodiac: ring("astralZodiac", 0.297, 0.395),
|
|
641
|
+
astralPlanetary: ring("astralPlanetary", 0.198, 0.297),
|
|
642
|
+
chromicRays: ring("chromicRays", 0.198, 0.395),
|
|
643
|
+
whiteRays: ring("whiteRays", 0.12, 0.198),
|
|
644
|
+
solarCenter: ring("solarCenter", 0, 0.099)
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
function planetaryTriangleClipInnerRadius(rings) {
|
|
648
|
+
return rings.planetaryUtterance.r1;
|
|
649
|
+
}
|
|
650
|
+
function planetaryTriangleClipOuterRadius(rings) {
|
|
651
|
+
return rings.planetaryUtterance.r2;
|
|
652
|
+
}
|
|
653
|
+
function chromicCoreInnerRadius(rings) {
|
|
654
|
+
return rings.solarCenter.r2;
|
|
655
|
+
}
|
|
656
|
+
function chromicCoreOuterRadius(rings) {
|
|
657
|
+
return rings.whiteRays.r2;
|
|
658
|
+
}
|
|
659
|
+
function resolvePalette(palette) {
|
|
660
|
+
const base = COLOR_PALETTE;
|
|
661
|
+
const overrides = typeof palette === "object" ? palette : {};
|
|
662
|
+
return {
|
|
663
|
+
paper: overrides.paper ?? base.paper,
|
|
664
|
+
ink: overrides.ink ?? base.ink,
|
|
665
|
+
subtleInk: overrides.subtleInk ?? base.subtleInk,
|
|
666
|
+
ringStroke: overrides.ringStroke ?? base.ringStroke,
|
|
667
|
+
degreeTick: overrides.degreeTick ?? base.degreeTick,
|
|
668
|
+
degreeLabel: overrides.degreeLabel ?? base.degreeLabel,
|
|
669
|
+
whiteRay: overrides.whiteRay ?? base.whiteRay,
|
|
670
|
+
ringFills: { ...base.ringFills, ...overrides.ringFills ?? {} }
|
|
671
|
+
};
|
|
672
|
+
}
|
|
673
|
+
function normalizeViewBox(viewBox) {
|
|
674
|
+
return {
|
|
675
|
+
minX: viewBox?.minX ?? ARCHEOMETER_DEFAULT_VIEWBOX.minX,
|
|
676
|
+
minY: viewBox?.minY ?? ARCHEOMETER_DEFAULT_VIEWBOX.minY,
|
|
677
|
+
width: viewBox?.width ?? ARCHEOMETER_DEFAULT_VIEWBOX.width,
|
|
678
|
+
height: viewBox?.height ?? ARCHEOMETER_DEFAULT_VIEWBOX.height
|
|
679
|
+
};
|
|
680
|
+
}
|
|
681
|
+
function angleOf(model, degree) {
|
|
682
|
+
return deg2rad(degree + model.rotationDegrees - 90);
|
|
683
|
+
}
|
|
684
|
+
function polarToXY(center, radius, angleRad) {
|
|
685
|
+
return {
|
|
686
|
+
x: round(center.x + Math.cos(angleRad) * radius),
|
|
687
|
+
y: round(center.y + Math.sin(angleRad) * radius)
|
|
688
|
+
};
|
|
689
|
+
}
|
|
690
|
+
function scaleArcheometerReferencePoint(center, radius, x, y) {
|
|
691
|
+
const referenceCenter = 137.05;
|
|
692
|
+
const referenceRadius = 135.652;
|
|
693
|
+
const scale = radius / referenceRadius;
|
|
694
|
+
return {
|
|
695
|
+
x: round(center.x + (x - referenceCenter) * scale),
|
|
696
|
+
y: round(center.y + (y - referenceCenter) * scale)
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
function lineFromPolar(center, r1, r2, angleRad) {
|
|
700
|
+
const p1 = polarToXY(center, r1, angleRad);
|
|
701
|
+
const p2 = polarToXY(center, r2, angleRad);
|
|
702
|
+
return { x1: p1.x, y1: p1.y, x2: p2.x, y2: p2.y };
|
|
703
|
+
}
|
|
704
|
+
function lineSvg(line, color, strokeWidth, opacity = 1, className, attributes = "") {
|
|
705
|
+
const classAttr = className ? ` class="${escapeAttr(className)}"` : "";
|
|
706
|
+
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"/>`;
|
|
707
|
+
}
|
|
708
|
+
function textSvg(value, p, fontSize, color, rotation = 0, anchor = "middle", weight, className, attributes = "") {
|
|
709
|
+
const transform = rotation ? ` transform="rotate(${fmt(rotation)} ${fmt(p.x)} ${fmt(p.y)})"` : "";
|
|
710
|
+
const weightAttr = weight ? ` font-weight="${weight}"` : "";
|
|
711
|
+
const classAttr = "";
|
|
712
|
+
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>`;
|
|
713
|
+
}
|
|
714
|
+
function annulusPath(center, r1, r2) {
|
|
715
|
+
return [
|
|
716
|
+
`M ${fmt(center.x)} ${fmt(center.y - r2)}`,
|
|
717
|
+
`A ${fmt(r2)} ${fmt(r2)} 0 1 1 ${fmt(center.x)} ${fmt(center.y + r2)}`,
|
|
718
|
+
`A ${fmt(r2)} ${fmt(r2)} 0 1 1 ${fmt(center.x)} ${fmt(center.y - r2)}`,
|
|
719
|
+
`M ${fmt(center.x)} ${fmt(center.y - r1)}`,
|
|
720
|
+
`A ${fmt(r1)} ${fmt(r1)} 0 1 0 ${fmt(center.x)} ${fmt(center.y + r1)}`,
|
|
721
|
+
`A ${fmt(r1)} ${fmt(r1)} 0 1 0 ${fmt(center.x)} ${fmt(center.y - r1)}`,
|
|
722
|
+
`Z`
|
|
723
|
+
].join(" ");
|
|
724
|
+
}
|
|
725
|
+
function annularSectorPath(center, r1, r2, startAngle, endAngle, spanDegrees) {
|
|
726
|
+
const outerStart = polarToXY(center, r2, startAngle);
|
|
727
|
+
const outerEnd = polarToXY(center, r2, endAngle);
|
|
728
|
+
const innerEnd = polarToXY(center, r1, endAngle);
|
|
729
|
+
const innerStart = polarToXY(center, r1, startAngle);
|
|
730
|
+
const largeArc = Math.abs(spanDegrees) > 180 ? 1 : 0;
|
|
731
|
+
const sweep = 1 ;
|
|
732
|
+
const inverseSweep = 0 ;
|
|
733
|
+
return [
|
|
734
|
+
`M ${fmt(outerStart.x)} ${fmt(outerStart.y)}`,
|
|
735
|
+
`A ${fmt(r2)} ${fmt(r2)} 0 ${largeArc} ${sweep} ${fmt(outerEnd.x)} ${fmt(outerEnd.y)}`,
|
|
736
|
+
`L ${fmt(innerEnd.x)} ${fmt(innerEnd.y)}`,
|
|
737
|
+
`A ${fmt(r1)} ${fmt(r1)} 0 ${largeArc} ${inverseSweep} ${fmt(innerStart.x)} ${fmt(innerStart.y)}`,
|
|
738
|
+
`Z`
|
|
739
|
+
].join(" ");
|
|
740
|
+
}
|
|
741
|
+
function arcSegmentPath(center, radius, startAngle, endAngle) {
|
|
742
|
+
const start = polarToXY(center, radius, startAngle);
|
|
743
|
+
const end = polarToXY(center, radius, endAngle);
|
|
744
|
+
return `M ${fmt(start.x)} ${fmt(start.y)} A ${fmt(radius)} ${fmt(radius)} 0 0 1 ${fmt(end.x)} ${fmt(end.y)}`;
|
|
745
|
+
}
|
|
746
|
+
function polygonPath(points) {
|
|
747
|
+
if (points.length === 0) return "";
|
|
748
|
+
const [first, ...rest] = points;
|
|
749
|
+
return [`M ${fmt(first.x)} ${fmt(first.y)}`, ...rest.map((p) => `L ${fmt(p.x)} ${fmt(p.y)}`), "Z"].join(" ");
|
|
750
|
+
}
|
|
751
|
+
function midpoint(a, b) {
|
|
752
|
+
return { x: round((a.x + b.x) / 2), y: round((a.y + b.y) / 2) };
|
|
753
|
+
}
|
|
754
|
+
function polygonCentroid(points) {
|
|
755
|
+
const total = points.reduce(
|
|
756
|
+
(sum, point) => ({ x: sum.x + point.x, y: sum.y + point.y }),
|
|
757
|
+
{ x: 0, y: 0 }
|
|
758
|
+
);
|
|
759
|
+
return { x: round(total.x / points.length), y: round(total.y / points.length) };
|
|
760
|
+
}
|
|
761
|
+
function sortedByDegree(items) {
|
|
762
|
+
return [...items].sort((a, b) => normalizeDegrees(a.degree) - normalizeDegrees(b.degree));
|
|
763
|
+
}
|
|
764
|
+
function nearestUtterance(degree, utterance) {
|
|
765
|
+
let best;
|
|
766
|
+
let bestDelta = Number.POSITIVE_INFINITY;
|
|
767
|
+
for (const point of utterance) {
|
|
768
|
+
const delta = Math.abs(shortestAngularDistance(degree, point.degree));
|
|
769
|
+
if (delta < bestDelta) {
|
|
770
|
+
best = point;
|
|
771
|
+
bestDelta = delta;
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
return best;
|
|
775
|
+
}
|
|
776
|
+
function triangleVertexFillForDegree(model, degree) {
|
|
777
|
+
for (const triangle of model.triangles) {
|
|
778
|
+
if (!triangle.vertexFills) continue;
|
|
779
|
+
for (const [index, vertexDegree] of triangle.vertices.entries()) {
|
|
780
|
+
if (Math.abs(shortestAngularDistance(degree, vertexDegree)) < 1e-3) {
|
|
781
|
+
return triangle.vertexFills[index];
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
return void 0;
|
|
786
|
+
}
|
|
787
|
+
function tangentRotation(angleRad) {
|
|
788
|
+
let degrees = rad2deg(angleRad) + 90;
|
|
789
|
+
degrees = (degrees % 360 + 360) % 360;
|
|
790
|
+
if (degrees > 90 && degrees < 270) degrees += 180;
|
|
791
|
+
return (degrees % 360 + 360) % 360;
|
|
792
|
+
}
|
|
793
|
+
function shortestAngularDistance(a, b) {
|
|
794
|
+
return (normalizeDegrees(a) - normalizeDegrees(b) + 540) % 360 - 180;
|
|
795
|
+
}
|
|
796
|
+
function normalizeDegrees(value) {
|
|
797
|
+
return (value % 360 + 360) % 360;
|
|
798
|
+
}
|
|
799
|
+
function deg2rad(degrees) {
|
|
800
|
+
return degrees * (TAU / 360);
|
|
801
|
+
}
|
|
802
|
+
function rad2deg(radians) {
|
|
803
|
+
return radians * (360 / TAU);
|
|
804
|
+
}
|
|
805
|
+
function round(value) {
|
|
806
|
+
return Math.round(value * 1e3) / 1e3;
|
|
807
|
+
}
|
|
808
|
+
function fmt(value) {
|
|
809
|
+
if (!Number.isFinite(value)) return "0";
|
|
810
|
+
return Number.isInteger(value) ? String(value) : value.toFixed(3).replace(/0+$/, "").replace(/\.$/, "");
|
|
811
|
+
}
|
|
812
|
+
function escapeAttr(value) {
|
|
813
|
+
return escapeText(value).replace(/"/g, """);
|
|
814
|
+
}
|
|
815
|
+
function escapeText(value) {
|
|
816
|
+
return String(value).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
817
|
+
}
|
|
818
|
+
function textFontFamily() {
|
|
819
|
+
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";
|
|
820
|
+
}
|
|
821
|
+
|
|
5
822
|
// src/visual/astro-glyph-assets.ts
|
|
6
823
|
var rawGlyph = (markup) => [
|
|
7
824
|
{ kind: "raw", markup }
|
|
@@ -250,8 +1067,15 @@ function titleCaseGlyphKey(value) {
|
|
|
250
1067
|
}
|
|
251
1068
|
|
|
252
1069
|
// src/visual/astro-wheel.ts
|
|
253
|
-
var
|
|
1070
|
+
var TAU2 = Math.PI * 2;
|
|
254
1071
|
var GLYPH_OUTLINE_FILTER_ID = "astro-wheel-glyph-outline";
|
|
1072
|
+
var DEFAULT_ASTRO_WHEEL_RING_FRACTIONS = {
|
|
1073
|
+
houses: 7,
|
|
1074
|
+
zodiac: 13,
|
|
1075
|
+
planets: 27,
|
|
1076
|
+
aspects: 53
|
|
1077
|
+
};
|
|
1078
|
+
var DEFAULT_POINT_DISPLACEMENT_DEGREES = 20;
|
|
255
1079
|
var ASTRO_WHEEL_DEFAULT_VIEWBOX = {
|
|
256
1080
|
minX: 0,
|
|
257
1081
|
minY: 0,
|
|
@@ -394,10 +1218,10 @@ function generateGlyphSvg(primitives, options = {}) {
|
|
|
394
1218
|
const push = (s) => lines.push(s);
|
|
395
1219
|
push(`<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">`);
|
|
396
1220
|
if (bg !== "transparent") {
|
|
397
|
-
push(`<rect width="${size}" height="${size}" fill="${
|
|
1221
|
+
push(`<rect width="${size}" height="${size}" fill="${escapeAttr2(bg)}"/>`);
|
|
398
1222
|
}
|
|
399
1223
|
const glyphFill = bg === "transparent" ? "#fff" : bg;
|
|
400
|
-
push(`<g transform="translate(${cx} ${cy}) scale(${
|
|
1224
|
+
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
1225
|
renderGlyphPrimitives(push, primitives, { color, glyphFill });
|
|
402
1226
|
push(`</g>`);
|
|
403
1227
|
push(`</svg>`);
|
|
@@ -409,39 +1233,41 @@ function generateAstroGlyphSvg(keyOrGlyph, options = {}) {
|
|
|
409
1233
|
throw new Error(`Unknown astrology glyph: ${String(keyOrGlyph)}`);
|
|
410
1234
|
}
|
|
411
1235
|
const svg = generateGlyphSvg(glyph.primitives, options);
|
|
412
|
-
return svg.replace("<svg ", `<svg data-astro-glyph="${
|
|
1236
|
+
return svg.replace("<svg ", `<svg data-astro-glyph="${escapeAttr2(glyph.key)}" data-astro-glyph-category="${glyph.category}" `);
|
|
413
1237
|
}
|
|
414
1238
|
function getAstroWheelRenderModel(chart, options = {}) {
|
|
415
|
-
const viewBox =
|
|
416
|
-
const palette =
|
|
1239
|
+
const viewBox = normalizeViewBox2(options.viewBox);
|
|
1240
|
+
const palette = resolvePalette2(options.palette, options.background ?? "transparent");
|
|
417
1241
|
const excludedBodies = resolveExcludedBodies(options.excludeBodies);
|
|
418
1242
|
const scale = Math.min(
|
|
419
1243
|
viewBox.width / ASTRO_WHEEL_DEFAULT_VIEWBOX.width,
|
|
420
1244
|
viewBox.height / ASTRO_WHEEL_DEFAULT_VIEWBOX.height
|
|
421
1245
|
);
|
|
422
|
-
const padding = options.padding ??
|
|
1246
|
+
const padding = options.padding ?? round2(18 * scale + getExternalPointPadding(options, scale));
|
|
423
1247
|
const center = {
|
|
424
|
-
x:
|
|
425
|
-
y:
|
|
1248
|
+
x: round2(viewBox.minX + viewBox.width / 2),
|
|
1249
|
+
y: round2(viewBox.minY + viewBox.height / 2)
|
|
426
1250
|
};
|
|
427
|
-
const outerRadius =
|
|
428
|
-
const
|
|
429
|
-
const rings =
|
|
1251
|
+
const outerRadius = round2(Math.max(0, Math.min(viewBox.width, viewBox.height) / 2 - padding));
|
|
1252
|
+
const angleOf2 = (longitude) => deg2rad2(clamp360(180 + chart.houses.ascendant.longitude - longitude));
|
|
1253
|
+
const rings = buildRings2(outerRadius, options.layout?.rings);
|
|
1254
|
+
const pointConnectorMode = options.layout?.pointConnectors ?? "auto";
|
|
1255
|
+
const maxPointDisplacementDegrees = options.layout?.maxPointDisplacementDegrees ?? DEFAULT_POINT_DISPLACEMENT_DEGREES;
|
|
430
1256
|
const resolvedPoints = resolvePointOptions(options.points);
|
|
431
1257
|
const resolvedHouses = resolveHouseOptions(options.houses);
|
|
432
1258
|
const resolvedAspects = resolveAspectOptions(options.aspects);
|
|
433
|
-
const zodiacSegments = buildZodiacSegments({ center, angleOf, rings, scale, palette });
|
|
1259
|
+
const zodiacSegments = buildZodiacSegments({ center, angleOf: angleOf2, rings, scale, palette });
|
|
434
1260
|
const houseCusps = resolvedHouses.cuspLines || resolvedHouses.labels ? buildHouseCusps({
|
|
435
1261
|
houses: chart.houses.houses,
|
|
436
1262
|
center,
|
|
437
|
-
angleOf,
|
|
1263
|
+
angleOf: angleOf2,
|
|
438
1264
|
rings,
|
|
439
1265
|
scale
|
|
440
1266
|
}) : [];
|
|
441
1267
|
const angleMarkers = resolvedHouses.angles ? buildAngleMarkers({
|
|
442
1268
|
chart,
|
|
443
1269
|
center,
|
|
444
|
-
angleOf,
|
|
1270
|
+
angleOf: angleOf2,
|
|
445
1271
|
rings,
|
|
446
1272
|
scale
|
|
447
1273
|
}) : [];
|
|
@@ -458,21 +1284,25 @@ function getAstroWheelRenderModel(chart, options = {}) {
|
|
|
458
1284
|
collisionThresholdDegrees: resolvedPoints.collisionThresholdDegrees
|
|
459
1285
|
},
|
|
460
1286
|
center,
|
|
461
|
-
angleOf,
|
|
1287
|
+
angleOf: angleOf2,
|
|
462
1288
|
rings,
|
|
463
1289
|
scale,
|
|
464
1290
|
palette,
|
|
465
|
-
excludedBodies
|
|
1291
|
+
excludedBodies,
|
|
1292
|
+
pointConnectorMode,
|
|
1293
|
+
maxDisplacementDegrees: maxPointDisplacementDegrees
|
|
466
1294
|
});
|
|
467
1295
|
const extraPointLayers = (options.pointLayers ?? []).map(
|
|
468
1296
|
(layer) => buildPointLayer({
|
|
469
1297
|
layer,
|
|
470
1298
|
center,
|
|
471
|
-
angleOf,
|
|
1299
|
+
angleOf: angleOf2,
|
|
472
1300
|
rings,
|
|
473
1301
|
scale,
|
|
474
1302
|
palette,
|
|
475
|
-
excludedBodies
|
|
1303
|
+
excludedBodies,
|
|
1304
|
+
pointConnectorMode,
|
|
1305
|
+
maxDisplacementDegrees: maxPointDisplacementDegrees
|
|
476
1306
|
})
|
|
477
1307
|
);
|
|
478
1308
|
const pointLayers = [
|
|
@@ -492,7 +1322,7 @@ function getAstroWheelRenderModel(chart, options = {}) {
|
|
|
492
1322
|
chart,
|
|
493
1323
|
pointByKey,
|
|
494
1324
|
center,
|
|
495
|
-
angleOf,
|
|
1325
|
+
angleOf: angleOf2,
|
|
496
1326
|
rings,
|
|
497
1327
|
palette,
|
|
498
1328
|
excludedBodies
|
|
@@ -503,7 +1333,7 @@ function getAstroWheelRenderModel(chart, options = {}) {
|
|
|
503
1333
|
chart: layer.chart ?? chart,
|
|
504
1334
|
pointByKey,
|
|
505
1335
|
center,
|
|
506
|
-
angleOf,
|
|
1336
|
+
angleOf: angleOf2,
|
|
507
1337
|
rings,
|
|
508
1338
|
palette,
|
|
509
1339
|
excludedBodies
|
|
@@ -542,19 +1372,19 @@ function generateAstroWheelSvg(chart, options = {}) {
|
|
|
542
1372
|
const push = (line) => lines.push(line);
|
|
543
1373
|
const svgAttributes = [
|
|
544
1374
|
`xmlns="http://www.w3.org/2000/svg"`,
|
|
545
|
-
options.width !== void 0 ? `width="${
|
|
546
|
-
options.height !== void 0 ? `height="${
|
|
547
|
-
`viewBox="${
|
|
1375
|
+
options.width !== void 0 ? `width="${escapeAttr2(String(options.width))}"` : "",
|
|
1376
|
+
options.height !== void 0 ? `height="${escapeAttr2(String(options.height))}"` : "",
|
|
1377
|
+
`viewBox="${fmt2(viewBox.minX)} ${fmt2(viewBox.minY)} ${fmt2(viewBox.width)} ${fmt2(viewBox.height)}"`,
|
|
548
1378
|
`preserveAspectRatio="xMidYMid meet"`,
|
|
549
1379
|
`role="img"`,
|
|
550
|
-
`aria-label="${
|
|
1380
|
+
`aria-label="${escapeAttr2(options.title ?? "Astrological birth chart wheel")}"`
|
|
551
1381
|
].filter(Boolean);
|
|
552
1382
|
push(`<svg ${svgAttributes.join(" ")}>`);
|
|
553
|
-
push(`<title>${
|
|
1383
|
+
push(`<title>${escapeText2(options.title ?? "Astrological birth chart wheel")}</title>`);
|
|
554
1384
|
renderSvgDefs(push, model);
|
|
555
1385
|
if (background !== "transparent") {
|
|
556
1386
|
push(
|
|
557
|
-
`<rect x="${
|
|
1387
|
+
`<rect x="${fmt2(viewBox.minX)}" y="${fmt2(viewBox.minY)}" width="${fmt2(viewBox.width)}" height="${fmt2(viewBox.height)}" fill="${escapeAttr2(background)}"/>`
|
|
558
1388
|
);
|
|
559
1389
|
}
|
|
560
1390
|
renderAspects(push, model);
|
|
@@ -571,10 +1401,10 @@ function renderSvgDefs(push, model) {
|
|
|
571
1401
|
`<filter id="${GLYPH_OUTLINE_FILTER_ID}" x="-45%" y="-45%" width="190%" height="190%">`
|
|
572
1402
|
);
|
|
573
1403
|
push(
|
|
574
|
-
`<feMorphology in="SourceAlpha" operator="dilate" radius="${
|
|
1404
|
+
`<feMorphology in="SourceAlpha" operator="dilate" radius="${fmt2(1.75 * model.scale)}" result="dilated"/>`
|
|
575
1405
|
);
|
|
576
1406
|
push(
|
|
577
|
-
`<feFlood flood-color="${
|
|
1407
|
+
`<feFlood flood-color="${escapeAttr2(model.palette.glyphHalo)}" result="haloColor"/>`
|
|
578
1408
|
);
|
|
579
1409
|
push(
|
|
580
1410
|
`<feComposite in="haloColor" in2="dilated" operator="in" result="outline"/>`
|
|
@@ -594,22 +1424,22 @@ function renderAspects(push, model) {
|
|
|
594
1424
|
const innerGuideRadius = guideRadius * 0.52;
|
|
595
1425
|
push(`<g id="astro-wheel-aspects" aria-label="aspects">`);
|
|
596
1426
|
push(
|
|
597
|
-
`<circle cx="${
|
|
1427
|
+
`<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
1428
|
);
|
|
599
1429
|
push(
|
|
600
|
-
`<circle cx="${
|
|
1430
|
+
`<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
1431
|
);
|
|
602
1432
|
for (const layer of model.aspectLayers) {
|
|
603
|
-
push(`<g class="astro-wheel-aspect-layer" data-aspect-layer="${
|
|
1433
|
+
push(`<g class="astro-wheel-aspect-layer" data-aspect-layer="${escapeAttr2(layer.id)}"${layer.label ? ` aria-label="${escapeAttr2(layer.label)}"` : ""}>`);
|
|
604
1434
|
for (const aspect of layer.aspectLines) {
|
|
605
1435
|
push(
|
|
606
|
-
`<line data-aspect-layer="${
|
|
1436
|
+
`<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
1437
|
);
|
|
608
1438
|
}
|
|
609
1439
|
push(`</g>`);
|
|
610
1440
|
}
|
|
611
1441
|
push(
|
|
612
|
-
`<circle cx="${
|
|
1442
|
+
`<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
1443
|
);
|
|
614
1444
|
push(`</g>`);
|
|
615
1445
|
}
|
|
@@ -620,12 +1450,12 @@ function renderZodiac(push, model, options) {
|
|
|
620
1450
|
const tickEvery = 1;
|
|
621
1451
|
const { center, rings, palette, scale } = model;
|
|
622
1452
|
const thickness = rings.zodiac.r2 - rings.zodiac.r1;
|
|
623
|
-
const
|
|
1453
|
+
const angleOf2 = (longitude) => deg2rad2(clamp360(180 + model.ascendantLongitude - longitude));
|
|
624
1454
|
push(`<g id="astro-wheel-zodiac" aria-label="zodiac">`);
|
|
625
1455
|
if (options.segments) {
|
|
626
1456
|
for (const segment of model.zodiacSegments) {
|
|
627
1457
|
push(
|
|
628
|
-
`<path data-zodiac-sign="${
|
|
1458
|
+
`<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
1459
|
);
|
|
630
1460
|
}
|
|
631
1461
|
}
|
|
@@ -638,17 +1468,17 @@ function renderZodiac(push, model, options) {
|
|
|
638
1468
|
for (let index = 0; index < 360 / tickEvery; index++) {
|
|
639
1469
|
const longitude = index * tickEvery;
|
|
640
1470
|
const signDegree = longitude % 30;
|
|
641
|
-
const angle =
|
|
1471
|
+
const angle = angleOf2(longitude);
|
|
642
1472
|
const isSignBoundary = signDegree === 0;
|
|
643
1473
|
const isTen = signDegree % 10 === 0;
|
|
644
1474
|
const isFive = signDegree % 5 === 0;
|
|
645
1475
|
const length = isSignBoundary ? thickness * 0.58 : isTen ? thickness * 0.42 : isFive ? thickness * 0.29 : thickness * 0.18;
|
|
646
1476
|
const strokeWidth = isSignBoundary ? 2.2 * scale : isTen ? 1.55 * scale : isFive ? 1.1 * scale : 0.75 * scale;
|
|
647
1477
|
const opacity = isSignBoundary ? 0.95 : isFive ? 0.82 : 0.62;
|
|
648
|
-
const inner =
|
|
649
|
-
const outer =
|
|
1478
|
+
const inner = polarToXY2(center.x, center.y, rings.zodiac.r2 - length, angle);
|
|
1479
|
+
const outer = polarToXY2(center.x, center.y, rings.zodiac.r2, angle);
|
|
650
1480
|
push(
|
|
651
|
-
`<line data-zodiac-tick="${longitude}" x1="${
|
|
1481
|
+
`<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
1482
|
);
|
|
653
1483
|
}
|
|
654
1484
|
}
|
|
@@ -659,9 +1489,9 @@ function renderZodiacGlyph(push, segment, palette) {
|
|
|
659
1489
|
const glyphScale = segment.labelFontSize * 0.72;
|
|
660
1490
|
const strokeWidth = clamp(0.11 / Math.max(glyphScale / 10, 0.6), 0.08, 0.16);
|
|
661
1491
|
push(
|
|
662
|
-
`<g class="astro-wheel-glyph" data-astro-glyph="${
|
|
1492
|
+
`<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
1493
|
);
|
|
664
|
-
push(`<title>${
|
|
1494
|
+
push(`<title>${escapeText2(`${segment.sign} ${segment.glyph}`)}</title>`);
|
|
665
1495
|
renderGlyphPrimitives(push, glyph.primitives, { color: palette.zodiacGlyph });
|
|
666
1496
|
push(`</g>`);
|
|
667
1497
|
}
|
|
@@ -674,14 +1504,14 @@ function renderHouses(push, model, options) {
|
|
|
674
1504
|
for (const cusp of model.houseCusps) {
|
|
675
1505
|
const isAngleHouse = cusp.house === 1 || cusp.house === 4 || cusp.house === 7 || cusp.house === 10;
|
|
676
1506
|
push(
|
|
677
|
-
`<line data-house-cusp="${cusp.house}" x1="${
|
|
1507
|
+
`<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
1508
|
);
|
|
679
1509
|
}
|
|
680
1510
|
}
|
|
681
1511
|
if (options.labels) {
|
|
682
1512
|
for (const cusp of model.houseCusps) {
|
|
683
1513
|
push(
|
|
684
|
-
`<text data-house-label="${cusp.house}" x="${
|
|
1514
|
+
`<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
1515
|
);
|
|
686
1516
|
}
|
|
687
1517
|
}
|
|
@@ -689,7 +1519,7 @@ function renderHouses(push, model, options) {
|
|
|
689
1519
|
for (const marker of model.angleMarkers) {
|
|
690
1520
|
push(`<g data-angle-marker="${marker.key}">`);
|
|
691
1521
|
push(
|
|
692
|
-
`<line x1="${
|
|
1522
|
+
`<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
1523
|
);
|
|
694
1524
|
push(`</g>`);
|
|
695
1525
|
}
|
|
@@ -705,18 +1535,22 @@ function renderPlanets(push, model) {
|
|
|
705
1535
|
renderPointLayerGuide(push, layer, model);
|
|
706
1536
|
}
|
|
707
1537
|
for (const layer of model.pointLayers) {
|
|
708
|
-
push(`<g class="astro-wheel-point-layer" data-point-layer="${
|
|
1538
|
+
push(`<g class="astro-wheel-point-layer" data-point-layer="${escapeAttr2(layer.id)}"${layer.label ? ` aria-label="${escapeAttr2(layer.label)}"` : ""}>`);
|
|
709
1539
|
for (const point of layer.points) {
|
|
710
1540
|
push(
|
|
711
|
-
`<g class="astro-wheel-point" data-point-layer="${
|
|
1541
|
+
`<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
1542
|
);
|
|
713
|
-
push(`<title>${
|
|
1543
|
+
push(`<title>${escapeText2(point.name)} ${fmt2(point.longitude)}\xB0</title>`);
|
|
714
1544
|
push(
|
|
715
|
-
`<line x1="${
|
|
1545
|
+
`<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
1546
|
);
|
|
717
|
-
if (point.
|
|
1547
|
+
if (point.leaderArc) {
|
|
1548
|
+
push(
|
|
1549
|
+
`<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"/>`
|
|
1550
|
+
);
|
|
1551
|
+
} else if (point.leaderLine) {
|
|
718
1552
|
push(
|
|
719
|
-
`<line class="astro-wheel-point-leader" x1="${
|
|
1553
|
+
`<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
1554
|
);
|
|
721
1555
|
}
|
|
722
1556
|
push(`</g>`);
|
|
@@ -731,7 +1565,7 @@ function renderPointLayerGuide(push, layer, model) {
|
|
|
731
1565
|
return;
|
|
732
1566
|
}
|
|
733
1567
|
push(
|
|
734
|
-
`<circle class="astro-wheel-external-point-ring" data-point-layer="${
|
|
1568
|
+
`<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
1569
|
);
|
|
736
1570
|
}
|
|
737
1571
|
function renderGlyphOverlay(push, model) {
|
|
@@ -749,7 +1583,7 @@ function renderGlyphOverlay(push, model) {
|
|
|
749
1583
|
if (model.pointLayers.length > 0) {
|
|
750
1584
|
push(`<g id="astro-wheel-point-glyphs" aria-label="planet glyphs">`);
|
|
751
1585
|
for (const layer of model.pointLayers) {
|
|
752
|
-
push(`<g class="astro-wheel-point-glyph-layer" data-point-layer="${
|
|
1586
|
+
push(`<g class="astro-wheel-point-glyph-layer" data-point-layer="${escapeAttr2(layer.id)}"${layer.label ? ` aria-label="${escapeAttr2(layer.label)} glyphs"` : ""}>`);
|
|
753
1587
|
for (const point of layer.points) {
|
|
754
1588
|
renderPointLabelGroup(push, point, model);
|
|
755
1589
|
}
|
|
@@ -776,14 +1610,14 @@ function renderAngleGlyph(push, marker, model) {
|
|
|
776
1610
|
const signX = degreeX + degreeWidth + gap + signScale / 2;
|
|
777
1611
|
const minutesX = signX + signScale / 2 + gap;
|
|
778
1612
|
push(
|
|
779
|
-
`<g class="astro-wheel-angle-glyph-label" data-angle-marker="${marker.key}" data-longitude="${
|
|
1613
|
+
`<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
1614
|
);
|
|
781
|
-
push(`<title>${
|
|
1615
|
+
push(`<title>${escapeText2(`${label} ${position.degreesText} ${position.sign} ${position.minutesText}`)}</title>`);
|
|
782
1616
|
push(
|
|
783
|
-
`<text class="astro-wheel-angle-label" x="${
|
|
1617
|
+
`<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
1618
|
);
|
|
785
1619
|
push(
|
|
786
|
-
`<text class="astro-wheel-angle-degree" x="${
|
|
1620
|
+
`<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
1621
|
);
|
|
788
1622
|
renderInlineSignGlyph(
|
|
789
1623
|
push,
|
|
@@ -794,7 +1628,7 @@ function renderAngleGlyph(push, marker, model) {
|
|
|
794
1628
|
model.palette.angleLabel
|
|
795
1629
|
);
|
|
796
1630
|
push(
|
|
797
|
-
`<text class="astro-wheel-angle-minutes" x="${
|
|
1631
|
+
`<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
1632
|
);
|
|
799
1633
|
push(`</g>`);
|
|
800
1634
|
}
|
|
@@ -805,11 +1639,11 @@ function angleDisplayLabel(key) {
|
|
|
805
1639
|
}
|
|
806
1640
|
function renderPointLabelGroup(push, point, model) {
|
|
807
1641
|
const layout = getPointLabelLayout(point, model.scale);
|
|
808
|
-
const boundsAttr = point.labelBounds ? ` data-label-bounds="${
|
|
1642
|
+
const boundsAttr = point.labelBounds ? ` data-label-bounds="${escapeAttr2(formatLabelBounds(point.labelBounds))}"` : "";
|
|
809
1643
|
push(
|
|
810
|
-
`<g class="astro-wheel-point-label" data-point-layer="${
|
|
1644
|
+
`<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
1645
|
);
|
|
812
|
-
push(`<title>${
|
|
1646
|
+
push(`<title>${escapeText2(pointLabelTitle(point))}</title>`);
|
|
813
1647
|
renderPointGlyph(push, point, layout.glyphX, layout.glyphY, layout.glyphScale, model.palette.glyphHalo);
|
|
814
1648
|
if (point.retrograde) {
|
|
815
1649
|
renderRetrogradeMarker(
|
|
@@ -828,13 +1662,13 @@ function renderPointGlyph(push, point, x, y, glyphScale, glyphFill) {
|
|
|
828
1662
|
if (glyph) {
|
|
829
1663
|
const strokeWidth = clamp(0.12 / Math.max(glyphScale / 10, 0.6), 0.1, 0.18);
|
|
830
1664
|
push(
|
|
831
|
-
`<g class="astro-wheel-glyph" data-astro-glyph="${
|
|
1665
|
+
`<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
1666
|
);
|
|
833
1667
|
renderGlyphPrimitives(push, glyph.primitives, { color: point.color, glyphFill });
|
|
834
1668
|
push(`</g>`);
|
|
835
1669
|
} else {
|
|
836
1670
|
push(
|
|
837
|
-
`<text class="astro-wheel-glyph" data-point-glyph="${
|
|
1671
|
+
`<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
1672
|
);
|
|
839
1673
|
}
|
|
840
1674
|
}
|
|
@@ -844,14 +1678,14 @@ function renderRetrogradeMarker(push, x, y, fontSize, color) {
|
|
|
844
1678
|
const glyphScale = fontSize * 0.62;
|
|
845
1679
|
const strokeWidth = clamp(0.12 / Math.max(glyphScale / 10, 0.6), 0.1, 0.18);
|
|
846
1680
|
push(
|
|
847
|
-
`<g class="astro-wheel-point-retrograde" data-astro-glyph="${
|
|
1681
|
+
`<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
1682
|
);
|
|
849
1683
|
renderGlyphPrimitives(push, glyph.primitives, { color });
|
|
850
1684
|
push(`</g>`);
|
|
851
1685
|
return;
|
|
852
1686
|
}
|
|
853
1687
|
push(
|
|
854
|
-
`<text class="astro-wheel-point-retrograde" x="${
|
|
1688
|
+
`<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
1689
|
);
|
|
856
1690
|
}
|
|
857
1691
|
function renderPointInlineDegreeLabel(push, point, layout) {
|
|
@@ -859,11 +1693,11 @@ function renderPointInlineDegreeLabel(push, point, layout) {
|
|
|
859
1693
|
return;
|
|
860
1694
|
}
|
|
861
1695
|
push(
|
|
862
|
-
`<text class="astro-wheel-point-degree" x="${
|
|
1696
|
+
`<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
1697
|
);
|
|
864
1698
|
renderInlineSignGlyph(push, layout.position.sign, layout.signX, layout.signY, layout.signScale, point.color);
|
|
865
1699
|
push(
|
|
866
|
-
`<text class="astro-wheel-point-minutes" x="${
|
|
1700
|
+
`<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
1701
|
);
|
|
868
1702
|
}
|
|
869
1703
|
function renderInlineSignGlyph(push, sign, x, y, glyphScale, color) {
|
|
@@ -871,14 +1705,14 @@ function renderInlineSignGlyph(push, sign, x, y, glyphScale, color) {
|
|
|
871
1705
|
if (glyph) {
|
|
872
1706
|
const strokeWidth = clamp(0.11 / Math.max(glyphScale / 10, 0.6), 0.08, 0.16);
|
|
873
1707
|
push(
|
|
874
|
-
`<g class="astro-wheel-point-sign-glyph" data-astro-glyph="${
|
|
1708
|
+
`<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
1709
|
);
|
|
876
1710
|
renderGlyphPrimitives(push, glyph.primitives, { color });
|
|
877
1711
|
push(`</g>`);
|
|
878
1712
|
return;
|
|
879
1713
|
}
|
|
880
1714
|
push(
|
|
881
|
-
`<text class="astro-wheel-point-sign-glyph" x="${
|
|
1715
|
+
`<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
1716
|
);
|
|
883
1717
|
}
|
|
884
1718
|
function getPointLabelLayout(point, scale) {
|
|
@@ -980,7 +1814,7 @@ function formatInlinePosition(position) {
|
|
|
980
1814
|
function pointLabelTitle(point) {
|
|
981
1815
|
const position = point.zodiacPosition ? formatInlinePosition(point.zodiacPosition) : null;
|
|
982
1816
|
if (!position) {
|
|
983
|
-
return `${point.name} ${
|
|
1817
|
+
return `${point.name} ${fmt2(point.longitude)}\xB0`;
|
|
984
1818
|
}
|
|
985
1819
|
const retrograde = point.retrograde ? " Rx" : "";
|
|
986
1820
|
return `${point.name} ${position.degreesText} ${position.sign} ${position.minutesText}${retrograde}`;
|
|
@@ -992,10 +1826,10 @@ function labelBoundsFor(position, layout, padding) {
|
|
|
992
1826
|
const width = layout.width + padding * 2;
|
|
993
1827
|
const height = layout.height + padding * 2;
|
|
994
1828
|
return {
|
|
995
|
-
x:
|
|
996
|
-
y:
|
|
997
|
-
width:
|
|
998
|
-
height:
|
|
1829
|
+
x: round2(position.x + layout.boundsX - padding),
|
|
1830
|
+
y: round2(position.y + layout.boundsY - padding),
|
|
1831
|
+
width: round2(width),
|
|
1832
|
+
height: round2(height)
|
|
999
1833
|
};
|
|
1000
1834
|
}
|
|
1001
1835
|
function constrainLabelInsideCircle(params) {
|
|
@@ -1019,8 +1853,8 @@ function constrainLabelInsideCircle(params) {
|
|
|
1019
1853
|
const dy = position.y - center.y;
|
|
1020
1854
|
const distance = Math.max(Math.hypot(dx, dy), 1);
|
|
1021
1855
|
position = {
|
|
1022
|
-
x:
|
|
1023
|
-
y:
|
|
1856
|
+
x: round2(position.x - dx / distance * (overflow + 0.75)),
|
|
1857
|
+
y: round2(position.y - dy / distance * (overflow + 0.75))
|
|
1024
1858
|
};
|
|
1025
1859
|
moved = true;
|
|
1026
1860
|
}
|
|
@@ -1044,14 +1878,13 @@ function labelBoundsCircleOverflow(center, bounds, maxRadius) {
|
|
|
1044
1878
|
);
|
|
1045
1879
|
return farthestCorner - maxRadius;
|
|
1046
1880
|
}
|
|
1047
|
-
function hasLabelBoundsCollision(bounds, placed) {
|
|
1048
|
-
return placed.some((other) => labelBoundsOverlap(bounds, other));
|
|
1049
|
-
}
|
|
1050
|
-
function labelBoundsOverlap(a, b) {
|
|
1051
|
-
return !(a.x + a.width <= b.x || b.x + b.width <= a.x || a.y + a.height <= b.y || b.y + b.height <= a.y);
|
|
1052
|
-
}
|
|
1053
1881
|
function formatLabelBounds(bounds) {
|
|
1054
|
-
return `${
|
|
1882
|
+
return `${fmt2(bounds.x)} ${fmt2(bounds.y)} ${fmt2(bounds.width)} ${fmt2(bounds.height)}`;
|
|
1883
|
+
}
|
|
1884
|
+
function projectedLabelWidthAlongTangent(angleRad, bounds) {
|
|
1885
|
+
const tangentX = -Math.sin(angleRad);
|
|
1886
|
+
const tangentY = Math.cos(angleRad);
|
|
1887
|
+
return Math.abs(tangentX) * bounds.width + Math.abs(tangentY) * bounds.height;
|
|
1055
1888
|
}
|
|
1056
1889
|
var POINT_GLYPH_ALIASES = {
|
|
1057
1890
|
"mean node": "north node",
|
|
@@ -1096,11 +1929,11 @@ function getExternalPointPadding(options, scale) {
|
|
|
1096
1929
|
);
|
|
1097
1930
|
}
|
|
1098
1931
|
function buildZodiacSegments(params) {
|
|
1099
|
-
const { center, angleOf, rings, scale, palette } = params;
|
|
1932
|
+
const { center, angleOf: angleOf2, rings, scale, palette } = params;
|
|
1100
1933
|
const boundaries = unwrapAngles(
|
|
1101
1934
|
Array.from(
|
|
1102
1935
|
{ length: ASTRO_WHEEL_ZODIAC_SIGNS.length + 1 },
|
|
1103
|
-
(_, index) =>
|
|
1936
|
+
(_, index) => angleOf2(index * 30)
|
|
1104
1937
|
),
|
|
1105
1938
|
"dec"
|
|
1106
1939
|
);
|
|
@@ -1109,11 +1942,11 @@ function buildZodiacSegments(params) {
|
|
|
1109
1942
|
return ASTRO_WHEEL_ZODIAC_SIGNS.map((entry, index) => {
|
|
1110
1943
|
const angleStart = boundaries[index];
|
|
1111
1944
|
const angleEnd = boundaries[index + 1];
|
|
1112
|
-
const labelPosition =
|
|
1945
|
+
const labelPosition = polarToXY2(
|
|
1113
1946
|
center.x,
|
|
1114
1947
|
center.y,
|
|
1115
1948
|
(rings.zodiac.r1 + rings.zodiac.r2) / 2,
|
|
1116
|
-
|
|
1949
|
+
angleOf2(index * 30 + 15)
|
|
1117
1950
|
);
|
|
1118
1951
|
return {
|
|
1119
1952
|
sign: entry.sign,
|
|
@@ -1131,14 +1964,14 @@ function buildZodiacSegments(params) {
|
|
|
1131
1964
|
});
|
|
1132
1965
|
}
|
|
1133
1966
|
function buildHouseCusps(params) {
|
|
1134
|
-
const { houses, center, angleOf, rings, scale } = params;
|
|
1967
|
+
const { houses, center, angleOf: angleOf2, rings, scale } = params;
|
|
1135
1968
|
const ring = rings.houses;
|
|
1136
1969
|
const spokeInnerRadius = rings.aspects.r2;
|
|
1137
1970
|
const spokeOuterRadius = ring.r2 + 4 * scale;
|
|
1138
1971
|
const labelRadius = ring.r2 + 12 * scale;
|
|
1139
1972
|
const labelFontSize = clamp((ring.r2 - ring.r1) * 0.48, 10 * scale, 19 * scale);
|
|
1140
1973
|
return houses.map((house, index) => {
|
|
1141
|
-
const angle =
|
|
1974
|
+
const angle = angleOf2(house.longitude);
|
|
1142
1975
|
const next = houses[(index + 1) % houses.length];
|
|
1143
1976
|
const span = clamp360(next.longitude - house.longitude);
|
|
1144
1977
|
const labelLongitude = clamp360(house.longitude + span / 2);
|
|
@@ -1146,16 +1979,20 @@ function buildHouseCusps(params) {
|
|
|
1146
1979
|
house: index + 1,
|
|
1147
1980
|
longitude: normalizeAngle(house.longitude),
|
|
1148
1981
|
sign: house.sign,
|
|
1149
|
-
line:
|
|
1150
|
-
labelPosition:
|
|
1982
|
+
line: lineFromPolar2(center, spokeInnerRadius, spokeOuterRadius, angle),
|
|
1983
|
+
labelPosition: polarToXY2(center.x, center.y, labelRadius, angleOf2(labelLongitude)),
|
|
1151
1984
|
labelFontSize
|
|
1152
1985
|
};
|
|
1153
1986
|
});
|
|
1154
1987
|
}
|
|
1155
1988
|
function buildAngleMarkers(params) {
|
|
1156
|
-
const { chart, center, angleOf, rings, scale } = params;
|
|
1989
|
+
const { chart, center, angleOf: angleOf2, rings, scale } = params;
|
|
1157
1990
|
const ring = rings.houses;
|
|
1158
1991
|
const labelFontSize = clamp((ring.r2 - ring.r1) * 0.32, 8 * scale, 18 * scale);
|
|
1992
|
+
const labelRadius = Math.min(
|
|
1993
|
+
ring.r2 + 9 * scale,
|
|
1994
|
+
ring.r2 - Math.max(10 * scale, labelFontSize * 0.6)
|
|
1995
|
+
);
|
|
1159
1996
|
const markers = [
|
|
1160
1997
|
{ key: "ASC", position: chart.houses.ascendant },
|
|
1161
1998
|
{ key: "MC", position: chart.houses.mc },
|
|
@@ -1163,7 +2000,7 @@ function buildAngleMarkers(params) {
|
|
|
1163
2000
|
{ key: "IC", position: chart.houses.ic }
|
|
1164
2001
|
];
|
|
1165
2002
|
return markers.map((marker) => {
|
|
1166
|
-
const angle =
|
|
2003
|
+
const angle = angleOf2(marker.position.longitude);
|
|
1167
2004
|
const angleDeg = clamp360(angle * (180 / Math.PI));
|
|
1168
2005
|
let labelRotation = angleDeg;
|
|
1169
2006
|
if (labelRotation > 90 && labelRotation < 270) {
|
|
@@ -1173,11 +2010,11 @@ function buildAngleMarkers(params) {
|
|
|
1173
2010
|
key: marker.key,
|
|
1174
2011
|
longitude: normalizeAngle(marker.position.longitude),
|
|
1175
2012
|
zodiacPosition: marker.position,
|
|
1176
|
-
line:
|
|
2013
|
+
line: lineFromPolar2(center, ring.r1 + 4 * scale, ring.r2 - 4 * scale, angle),
|
|
1177
2014
|
labelPosition: polarWithNudge(
|
|
1178
2015
|
center.x,
|
|
1179
2016
|
center.y,
|
|
1180
|
-
|
|
2017
|
+
labelRadius,
|
|
1181
2018
|
angle,
|
|
1182
2019
|
0,
|
|
1183
2020
|
0
|
|
@@ -1188,7 +2025,17 @@ function buildAngleMarkers(params) {
|
|
|
1188
2025
|
});
|
|
1189
2026
|
}
|
|
1190
2027
|
function buildPointLayer(params) {
|
|
1191
|
-
const {
|
|
2028
|
+
const {
|
|
2029
|
+
layer,
|
|
2030
|
+
center,
|
|
2031
|
+
angleOf: angleOf2,
|
|
2032
|
+
rings,
|
|
2033
|
+
scale,
|
|
2034
|
+
palette,
|
|
2035
|
+
excludedBodies,
|
|
2036
|
+
pointConnectorMode,
|
|
2037
|
+
maxDisplacementDegrees
|
|
2038
|
+
} = params;
|
|
1192
2039
|
const ring = rings.planets;
|
|
1193
2040
|
const requestedRadius = resolvePointLayerRadius(layer, rings);
|
|
1194
2041
|
const requestedExternalLayer = requestedRadius > rings.houses.r2 + scale;
|
|
@@ -1202,108 +2049,118 @@ function buildPointLayer(params) {
|
|
|
1202
2049
|
) : requestedRadius;
|
|
1203
2050
|
const isExternalLayer = radius > rings.houses.r2 + scale;
|
|
1204
2051
|
const tickLength = Math.min(14 * scale, thickness * 0.34);
|
|
1205
|
-
const glyphMinSepDeg = glyphFontSize * 0.9 / Math.max(radius, 1) * (180 / Math.PI);
|
|
1206
|
-
const collisionThresholdDegrees = clamp(
|
|
1207
|
-
layer.collisionThresholdDegrees ?? Math.max(2, Math.min(8, glyphMinSepDeg)),
|
|
1208
|
-
0,
|
|
1209
|
-
30
|
|
1210
|
-
);
|
|
1211
|
-
const tangentStep = glyphFontSize * (isExternalLayer ? 0.68 : 0.74);
|
|
1212
2052
|
const collisionPadding = Math.max(2 * scale, 1.5);
|
|
1213
2053
|
const zodiacKeepOutGap = Math.max(5 * scale, 4);
|
|
1214
2054
|
const labelMaxRadius = isExternalLayer ? Number.POSITIVE_INFINITY : rings.zodiac.r1 - zodiacKeepOutGap;
|
|
1215
2055
|
const seeds = getPointSeeds(layer, excludedBodies);
|
|
1216
|
-
const clusters = clusterPointSeeds(seeds, collisionThresholdDegrees);
|
|
1217
2056
|
const color = layer.color ?? palette.planetGlyph;
|
|
1218
2057
|
const tickColor = layer.tickColor ?? color;
|
|
1219
|
-
const
|
|
1220
|
-
|
|
1221
|
-
const
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
};
|
|
1294
|
-
};
|
|
1295
|
-
let point = makePoint();
|
|
1296
|
-
let attempts = 0;
|
|
1297
|
-
while (point.labelBounds && hasLabelBoundsCollision(point.labelBounds, placedLabelBounds) && attempts < 16) {
|
|
1298
|
-
tangentOffset += nudgeDirection * (tangentStep * 0.45 + collisionPadding);
|
|
1299
|
-
point = makePoint();
|
|
1300
|
-
attempts += 1;
|
|
1301
|
-
}
|
|
1302
|
-
if (point.labelBounds) {
|
|
1303
|
-
placedLabelBounds.push(point.labelBounds);
|
|
1304
|
-
}
|
|
1305
|
-
return point;
|
|
2058
|
+
const pointIntents = seeds.map((seed) => {
|
|
2059
|
+
const tickAngle = angleOf2(seed.longitude);
|
|
2060
|
+
const pointGlyphFontSize = seed.kind === "vertex" ? glyphFontSize * 0.82 : glyphFontSize;
|
|
2061
|
+
const rawGlyphRadius = radius;
|
|
2062
|
+
const glyphRadius = isExternalLayer ? rawGlyphRadius : clamp(
|
|
2063
|
+
rawGlyphRadius,
|
|
2064
|
+
rings.aspects.r2 + pointGlyphFontSize * 0.65,
|
|
2065
|
+
labelMaxRadius - pointGlyphFontSize * 0.5
|
|
2066
|
+
);
|
|
2067
|
+
const connectorRadius = glyphRadius;
|
|
2068
|
+
const tickLine = isExternalLayer ? lineFromPolar2(
|
|
2069
|
+
center,
|
|
2070
|
+
rings.houses.r2 + 2 * scale,
|
|
2071
|
+
connectorRadius,
|
|
2072
|
+
tickAngle
|
|
2073
|
+
) : lineFromPolar2(
|
|
2074
|
+
center,
|
|
2075
|
+
Math.min(ring.r2, connectorRadius + tickLength),
|
|
2076
|
+
connectorRadius,
|
|
2077
|
+
tickAngle
|
|
2078
|
+
);
|
|
2079
|
+
const idealPosition = polarToXY2(center.x, center.y, glyphRadius, tickAngle);
|
|
2080
|
+
const point = makeAstroWheelPoint({
|
|
2081
|
+
layer,
|
|
2082
|
+
seed,
|
|
2083
|
+
tickLine,
|
|
2084
|
+
labelAngle: tickAngle,
|
|
2085
|
+
glyphPosition: idealPosition,
|
|
2086
|
+
glyphFontSize: pointGlyphFontSize,
|
|
2087
|
+
color,
|
|
2088
|
+
tickColor
|
|
2089
|
+
});
|
|
2090
|
+
const layout = getPointLabelLayout(point, scale);
|
|
2091
|
+
const labelBounds = labelBoundsFor(idealPosition, layout, collisionPadding);
|
|
2092
|
+
const labelTangentDemandPx = projectedLabelWidthAlongTangent(tickAngle, labelBounds);
|
|
2093
|
+
const configuredTangentDemandPx = layer.collisionThresholdDegrees ? deg2rad2(clamp(layer.collisionThresholdDegrees, 0, 30)) * glyphRadius : 0;
|
|
2094
|
+
const tangentDemandPx = Math.max(labelTangentDemandPx, configuredTangentDemandPx);
|
|
2095
|
+
return {
|
|
2096
|
+
seed,
|
|
2097
|
+
tickAngle,
|
|
2098
|
+
tickLine,
|
|
2099
|
+
connectorRadius,
|
|
2100
|
+
glyphRadius,
|
|
2101
|
+
pointGlyphFontSize,
|
|
2102
|
+
tangentDemandPx
|
|
2103
|
+
};
|
|
2104
|
+
});
|
|
2105
|
+
const solvedLabels = solveCircularLabelAngles(
|
|
2106
|
+
pointIntents.map((intent) => ({
|
|
2107
|
+
item: intent,
|
|
2108
|
+
idealAngle: intent.tickAngle,
|
|
2109
|
+
radius: intent.glyphRadius,
|
|
2110
|
+
tangentDemandPx: intent.tangentDemandPx
|
|
2111
|
+
})),
|
|
2112
|
+
{
|
|
2113
|
+
paddingPx: collisionPadding,
|
|
2114
|
+
maxDisplacementRad: deg2rad2(clamp(maxDisplacementDegrees, 0, 180))
|
|
2115
|
+
}
|
|
2116
|
+
);
|
|
2117
|
+
const visualAngleByKey = Object.fromEntries(
|
|
2118
|
+
solvedLabels.map(({ item, visualAngle }) => [item.seed.key, visualAngle])
|
|
2119
|
+
);
|
|
2120
|
+
const points = pointIntents.map((intent) => {
|
|
2121
|
+
const visualAngle = visualAngleByKey[intent.seed.key] ?? intent.tickAngle;
|
|
2122
|
+
let glyphPosition = polarToXY2(center.x, center.y, intent.glyphRadius, visualAngle);
|
|
2123
|
+
let point = makeAstroWheelPoint({
|
|
2124
|
+
layer,
|
|
2125
|
+
seed: intent.seed,
|
|
2126
|
+
tickLine: intent.tickLine,
|
|
2127
|
+
labelAngle: visualAngle,
|
|
2128
|
+
glyphPosition,
|
|
2129
|
+
glyphFontSize: intent.pointGlyphFontSize,
|
|
2130
|
+
color,
|
|
2131
|
+
tickColor
|
|
1306
2132
|
});
|
|
2133
|
+
const layout = getPointLabelLayout(point, scale);
|
|
2134
|
+
const constrainedLabel = constrainLabelInsideCircle({
|
|
2135
|
+
center,
|
|
2136
|
+
position: glyphPosition,
|
|
2137
|
+
layout,
|
|
2138
|
+
padding: collisionPadding,
|
|
2139
|
+
maxRadius: labelMaxRadius
|
|
2140
|
+
});
|
|
2141
|
+
if (constrainedLabel.moved) {
|
|
2142
|
+
glyphPosition = constrainedLabel.position;
|
|
2143
|
+
point = {
|
|
2144
|
+
...point,
|
|
2145
|
+
glyphPosition,
|
|
2146
|
+
leaderLine: void 0
|
|
2147
|
+
};
|
|
2148
|
+
}
|
|
2149
|
+
point = {
|
|
2150
|
+
...point,
|
|
2151
|
+
leaderArc: buildPointConnector({
|
|
2152
|
+
center,
|
|
2153
|
+
tickAngle: intent.tickAngle,
|
|
2154
|
+
labelAngle: visualAngle,
|
|
2155
|
+
connectorRadius: intent.connectorRadius,
|
|
2156
|
+
glyphPosition,
|
|
2157
|
+
mode: pointConnectorMode
|
|
2158
|
+
})
|
|
2159
|
+
};
|
|
2160
|
+
return {
|
|
2161
|
+
...point,
|
|
2162
|
+
labelBounds: constrainedLabel.bounds
|
|
2163
|
+
};
|
|
1307
2164
|
});
|
|
1308
2165
|
return {
|
|
1309
2166
|
id: layer.id,
|
|
@@ -1314,8 +2171,40 @@ function buildPointLayer(params) {
|
|
|
1314
2171
|
points
|
|
1315
2172
|
};
|
|
1316
2173
|
}
|
|
2174
|
+
function makeAstroWheelPoint(params) {
|
|
2175
|
+
const {
|
|
2176
|
+
layer,
|
|
2177
|
+
seed,
|
|
2178
|
+
tickLine,
|
|
2179
|
+
labelAngle,
|
|
2180
|
+
glyphPosition,
|
|
2181
|
+
glyphFontSize,
|
|
2182
|
+
color,
|
|
2183
|
+
tickColor
|
|
2184
|
+
} = params;
|
|
2185
|
+
return {
|
|
2186
|
+
layerId: layer.id,
|
|
2187
|
+
key: seed.key,
|
|
2188
|
+
name: seed.name,
|
|
2189
|
+
kind: seed.kind,
|
|
2190
|
+
glyph: seed.glyph,
|
|
2191
|
+
glyphKey: seed.glyphKey,
|
|
2192
|
+
longitude: normalizeAngle(seed.longitude),
|
|
2193
|
+
displayLongitude: normalizeAngle(seed.longitude),
|
|
2194
|
+
zodiacPosition: seed.zodiacPosition,
|
|
2195
|
+
tickLine,
|
|
2196
|
+
labelAngle,
|
|
2197
|
+
leaderArc: void 0,
|
|
2198
|
+
leaderLine: void 0,
|
|
2199
|
+
glyphPosition,
|
|
2200
|
+
glyphFontSize,
|
|
2201
|
+
retrograde: seed.retrograde,
|
|
2202
|
+
color,
|
|
2203
|
+
tickColor
|
|
2204
|
+
};
|
|
2205
|
+
}
|
|
1317
2206
|
function buildAspectLayer(params) {
|
|
1318
|
-
const { layer, chart, pointByKey, center, angleOf, rings, palette, excludedBodies } = params;
|
|
2207
|
+
const { layer, chart, pointByKey, center, angleOf: angleOf2, rings, palette, excludedBodies } = params;
|
|
1319
2208
|
const sourceEdges = getSourceAspectEdges(chart, {
|
|
1320
2209
|
edges: layer.edges,
|
|
1321
2210
|
aspectSpecs: layer.aspectSpecs
|
|
@@ -1338,8 +2227,8 @@ function buildAspectLayer(params) {
|
|
|
1338
2227
|
const spec = findAspectSpec(edge.aspect, layer.aspectSpecs);
|
|
1339
2228
|
const maxOrb = spec?.orb ?? 8;
|
|
1340
2229
|
const opacity = clamp((1 - edge.orb / Math.max(maxOrb, 1e-3)) * (layer.opacityScale ?? 1), 0.25, 0.92);
|
|
1341
|
-
const a =
|
|
1342
|
-
const b =
|
|
2230
|
+
const a = polarToXY2(center.x, center.y, aspectRadius, angleOf2(planetA.longitude));
|
|
2231
|
+
const b = polarToXY2(center.x, center.y, aspectRadius, angleOf2(planetB.longitude));
|
|
1343
2232
|
return [{
|
|
1344
2233
|
layerId: layer.id,
|
|
1345
2234
|
planetA: planetA.name,
|
|
@@ -1435,37 +2324,139 @@ function pointSeed(point, layerId) {
|
|
|
1435
2324
|
zodiacPosition: point.zodiacPosition
|
|
1436
2325
|
};
|
|
1437
2326
|
}
|
|
1438
|
-
function
|
|
1439
|
-
|
|
2327
|
+
function solveCircularLabelAngles(items, options) {
|
|
2328
|
+
const { paddingPx, maxDisplacementRad } = options;
|
|
2329
|
+
if (items.length === 0) {
|
|
1440
2330
|
return [];
|
|
1441
2331
|
}
|
|
1442
|
-
const
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
2332
|
+
const normalized = items.map((item) => ({
|
|
2333
|
+
...item,
|
|
2334
|
+
idealAngle: clampRad(item.idealAngle)
|
|
2335
|
+
})).sort((a, b) => a.idealAngle - b.idealAngle);
|
|
2336
|
+
if (normalized.length === 1) {
|
|
2337
|
+
return [{ ...normalized[0], visualAngle: normalized[0].idealAngle }];
|
|
2338
|
+
}
|
|
2339
|
+
let largestGap = -Infinity;
|
|
2340
|
+
let seamIndex = 0;
|
|
2341
|
+
for (let i = 0; i < normalized.length; i++) {
|
|
2342
|
+
const current = normalized[i];
|
|
2343
|
+
const next = normalized[(i + 1) % normalized.length];
|
|
2344
|
+
const nextAngle = i === normalized.length - 1 ? next.idealAngle + TAU2 : next.idealAngle;
|
|
2345
|
+
const gap = nextAngle - current.idealAngle;
|
|
2346
|
+
if (gap > largestGap) {
|
|
2347
|
+
largestGap = gap;
|
|
2348
|
+
seamIndex = (i + 1) % normalized.length;
|
|
1448
2349
|
}
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
2350
|
+
}
|
|
2351
|
+
const linear = [
|
|
2352
|
+
...normalized.slice(seamIndex),
|
|
2353
|
+
...normalized.slice(0, seamIndex)
|
|
2354
|
+
].map((item, index) => {
|
|
2355
|
+
const wrapped = seamIndex > 0 && index >= normalized.length - seamIndex;
|
|
2356
|
+
return {
|
|
2357
|
+
...item,
|
|
2358
|
+
idealAngle: item.idealAngle + (wrapped ? TAU2 : 0)
|
|
2359
|
+
};
|
|
2360
|
+
});
|
|
2361
|
+
for (let i = 1; i < linear.length; i++) {
|
|
2362
|
+
while (linear[i].idealAngle <= linear[i - 1].idealAngle) {
|
|
2363
|
+
linear[i] = {
|
|
2364
|
+
...linear[i],
|
|
2365
|
+
idealAngle: linear[i].idealAngle + TAU2
|
|
2366
|
+
};
|
|
1456
2367
|
}
|
|
1457
2368
|
}
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
2369
|
+
const solved = linear.map((item) => ({
|
|
2370
|
+
...item,
|
|
2371
|
+
visualAngle: item.idealAngle
|
|
2372
|
+
}));
|
|
2373
|
+
for (let iteration = 0; iteration < 50; iteration++) {
|
|
2374
|
+
const forces = new Array(solved.length).fill(0);
|
|
2375
|
+
let maxForce = 0;
|
|
2376
|
+
for (let i = 0; i < solved.length; i++) {
|
|
2377
|
+
const j = (i + 1) % solved.length;
|
|
2378
|
+
const current = solved[i];
|
|
2379
|
+
const next = solved[j];
|
|
2380
|
+
const nextAngle = j === 0 ? next.visualAngle + TAU2 : next.visualAngle;
|
|
2381
|
+
const gap = nextAngle - current.visualAngle;
|
|
2382
|
+
const minGap = labelAngularHalfDemand(current, paddingPx) + labelAngularHalfDemand(next, paddingPx);
|
|
2383
|
+
if (gap >= minGap) {
|
|
2384
|
+
continue;
|
|
2385
|
+
}
|
|
2386
|
+
const push = (minGap - gap) / 2;
|
|
2387
|
+
forces[i] -= push;
|
|
2388
|
+
forces[j] += push;
|
|
2389
|
+
maxForce = Math.max(maxForce, push);
|
|
2390
|
+
}
|
|
2391
|
+
if (maxForce < 1e-4) {
|
|
2392
|
+
break;
|
|
2393
|
+
}
|
|
2394
|
+
for (let i = 0; i < solved.length; i++) {
|
|
2395
|
+
const movement = clamp(forces[i], -deg2rad2(2), deg2rad2(2));
|
|
2396
|
+
const moved = solved[i].visualAngle + movement;
|
|
2397
|
+
solved[i].visualAngle = clampAngleAroundIdeal(
|
|
2398
|
+
moved,
|
|
2399
|
+
solved[i].idealAngle,
|
|
2400
|
+
maxDisplacementRad
|
|
2401
|
+
);
|
|
2402
|
+
}
|
|
2403
|
+
solved.sort((a, b) => a.visualAngle - b.visualAngle);
|
|
2404
|
+
for (let i = 1; i < solved.length; i++) {
|
|
2405
|
+
while (solved[i].visualAngle <= solved[i - 1].visualAngle) {
|
|
2406
|
+
solved[i].visualAngle += TAU2;
|
|
2407
|
+
}
|
|
1466
2408
|
}
|
|
1467
2409
|
}
|
|
1468
|
-
return
|
|
2410
|
+
return solved.map((item) => ({
|
|
2411
|
+
...item,
|
|
2412
|
+
visualAngle: clampRad(item.visualAngle)
|
|
2413
|
+
}));
|
|
2414
|
+
}
|
|
2415
|
+
function clampAngleAroundIdeal(value, ideal, maxDistance) {
|
|
2416
|
+
if (!Number.isFinite(maxDistance) || maxDistance >= Math.PI) {
|
|
2417
|
+
return value;
|
|
2418
|
+
}
|
|
2419
|
+
const delta = signedAngleDelta(ideal, value);
|
|
2420
|
+
return ideal + clamp(delta, -maxDistance, maxDistance);
|
|
2421
|
+
}
|
|
2422
|
+
function signedAngleDelta(from, to) {
|
|
2423
|
+
let delta = clampRad(to) - clampRad(from);
|
|
2424
|
+
if (delta > Math.PI) {
|
|
2425
|
+
delta -= TAU2;
|
|
2426
|
+
} else if (delta < -Math.PI) {
|
|
2427
|
+
delta += TAU2;
|
|
2428
|
+
}
|
|
2429
|
+
return delta;
|
|
2430
|
+
}
|
|
2431
|
+
function labelAngularHalfDemand(item, paddingPx) {
|
|
2432
|
+
return (item.tangentDemandPx / 2 + paddingPx) / Math.max(item.radius, 1);
|
|
2433
|
+
}
|
|
2434
|
+
function clampRad(value) {
|
|
2435
|
+
return (value % TAU2 + TAU2) % TAU2;
|
|
2436
|
+
}
|
|
2437
|
+
function circularAngleDistance(a, b) {
|
|
2438
|
+
const delta = Math.abs(clampRad(a) - clampRad(b));
|
|
2439
|
+
return Math.min(delta, TAU2 - delta);
|
|
2440
|
+
}
|
|
2441
|
+
function buildPointConnector(params) {
|
|
2442
|
+
const { center, tickAngle, labelAngle, connectorRadius, glyphPosition, mode } = params;
|
|
2443
|
+
const displacement = circularAngleDistance(tickAngle, labelAngle);
|
|
2444
|
+
if (mode === "never" || mode === "auto" && displacement < deg2rad2(0.35)) {
|
|
2445
|
+
return void 0;
|
|
2446
|
+
}
|
|
2447
|
+
const path = arcConnectorPath({
|
|
2448
|
+
center,
|
|
2449
|
+
startAngle: tickAngle,
|
|
2450
|
+
endAngle: labelAngle,
|
|
2451
|
+
radius: connectorRadius,
|
|
2452
|
+
end: glyphPosition
|
|
2453
|
+
});
|
|
2454
|
+
return {
|
|
2455
|
+
startAngle: tickAngle,
|
|
2456
|
+
endAngle: labelAngle,
|
|
2457
|
+
radius: connectorRadius,
|
|
2458
|
+
path
|
|
2459
|
+
};
|
|
1469
2460
|
}
|
|
1470
2461
|
function getSourceAspectEdges(chart, options) {
|
|
1471
2462
|
if (options.edges) {
|
|
@@ -1517,12 +2508,16 @@ function getAspectMatch(lonA, lonB, specs) {
|
|
|
1517
2508
|
function findAspectSpec(aspect, specs = ASTRO_WHEEL_DEFAULT_ASPECT_SPECS) {
|
|
1518
2509
|
return specs.find((spec) => spec.name === aspect);
|
|
1519
2510
|
}
|
|
1520
|
-
function
|
|
2511
|
+
function buildRings2(outerRadius, ringFractions = {}) {
|
|
2512
|
+
const fractions = {
|
|
2513
|
+
...DEFAULT_ASTRO_WHEEL_RING_FRACTIONS,
|
|
2514
|
+
...ringFractions
|
|
2515
|
+
};
|
|
1521
2516
|
const ringMap = buildRingMap(outerRadius, [
|
|
1522
|
-
{ id: "houses", fr:
|
|
1523
|
-
{ id: "zodiac", fr:
|
|
1524
|
-
{ id: "planets", fr:
|
|
1525
|
-
{ id: "aspects", fr:
|
|
2517
|
+
{ id: "houses", fr: fractions.houses },
|
|
2518
|
+
{ id: "zodiac", fr: fractions.zodiac },
|
|
2519
|
+
{ id: "planets", fr: fractions.planets },
|
|
2520
|
+
{ id: "aspects", fr: fractions.aspects }
|
|
1526
2521
|
]);
|
|
1527
2522
|
return {
|
|
1528
2523
|
aspects: ringMap.aspects,
|
|
@@ -1532,23 +2527,27 @@ function buildRings(outerRadius) {
|
|
|
1532
2527
|
};
|
|
1533
2528
|
}
|
|
1534
2529
|
function buildRingMap(radius, defs) {
|
|
1535
|
-
const
|
|
2530
|
+
const normalizedDefs = defs.map((def) => ({
|
|
2531
|
+
...def,
|
|
2532
|
+
fr: Number.isFinite(def.fr) && def.fr > 0 ? def.fr : DEFAULT_ASTRO_WHEEL_RING_FRACTIONS[def.id]
|
|
2533
|
+
}));
|
|
2534
|
+
const frTotal = normalizedDefs.reduce((sum, def) => sum + def.fr, 0);
|
|
1536
2535
|
let cursor = radius;
|
|
1537
2536
|
const result = {};
|
|
1538
|
-
for (const def of
|
|
2537
|
+
for (const def of normalizedDefs) {
|
|
1539
2538
|
const thickness = radius * def.fr / frTotal;
|
|
1540
2539
|
const r2 = cursor;
|
|
1541
2540
|
const r1 = cursor - thickness;
|
|
1542
2541
|
result[def.id] = {
|
|
1543
2542
|
id: def.id,
|
|
1544
|
-
r1:
|
|
1545
|
-
r2:
|
|
2543
|
+
r1: round2(r1),
|
|
2544
|
+
r2: round2(r2)
|
|
1546
2545
|
};
|
|
1547
2546
|
cursor = r1;
|
|
1548
2547
|
}
|
|
1549
2548
|
return result;
|
|
1550
2549
|
}
|
|
1551
|
-
function
|
|
2550
|
+
function resolvePalette2(palette = "default", background = "transparent") {
|
|
1552
2551
|
const base = palette === "monochrome" ? MONOCHROME_PALETTE : DEFAULT_PALETTE;
|
|
1553
2552
|
if (palette === "default" || palette === "monochrome") {
|
|
1554
2553
|
return {
|
|
@@ -1647,7 +2646,7 @@ function resolvePointLayerRadius(layer, rings) {
|
|
|
1647
2646
|
const radius = layer.radius === "inner" ? ring.r1 : layer.radius === "outer" ? ring.r2 : typeof layer.radius === "number" ? layer.radius : base;
|
|
1648
2647
|
return radius + (layer.radiusOffset ?? 0);
|
|
1649
2648
|
}
|
|
1650
|
-
function
|
|
2649
|
+
function normalizeViewBox2(viewBox) {
|
|
1651
2650
|
return {
|
|
1652
2651
|
minX: viewBox?.minX ?? ASTRO_WHEEL_DEFAULT_VIEWBOX.minX,
|
|
1653
2652
|
minY: viewBox?.minY ?? ASTRO_WHEEL_DEFAULT_VIEWBOX.minY,
|
|
@@ -1681,16 +2680,16 @@ function pointKeyPrefix(layerId) {
|
|
|
1681
2680
|
function renderGlyphPrimitives(push, primitives, options) {
|
|
1682
2681
|
for (const p of primitives) {
|
|
1683
2682
|
if (p.kind === "path") {
|
|
1684
|
-
push(`<path d="${
|
|
2683
|
+
push(`<path d="${escapeAttr2(p.d)}"/>`);
|
|
1685
2684
|
} else if (p.kind === "circle") {
|
|
1686
|
-
push(`<circle cx="${
|
|
2685
|
+
push(`<circle cx="${fmt2(p.cx)}" cy="${fmt2(p.cy)}" r="${fmt2(p.r)}"/>`);
|
|
1687
2686
|
} else if (p.kind === "line") {
|
|
1688
|
-
push(`<line x1="${
|
|
2687
|
+
push(`<line x1="${fmt2(p.x1)}" y1="${fmt2(p.y1)}" x2="${fmt2(p.x2)}" y2="${fmt2(p.y2)}"/>`);
|
|
1689
2688
|
} else if (p.kind === "polyline") {
|
|
1690
|
-
push(`<polyline points="${
|
|
2689
|
+
push(`<polyline points="${escapeAttr2(p.points)}"/>`);
|
|
1691
2690
|
} else if (p.kind === "text") {
|
|
1692
2691
|
push(
|
|
1693
|
-
`<text x="${
|
|
2692
|
+
`<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>`
|
|
1694
2693
|
);
|
|
1695
2694
|
} else {
|
|
1696
2695
|
let markup = p.markup;
|
|
@@ -1707,16 +2706,16 @@ function normalizeAngle(value) {
|
|
|
1707
2706
|
function clamp360(value) {
|
|
1708
2707
|
return (value % 360 + 360) % 360;
|
|
1709
2708
|
}
|
|
1710
|
-
function
|
|
2709
|
+
function deg2rad2(degrees) {
|
|
1711
2710
|
return degrees * Math.PI / 180;
|
|
1712
2711
|
}
|
|
1713
2712
|
function clamp(value, min, max) {
|
|
1714
2713
|
return Math.max(min, Math.min(max, value));
|
|
1715
2714
|
}
|
|
1716
|
-
function
|
|
2715
|
+
function polarToXY2(cx, cy, radius, angleRad) {
|
|
1717
2716
|
return {
|
|
1718
|
-
x:
|
|
1719
|
-
y:
|
|
2717
|
+
x: round2(cx + radius * Math.cos(angleRad)),
|
|
2718
|
+
y: round2(cy + radius * Math.sin(angleRad))
|
|
1720
2719
|
};
|
|
1721
2720
|
}
|
|
1722
2721
|
function polarWithNudge(cx, cy, radius, angleRad, radialOffset = 0, tangentOffset = 0) {
|
|
@@ -1725,13 +2724,13 @@ function polarWithNudge(cx, cy, radius, angleRad, radialOffset = 0, tangentOffse
|
|
|
1725
2724
|
const tangentX = -Math.sin(angleRad);
|
|
1726
2725
|
const tangentY = Math.cos(angleRad);
|
|
1727
2726
|
return {
|
|
1728
|
-
x:
|
|
1729
|
-
y:
|
|
2727
|
+
x: round2(x + tangentX * tangentOffset),
|
|
2728
|
+
y: round2(y + tangentY * tangentOffset)
|
|
1730
2729
|
};
|
|
1731
2730
|
}
|
|
1732
|
-
function
|
|
1733
|
-
const p1 =
|
|
1734
|
-
const p2 =
|
|
2731
|
+
function lineFromPolar2(center, r1, r2, angleRad) {
|
|
2732
|
+
const p1 = polarToXY2(center.x, center.y, r1, angleRad);
|
|
2733
|
+
const p2 = polarToXY2(center.x, center.y, r2, angleRad);
|
|
1735
2734
|
return {
|
|
1736
2735
|
x1: p1.x,
|
|
1737
2736
|
y1: p1.y,
|
|
@@ -1740,20 +2739,36 @@ function lineFromPolar(center, r1, r2, angleRad) {
|
|
|
1740
2739
|
};
|
|
1741
2740
|
}
|
|
1742
2741
|
function arcPath(cx, cy, innerRadius, outerRadius, angleStart, angleEnd) {
|
|
1743
|
-
const p0 =
|
|
1744
|
-
const p1 =
|
|
1745
|
-
const p2 =
|
|
1746
|
-
const p3 =
|
|
1747
|
-
const large = Math.abs(angleEnd - angleStart) %
|
|
2742
|
+
const p0 = polarToXY2(cx, cy, outerRadius, angleStart);
|
|
2743
|
+
const p1 = polarToXY2(cx, cy, outerRadius, angleEnd);
|
|
2744
|
+
const p2 = polarToXY2(cx, cy, innerRadius, angleEnd);
|
|
2745
|
+
const p3 = polarToXY2(cx, cy, innerRadius, angleStart);
|
|
2746
|
+
const large = Math.abs(angleEnd - angleStart) % TAU2 > Math.PI ? 1 : 0;
|
|
1748
2747
|
const sweep = angleEnd > angleStart ? 1 : 0;
|
|
1749
2748
|
return [
|
|
1750
|
-
`M ${
|
|
1751
|
-
`A ${
|
|
1752
|
-
`L ${
|
|
1753
|
-
`A ${
|
|
2749
|
+
`M ${fmt2(p0.x)},${fmt2(p0.y)}`,
|
|
2750
|
+
`A ${fmt2(outerRadius)},${fmt2(outerRadius)} 0 ${large} ${sweep} ${fmt2(p1.x)},${fmt2(p1.y)}`,
|
|
2751
|
+
`L ${fmt2(p2.x)},${fmt2(p2.y)}`,
|
|
2752
|
+
`A ${fmt2(innerRadius)},${fmt2(innerRadius)} 0 ${large} ${sweep ? 0 : 1} ${fmt2(p3.x)},${fmt2(p3.y)}`,
|
|
1754
2753
|
"Z"
|
|
1755
2754
|
].join(" ");
|
|
1756
2755
|
}
|
|
2756
|
+
function arcConnectorPath(params) {
|
|
2757
|
+
const { center, startAngle, endAngle, radius, end } = params;
|
|
2758
|
+
const start = polarToXY2(center.x, center.y, radius, startAngle);
|
|
2759
|
+
const arcEnd = polarToXY2(center.x, center.y, radius, endAngle);
|
|
2760
|
+
const delta = signedAngleDelta(startAngle, endAngle);
|
|
2761
|
+
const large = Math.abs(delta) > Math.PI ? 1 : 0;
|
|
2762
|
+
const sweep = delta >= 0 ? 1 : 0;
|
|
2763
|
+
const commands = [
|
|
2764
|
+
`M ${fmt2(start.x)},${fmt2(start.y)}`,
|
|
2765
|
+
`A ${fmt2(radius)},${fmt2(radius)} 0 ${large} ${sweep} ${fmt2(arcEnd.x)},${fmt2(arcEnd.y)}`
|
|
2766
|
+
];
|
|
2767
|
+
if (Math.hypot(arcEnd.x - end.x, arcEnd.y - end.y) > 0.5) {
|
|
2768
|
+
commands.push(`L ${fmt2(end.x)},${fmt2(end.y)}`);
|
|
2769
|
+
}
|
|
2770
|
+
return commands.join(" ");
|
|
2771
|
+
}
|
|
1757
2772
|
function unwrapAngles(angles, direction = "inc") {
|
|
1758
2773
|
const unwrapped = [];
|
|
1759
2774
|
if (angles.length === 0) {
|
|
@@ -1764,41 +2779,41 @@ function unwrapAngles(angles, direction = "inc") {
|
|
|
1764
2779
|
let angle = angles[index];
|
|
1765
2780
|
if (direction === "inc") {
|
|
1766
2781
|
while (angle <= unwrapped[index - 1]) {
|
|
1767
|
-
angle +=
|
|
2782
|
+
angle += TAU2;
|
|
1768
2783
|
}
|
|
1769
2784
|
} else {
|
|
1770
2785
|
while (angle >= unwrapped[index - 1]) {
|
|
1771
|
-
angle -=
|
|
2786
|
+
angle -= TAU2;
|
|
1772
2787
|
}
|
|
1773
2788
|
}
|
|
1774
2789
|
unwrapped.push(angle);
|
|
1775
2790
|
}
|
|
1776
2791
|
return unwrapped;
|
|
1777
2792
|
}
|
|
1778
|
-
function
|
|
2793
|
+
function round2(value) {
|
|
1779
2794
|
return Math.round((value + Number.EPSILON) * 100) / 100;
|
|
1780
2795
|
}
|
|
1781
|
-
function
|
|
1782
|
-
const rounded =
|
|
2796
|
+
function fmt2(value) {
|
|
2797
|
+
const rounded = round2(value);
|
|
1783
2798
|
if (Object.is(rounded, -0)) {
|
|
1784
2799
|
return "0";
|
|
1785
2800
|
}
|
|
1786
2801
|
return String(rounded);
|
|
1787
2802
|
}
|
|
1788
|
-
function
|
|
2803
|
+
function escapeAttr2(value) {
|
|
1789
2804
|
return value.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
1790
2805
|
}
|
|
1791
|
-
function
|
|
2806
|
+
function escapeText2(value) {
|
|
1792
2807
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
1793
2808
|
}
|
|
1794
2809
|
function symbolFontFamily() {
|
|
1795
|
-
return
|
|
2810
|
+
return escapeAttr2("'Apple Symbols', 'Arial Unicode MS', 'Noto Sans Symbols 2', 'Noto Sans Symbols', 'Segoe UI Symbol', serif, sans-serif");
|
|
1796
2811
|
}
|
|
1797
|
-
function
|
|
1798
|
-
return
|
|
2812
|
+
function textFontFamily2() {
|
|
2813
|
+
return escapeAttr2("Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif");
|
|
1799
2814
|
}
|
|
1800
2815
|
|
|
1801
|
-
// src/visual/tree
|
|
2816
|
+
// src/visual/tree.ts
|
|
1802
2817
|
var TREE_SVG_DEFAULT_VIEWBOX = {
|
|
1803
2818
|
minX: 0,
|
|
1804
2819
|
minY: 0,
|
|
@@ -1877,8 +2892,8 @@ function getTreeLayout(system = "kaabalah") {
|
|
|
1877
2892
|
function getTreeRenderModel(options = {}) {
|
|
1878
2893
|
const system = options.system ?? "kaabalah";
|
|
1879
2894
|
const tree = chunkS6KNERP7_js.createTree({ system, parts: ["colors"] });
|
|
1880
|
-
const viewBox =
|
|
1881
|
-
const palette =
|
|
2895
|
+
const viewBox = normalizeViewBox3(options.viewBox);
|
|
2896
|
+
const palette = resolvePalette3(options.palette);
|
|
1882
2897
|
const highlights = resolveHighlights(options.highlights);
|
|
1883
2898
|
const activationMap = resolveActivationMap(options.activations);
|
|
1884
2899
|
const layout = getTreeLayout(system);
|
|
@@ -1888,12 +2903,12 @@ function getTreeRenderModel(options = {}) {
|
|
|
1888
2903
|
viewBox.width / TREE_SVG_DEFAULT_VIEWBOX.width,
|
|
1889
2904
|
viewBox.height / TREE_SVG_DEFAULT_VIEWBOX.height
|
|
1890
2905
|
);
|
|
1891
|
-
const radius =
|
|
1892
|
-
const pathEdgeWidth =
|
|
1893
|
-
const pathMainWidth =
|
|
1894
|
-
const pathHighlightWidth =
|
|
1895
|
-
const sphereHitRadius =
|
|
1896
|
-
const pathHitStrokeWidth =
|
|
2906
|
+
const radius = round3(DEFAULT_SPHERE_RADIUS * scale);
|
|
2907
|
+
const pathEdgeWidth = round3(DEFAULT_PATH_EDGE_WIDTH * scale);
|
|
2908
|
+
const pathMainWidth = round3(DEFAULT_PATH_MAIN_WIDTH * scale);
|
|
2909
|
+
const pathHighlightWidth = round3(DEFAULT_PATH_HIGHLIGHT_WIDTH * scale);
|
|
2910
|
+
const sphereHitRadius = round3(DEFAULT_SPHERE_HIT_RADIUS * scale);
|
|
2911
|
+
const pathHitStrokeWidth = round3(DEFAULT_PATH_HIT_STROKE_WIDTH * scale);
|
|
1897
2912
|
const layers = [
|
|
1898
2913
|
{ name: "background", order: 0, description: "Background rectangle when requested." },
|
|
1899
2914
|
...options.daathLayer === "back" ? [{ name: "spheres-behind-paths", order: 1, description: "Daath behind the paths." }] : [],
|
|
@@ -2027,8 +3042,8 @@ function generateTreeSvg(options = {}) {
|
|
|
2027
3042
|
const system = options.system ?? "kaabalah";
|
|
2028
3043
|
const daathLayer = options.daathLayer ?? "front";
|
|
2029
3044
|
const tree = chunkS6KNERP7_js.createTree({ system, parts: ["colors"] });
|
|
2030
|
-
const viewBox =
|
|
2031
|
-
const palette =
|
|
3045
|
+
const viewBox = normalizeViewBox3(options.viewBox);
|
|
3046
|
+
const palette = resolvePalette3(options.palette);
|
|
2032
3047
|
const highlights = resolveHighlights(options.highlights);
|
|
2033
3048
|
const activationMap = resolveActivationMap(options.activations);
|
|
2034
3049
|
const spherePositions = scaleCoordinates(CANONICAL_SPHERE_PERCENTAGES, viewBox);
|
|
@@ -2037,17 +3052,17 @@ function generateTreeSvg(options = {}) {
|
|
|
2037
3052
|
viewBox.width / TREE_SVG_DEFAULT_VIEWBOX.width,
|
|
2038
3053
|
viewBox.height / TREE_SVG_DEFAULT_VIEWBOX.height
|
|
2039
3054
|
);
|
|
2040
|
-
const radius =
|
|
2041
|
-
const pathEdgeWidth =
|
|
2042
|
-
const pathMainWidth =
|
|
2043
|
-
const pathHighlightWidth =
|
|
2044
|
-
const sphereStrokeWidth = palette.sphereStrokeWidth ?
|
|
3055
|
+
const radius = round3(DEFAULT_SPHERE_RADIUS * scale);
|
|
3056
|
+
const pathEdgeWidth = round3(DEFAULT_PATH_EDGE_WIDTH * scale);
|
|
3057
|
+
const pathMainWidth = round3(DEFAULT_PATH_MAIN_WIDTH * scale);
|
|
3058
|
+
const pathHighlightWidth = round3(DEFAULT_PATH_HIGHLIGHT_WIDTH * scale);
|
|
3059
|
+
const sphereStrokeWidth = palette.sphereStrokeWidth ? round3(palette.sphereStrokeWidth * scale) : void 0;
|
|
2045
3060
|
const lines = [];
|
|
2046
3061
|
const push = (line) => lines.push(line);
|
|
2047
3062
|
const svgAttributes = [
|
|
2048
3063
|
`xmlns="http://www.w3.org/2000/svg"`,
|
|
2049
|
-
options.width !== void 0 ? `width="${
|
|
2050
|
-
options.height !== void 0 ? `height="${
|
|
3064
|
+
options.width !== void 0 ? `width="${escapeAttr3(String(options.width))}"` : "",
|
|
3065
|
+
options.height !== void 0 ? `height="${escapeAttr3(String(options.height))}"` : "",
|
|
2051
3066
|
`viewBox="${viewBox.minX} ${viewBox.minY} ${viewBox.width} ${viewBox.height}"`,
|
|
2052
3067
|
`preserveAspectRatio="xMidYMid meet"`
|
|
2053
3068
|
].filter(Boolean);
|
|
@@ -2101,7 +3116,7 @@ function generateTreeSvg(options = {}) {
|
|
|
2101
3116
|
const background = options.background ?? "white";
|
|
2102
3117
|
if (background !== "transparent") {
|
|
2103
3118
|
push(
|
|
2104
|
-
`<rect x="${viewBox.minX}" y="${viewBox.minY}" width="${viewBox.width}" height="${viewBox.height}" fill="${
|
|
3119
|
+
`<rect x="${viewBox.minX}" y="${viewBox.minY}" width="${viewBox.width}" height="${viewBox.height}" fill="${escapeAttr3(background)}"/>`
|
|
2105
3120
|
);
|
|
2106
3121
|
}
|
|
2107
3122
|
if (daathLayer === "back") {
|
|
@@ -2151,18 +3166,18 @@ function generateTreeSvg(options = {}) {
|
|
|
2151
3166
|
pathColor: color
|
|
2152
3167
|
});
|
|
2153
3168
|
push(
|
|
2154
|
-
`<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${
|
|
3169
|
+
`<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)"` : ""}/>`
|
|
2155
3170
|
);
|
|
2156
3171
|
if (activation?.visible && activation.emphasis > 0) {
|
|
2157
3172
|
push(
|
|
2158
|
-
`<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${
|
|
3173
|
+
`<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr3(color)}" stroke-opacity="${round3(0.18 + activation.emphasis * 0.28)}" stroke-width="${round3(pathEdgeWidth + activation.emphasis * 10)}" stroke-linecap="round"/>`
|
|
2159
3174
|
);
|
|
2160
3175
|
}
|
|
2161
3176
|
push(
|
|
2162
|
-
`<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${
|
|
3177
|
+
`<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr3(color)}" stroke-width="${pathMainWidth}" stroke-linecap="round"/>`
|
|
2163
3178
|
);
|
|
2164
3179
|
push(
|
|
2165
|
-
`<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${
|
|
3180
|
+
`<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"/>`
|
|
2166
3181
|
);
|
|
2167
3182
|
}
|
|
2168
3183
|
push(`</g>`);
|
|
@@ -2219,11 +3234,11 @@ function renderSphere(push, params) {
|
|
|
2219
3234
|
activation: params.activation
|
|
2220
3235
|
});
|
|
2221
3236
|
if (params.activation?.visible && params.activation.emphasis > 0) {
|
|
2222
|
-
const haloStrokeWidth =
|
|
2223
|
-
const haloRadius =
|
|
3237
|
+
const haloStrokeWidth = round3(3.2 + params.activation.emphasis * 4.8);
|
|
3238
|
+
const haloRadius = round3(params.radius + haloStrokeWidth / 2 + 0.7);
|
|
2224
3239
|
const haloColor = params.activation.displayColor;
|
|
2225
3240
|
push(
|
|
2226
|
-
`<circle cx="${point.x}" cy="${point.y}" r="${haloRadius}" fill="none" stroke="${
|
|
3241
|
+
`<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}"/>`
|
|
2227
3242
|
);
|
|
2228
3243
|
}
|
|
2229
3244
|
push(`<g id="sphere-${slug}" clip-path="url(#clip-${slug})">`);
|
|
@@ -2251,12 +3266,12 @@ function renderSphere(push, params) {
|
|
|
2251
3266
|
renderSlicedSphere(push, point, params.radius, slicedColors, -135);
|
|
2252
3267
|
} else {
|
|
2253
3268
|
push(
|
|
2254
|
-
`<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="${
|
|
3269
|
+
`<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="${escapeAttr3(toPrimaryFill(activeFill, params.palette.defaultSphereFill))}"/>`
|
|
2255
3270
|
);
|
|
2256
3271
|
}
|
|
2257
3272
|
} else {
|
|
2258
3273
|
push(
|
|
2259
|
-
`<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="${
|
|
3274
|
+
`<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="${escapeAttr3(toPrimaryFill(activeFill, params.palette.defaultSphereFill))}"/>`
|
|
2260
3275
|
);
|
|
2261
3276
|
}
|
|
2262
3277
|
push(
|
|
@@ -2270,7 +3285,7 @@ function renderSphere(push, params) {
|
|
|
2270
3285
|
push(`</g>`);
|
|
2271
3286
|
if (params.palette.sphereStrokeColor && params.sphereStrokeWidth) {
|
|
2272
3287
|
push(
|
|
2273
|
-
`<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="none" stroke="${
|
|
3288
|
+
`<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="none" stroke="${escapeAttr3(params.palette.sphereStrokeColor)}" stroke-width="${params.sphereStrokeWidth}"/>`
|
|
2274
3289
|
);
|
|
2275
3290
|
}
|
|
2276
3291
|
}
|
|
@@ -2315,13 +3330,13 @@ function scaleCoordinates(coordinates, viewBox) {
|
|
|
2315
3330
|
for (const currentSphereId of TREE_SPHERE_IDS) {
|
|
2316
3331
|
const point = coordinates[currentSphereId];
|
|
2317
3332
|
scaled[currentSphereId] = {
|
|
2318
|
-
x:
|
|
2319
|
-
y:
|
|
3333
|
+
x: round3(viewBox.minX + point.x / 100 * viewBox.width),
|
|
3334
|
+
y: round3(viewBox.minY + point.y / 100 * viewBox.height)
|
|
2320
3335
|
};
|
|
2321
3336
|
}
|
|
2322
3337
|
return scaled;
|
|
2323
3338
|
}
|
|
2324
|
-
function
|
|
3339
|
+
function normalizeViewBox3(viewBox) {
|
|
2325
3340
|
return {
|
|
2326
3341
|
minX: viewBox?.minX ?? TREE_SVG_DEFAULT_VIEWBOX.minX,
|
|
2327
3342
|
minY: viewBox?.minY ?? TREE_SVG_DEFAULT_VIEWBOX.minY,
|
|
@@ -2422,17 +3437,17 @@ function getViewBoxAnchor(point, viewBox) {
|
|
|
2422
3437
|
};
|
|
2423
3438
|
}
|
|
2424
3439
|
function getPercentagePathAnchor(path) {
|
|
2425
|
-
const y =
|
|
3440
|
+
const y = round3((path.from.y + path.to.y) / 2);
|
|
2426
3441
|
return {
|
|
2427
|
-
x:
|
|
3442
|
+
x: round3((path.from.x + path.to.x) / 2),
|
|
2428
3443
|
y,
|
|
2429
3444
|
vertical: y < 18 ? "below" : "above"
|
|
2430
3445
|
};
|
|
2431
3446
|
}
|
|
2432
3447
|
function getViewBoxPathAnchor(path, viewBox) {
|
|
2433
|
-
const y =
|
|
3448
|
+
const y = round3((path.from.y + path.to.y) / 2);
|
|
2434
3449
|
return {
|
|
2435
|
-
x:
|
|
3450
|
+
x: round3((path.from.x + path.to.x) / 2),
|
|
2436
3451
|
y,
|
|
2437
3452
|
vertical: y - viewBox.minY < viewBox.height * 0.18 ? "below" : "above"
|
|
2438
3453
|
};
|
|
@@ -2483,7 +3498,7 @@ function getSphereMaterial(params) {
|
|
|
2483
3498
|
function clamp01(value) {
|
|
2484
3499
|
return Math.max(0, Math.min(1, value));
|
|
2485
3500
|
}
|
|
2486
|
-
function
|
|
3501
|
+
function resolvePalette3(palette) {
|
|
2487
3502
|
if (palette === void 0 || palette === "color") {
|
|
2488
3503
|
return {
|
|
2489
3504
|
mode: "color",
|
|
@@ -2589,14 +3604,14 @@ function expandColors(fill, count, fallbackColors) {
|
|
|
2589
3604
|
}
|
|
2590
3605
|
return Array.from({ length: count }, () => fill);
|
|
2591
3606
|
}
|
|
2592
|
-
function
|
|
3607
|
+
function round3(value) {
|
|
2593
3608
|
return Math.round(value * 100) / 100;
|
|
2594
3609
|
}
|
|
2595
3610
|
function polarToCartesian(cx, cy, radius, degrees) {
|
|
2596
3611
|
const radians = Math.PI / 180 * degrees;
|
|
2597
3612
|
return {
|
|
2598
|
-
x:
|
|
2599
|
-
y:
|
|
3613
|
+
x: round3(cx + radius * Math.cos(radians)),
|
|
3614
|
+
y: round3(cy + radius * Math.sin(radians))
|
|
2600
3615
|
};
|
|
2601
3616
|
}
|
|
2602
3617
|
function arcPath2(cx, cy, radius, startDegrees, endDegrees) {
|
|
@@ -2607,24 +3622,24 @@ function arcPath2(cx, cy, radius, startDegrees, endDegrees) {
|
|
|
2607
3622
|
}
|
|
2608
3623
|
function renderKether(push, point, radius, baseFill = "#e0e0e0") {
|
|
2609
3624
|
push(
|
|
2610
|
-
`<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="${
|
|
3625
|
+
`<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="${escapeAttr3(baseFill)}"/>`
|
|
2611
3626
|
);
|
|
2612
3627
|
push(`<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="url(#kether-glow)"/>`);
|
|
2613
3628
|
const spokes = 16;
|
|
2614
|
-
const innerRadius =
|
|
2615
|
-
const outerRadius =
|
|
2616
|
-
const innerWidth =
|
|
3629
|
+
const innerRadius = round3(radius * 0.18);
|
|
3630
|
+
const outerRadius = round3(radius * 0.92);
|
|
3631
|
+
const innerWidth = round3(radius * 0.04);
|
|
2617
3632
|
const angleStep = 360 / spokes;
|
|
2618
3633
|
push(`<g opacity="0.85">`);
|
|
2619
3634
|
for (let index = 0; index < spokes; index++) {
|
|
2620
3635
|
const angle = index * angleStep;
|
|
2621
3636
|
push(`<g transform="rotate(${angle} ${point.x} ${point.y})">`);
|
|
2622
|
-
const x0 =
|
|
2623
|
-
const y0 =
|
|
3637
|
+
const x0 = round3(point.x - innerWidth);
|
|
3638
|
+
const y0 = round3(point.y - innerRadius);
|
|
2624
3639
|
const x1 = point.x;
|
|
2625
|
-
const y1 =
|
|
2626
|
-
const x2 =
|
|
2627
|
-
const y2 =
|
|
3640
|
+
const y1 = round3(point.y - outerRadius);
|
|
3641
|
+
const x2 = round3(point.x + innerWidth);
|
|
3642
|
+
const y2 = round3(point.y - innerRadius);
|
|
2628
3643
|
push(
|
|
2629
3644
|
`<polygon points="${x0},${y0} ${x1},${y1} ${x2},${y2} ${point.x},${point.y}" fill="url(#kether-facet)"/>`
|
|
2630
3645
|
);
|
|
@@ -2639,7 +3654,7 @@ function renderSlicedSphere(push, point, radius, colors, startAngle) {
|
|
|
2639
3654
|
let currentAngle = startAngle;
|
|
2640
3655
|
for (let index = 0; index < segmentCount; index++) {
|
|
2641
3656
|
const path = arcPath2(point.x, point.y, radius * 0.96, currentAngle, currentAngle + step);
|
|
2642
|
-
push(`<path d="${path}" fill="${
|
|
3657
|
+
push(`<path d="${path}" fill="${escapeAttr3(colors[index])}" stroke="none"/>`);
|
|
2643
3658
|
currentAngle += step;
|
|
2644
3659
|
}
|
|
2645
3660
|
}
|
|
@@ -2656,7 +3671,7 @@ function renderIridescent(push, point, radius) {
|
|
|
2656
3671
|
[1, "#F0E8EE"]
|
|
2657
3672
|
];
|
|
2658
3673
|
const slices = 72;
|
|
2659
|
-
const sphereRadius =
|
|
3674
|
+
const sphereRadius = round3(radius * 0.96);
|
|
2660
3675
|
for (let index = 0; index < slices; index++) {
|
|
2661
3676
|
const t = index / slices;
|
|
2662
3677
|
const color = interpolateColorStops(stops, t);
|
|
@@ -2695,28 +3710,28 @@ function interpolateColor(start, end, factor) {
|
|
|
2695
3710
|
}
|
|
2696
3711
|
function renderYinYang(push, point, radius, fill) {
|
|
2697
3712
|
const scale = radius / 50;
|
|
2698
|
-
const circleRadius =
|
|
2699
|
-
const halfRadius =
|
|
2700
|
-
const dotRadius =
|
|
3713
|
+
const circleRadius = round3(48 * scale);
|
|
3714
|
+
const halfRadius = round3(24 * scale);
|
|
3715
|
+
const dotRadius = round3(6 * scale);
|
|
2701
3716
|
const [lightFill, darkFill] = resolveDualToneFill(fill);
|
|
2702
3717
|
push(`<g transform="rotate(180 ${point.x} ${point.y})">`);
|
|
2703
3718
|
push(
|
|
2704
|
-
`<circle cx="${point.x}" cy="${point.y}" r="${circleRadius}" fill="${
|
|
3719
|
+
`<circle cx="${point.x}" cy="${point.y}" r="${circleRadius}" fill="${escapeAttr3(lightFill)}"/>`
|
|
2705
3720
|
);
|
|
2706
3721
|
push(
|
|
2707
|
-
`<path d="M${point.x},${
|
|
3722
|
+
`<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)}"/>`
|
|
2708
3723
|
);
|
|
2709
3724
|
push(
|
|
2710
|
-
`<circle cx="${point.x}" cy="${
|
|
3725
|
+
`<circle cx="${point.x}" cy="${round3(point.y - halfRadius)}" r="${dotRadius}" fill="${escapeAttr3(lightFill)}"/>`
|
|
2711
3726
|
);
|
|
2712
3727
|
push(
|
|
2713
|
-
`<circle cx="${point.x}" cy="${
|
|
3728
|
+
`<circle cx="${point.x}" cy="${round3(point.y + halfRadius)}" r="${dotRadius}" fill="${escapeAttr3(darkFill)}"/>`
|
|
2714
3729
|
);
|
|
2715
3730
|
push(`</g>`);
|
|
2716
3731
|
}
|
|
2717
3732
|
function renderSphereTintOverlay(push, point, radius, fill, opacity) {
|
|
2718
3733
|
push(
|
|
2719
|
-
`<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="${
|
|
3734
|
+
`<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="${escapeAttr3(toPrimaryFill(fill, "#ffffff"))}" fill-opacity="${opacity}"/>`
|
|
2720
3735
|
);
|
|
2721
3736
|
}
|
|
2722
3737
|
function resolveDualToneFill(fill) {
|
|
@@ -2728,12 +3743,13 @@ function resolveDualToneFill(fill) {
|
|
|
2728
3743
|
}
|
|
2729
3744
|
return ["white", "black"];
|
|
2730
3745
|
}
|
|
2731
|
-
function
|
|
3746
|
+
function escapeAttr3(value) {
|
|
2732
3747
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
2733
3748
|
}
|
|
2734
3749
|
|
|
2735
3750
|
exports.ANGLE_GLYPHS = ANGLE_GLYPHS;
|
|
2736
3751
|
exports.ANGLE_GLYPH_PRIMITIVES = ANGLE_GLYPH_PRIMITIVES;
|
|
3752
|
+
exports.ARCHEOMETER_DEFAULT_VIEWBOX = ARCHEOMETER_DEFAULT_VIEWBOX;
|
|
2737
3753
|
exports.ASPECT_GLYPHS = ASPECT_GLYPHS;
|
|
2738
3754
|
exports.ASPECT_GLYPH_PRIMITIVES = ASPECT_GLYPH_PRIMITIVES;
|
|
2739
3755
|
exports.ASTRO_GLYPHS = ASTRO_GLYPHS;
|
|
@@ -2741,6 +3757,18 @@ exports.ASTRO_WHEEL_DEFAULT_ASPECT_SPECS = ASTRO_WHEEL_DEFAULT_ASPECT_SPECS;
|
|
|
2741
3757
|
exports.ASTRO_WHEEL_DEFAULT_VIEWBOX = ASTRO_WHEEL_DEFAULT_VIEWBOX;
|
|
2742
3758
|
exports.ASTRO_WHEEL_POINT_GLYPHS = ASTRO_WHEEL_POINT_GLYPHS;
|
|
2743
3759
|
exports.ASTRO_WHEEL_ZODIAC_SIGNS = ASTRO_WHEEL_ZODIAC_SIGNS;
|
|
3760
|
+
exports.DEFAULT_ARCHEOMETER_MUSICAL_NOTES = DEFAULT_ARCHEOMETER_MUSICAL_NOTES;
|
|
3761
|
+
exports.DEFAULT_ARCHEOMETER_PLANETS = DEFAULT_ARCHEOMETER_PLANETS;
|
|
3762
|
+
exports.DEFAULT_ARCHEOMETER_SECTOR_CORRESPONDENCES = DEFAULT_ARCHEOMETER_SECTOR_CORRESPONDENCES;
|
|
3763
|
+
exports.DEFAULT_ARCHEOMETER_TRIANGLES = DEFAULT_ARCHEOMETER_TRIANGLES;
|
|
3764
|
+
exports.DEFAULT_ARCHEOMETER_TRIANGLE_LABELS = DEFAULT_ARCHEOMETER_TRIANGLE_LABELS;
|
|
3765
|
+
exports.DEFAULT_ARCHEOMETER_UTTERANCE = DEFAULT_ARCHEOMETER_UTTERANCE;
|
|
3766
|
+
exports.DEFAULT_ARCHEOMETER_ZODIAC = DEFAULT_ARCHEOMETER_ZODIAC;
|
|
3767
|
+
exports.DEFAULT_ARCHETYPE_MUSICAL_NOTES = DEFAULT_ARCHETYPE_MUSICAL_NOTES;
|
|
3768
|
+
exports.DEFAULT_ARCHETYPE_PLANETS = DEFAULT_ARCHETYPE_PLANETS;
|
|
3769
|
+
exports.DEFAULT_ARCHETYPE_TRIANGLES = DEFAULT_ARCHETYPE_TRIANGLES;
|
|
3770
|
+
exports.DEFAULT_ARCHETYPE_UTTERANCE = DEFAULT_ARCHETYPE_UTTERANCE;
|
|
3771
|
+
exports.DEFAULT_ARCHETYPE_ZODIAC = DEFAULT_ARCHETYPE_ZODIAC;
|
|
2744
3772
|
exports.PLANET_GLYPHS = PLANET_GLYPHS;
|
|
2745
3773
|
exports.PLANET_GLYPH_PRIMITIVES = PLANET_GLYPH_PRIMITIVES;
|
|
2746
3774
|
exports.TREE_PATH_IDS = TREE_PATH_IDS;
|
|
@@ -2749,14 +3777,16 @@ exports.TREE_SPHERE_NAMES = TREE_SPHERE_NAMES;
|
|
|
2749
3777
|
exports.TREE_SVG_DEFAULT_VIEWBOX = TREE_SVG_DEFAULT_VIEWBOX;
|
|
2750
3778
|
exports.ZODIAC_GLYPHS = ZODIAC_GLYPHS;
|
|
2751
3779
|
exports.ZODIAC_GLYPH_PRIMITIVES = ZODIAC_GLYPH_PRIMITIVES;
|
|
3780
|
+
exports.generateArcheometerSvg = generateArcheometerSvg;
|
|
2752
3781
|
exports.generateAstroGlyphSvg = generateAstroGlyphSvg;
|
|
2753
3782
|
exports.generateAstroWheelSvg = generateAstroWheelSvg;
|
|
2754
3783
|
exports.generateGlyphSvg = generateGlyphSvg;
|
|
2755
3784
|
exports.generateTreeSvg = generateTreeSvg;
|
|
3785
|
+
exports.getArcheometerRenderModel = getArcheometerRenderModel;
|
|
2756
3786
|
exports.getAstroGlyph = getAstroGlyph;
|
|
2757
3787
|
exports.getAstroWheelRenderModel = getAstroWheelRenderModel;
|
|
2758
3788
|
exports.getTreeLayout = getTreeLayout;
|
|
2759
3789
|
exports.getTreeRenderModel = getTreeRenderModel;
|
|
2760
3790
|
exports.listAstroGlyphs = listAstroGlyphs;
|
|
2761
|
-
//# sourceMappingURL=chunk-
|
|
2762
|
-
//# sourceMappingURL=chunk-
|
|
3791
|
+
//# sourceMappingURL=chunk-WCOGJKT7.js.map
|
|
3792
|
+
//# sourceMappingURL=chunk-WCOGJKT7.js.map
|