@khanacademy/kmath 0.1.24 → 0.3.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/angles.d.ts +6 -0
- package/dist/coefficients.d.ts +11 -0
- package/dist/es/index.js +10421 -17
- package/dist/es/index.js.map +1 -1
- package/dist/geometry.d.ts +29 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +10428 -16
- package/dist/index.js.map +1 -1
- package/dist/math.d.ts +29 -0
- package/dist/types.d.ts +2 -0
- package/package.json +2 -2
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A collection of geomtry-related utility functions
|
|
3
|
+
*/
|
|
4
|
+
import { type Coord } from "@khanacademy/perseus-core";
|
|
5
|
+
type Line = [Coord, Coord];
|
|
6
|
+
export type Range = [number, number];
|
|
7
|
+
export type SineCoefficient = [
|
|
8
|
+
number,
|
|
9
|
+
number,
|
|
10
|
+
number,
|
|
11
|
+
number
|
|
12
|
+
];
|
|
13
|
+
export declare function sign(val: number): 0 | 1 | -1;
|
|
14
|
+
export declare function ccw(a: Coord, b: Coord, c: Coord): number;
|
|
15
|
+
export declare function collinear(a: Coord, b: Coord, c: Coord): boolean;
|
|
16
|
+
export declare function intersects(ab: Line, cd: Line): boolean;
|
|
17
|
+
export declare function polygonSidesIntersect(vertices: Coord[]): boolean;
|
|
18
|
+
export declare function vector(a: any, b: any): number[];
|
|
19
|
+
export declare function reverseVector(vector: Coord): Coord;
|
|
20
|
+
export declare function clockwise(points: Coord[]): boolean;
|
|
21
|
+
export declare function magnitude(v: ReadonlyArray<Coord>): number;
|
|
22
|
+
export declare function angleMeasures(coords: ReadonlyArray<Coord>): ReadonlyArray<number>;
|
|
23
|
+
export declare function similar(coords1: ReadonlyArray<Coord>, coords2: ReadonlyArray<Coord>, tolerance: number): boolean;
|
|
24
|
+
export declare function lawOfCosines(a: number, b: number, c: number): number;
|
|
25
|
+
export declare function canonicalSineCoefficients([amplitude, angularFrequency, phase, verticalOffset,]: [any, any, any, any]): any[];
|
|
26
|
+
export declare function rotate<T>(array: ReadonlyArray<T>, n?: number): ReadonlyArray<T>;
|
|
27
|
+
export declare function getLineEquation(first: Coord, second: Coord): string;
|
|
28
|
+
export declare function getLineIntersection(firstPoints: ReadonlyArray<Coord>, secondPoints: ReadonlyArray<Coord>): string;
|
|
29
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -4,3 +4,10 @@ export * as vector from "./vector";
|
|
|
4
4
|
export * as point from "./point";
|
|
5
5
|
export * as line from "./line";
|
|
6
6
|
export * as ray from "./ray";
|
|
7
|
+
export * as angles from "./angles";
|
|
8
|
+
export * as geometry from "./geometry";
|
|
9
|
+
export * as coefficients from "./coefficients";
|
|
10
|
+
export { default as KhanMath, sum } from "./math";
|
|
11
|
+
export type { Range, SineCoefficient } from "./geometry";
|
|
12
|
+
export type { NamedSineCoefficient, QuadraticCoefficient } from "./coefficients";
|
|
13
|
+
export type * from "./types";
|