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