pantograph2d 0.5.0 → 0.6.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/Diagram-ab93c8b7.cjs +11 -0
- package/dist/Diagram-ab93c8b7.cjs.map +1 -0
- package/dist/Diagram-d848c815.js +4252 -0
- package/dist/Diagram-d848c815.js.map +1 -0
- package/dist/draw-0f591ea4.cjs +2 -0
- package/dist/draw-0f591ea4.cjs.map +1 -0
- package/dist/draw-a830827a.js +288 -0
- package/dist/draw-a830827a.js.map +1 -0
- package/dist/pantograph/drawShape.cjs +1 -1
- package/dist/pantograph/drawShape.cjs.map +1 -1
- package/dist/pantograph/drawShape.js +13 -17
- package/dist/pantograph/drawShape.js.map +1 -1
- package/dist/pantograph/models.cjs +1 -1
- package/dist/pantograph/models.js +3 -3
- package/dist/pantograph.cjs +6 -6
- package/dist/pantograph.cjs.map +1 -1
- package/dist/pantograph.js +475 -334
- package/dist/pantograph.js.map +1 -1
- package/dist/types/algorithms/boolean/figureBooleans.d.ts +8 -0
- package/dist/types/algorithms/boolean/loopBooleans.d.ts +14 -0
- package/dist/types/algorithms/boolean/strandBoolean.d.ts +8 -0
- package/dist/types/algorithms/boolean/strandsBetweenIntersections.d.ts +4 -0
- package/dist/types/algorithms/distances/arcArcDistance.d.ts +2 -0
- package/dist/types/algorithms/distances/genericDistance.d.ts +6 -0
- package/dist/types/algorithms/distances/index.d.ts +2 -0
- package/dist/types/algorithms/distances/lineArcDistance.d.ts +3 -0
- package/dist/types/algorithms/distances/lineLineDistance.d.ts +2 -0
- package/dist/types/algorithms/filletSegments.d.ts +3 -0
- package/dist/types/algorithms/intersections/arcArcIntersection.d.ts +3 -0
- package/dist/types/algorithms/intersections/arcEllipseArcIntersection.d.ts +3 -0
- package/dist/types/algorithms/intersections/ellipseArcEllipseArcIntersection.d.ts +3 -0
- package/dist/types/algorithms/intersections/ellipseEllipseIntersection.d.ts +4 -0
- package/dist/types/algorithms/intersections/index.d.ts +8 -0
- package/dist/types/algorithms/intersections/lineArcIntersection.d.ts +4 -0
- package/dist/types/algorithms/intersections/lineEllipseArcIntersection.d.ts +4 -0
- package/dist/types/algorithms/intersections/lineLineIntersection.d.ts +28 -0
- package/dist/types/algorithms/intersections/rayIntersections.d.ts +3 -0
- package/dist/types/algorithms/offsets/offsetFigure.d.ts +4 -0
- package/dist/types/algorithms/offsets/offsetSegment.d.ts +12 -0
- package/dist/types/algorithms/offsets/offsetStroke.d.ts +9 -0
- package/dist/types/algorithms/optimisation/DiRect.d.ts +45 -0
- package/dist/types/algorithms/organiseLoops.d.ts +9 -0
- package/dist/types/algorithms/simplify.d.ts +3 -0
- package/dist/types/algorithms/solvers/solvePolynomials.d.ts +4 -0
- package/dist/types/algorithms/stitchSegments.d.ts +2 -0
- package/dist/types/api/drawShape.d.ts +2 -0
- package/dist/types/api/models.d.ts +1 -0
- package/dist/types/booleanOperations.d.ts +11 -0
- package/dist/types/definitions.d.ts +2 -0
- package/dist/types/draw.d.ts +47 -0
- package/dist/types/drawShape/drawCircle.d.ts +2 -0
- package/dist/types/drawShape/drawRect.d.ts +5 -0
- package/dist/types/export/json/exportJSON.d.ts +196 -0
- package/dist/types/export/json/jsonDiagram.d.ts +69 -0
- package/dist/types/export/json/jsonFigure.d.ts +66 -0
- package/dist/types/export/json/jsonLoop.d.ts +32 -0
- package/dist/types/export/json/jsonSegment.d.ts +29 -0
- package/dist/types/export/svg/exportSVG.d.ts +18 -0
- package/dist/types/export/svg/svgDiagram.d.ts +2 -0
- package/dist/types/export/svg/svgFigure.d.ts +2 -0
- package/dist/types/export/svg/svgLoop.d.ts +2 -0
- package/dist/types/export/svg/svgSegment.d.ts +2 -0
- package/dist/types/export/svg/svgStrand.d.ts +2 -0
- package/dist/types/export/svg/wrapSVG.d.ts +4 -0
- package/dist/types/import/json/importJSON.d.ts +7 -0
- package/dist/types/main.d.ts +12 -0
- package/dist/types/models/BoundingBox.d.ts +15 -0
- package/dist/types/models/Diagram.d.ts +25 -0
- package/dist/types/models/Figure.d.ts +23 -0
- package/dist/types/models/Loop.d.ts +18 -0
- package/dist/types/models/Strand.d.ts +10 -0
- package/dist/types/models/Stroke.d.ts +29 -0
- package/dist/types/models/TransformationMatrix.d.ts +31 -0
- package/dist/types/models/exports.d.ts +11 -0
- package/dist/types/models/segments/Arc.d.ts +52 -0
- package/dist/types/models/segments/EllipseArc.d.ts +70 -0
- package/dist/types/models/segments/Line.d.ts +32 -0
- package/dist/types/models/segments/Segment.d.ts +28 -0
- package/dist/types/models/utils/Transformable.d.ts +14 -0
- package/dist/types/offsetOperations.d.ts +8 -0
- package/dist/types/operations.d.ts +2 -0
- package/dist/types/utils/allCombinations.d.ts +2 -0
- package/dist/types/utils/allPairs.d.ts +1 -0
- package/dist/types/utils/angularDistance.d.ts +1 -0
- package/dist/types/utils/listOfFigures.d.ts +4 -0
- package/dist/types/utils/projectPointOnLine.d.ts +3 -0
- package/dist/types/utils/range.d.ts +1 -0
- package/dist/types/utils/removeDuplicatePoints.d.ts +2 -0
- package/dist/types/utils/unitAngle.d.ts +1 -0
- package/dist/types/utils/zip.d.ts +3 -0
- package/dist/types/vectorOperations.d.ts +23 -0
- package/package.json +29 -10
- package/dist/Diagram-9915ed5e.js +0 -1700
- package/dist/Diagram-9915ed5e.js.map +0 -1
- package/dist/Diagram-c2ca1c3b.cjs +0 -4
- package/dist/Diagram-c2ca1c3b.cjs.map +0 -1
- package/dist/draw-25b9ed64.cjs +0 -2
- package/dist/draw-25b9ed64.cjs.map +0 -1
- package/dist/draw-cd61ec6b.js +0 -256
- package/dist/draw-cd61ec6b.js.map +0 -1
- package/dist/drawShape.d.ts +0 -153
- package/dist/models.d.ts +0 -210
- package/dist/pantograph/drawShape.d.ts +0 -1
- package/dist/pantograph/models.d.ts +0 -1
- package/dist/pantograph.d.ts +0 -397
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { BoundingBox } from "./BoundingBox.js";
|
|
2
|
+
import { Vector } from "../definitions.js";
|
|
3
|
+
import { Segment } from "./segments/Segment.js";
|
|
4
|
+
import { TransformationMatrix } from "./TransformationMatrix.js";
|
|
5
|
+
import { Transformable } from "./utils/Transformable.js";
|
|
6
|
+
export type Stroke = AbstractStroke<any>;
|
|
7
|
+
export declare abstract class AbstractStroke<T extends AbstractStroke<T>> extends Transformable<T> {
|
|
8
|
+
readonly segments: Segment[];
|
|
9
|
+
abstract strokeType: string;
|
|
10
|
+
get repr(): string;
|
|
11
|
+
get info(): string;
|
|
12
|
+
constructor(segments: Segment[], { ignoreChecks }?: {
|
|
13
|
+
ignoreChecks?: boolean | undefined;
|
|
14
|
+
});
|
|
15
|
+
get firstPoint(): Vector;
|
|
16
|
+
get lastPoint(): Vector;
|
|
17
|
+
get segmentsCount(): number;
|
|
18
|
+
onStroke(point: Vector): boolean;
|
|
19
|
+
intersects(other: Stroke): boolean;
|
|
20
|
+
overlappingSegments(other: Stroke): Segment[];
|
|
21
|
+
private _boundingBox;
|
|
22
|
+
get boundingBox(): BoundingBox;
|
|
23
|
+
abstract reverse(): T;
|
|
24
|
+
abstract clone(): T;
|
|
25
|
+
abstract transform(matrix: TransformationMatrix): T;
|
|
26
|
+
abstract simplify(): T;
|
|
27
|
+
}
|
|
28
|
+
export declare function checkSelfIntersections(segments: Segment[], type?: string): void;
|
|
29
|
+
export declare function checkValidStroke(segments: Segment[], type?: string): void;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Vector } from "../definitions.js";
|
|
2
|
+
type Matrix = [
|
|
3
|
+
number,
|
|
4
|
+
number,
|
|
5
|
+
number,
|
|
6
|
+
number,
|
|
7
|
+
number,
|
|
8
|
+
number,
|
|
9
|
+
number,
|
|
10
|
+
number,
|
|
11
|
+
number
|
|
12
|
+
];
|
|
13
|
+
export declare class TransformationMatrix {
|
|
14
|
+
private _matrix;
|
|
15
|
+
constructor(matrix?: Matrix);
|
|
16
|
+
clone(): TransformationMatrix;
|
|
17
|
+
transpose(): TransformationMatrix;
|
|
18
|
+
inverse(): TransformationMatrix;
|
|
19
|
+
translate(x: number, y: number): TransformationMatrix;
|
|
20
|
+
rotate(angle: number, center?: Vector): TransformationMatrix;
|
|
21
|
+
mirrorX(): TransformationMatrix;
|
|
22
|
+
mirrorY(): TransformationMatrix;
|
|
23
|
+
mirrorLine(normal: Vector, point?: Vector): TransformationMatrix;
|
|
24
|
+
mirrorCenter(center?: Vector): TransformationMatrix;
|
|
25
|
+
scale(scalar: number, center?: Vector): TransformationMatrix;
|
|
26
|
+
transform(point: Vector): Vector;
|
|
27
|
+
transformAngle(angle: number): number;
|
|
28
|
+
keepsOrientation(): boolean;
|
|
29
|
+
scaleFactor(): number;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { Diagram } from "./Diagram.js";
|
|
2
|
+
export { Figure } from "./Figure.js";
|
|
3
|
+
export { Loop } from "./Loop.js";
|
|
4
|
+
export { Strand } from "./Strand.js";
|
|
5
|
+
export type { Stroke } from "./Stroke.js";
|
|
6
|
+
export { BoundingBox } from "./BoundingBox.js";
|
|
7
|
+
export { TransformationMatrix } from "./TransformationMatrix.js";
|
|
8
|
+
export { Line } from "./segments/Line.js";
|
|
9
|
+
export { Arc } from "./segments/Arc.js";
|
|
10
|
+
export type { Segment } from "./segments/Segment.js";
|
|
11
|
+
export { Transformable } from "./utils/Transformable.js";
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { BoundingBox } from "../BoundingBox.js";
|
|
2
|
+
import { Vector } from "../../definitions.js";
|
|
3
|
+
import { TransformationMatrix } from "../TransformationMatrix.js";
|
|
4
|
+
import { Segment, AbstractSegment } from "./Segment.js";
|
|
5
|
+
export declare class Arc extends AbstractSegment<Arc> {
|
|
6
|
+
segmentType: string;
|
|
7
|
+
readonly center: Vector;
|
|
8
|
+
readonly clockwise: boolean;
|
|
9
|
+
constructor(firstPoint: Vector, lastPoint: Vector, center: Vector, clockwise?: boolean, { ignoreChecks }?: {
|
|
10
|
+
ignoreChecks?: boolean | undefined;
|
|
11
|
+
});
|
|
12
|
+
get info(): string;
|
|
13
|
+
private _coefficients;
|
|
14
|
+
get coefficients(): {
|
|
15
|
+
x2: number;
|
|
16
|
+
xy: number;
|
|
17
|
+
y2: number;
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
c: number;
|
|
21
|
+
};
|
|
22
|
+
isValidParameter(t: number): boolean;
|
|
23
|
+
angleToParam(angle: number): number;
|
|
24
|
+
private _angularLength;
|
|
25
|
+
get angularLength(): number;
|
|
26
|
+
paramPoint(t: number): Vector;
|
|
27
|
+
pointToParam(point: Vector): number;
|
|
28
|
+
private _radius;
|
|
29
|
+
get radius(): number;
|
|
30
|
+
private _firstAngle;
|
|
31
|
+
get firstAngle(): number;
|
|
32
|
+
private _lastAngle;
|
|
33
|
+
get lastAngle(): number;
|
|
34
|
+
get length(): number;
|
|
35
|
+
get squareLength(): number;
|
|
36
|
+
get midPoint(): Vector;
|
|
37
|
+
isSame(other: Segment): boolean;
|
|
38
|
+
clone(): Arc;
|
|
39
|
+
reverse(): Arc;
|
|
40
|
+
private _boundingBox;
|
|
41
|
+
get boundingBox(): BoundingBox;
|
|
42
|
+
distanceFrom(point: Vector): number;
|
|
43
|
+
isOnSegment(point: Vector): boolean;
|
|
44
|
+
gradientAt(param: number): Vector;
|
|
45
|
+
tangentAt(point: Vector): Vector;
|
|
46
|
+
get tangentAtFirstPoint(): Vector;
|
|
47
|
+
get tangentAtLastPoint(): Vector;
|
|
48
|
+
splitAt(points: Vector | Vector[]): Arc[];
|
|
49
|
+
transform(matrix: TransformationMatrix): Arc;
|
|
50
|
+
}
|
|
51
|
+
export declare function threePointsArc(firstPoint: Vector, midPoint: Vector, lastPoint: Vector): Arc;
|
|
52
|
+
export declare function tangentArc(firstPoint: Vector, lastPoint: Vector, tangentAtFirstPoint: Vector): Arc;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { BoundingBox } from "../BoundingBox.js";
|
|
2
|
+
import { Vector } from "../../definitions.js";
|
|
3
|
+
import { TransformationMatrix } from "../TransformationMatrix.js";
|
|
4
|
+
import { AbstractSegment } from "./Segment.js";
|
|
5
|
+
import { Arc } from "./Arc.js";
|
|
6
|
+
export declare class EllipseArc extends AbstractSegment<EllipseArc> {
|
|
7
|
+
segmentType: string;
|
|
8
|
+
precision: number;
|
|
9
|
+
readonly majorRadius: number;
|
|
10
|
+
readonly minorRadius: number;
|
|
11
|
+
readonly center: Vector;
|
|
12
|
+
readonly tiltAngle: number;
|
|
13
|
+
readonly clockwise: boolean;
|
|
14
|
+
constructor(firstPoint: Vector, lastPoint: Vector, center: Vector, r0: number, r1: number, tiltAngle: number, clockwise?: boolean, { ignoreChecks, angleUnits, }?: {
|
|
15
|
+
ignoreChecks?: boolean;
|
|
16
|
+
angleUnits?: "deg" | "rad";
|
|
17
|
+
});
|
|
18
|
+
private _coefficients;
|
|
19
|
+
get coefficients(): {
|
|
20
|
+
x2: number;
|
|
21
|
+
xy: number;
|
|
22
|
+
y2: number;
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
c: number;
|
|
26
|
+
};
|
|
27
|
+
get info(): string;
|
|
28
|
+
reverse(): EllipseArc;
|
|
29
|
+
clone(): EllipseArc;
|
|
30
|
+
private computeEllipseExtrema;
|
|
31
|
+
private _boundingBox;
|
|
32
|
+
get boundingBox(): BoundingBox;
|
|
33
|
+
private _linearExentricity?;
|
|
34
|
+
get linearExentricity(): number;
|
|
35
|
+
private _exentricity?;
|
|
36
|
+
get exentricity(): number;
|
|
37
|
+
private _focals?;
|
|
38
|
+
get focals(): [Vector, Vector];
|
|
39
|
+
get majorAxis(): Vector;
|
|
40
|
+
paramPoint(t: number): Vector;
|
|
41
|
+
pointToParam(point: Vector): number;
|
|
42
|
+
get midPoint(): Vector;
|
|
43
|
+
isValidParameter(t: number): boolean;
|
|
44
|
+
isSame(other: EllipseArc): boolean;
|
|
45
|
+
pointTheta(point: Vector): number;
|
|
46
|
+
thetaToParam(angle: number): number;
|
|
47
|
+
private isPointOnEllipse;
|
|
48
|
+
isOnSegment(point: Vector): boolean;
|
|
49
|
+
distanceFrom(point: Vector): number;
|
|
50
|
+
private _ellipseReferenceFrameTransform;
|
|
51
|
+
get ellipseReferenceFrameTransform(): TransformationMatrix;
|
|
52
|
+
private _reverseEllipseReferenceFrameTransform;
|
|
53
|
+
get reverseEllipseReferenceFrameTransform(): TransformationMatrix;
|
|
54
|
+
private _rotateFromEllipseReferenceFrame;
|
|
55
|
+
get rotateFromEllipseReferenceFrame(): TransformationMatrix;
|
|
56
|
+
private _firstAngle;
|
|
57
|
+
get firstAngle(): number;
|
|
58
|
+
private _lastAngle;
|
|
59
|
+
get lastAngle(): number;
|
|
60
|
+
private _deltaAngle;
|
|
61
|
+
get deltaAngle(): number;
|
|
62
|
+
normalAt(point: Vector): Vector;
|
|
63
|
+
gradientAt(param: number): Vector;
|
|
64
|
+
tangentAt(point: Vector): Vector;
|
|
65
|
+
get tangentAtFirstPoint(): Vector;
|
|
66
|
+
get tangentAtLastPoint(): Vector;
|
|
67
|
+
transform(matrix: TransformationMatrix): EllipseArc;
|
|
68
|
+
splitAt(points: Vector | Vector[]): EllipseArc[];
|
|
69
|
+
}
|
|
70
|
+
export declare function svgEllipse(firstPoint: Vector, lastPoint: Vector, r0: number, r1: number, phi: number, fA: boolean, fS: boolean): EllipseArc | Arc;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { BoundingBox } from "../BoundingBox.js";
|
|
2
|
+
import { Vector } from "../../definitions.js";
|
|
3
|
+
import { TransformationMatrix } from "../TransformationMatrix.js";
|
|
4
|
+
import { Segment, AbstractSegment } from "./Segment.js";
|
|
5
|
+
export declare class Line extends AbstractSegment<Line> {
|
|
6
|
+
segmentType: string;
|
|
7
|
+
isValidParameter(t: number): boolean;
|
|
8
|
+
paramPoint(t: number): Vector;
|
|
9
|
+
get length(): number;
|
|
10
|
+
get squareLength(): number;
|
|
11
|
+
private _V;
|
|
12
|
+
get V(): Vector;
|
|
13
|
+
private _slope;
|
|
14
|
+
get slope(): number;
|
|
15
|
+
private _yIntercept;
|
|
16
|
+
get yIntercept(): number;
|
|
17
|
+
get midPoint(): Vector;
|
|
18
|
+
isSame(other: Segment): boolean;
|
|
19
|
+
clone(): Line;
|
|
20
|
+
reverse(): Line;
|
|
21
|
+
private _boundingBox;
|
|
22
|
+
get boundingBox(): BoundingBox;
|
|
23
|
+
distanceFrom(point: Vector): number;
|
|
24
|
+
isOnSegment(point: Vector): boolean;
|
|
25
|
+
gradientAt(param: number): Vector;
|
|
26
|
+
tangentAt(point: Vector): Vector;
|
|
27
|
+
get normalVector(): Vector;
|
|
28
|
+
get tangentAtFirstPoint(): Vector;
|
|
29
|
+
get tangentAtLastPoint(): Vector;
|
|
30
|
+
splitAt(points: Vector | Vector[]): Line[];
|
|
31
|
+
transform(matrix: TransformationMatrix): Line;
|
|
32
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Vector } from "../../definitions.js";
|
|
2
|
+
import { BoundingBox } from "../BoundingBox.js";
|
|
3
|
+
import type { TransformationMatrix } from "../TransformationMatrix.js";
|
|
4
|
+
import { Transformable } from "../utils/Transformable.js";
|
|
5
|
+
export type Segment = AbstractSegment<any>;
|
|
6
|
+
export declare abstract class AbstractSegment<T extends AbstractSegment<T>> extends Transformable<T> {
|
|
7
|
+
firstPoint: Vector;
|
|
8
|
+
lastPoint: Vector;
|
|
9
|
+
constructor(firstPoint: Vector, lastPoint: Vector);
|
|
10
|
+
readonly precision: number;
|
|
11
|
+
abstract segmentType: string;
|
|
12
|
+
get repr(): string;
|
|
13
|
+
get info(): string;
|
|
14
|
+
abstract get midPoint(): Vector;
|
|
15
|
+
abstract get boundingBox(): BoundingBox;
|
|
16
|
+
abstract clone(): T;
|
|
17
|
+
abstract reverse(): T;
|
|
18
|
+
abstract isSame(other: AbstractSegment<any>): boolean;
|
|
19
|
+
abstract distanceFrom(element: Vector): number;
|
|
20
|
+
abstract isOnSegment(point: Vector): boolean;
|
|
21
|
+
abstract gradientAt(param: number): Vector;
|
|
22
|
+
abstract tangentAt(point: Vector): Vector;
|
|
23
|
+
abstract get tangentAtFirstPoint(): Vector;
|
|
24
|
+
abstract get tangentAtLastPoint(): Vector;
|
|
25
|
+
abstract splitAt(points: Vector[] | number[]): T[];
|
|
26
|
+
abstract transform(matrix: TransformationMatrix): T;
|
|
27
|
+
abstract paramPoint(t: number): Vector;
|
|
28
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Vector } from "../../definitions.js";
|
|
2
|
+
import { TransformationMatrix } from "../TransformationMatrix.js";
|
|
3
|
+
export declare abstract class Transformable<T> {
|
|
4
|
+
abstract transform(matrix: TransformationMatrix): T;
|
|
5
|
+
translateX(x: number): T;
|
|
6
|
+
translateY(y: number): T;
|
|
7
|
+
translate(x: number, y: number): T;
|
|
8
|
+
translateTo([x, y]: Vector): T;
|
|
9
|
+
rotate(angle: number, center?: Vector): T;
|
|
10
|
+
scale(factor: number, center?: Vector): T;
|
|
11
|
+
mirrorCenter(center?: Vector): T;
|
|
12
|
+
mirror(axis?: "x" | "y"): T;
|
|
13
|
+
mirror(direction: Vector, center?: Vector): T;
|
|
14
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Strand } from "./models/Strand.js";
|
|
2
|
+
import { Diagram } from "./models/Diagram.js";
|
|
3
|
+
import { Figure } from "./models/Figure.js";
|
|
4
|
+
import { Loop } from "./models/Loop.js";
|
|
5
|
+
export declare function offset(shape: Diagram | Figure | Loop, offsetDistance: number): Diagram;
|
|
6
|
+
export declare function outlineStroke(shape: Diagram | Figure | Loop | Strand, outlineDistance: number, { endCap }?: {
|
|
7
|
+
endCap?: "butt" | "round";
|
|
8
|
+
}): Diagram;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function allPairs<S, T>(list1: T[], list2: S[]): [T, S][];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function angularDistance(angle1: number, angle2: number, clockwise: boolean, precision?: number): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function range(len: number): number[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function unitAngle(angle: number, precision?: number): number;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Vector } from "./definitions.js";
|
|
2
|
+
export declare const DEG2RAD: number;
|
|
3
|
+
export declare const RAD2DEG: number;
|
|
4
|
+
export declare const reprVector: (vector: Vector) => string;
|
|
5
|
+
export declare const sameVector: ([x0, y0]: Vector, [x1, y1]: Vector, precision?: number) => boolean;
|
|
6
|
+
export declare const add: ([x0, y0]: Vector, [x1, y1]: Vector) => Vector;
|
|
7
|
+
export declare const subtract: ([x0, y0]: Vector, [x1, y1]: Vector) => Vector;
|
|
8
|
+
export declare const squareLength: ([x, y]: Vector) => number;
|
|
9
|
+
export declare const length: ([x, y]: Vector) => number;
|
|
10
|
+
export declare const scalarMultiply: ([x0, y0]: Vector, scalar: number) => Vector;
|
|
11
|
+
export declare const squareDistance: ([x0, y0]: Vector, [x1, y1]?: Vector) => number;
|
|
12
|
+
export declare const distance: (p0: Vector, p1?: Vector) => number;
|
|
13
|
+
export declare function crossProduct([x0, y0]: Vector, [x1, y1]: Vector): number;
|
|
14
|
+
export declare function dotProduct([x0, y0]: Vector, [x1, y1]: Vector): number;
|
|
15
|
+
export declare const angle: ([x0, y0]: Vector, [x1, y1]?: Vector) => number;
|
|
16
|
+
export declare function normalize([x0, y0]: Vector): Vector;
|
|
17
|
+
export declare function polarToCartesian(r: number, theta: number): Vector;
|
|
18
|
+
export declare function polarAngle([x, y]: Vector): number;
|
|
19
|
+
export declare function cartesianToPolar(v: Vector): [number, number];
|
|
20
|
+
export declare function parallel(v1: Vector, v2: Vector, precision?: number): boolean;
|
|
21
|
+
export declare function perpendicular(v: Vector): Vector;
|
|
22
|
+
export declare function perpendicularClockwise(v: Vector): Vector;
|
|
23
|
+
export declare function isOnAxis(point: Vector, direction: Vector, center: Vector): boolean;
|
package/package.json
CHANGED
|
@@ -1,26 +1,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pantograph2d",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Pantograph, the pure JS 2D CAD library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/pantograph.cjs",
|
|
7
7
|
"module": "./dist/pantograph.js",
|
|
8
|
-
"types": "./dist/pantograph.d.ts",
|
|
9
8
|
"files": [
|
|
10
9
|
"dist"
|
|
11
10
|
],
|
|
11
|
+
"types": "./dist/types/main.d.ts",
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
14
|
-
"import":
|
|
15
|
-
|
|
14
|
+
"import": {
|
|
15
|
+
"default": "./dist/pantograph.js",
|
|
16
|
+
"types": "./dist/types/main.d.ts"
|
|
17
|
+
},
|
|
18
|
+
"require": {
|
|
19
|
+
"default": "./dist/pantograph.cjs",
|
|
20
|
+
"types": "./dist/types/main.d.ts"
|
|
21
|
+
}
|
|
16
22
|
},
|
|
17
23
|
"./models": {
|
|
18
|
-
"import":
|
|
19
|
-
|
|
24
|
+
"import": {
|
|
25
|
+
"default": "./dist/pantograph/models.js",
|
|
26
|
+
"types": "./dist/types/api/models.d.ts"
|
|
27
|
+
},
|
|
28
|
+
"require": {
|
|
29
|
+
"default": "./dist/pantograph/models.cjs",
|
|
30
|
+
"types": "./dist/types/api/drawShape.d.ts"
|
|
31
|
+
}
|
|
20
32
|
},
|
|
21
33
|
"./drawShape": {
|
|
22
|
-
"import":
|
|
23
|
-
|
|
34
|
+
"import": {
|
|
35
|
+
"default": "./dist/pantograph/drawShape.js",
|
|
36
|
+
"types": "./dist/types/api/drawShape.d.ts"
|
|
37
|
+
},
|
|
38
|
+
"require": {
|
|
39
|
+
"default": "./dist/pantograph/drawShape.cjs"
|
|
40
|
+
}
|
|
24
41
|
}
|
|
25
42
|
},
|
|
26
43
|
"scripts": {
|
|
@@ -37,6 +54,7 @@
|
|
|
37
54
|
"author": "Steve Genoud",
|
|
38
55
|
"license": "AGPL",
|
|
39
56
|
"devDependencies": {
|
|
57
|
+
"@microsoft/api-extractor": "^7.35.1",
|
|
40
58
|
"@types/node": "^18.15.5",
|
|
41
59
|
"@typescript-eslint/eslint-plugin": "^5.55.0",
|
|
42
60
|
"@typescript-eslint/parser": "^5.55.0",
|
|
@@ -48,10 +66,11 @@
|
|
|
48
66
|
"vite-plugin-dts": "^2.2.0",
|
|
49
67
|
"vitest": "^0.29.2"
|
|
50
68
|
},
|
|
51
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "f5ef0d6e05b349cbdf28fb22d4dc62c9dded7396",
|
|
52
70
|
"dependencies": {
|
|
53
71
|
"-": "^0.0.1",
|
|
54
72
|
"@types/flatbush": "^3.3.0",
|
|
55
|
-
"flatbush": "^4.1.0"
|
|
73
|
+
"flatbush": "^4.1.0",
|
|
74
|
+
"ml-matrix": "^6.10.4"
|
|
56
75
|
}
|
|
57
76
|
}
|