@beff/aula 0.8.2 → 0.9.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/generated/aula.core5.wasm +0 -0
- package/dist/index.d.ts +7304 -6
- package/dist/index.js +14864 -11
- package/dist/index.js.map +1 -0
- package/package.json +8 -25
- package/dist/animations.d.ts +0 -635
- package/dist/animations.js +0 -1778
- package/dist/braces.d.ts +0 -84
- package/dist/braces.js +0 -253
- package/dist/card.d.ts +0 -17
- package/dist/card.js +0 -90
- package/dist/colors-palette.d.ts +0 -2242
- package/dist/colors-palette.js +0 -2241
- package/dist/colors.d.ts +0 -120
- package/dist/colors.js +0 -403
- package/dist/curves.d.ts +0 -10
- package/dist/curves.js +0 -128
- package/dist/engine.d.ts +0 -1705
- package/dist/engine.js +0 -3561
- package/dist/errors.d.ts +0 -19
- package/dist/errors.js +0 -25
- package/dist/geometry.d.ts +0 -551
- package/dist/geometry.js +0 -1555
- package/dist/graph.d.ts +0 -117
- package/dist/graph.js +0 -526
- package/dist/graphing.d.ts +0 -597
- package/dist/graphing.js +0 -1504
- package/dist/host.d.ts +0 -19
- package/dist/host.js +0 -85
- package/dist/lexicon.d.ts +0 -10
- package/dist/lexicon.js +0 -23
- package/dist/load.d.ts +0 -21
- package/dist/load.js +0 -109
- package/dist/logo.d.ts +0 -30
- package/dist/logo.js +0 -186
- package/dist/manim.d.ts +0 -22
- package/dist/manim.js +0 -19
- package/dist/media.d.ts +0 -34
- package/dist/media.js +0 -391
- package/dist/mobjects.d.ts +0 -127
- package/dist/mobjects.js +0 -316
- package/dist/picture.d.ts +0 -23
- package/dist/picture.js +0 -291
- package/dist/pointcloud.d.ts +0 -144
- package/dist/pointcloud.js +0 -384
- package/dist/rates.d.ts +0 -19
- package/dist/rates.js +0 -54
- package/dist/run.d.ts +0 -101
- package/dist/run.js +0 -323
- package/dist/tables.d.ts +0 -179
- package/dist/tables.js +0 -403
- package/dist/tex.d.ts +0 -8
- package/dist/tex.js +0 -257
- package/dist/text-layouts.d.ts +0 -64
- package/dist/text-layouts.js +0 -225
- package/dist/text.d.ts +0 -61
- package/dist/text.js +0 -78
- package/dist/theme.d.ts +0 -25
- package/dist/theme.js +0 -12
- package/dist/user-code.d.ts +0 -5
- package/dist/user-code.js +0 -20
- package/dist/utils.d.ts +0 -152
- package/dist/utils.js +0 -517
- package/dist/vector-field.d.ts +0 -132
- package/dist/vector-field.js +0 -361
package/dist/text-layouts.d.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { type Color, type TexOptions, type TextOptions, MathTexMobject, Mobject } from "./engine.ts";
|
|
2
|
-
import type { Mobject as RawMobject } from "./generated/interfaces/aula-engine-engine.js";
|
|
3
|
-
/** Lines of text, each one a submobject of its glyphs: Manim's `Paragraph`. */
|
|
4
|
-
export declare class ParagraphMobject extends Mobject {
|
|
5
|
-
/** The alignment of each line: `"left"`, `"center"`, `"right"` or undefined. */
|
|
6
|
-
readonly linesAlignments: (string | undefined)[];
|
|
7
|
-
constructor(handle: RawMobject, alignments: (string | undefined)[]);
|
|
8
|
-
/** The lines (Manim `chars`): line `i` is a VGroup of its glyphs. */
|
|
9
|
-
get chars(): Mobject;
|
|
10
|
-
copy(): ParagraphMobject;
|
|
11
|
-
}
|
|
12
|
-
/** Manim's `Paragraph(...text, { lineSpacing, alignment })`: each argument is a line, with the
|
|
13
|
-
* options of `Text`. `alignment` is `"left"`, `"center"` or `"right"`. */
|
|
14
|
-
export declare function Paragraph(...args: (string | (TextOptions & {
|
|
15
|
-
alignment?: string;
|
|
16
|
-
}))[]): ParagraphMobject;
|
|
17
|
-
/** Text with Pango markup (Manim `MarkupText`): `<b>`, `<i>`, `<span foreground="#…" weight="…"
|
|
18
|
-
* style="…">` and Manim's `<gradient from="#…" to="#…">`. Its options are those of `Text`. */
|
|
19
|
-
export declare function MarkupText(text: string, opts?: TextOptions): Mobject;
|
|
20
|
-
/** The options of BulletedList (Manim's keyword arguments) with those of `Tex`. */
|
|
21
|
-
export interface BulletedListOptions extends TexOptions {
|
|
22
|
-
buff?: number;
|
|
23
|
-
dotScaleFactor?: number;
|
|
24
|
-
dotBuff?: number;
|
|
25
|
-
}
|
|
26
|
-
/** A `Tex` list (Manim `BulletedList`): each item is a part with a dot before it, and the parts
|
|
27
|
-
* go down, left-aligned. */
|
|
28
|
-
export declare class BulletedListMobject extends MathTexMobject {
|
|
29
|
-
/** Sets the fill opacity of every part to `opacity`, except the part at the index or with the
|
|
30
|
-
* LaTeX, which is opaque (Manim `fade_all_but`). */
|
|
31
|
-
fadeAllBut(indexOrString: number | string, opacity?: number): this;
|
|
32
|
-
copy(): BulletedListMobject;
|
|
33
|
-
}
|
|
34
|
-
/** Manim's `BulletedList(...items, { buff, dotScaleFactor, dotBuff })`. */
|
|
35
|
-
export declare function BulletedList(...args: (string | BulletedListOptions)[]): BulletedListMobject;
|
|
36
|
-
/** The options of Title (Manim's keyword arguments) with those of `Tex`. */
|
|
37
|
-
export interface TitleOptions extends TexOptions {
|
|
38
|
-
includeUnderline?: boolean;
|
|
39
|
-
matchUnderlineWidthToText?: boolean;
|
|
40
|
-
underlineBuff?: number;
|
|
41
|
-
}
|
|
42
|
-
/** A `Tex` at the top edge with a line under it (Manim `Title`). The line is as wide as the
|
|
43
|
-
* frame minus 2, or as the text with `matchUnderlineWidthToText`. */
|
|
44
|
-
export declare function Title(...args: (string | TitleOptions)[]): TitleMobject;
|
|
45
|
-
/** A title: Manim's `Title`. */
|
|
46
|
-
export declare class TitleMobject extends MathTexMobject {
|
|
47
|
-
#private;
|
|
48
|
-
constructor(handle: RawMobject, texStrings: readonly string[], texString: string, underlined: boolean);
|
|
49
|
-
/** The line under the text (Manim `underline`), or undefined without one. */
|
|
50
|
-
get underline(): Mobject | undefined;
|
|
51
|
-
copy(): TitleMobject;
|
|
52
|
-
}
|
|
53
|
-
/** The options of SingleStringMathTex (Manim's keyword arguments). */
|
|
54
|
-
export interface SingleStringMathTexOptions {
|
|
55
|
-
fontSize?: number;
|
|
56
|
-
color?: Color;
|
|
57
|
-
strokeWidth?: number;
|
|
58
|
-
/** Scales the formula to this height. */
|
|
59
|
-
height?: number;
|
|
60
|
-
/** Sorts the glyphs from left to right. */
|
|
61
|
-
organizeLeftToRight?: boolean;
|
|
62
|
-
}
|
|
63
|
-
/** One LaTeX string in math mode as one part (Manim `SingleStringMathTex`). */
|
|
64
|
-
export declare function SingleStringMathTex(texString: string, opts?: SingleStringMathTexOptions): MathTexMobject;
|
package/dist/text-layouts.js
DELETED
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
// Manim CE's text layouts over `Text` and `Tex`: Paragraph, MarkupText, BulletedList, Title and
|
|
2
|
-
// SingleStringMathTex.
|
|
3
|
-
import { DOWN, FRAME_WIDTH, LEFT, MED_LARGE_BUFF, MED_SMALL_BUFF, MathTex, MathTexMobject, Mobject, ORIGIN, RIGHT, SMALL_BUFF, Tex, Text, UP, VGroup, raw, split, wrong, } from "./engine.js";
|
|
4
|
-
import { Line } from "./geometry.js";
|
|
5
|
-
import { engine } from "./load.js";
|
|
6
|
-
/** Lines of text, each one a submobject of its glyphs: Manim's `Paragraph`. */
|
|
7
|
-
export class ParagraphMobject extends Mobject {
|
|
8
|
-
/** The alignment of each line: `"left"`, `"center"`, `"right"` or undefined. */
|
|
9
|
-
linesAlignments;
|
|
10
|
-
constructor(handle, alignments) {
|
|
11
|
-
super(handle);
|
|
12
|
-
this.linesAlignments = alignments;
|
|
13
|
-
}
|
|
14
|
-
/** The lines (Manim `chars`): line `i` is a VGroup of its glyphs. */
|
|
15
|
-
get chars() {
|
|
16
|
-
return VGroup(this.submobjects);
|
|
17
|
-
}
|
|
18
|
-
copy() {
|
|
19
|
-
return new ParagraphMobject(raw(this).copy(), [...this.linesAlignments]);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
/** Manim's `Paragraph(...text, { lineSpacing, alignment })`: each argument is a line, with the
|
|
23
|
-
* options of `Text`. `alignment` is `"left"`, `"center"` or `"right"`. */
|
|
24
|
-
export function Paragraph(...args) {
|
|
25
|
-
const [lines, o = {}] = split(args);
|
|
26
|
-
const { alignment, ...textOptions } = o;
|
|
27
|
-
if (alignment !== undefined && !["left", "center", "right"].includes(alignment)) {
|
|
28
|
-
wrong("Paragraph", `alignment must be "left", "center" or "right"; got ${JSON.stringify(alignment)}`);
|
|
29
|
-
}
|
|
30
|
-
const text = lines.join("\n");
|
|
31
|
-
const glyphs = Text(text, textOptions).submobjects;
|
|
32
|
-
let next = 0;
|
|
33
|
-
const groups = text.split("\n").map((line) => {
|
|
34
|
-
const count = Array.from(line).filter((c) => !/\s/.test(c)).length;
|
|
35
|
-
const group = VGroup(glyphs.slice(next, next + count));
|
|
36
|
-
next += count;
|
|
37
|
-
return group;
|
|
38
|
-
});
|
|
39
|
-
const p = new ParagraphMobject(engine.vGroup(groups.map(raw)), groups.map(() => alignment));
|
|
40
|
-
p.moveTo(ORIGIN);
|
|
41
|
-
if (alignment !== undefined) {
|
|
42
|
-
const [x0, x1, cx] = [p.left(), p.right(), p.getX()];
|
|
43
|
-
for (const g of groups) {
|
|
44
|
-
if (!g.hasPoints() && g.length === 0)
|
|
45
|
-
continue;
|
|
46
|
-
if (alignment === "center")
|
|
47
|
-
g.setX(cx);
|
|
48
|
-
else if (alignment === "left")
|
|
49
|
-
g.shift([x0 - g.left(), 0]);
|
|
50
|
-
else
|
|
51
|
-
g.shift([x1 - g.right(), 0]);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return p;
|
|
55
|
-
}
|
|
56
|
-
const ENTITIES = { lt: "<", gt: ">", amp: "&", quot: '"', apos: "'" };
|
|
57
|
-
/** The tags that MarkupText takes. */
|
|
58
|
-
const TAGS = new Set(["b", "i", "span", "gradient"]);
|
|
59
|
-
function markupColor(value) {
|
|
60
|
-
if (/^#[0-9a-fA-F]{6}$/.test(value))
|
|
61
|
-
return value.toUpperCase();
|
|
62
|
-
if (/^#[0-9a-fA-F]{3}$/.test(value)) {
|
|
63
|
-
return `#${Array.from(value.slice(1))
|
|
64
|
-
.map((c) => c + c)
|
|
65
|
-
.join("")}`.toUpperCase();
|
|
66
|
-
}
|
|
67
|
-
return wrong("MarkupText", `the colour ${JSON.stringify(value)} is not a hex colour`, "write it as #RRGGBB");
|
|
68
|
-
}
|
|
69
|
-
/** The plain text of Pango markup, with the keys of its tags as slices `"[start:end]"`. */
|
|
70
|
-
function parseMarkup(markup) {
|
|
71
|
-
const out = { text: "", t2c: [], t2w: [], t2s: [], t2g: [] };
|
|
72
|
-
let length = 0;
|
|
73
|
-
const open = [];
|
|
74
|
-
const slots = [];
|
|
75
|
-
const token = /<(\/?)([a-zA-Z]+)([^>]*)>|&(\w+);|[^<&]+|[<&]/g;
|
|
76
|
-
for (const m of markup.matchAll(token)) {
|
|
77
|
-
const [whole, close, tag, attrText, entity] = m;
|
|
78
|
-
if (tag !== undefined) {
|
|
79
|
-
const name = tag.toLowerCase();
|
|
80
|
-
if (!TAGS.has(name)) {
|
|
81
|
-
wrong("MarkupText", `the tag <${name}> is not available`, "use <b>, <i>, <span> or <gradient>");
|
|
82
|
-
}
|
|
83
|
-
if (close === "/") {
|
|
84
|
-
const top = open.pop();
|
|
85
|
-
if (top?.tag !== name)
|
|
86
|
-
wrong("MarkupText", `</${name}> closes no open <${name}>`);
|
|
87
|
-
const key = `[${String(top.start)}:${String(length)}]`;
|
|
88
|
-
const { attrs } = top;
|
|
89
|
-
slots[top.slot] = () => {
|
|
90
|
-
if (name === "b")
|
|
91
|
-
out.t2w.push([key, "BOLD"]);
|
|
92
|
-
if (name === "i")
|
|
93
|
-
out.t2s.push([key, "ITALIC"]);
|
|
94
|
-
if (name === "gradient")
|
|
95
|
-
out.t2g.push([key, [markupColor(attrs.from ?? ""), markupColor(attrs.to ?? "")]]);
|
|
96
|
-
if (name === "span") {
|
|
97
|
-
const color = attrs.foreground ?? attrs.fgcolor ?? attrs.color;
|
|
98
|
-
if (color !== undefined)
|
|
99
|
-
out.t2c.push([key, markupColor(color)]);
|
|
100
|
-
const weight = attrs.weight ?? attrs.font_weight;
|
|
101
|
-
if (weight !== undefined)
|
|
102
|
-
out.t2w.push([key, weight.toUpperCase()]);
|
|
103
|
-
const style = attrs.style ?? attrs.font_style;
|
|
104
|
-
if (style !== undefined)
|
|
105
|
-
out.t2s.push([key, style.toUpperCase()]);
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
const attrs = {};
|
|
111
|
-
for (const a of (attrText ?? "").matchAll(/(\w+)\s*=\s*(?:"([^"]*)"|'([^']*)')/g)) {
|
|
112
|
-
attrs[a[1] ?? ""] = a[2] ?? a[3] ?? "";
|
|
113
|
-
}
|
|
114
|
-
open.push({ tag: name, attrs, start: length, slot: slots.length });
|
|
115
|
-
slots.push(() => undefined);
|
|
116
|
-
}
|
|
117
|
-
continue;
|
|
118
|
-
}
|
|
119
|
-
const chunk = entity === undefined ? whole : (ENTITIES[entity] ?? wrong("MarkupText", `unknown entity &${entity};`));
|
|
120
|
-
out.text += chunk;
|
|
121
|
-
length += Array.from(chunk).length;
|
|
122
|
-
}
|
|
123
|
-
const unclosed = open.at(-1);
|
|
124
|
-
if (unclosed !== undefined)
|
|
125
|
-
wrong("MarkupText", `<${unclosed.tag}> is not closed`);
|
|
126
|
-
for (const f of slots)
|
|
127
|
-
f();
|
|
128
|
-
return out;
|
|
129
|
-
}
|
|
130
|
-
/** Text with Pango markup (Manim `MarkupText`): `<b>`, `<i>`, `<span foreground="#…" weight="…"
|
|
131
|
-
* style="…">` and Manim's `<gradient from="#…" to="#…">`. Its options are those of `Text`. */
|
|
132
|
-
export function MarkupText(text, opts = {}) {
|
|
133
|
-
const m = parseMarkup(text);
|
|
134
|
-
return Text(m.text, {
|
|
135
|
-
...opts,
|
|
136
|
-
t2c: Object.fromEntries(m.t2c),
|
|
137
|
-
t2w: Object.fromEntries(m.t2w),
|
|
138
|
-
t2s: Object.fromEntries(m.t2s),
|
|
139
|
-
t2g: Object.fromEntries(m.t2g),
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
/** A `Tex` list (Manim `BulletedList`): each item is a part with a dot before it, and the parts
|
|
143
|
-
* go down, left-aligned. */
|
|
144
|
-
export class BulletedListMobject extends MathTexMobject {
|
|
145
|
-
/** Sets the fill opacity of every part to `opacity`, except the part at the index or with the
|
|
146
|
-
* LaTeX, which is opaque (Manim `fade_all_but`). */
|
|
147
|
-
fadeAllBut(indexOrString, opacity = 0.5) {
|
|
148
|
-
const parts = this.submobjects;
|
|
149
|
-
const part = typeof indexOrString === "number" ? parts.at(indexOrString) : this.getPartByTex(indexOrString);
|
|
150
|
-
if (part === undefined)
|
|
151
|
-
wrong("fadeAllBut", `no part is ${JSON.stringify(indexOrString)}`);
|
|
152
|
-
for (const other of parts)
|
|
153
|
-
other.setFill({ opacity: other === part ? 1 : opacity });
|
|
154
|
-
return this;
|
|
155
|
-
}
|
|
156
|
-
copy() {
|
|
157
|
-
return new BulletedListMobject(raw(this).copy(), this.texStrings, this.texString);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
/** Manim's `BulletedList(...items, { buff, dotScaleFactor, dotBuff })`. */
|
|
161
|
-
export function BulletedList(...args) {
|
|
162
|
-
const [items, o = {}] = split(args);
|
|
163
|
-
const { buff = MED_LARGE_BUFF, dotScaleFactor = 2, dotBuff = SMALL_BUFF, ...tex } = o;
|
|
164
|
-
const list = Tex(...items, tex);
|
|
165
|
-
for (const part of list.submobjects) {
|
|
166
|
-
const first = part.submobjects[0] ?? part;
|
|
167
|
-
const dot = MathTex("\\cdot").scale(dotScaleFactor).nextTo(first, LEFT, { buff: dotBuff });
|
|
168
|
-
const glyphs = part.submobjects;
|
|
169
|
-
part.remove(...glyphs);
|
|
170
|
-
part.add(dot, ...glyphs);
|
|
171
|
-
}
|
|
172
|
-
list.arrange(DOWN, { alignedEdge: LEFT, buff });
|
|
173
|
-
return new BulletedListMobject(raw(list).copy(), list.texStrings, list.texString);
|
|
174
|
-
}
|
|
175
|
-
/** A `Tex` at the top edge with a line under it (Manim `Title`). The line is as wide as the
|
|
176
|
-
* frame minus 2, or as the text with `matchUnderlineWidthToText`. */
|
|
177
|
-
export function Title(...args) {
|
|
178
|
-
const [parts, o = {}] = split(args);
|
|
179
|
-
const { includeUnderline = true, matchUnderlineWidthToText = false, underlineBuff = MED_SMALL_BUFF, ...tex } = o;
|
|
180
|
-
const title = Tex(...parts, tex).toEdge(UP);
|
|
181
|
-
if (includeUnderline) {
|
|
182
|
-
const underline = Line(LEFT, RIGHT).nextTo(title, DOWN, { buff: underlineBuff });
|
|
183
|
-
if (matchUnderlineWidthToText)
|
|
184
|
-
underline.stretchToFitWidth(title.width);
|
|
185
|
-
else
|
|
186
|
-
underline.width = FRAME_WIDTH - 2;
|
|
187
|
-
title.add(underline);
|
|
188
|
-
}
|
|
189
|
-
return new TitleMobject(raw(title).copy(), title.texStrings, title.texString, includeUnderline);
|
|
190
|
-
}
|
|
191
|
-
/** A title: Manim's `Title`. */
|
|
192
|
-
export class TitleMobject extends MathTexMobject {
|
|
193
|
-
#underlined;
|
|
194
|
-
constructor(handle, texStrings, texString, underlined) {
|
|
195
|
-
super(handle, texStrings, texString);
|
|
196
|
-
this.#underlined = underlined;
|
|
197
|
-
}
|
|
198
|
-
/** The line under the text (Manim `underline`), or undefined without one. */
|
|
199
|
-
get underline() {
|
|
200
|
-
return this.#underlined ? this.submobjects.at(-1) : undefined;
|
|
201
|
-
}
|
|
202
|
-
copy() {
|
|
203
|
-
return new TitleMobject(raw(this).copy(), this.texStrings, this.texString, this.#underlined);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
/** One LaTeX string in math mode as one part (Manim `SingleStringMathTex`). */
|
|
207
|
-
export function SingleStringMathTex(texString, opts = {}) {
|
|
208
|
-
const { strokeWidth = 0, height, organizeLeftToRight = false, fontSize, color } = opts;
|
|
209
|
-
const f = MathTex(`{{${texString}}}`, {
|
|
210
|
-
...(fontSize === undefined ? {} : { fontSize }),
|
|
211
|
-
...(color === undefined ? {} : { color }),
|
|
212
|
-
});
|
|
213
|
-
if (strokeWidth !== 0)
|
|
214
|
-
f.setStroke({ width: strokeWidth });
|
|
215
|
-
if (organizeLeftToRight) {
|
|
216
|
-
for (const part of f.submobjects) {
|
|
217
|
-
const glyphs = part.submobjects.toSorted((a, b) => a.getX() - b.getX());
|
|
218
|
-
part.remove(...glyphs);
|
|
219
|
-
part.add(...glyphs);
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
if (height !== undefined)
|
|
223
|
-
f.scaleToFitHeight(height);
|
|
224
|
-
return f;
|
|
225
|
-
}
|
package/dist/text.d.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { type Lexicon } from "./lexicon.ts";
|
|
2
|
-
import type { Diagnostic, Location, ChapterText } from "./generated/interfaces/aula-engine-types.js";
|
|
3
|
-
import type { Narration, ParagraphFrames, SayPart, ScriptCue, SpokenCue, UnclearWord } from "./generated/interfaces/aula-engine-engine.js";
|
|
4
|
-
export type { Diagnostic, Location, ChapterText };
|
|
5
|
-
export type { Embed, EmbedKind, Frame, Move, ParagraphText, Related, Say, Severity, } from "./generated/interfaces/aula-engine-types.js";
|
|
6
|
-
export type { CueKind, Narration, NarrationCue, NarrationWait, NarrationWord, ParagraphFrames, PlayedEmbed, SayPart, ScriptCue, SpokenCue, UnclearKind, UnclearWord, } from "./generated/interfaces/aula-engine-engine.js";
|
|
7
|
-
export type { Theme } from "./theme.ts";
|
|
8
|
-
export type { Lexicon } from "./lexicon.ts";
|
|
9
|
-
/** `# <title>` and each chapter's Markdown, with the chapter line of each heading and paragraph:
|
|
10
|
-
* for people to read. */
|
|
11
|
-
export declare function scriptMarkdown(title: string, texts: readonly ChapterText[]): string;
|
|
12
|
-
/** The narration script, one list of cues for each chapter: the title card (the title), then
|
|
13
|
-
* each chapter (its heading and paragraphs). `project` is the project (`defineProject`), or its
|
|
14
|
-
* title, the parts of its title and its lexicon. The spoken text of the title has the readings of
|
|
15
|
-
* its `pronounce` words and of the project lexicon, as each `say` of `texts` has; without
|
|
16
|
-
* `titleParts`, the title is one plain part. The spoken text of each heading is the
|
|
17
|
-
* `headingSpoken` of its chapter text. The CLI and the browser make the script with this call. */
|
|
18
|
-
export declare function narrationScript(project: {
|
|
19
|
-
readonly title: string;
|
|
20
|
-
readonly titleParts?: readonly SayPart[];
|
|
21
|
-
readonly lexicon?: Lexicon;
|
|
22
|
-
}, texts: readonly ChapterText[]): ScriptCue[][];
|
|
23
|
-
/** The narration of a chapter from its script `cues` and the speech of each cue (`spoken[i]`
|
|
24
|
-
* speaks the `words` of `cues[i]`, and has the start of each of them), at `sampleRate`. The
|
|
25
|
-
* caller puts the samples of each speech at the `speechStartFrame` of its cue. A speech with
|
|
26
|
-
* another number of starts than the words of its cue is an error. */
|
|
27
|
-
export declare function chapterNarration(cues: readonly ScriptCue[], spoken: readonly SpokenCue[], sampleRate: number): Narration;
|
|
28
|
-
/** The engine's rules on the text of a chapter. */
|
|
29
|
-
export declare function check(text: ChapterText): Diagnostic[];
|
|
30
|
-
/** Each say and move of a chapter with its line and second, on `narration`: the narration on
|
|
31
|
-
* the clock of the picture (`ChapterRun.narration`), so the waits are in it. */
|
|
32
|
-
export declare function timeline(narration: Narration, text: ChapterText): string[];
|
|
33
|
-
/** The frames of each paragraph of a chapter, in order, up to the last narrated one: where it
|
|
34
|
-
* starts (its cue start, the lead-in included) and where each of its moves starts, on the
|
|
35
|
-
* engine's frame grid. */
|
|
36
|
-
export declare function moveFrames(narration: Narration, text: ChapterText): ParagraphFrames[];
|
|
37
|
-
/** The narration of a chapter estimated from its script cues. */
|
|
38
|
-
export declare function estimateNarration(cues: readonly ScriptCue[]): Narration;
|
|
39
|
-
/** The words of a narration text, as the engine splits them: its runs with no space, with
|
|
40
|
-
* misaki's inline form as a part of one word. The engine's one word splitter: a cue of the
|
|
41
|
-
* script has its words already (`ScriptCue.words`). */
|
|
42
|
-
export declare function words(text: string): string[];
|
|
43
|
-
/** The index of the paragraph that holds chapter line `line`. */
|
|
44
|
-
export declare function paragraphAt(text: ChapterText, line: number): number | undefined;
|
|
45
|
-
/** The phonemes of English text as Kokoro's British voices read it: the project lexicon
|
|
46
|
-
* `lexicon` (`defineProject({ lexicon })`), aula's pronunciation lexicon, then misaki 0.9.4's
|
|
47
|
-
* British G2P (crates/aula-g2p), with eSpeak NG for the words that its dictionaries do not
|
|
48
|
-
* have. The same on every run, in Node and in the browser. Test a reading of the project
|
|
49
|
-
* lexicon with it before the narration. An entry with a problem (`checkLexicon`) is left out.
|
|
50
|
-
* Throws where misaki raises an error. */
|
|
51
|
-
export declare function phonemize(text: string, lexicon?: Lexicon): string;
|
|
52
|
-
/** The words of one narration text whose reading is not clear, in the order of the text: each
|
|
53
|
-
* use. `given` is the words of a script cue (`ScriptCue.words`), or the `words` of a plain text.
|
|
54
|
-
* A word is `ambiguous` when the context decides its reading and aula's lexicon gives it one
|
|
55
|
-
* reading (`sin`, `GB`, `3:00`): `reading` is that reading in words. A word is `unknown` when no
|
|
56
|
-
* dictionary has it, so eSpeak NG guesses it: `reading` is the phonemes of the word alone. A
|
|
57
|
-
* word that `pronounce` or the project lexicon decides is never in the list. `aula check` gives
|
|
58
|
-
* a note for each word. */
|
|
59
|
-
export declare function unclearWords(given: readonly string[]): UnclearWord[];
|
|
60
|
-
/** The one plain-text form of a diagnostic. */
|
|
61
|
-
export declare function renderDiagnostic(d: Diagnostic): string;
|
package/dist/text.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
// The engine's pure text rules (crates/aula-project): script, narration script, check,
|
|
2
|
-
// timeline, narration estimate, and the one diagnostic text format.
|
|
3
|
-
import { engine } from "./load.js";
|
|
4
|
-
import { lexiconEntries } from "./lexicon.js";
|
|
5
|
-
/** `# <title>` and each chapter's Markdown, with the chapter line of each heading and paragraph:
|
|
6
|
-
* for people to read. */
|
|
7
|
-
export function scriptMarkdown(title, texts) {
|
|
8
|
-
return engine.scriptMarkdown(title, [...texts]);
|
|
9
|
-
}
|
|
10
|
-
/** The narration script, one list of cues for each chapter: the title card (the title), then
|
|
11
|
-
* each chapter (its heading and paragraphs). `project` is the project (`defineProject`), or its
|
|
12
|
-
* title, the parts of its title and its lexicon. The spoken text of the title has the readings of
|
|
13
|
-
* its `pronounce` words and of the project lexicon, as each `say` of `texts` has; without
|
|
14
|
-
* `titleParts`, the title is one plain part. The spoken text of each heading is the
|
|
15
|
-
* `headingSpoken` of its chapter text. The CLI and the browser make the script with this call. */
|
|
16
|
-
export function narrationScript(project, texts) {
|
|
17
|
-
const title = project.titleParts ?? [{ text: project.title }];
|
|
18
|
-
return engine.narrationScript([...title], lexiconEntries(project.lexicon ?? {}), [...texts]);
|
|
19
|
-
}
|
|
20
|
-
/** The narration of a chapter from its script `cues` and the speech of each cue (`spoken[i]`
|
|
21
|
-
* speaks the `words` of `cues[i]`, and has the start of each of them), at `sampleRate`. The
|
|
22
|
-
* caller puts the samples of each speech at the `speechStartFrame` of its cue. A speech with
|
|
23
|
-
* another number of starts than the words of its cue is an error. */
|
|
24
|
-
export function chapterNarration(cues, spoken, sampleRate) {
|
|
25
|
-
return engine.chapterNarration([...cues], [...spoken], sampleRate);
|
|
26
|
-
}
|
|
27
|
-
/** The engine's rules on the text of a chapter. */
|
|
28
|
-
export function check(text) {
|
|
29
|
-
return engine.check(text);
|
|
30
|
-
}
|
|
31
|
-
/** Each say and move of a chapter with its line and second, on `narration`: the narration on
|
|
32
|
-
* the clock of the picture (`ChapterRun.narration`), so the waits are in it. */
|
|
33
|
-
export function timeline(narration, text) {
|
|
34
|
-
return engine.timeline(narration, text);
|
|
35
|
-
}
|
|
36
|
-
/** The frames of each paragraph of a chapter, in order, up to the last narrated one: where it
|
|
37
|
-
* starts (its cue start, the lead-in included) and where each of its moves starts, on the
|
|
38
|
-
* engine's frame grid. */
|
|
39
|
-
export function moveFrames(narration, text) {
|
|
40
|
-
return engine.moveFrames(narration, text);
|
|
41
|
-
}
|
|
42
|
-
/** The narration of a chapter estimated from its script cues. */
|
|
43
|
-
export function estimateNarration(cues) {
|
|
44
|
-
return engine.estimateNarration([...cues]);
|
|
45
|
-
}
|
|
46
|
-
/** The words of a narration text, as the engine splits them: its runs with no space, with
|
|
47
|
-
* misaki's inline form as a part of one word. The engine's one word splitter: a cue of the
|
|
48
|
-
* script has its words already (`ScriptCue.words`). */
|
|
49
|
-
export function words(text) {
|
|
50
|
-
return engine.words(text);
|
|
51
|
-
}
|
|
52
|
-
/** The index of the paragraph that holds chapter line `line`. */
|
|
53
|
-
export function paragraphAt(text, line) {
|
|
54
|
-
return engine.paragraphAt(text, line);
|
|
55
|
-
}
|
|
56
|
-
/** The phonemes of English text as Kokoro's British voices read it: the project lexicon
|
|
57
|
-
* `lexicon` (`defineProject({ lexicon })`), aula's pronunciation lexicon, then misaki 0.9.4's
|
|
58
|
-
* British G2P (crates/aula-g2p), with eSpeak NG for the words that its dictionaries do not
|
|
59
|
-
* have. The same on every run, in Node and in the browser. Test a reading of the project
|
|
60
|
-
* lexicon with it before the narration. An entry with a problem (`checkLexicon`) is left out.
|
|
61
|
-
* Throws where misaki raises an error. */
|
|
62
|
-
export function phonemize(text, lexicon = {}) {
|
|
63
|
-
return engine.phonemize(text, lexiconEntries(lexicon));
|
|
64
|
-
}
|
|
65
|
-
/** The words of one narration text whose reading is not clear, in the order of the text: each
|
|
66
|
-
* use. `given` is the words of a script cue (`ScriptCue.words`), or the `words` of a plain text.
|
|
67
|
-
* A word is `ambiguous` when the context decides its reading and aula's lexicon gives it one
|
|
68
|
-
* reading (`sin`, `GB`, `3:00`): `reading` is that reading in words. A word is `unknown` when no
|
|
69
|
-
* dictionary has it, so eSpeak NG guesses it: `reading` is the phonemes of the word alone. A
|
|
70
|
-
* word that `pronounce` or the project lexicon decides is never in the list. `aula check` gives
|
|
71
|
-
* a note for each word. */
|
|
72
|
-
export function unclearWords(given) {
|
|
73
|
-
return engine.unclearWords([...given]);
|
|
74
|
-
}
|
|
75
|
-
/** The one plain-text form of a diagnostic. */
|
|
76
|
-
export function renderDiagnostic(d) {
|
|
77
|
-
return engine.renderDiagnostic(d);
|
|
78
|
-
}
|
package/dist/theme.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { Color } from "./engine.ts";
|
|
2
|
-
/** The colours and the text sizes of the chrome (the title card, the chapter cards and the docked
|
|
3
|
-
* heading), and the colour of the frame. A project gives it to `defineProject({ theme })`; the
|
|
4
|
-
* default is `m.theme`. The card reads it (`Heading.theme`). */
|
|
5
|
-
export interface Theme {
|
|
6
|
-
/** The colour of the frame. */
|
|
7
|
-
background: Color;
|
|
8
|
-
/** The big heading of the card. */
|
|
9
|
-
heading: Color;
|
|
10
|
-
/** The kicker and the rule of the card, and the docked chapter number. */
|
|
11
|
-
accent: Color;
|
|
12
|
-
/** The docked heading. */
|
|
13
|
-
docked: Color;
|
|
14
|
-
/** The font size of the big heading. */
|
|
15
|
-
headingSize: number;
|
|
16
|
-
/** The font size of the kicker above it. */
|
|
17
|
-
kickerSize: number;
|
|
18
|
-
/** The font size of the docked heading. */
|
|
19
|
-
dockedSize: number;
|
|
20
|
-
/** The font size of the docked chapter number. */
|
|
21
|
-
numberSize: number;
|
|
22
|
-
}
|
|
23
|
-
/** The default theme: light text on a dark frame, with an amber accent. A kit can spread it and
|
|
24
|
-
* give its own colours: `{ ...m.theme, background: BG }`. */
|
|
25
|
-
export declare const theme: Theme;
|
package/dist/theme.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/** The default theme: light text on a dark frame, with an amber accent. A kit can spread it and
|
|
2
|
-
* give its own colours: `{ ...m.theme, background: BG }`. */
|
|
3
|
-
export const theme = {
|
|
4
|
-
background: "#0F1318",
|
|
5
|
-
heading: "#ECE7DC",
|
|
6
|
-
accent: "#E9B04A",
|
|
7
|
-
docked: "#7E8A96",
|
|
8
|
-
headingSize: 52,
|
|
9
|
-
kickerSize: 20,
|
|
10
|
-
dockedSize: 24,
|
|
11
|
-
numberSize: 16,
|
|
12
|
-
};
|
package/dist/user-code.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { Either } from "./errors.ts";
|
|
2
|
-
/** Runs `f`, chapter or kit code: its value, or what it threw. */
|
|
3
|
-
export declare function runUserCode<T>(f: () => T): Either<unknown, T>;
|
|
4
|
-
/** Imports a user module with `load` (an `import()`): the module, or what the import threw. */
|
|
5
|
-
export declare function importUserModule<T>(load: () => Promise<T>): Promise<Either<unknown, T>>;
|
package/dist/user-code.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/** Runs `f`, chapter or kit code: its value, or what it threw. */
|
|
2
|
-
export function runUserCode(f) {
|
|
3
|
-
try {
|
|
4
|
-
const value = f();
|
|
5
|
-
return { _tag: "Right", right: value };
|
|
6
|
-
}
|
|
7
|
-
catch (e) {
|
|
8
|
-
return { _tag: "Left", left: e };
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
/** Imports a user module with `load` (an `import()`): the module, or what the import threw. */
|
|
12
|
-
export async function importUserModule(load) {
|
|
13
|
-
try {
|
|
14
|
-
const module = await load();
|
|
15
|
-
return { _tag: "Right", right: module };
|
|
16
|
-
}
|
|
17
|
-
catch (e) {
|
|
18
|
-
return { _tag: "Left", left: e };
|
|
19
|
-
}
|
|
20
|
-
}
|
package/dist/utils.d.ts
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import { type Point } from "./engine.ts";
|
|
2
|
-
/** The weights and slants of `Text` (Manim's Pango names). The house font has only `NORMAL`
|
|
3
|
-
* and `BOLD`: `Text` takes only those two. */
|
|
4
|
-
export declare const ITALIC = "ITALIC";
|
|
5
|
-
export declare const OBLIQUE = "OBLIQUE";
|
|
6
|
-
export declare const THIN = "THIN";
|
|
7
|
-
export declare const ULTRALIGHT = "ULTRALIGHT";
|
|
8
|
-
export declare const LIGHT = "LIGHT";
|
|
9
|
-
export declare const SEMILIGHT = "SEMILIGHT";
|
|
10
|
-
export declare const BOOK = "BOOK";
|
|
11
|
-
export declare const MEDIUM = "MEDIUM";
|
|
12
|
-
export declare const SEMIBOLD = "SEMIBOLD";
|
|
13
|
-
export declare const ULTRABOLD = "ULTRABOLD";
|
|
14
|
-
export declare const HEAVY = "HEAVY";
|
|
15
|
-
export declare const ULTRAHEAVY = "ULTRAHEAVY";
|
|
16
|
-
export declare const X_AXIS: Point;
|
|
17
|
-
export declare const Y_AXIS: Point;
|
|
18
|
-
/** Manim's `START_X` and `START_Y` (Manim CE does not use them either). */
|
|
19
|
-
export declare const START_X = 30;
|
|
20
|
-
export declare const START_Y = 20;
|
|
21
|
-
export declare const DEFAULT_DOT_RADIUS = 0.08;
|
|
22
|
-
export declare const DEFAULT_SMALL_DOT_RADIUS = 0.04;
|
|
23
|
-
export declare const DEFAULT_DASH_LENGTH = 0.05;
|
|
24
|
-
export declare const DEFAULT_ARROW_TIP_LENGTH = 0.35;
|
|
25
|
-
export declare const DEFAULT_MOBJECT_TO_EDGE_BUFFER = 0.5;
|
|
26
|
-
export declare const DEFAULT_MOBJECT_TO_MOBJECT_BUFFER = 0.25;
|
|
27
|
-
export declare const DEFAULT_POINTWISE_FUNCTION_RUN_TIME = 3;
|
|
28
|
-
export declare const DEFAULT_WAIT_TIME = 1;
|
|
29
|
-
export declare const DEFAULT_POINT_DENSITY_2D = 25;
|
|
30
|
-
export declare const DEFAULT_POINT_DENSITY_1D = 10;
|
|
31
|
-
export declare const DEFAULT_STROKE_WIDTH = 4;
|
|
32
|
-
export declare const DEFAULT_FONT_SIZE = 48;
|
|
33
|
-
export declare const SCALE_FACTOR_PER_FONT_POINT: number;
|
|
34
|
-
/** The corner styles of a stroke (Manim `LineJointType`). */
|
|
35
|
-
export declare const LineJointType: {
|
|
36
|
-
readonly AUTO: "AUTO";
|
|
37
|
-
readonly ROUND: "ROUND";
|
|
38
|
-
readonly BEVEL: "BEVEL";
|
|
39
|
-
readonly MITER: "MITER";
|
|
40
|
-
};
|
|
41
|
-
export type LineJointType = (typeof LineJointType)[keyof typeof LineJointType];
|
|
42
|
-
/** The end styles of a stroke (Manim `CapStyleType`). */
|
|
43
|
-
export declare const CapStyleType: {
|
|
44
|
-
readonly AUTO: "AUTO";
|
|
45
|
-
readonly ROUND: "ROUND";
|
|
46
|
-
readonly BUTT: "BUTT";
|
|
47
|
-
readonly SQUARE: "SQUARE";
|
|
48
|
-
};
|
|
49
|
-
export type CapStyleType = (typeof CapStyleType)[keyof typeof CapStyleType];
|
|
50
|
-
/** The `x` from `lowerBound` to `upperBound` where `f(x)` is `target`, to `tolerance`, for a
|
|
51
|
-
* monotonic `f`; undefined when the target is not between `f` of the bounds (Manim `None`). */
|
|
52
|
-
export declare function binarySearch(f: (x: number) => number, target: number, lowerBound: number, upperBound: number, tolerance?: number): number | undefined;
|
|
53
|
-
/** The binomial coefficient: the number of ways to choose `k` of `n`. */
|
|
54
|
-
export declare function choose(n: number, k: number): number;
|
|
55
|
-
/** `a`, limited to `minA` … `maxA`. */
|
|
56
|
-
export declare function clip<T extends number | string>(a: T, minA: T, maxA: T): T;
|
|
57
|
-
/** The logistic function `1 / (1 + e^-x)`. */
|
|
58
|
-
export declare function sigmoid(x: number): number;
|
|
59
|
-
/** The Bézier curve of the control points, as a function of `t` (Manim `bezier`). */
|
|
60
|
-
export declare function bezier(points: readonly Point[]): (t: number) => Point;
|
|
61
|
-
/** The control points of the part of the curve from `a` to `b` (Manim `partial_bezier_points`). */
|
|
62
|
-
export declare function partialBezierPoints(points: readonly Point[], a: number, b: number): Point[];
|
|
63
|
-
/** The control points of the two halves at `t`, one after the other (Manim `split_bezier`). */
|
|
64
|
-
export declare function splitBezier(points: readonly Point[], t: number): Point[];
|
|
65
|
-
/** The control points of `nDivisions` equal parts of the curve, one after the other (Manim
|
|
66
|
-
* `subdivide_bezier`). */
|
|
67
|
-
export declare function subdivideBezier(points: readonly Point[], nDivisions: number): Point[];
|
|
68
|
-
/** Splits the curves into `newNumberOfCurves` curves, the earlier curves first (Manim
|
|
69
|
-
* `bezier_remap`). */
|
|
70
|
-
export declare function bezierRemap(bezierTuples: readonly (readonly Point[])[], newNumberOfCurves: number): Point[][];
|
|
71
|
-
/** `start + (end - start) * alpha`, for numbers or points. */
|
|
72
|
-
export declare function interpolate(start: number, end: number, alpha: number): number;
|
|
73
|
-
export declare function interpolate(start: Point, end: Point, alpha: number): Point;
|
|
74
|
-
/** The integer part and the fraction of `interpolate(start, end, alpha)`; at the end it is
|
|
75
|
-
* `[end - 1, 1]`. */
|
|
76
|
-
export declare function integerInterpolate(start: number, end: number, alpha: number): [number, number];
|
|
77
|
-
/** The middle of two numbers or points. */
|
|
78
|
-
export declare function mid(start: number, end: number): number;
|
|
79
|
-
export declare function mid(start: Point, end: Point): Point;
|
|
80
|
-
/** The `alpha` that `interpolate(start, end, alpha)` maps to `value`; for points, on each axis. */
|
|
81
|
-
export declare function inverseInterpolate(start: number, end: number, value: number): number;
|
|
82
|
-
export declare function inverseInterpolate(start: Point, end: Point, value: Point): Point;
|
|
83
|
-
/** Maps `oldValue` from the range `oldStart` … `oldEnd` to the range `newStart` … `newEnd`. */
|
|
84
|
-
export declare function matchInterpolate(newStart: number, newEnd: number, oldStart: number, oldEnd: number, oldValue: number): number;
|
|
85
|
-
/** True when the last point is the first point, within Manim's tolerance. */
|
|
86
|
-
export declare function isClosed(points: readonly Point[]): boolean;
|
|
87
|
-
/** The handles of a smooth cubic spline through the anchors: `[firstHandles, secondHandles]`,
|
|
88
|
-
* one of each for each curve (Manim `get_smooth_cubic_bezier_handle_points`). A closed list of
|
|
89
|
-
* anchors gives a closed spline. */
|
|
90
|
-
export declare function getSmoothCubicBezierHandlePoints(anchors: readonly Point[]): [Point[], Point[]];
|
|
91
|
-
/** The proportions `t` from 0 to 1 where the curve of the control points passes through
|
|
92
|
-
* `point`, rounded to `roundTo` (Manim `proportions_along_bezier_curve_for_point`). */
|
|
93
|
-
export declare function proportionsAlongBezierCurveForPoint(point: Point, controlPoints: readonly Point[], roundTo?: number): number[];
|
|
94
|
-
/** True when the curve of the control points passes through `point`. */
|
|
95
|
-
export declare function pointLiesOnBezier(point: Point, controlPoints: readonly Point[], roundTo?: number): boolean;
|
|
96
|
-
/** How points move from `startPoints` to `endPoints` at `alpha` (Manim's path functions). */
|
|
97
|
-
export type PathFunc = (startPoints: readonly Point[], endPoints: readonly Point[], alpha: number) => Point[];
|
|
98
|
-
/** Points move on straight lines. */
|
|
99
|
-
export declare function straightPath(): PathFunc;
|
|
100
|
-
/** Points move on arcs of `arcAngle` (counter-clockwise for a positive angle). */
|
|
101
|
-
export declare function pathAlongArc(arcAngle: number): PathFunc;
|
|
102
|
-
/** Points move on half circles, clockwise. */
|
|
103
|
-
export declare function clockwisePath(): PathFunc;
|
|
104
|
-
/** Points move on half circles, counter-clockwise. */
|
|
105
|
-
export declare function counterclockwisePath(): PathFunc;
|
|
106
|
-
/** `vector` turned by `angle`, counter-clockwise. */
|
|
107
|
-
export declare function rotateVector(vector: Point, angle: number): Point;
|
|
108
|
-
/** A `dim` × `dim` matrix of 1 where `|row - col| < thickness`, else 0. */
|
|
109
|
-
export declare function thickDiagonal(dim: number, thickness?: number): number[][];
|
|
110
|
-
/** The 2 × 2 matrix that turns by `angle`, counter-clockwise. */
|
|
111
|
-
export declare function rotationAboutZ(angle: number): [[number, number], [number, number]];
|
|
112
|
-
/** The angle of `vector` from the x axis, from -π to π. */
|
|
113
|
-
export declare function angleOfVector(vector: Point): number;
|
|
114
|
-
/** The angle between two vectors, from 0 to π. */
|
|
115
|
-
export declare function angleBetweenVectors(v1: Point, v2: Point): number;
|
|
116
|
-
/** `vect` with length 1; a zero vector gives `fallBack`, or `[0, 0]`. */
|
|
117
|
-
export declare function normalize(vect: Point, fallBack?: Point): Point;
|
|
118
|
-
/** `n` vectors, `startVect` turned by each multiple of `TAU / n`. */
|
|
119
|
-
export declare function compassDirections(n?: number, startVect?: Point): Point[];
|
|
120
|
-
/** The vertices of a regular `n`-gon and its start angle: `[vertices, startAngle]`. The start
|
|
121
|
-
* angle is 0 for an even `n` and `TAU / 4` for an odd `n` by default. */
|
|
122
|
-
export declare function regularVertices(n: number, opts?: {
|
|
123
|
-
radius?: number;
|
|
124
|
-
startAngle?: number;
|
|
125
|
-
}): [Point[], number];
|
|
126
|
-
/** A complex number: `[re, im]`. */
|
|
127
|
-
export type Complex = readonly [number, number];
|
|
128
|
-
/** The point of a complex number. */
|
|
129
|
-
export declare function complexToR3(complexNum: Complex): Point;
|
|
130
|
-
/** The complex number of a point. */
|
|
131
|
-
export declare function R3ToComplex(point: Point): Complex;
|
|
132
|
-
/** A function of points from a function of complex numbers. */
|
|
133
|
-
export declare function complexFuncToR3Func(complexFunc: (z: Complex) => Complex): (p: Point) => Point;
|
|
134
|
-
/** The mean of the points. */
|
|
135
|
-
export declare function centerOfMass(points: readonly Point[]): Point;
|
|
136
|
-
export declare function midpoint(point1: Point, point2: Point): Point;
|
|
137
|
-
/** For each `i`, the point where the line through `p0s[i]` along `v0s[i]` meets the line through
|
|
138
|
-
* `p1s[i]` along `v1s[i]`. */
|
|
139
|
-
export declare function findIntersection(p0s: readonly Point[], v0s: readonly Point[], p1s: readonly Point[], v1s: readonly Point[], threshold?: number): Point[];
|
|
140
|
-
/** The point where the lines through `line1` and `line2` (each two points) meet. Parallel lines
|
|
141
|
-
* are an error. */
|
|
142
|
-
export declare function lineIntersection(line1: readonly [Point, Point], line2: readonly [Point, Point]): Point;
|
|
143
|
-
/** How many times the closed polygon of `points` goes around the origin, counter-clockwise. */
|
|
144
|
-
export declare function getWindingNumber(points: readonly Point[]): number;
|
|
145
|
-
/** The trapezoid sum of the points (Manim `shoelace`): positive for a clockwise path. */
|
|
146
|
-
export declare function shoelace(xY: readonly Point[]): number;
|
|
147
|
-
/** `"CW"` or `"CCW"`: the direction of the path of the points. */
|
|
148
|
-
export declare function shoelaceDirection(xY: readonly Point[]): "CW" | "CCW";
|
|
149
|
-
/** The z of the cross product of two vectors: `a.x * b.y - a.y * b.x`. */
|
|
150
|
-
export declare function cross2d(a: Point, b: Point): number;
|
|
151
|
-
/** Two points on the perpendicular bisector of the two points of `line`. */
|
|
152
|
-
export declare function perpendicularBisector(line: readonly [Point, Point]): [Point, Point];
|