danceflow-geometry 1.0.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/README.md +94 -0
- package/dist/bezier.d.ts +158 -0
- package/dist/centroid.d.ts +35 -0
- package/dist/circleArrangement.d.ts +139 -0
- package/dist/collision.d.ts +149 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +985 -0
- package/dist/lineArrangement.d.ts +92 -0
- package/dist/mirrorFlip.d.ts +159 -0
- package/dist/polygon.d.ts +76 -0
- package/dist/rotateFormation.d.ts +177 -0
- package/dist/spline.d.ts +98 -0
- package/dist/spreader.d.ts +62 -0
- package/dist/types.d.ts +98 -0
- package/package.json +36 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A 2D point with x and y coordinates
|
|
3
|
+
*/
|
|
4
|
+
export interface Point {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A dancer's position including facing direction
|
|
10
|
+
*/
|
|
11
|
+
export interface DancerPosition {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
facing: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Spread direction types
|
|
18
|
+
*/
|
|
19
|
+
export type SpreadDirection = 'radial' | 'horizontal' | 'vertical' | 'diagonal';
|
|
20
|
+
/**
|
|
21
|
+
* Options for the spread transformation
|
|
22
|
+
*/
|
|
23
|
+
export interface SpreadOptions {
|
|
24
|
+
direction: SpreadDirection;
|
|
25
|
+
scaleFactor: number;
|
|
26
|
+
center?: Point;
|
|
27
|
+
aspectRatio?: number;
|
|
28
|
+
angle?: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Line orientation types
|
|
32
|
+
*/
|
|
33
|
+
export type LineOrientation = 'horizontal' | 'vertical' | 'diagonal-45' | 'diagonal-135';
|
|
34
|
+
/**
|
|
35
|
+
* Options for line arrangement
|
|
36
|
+
*/
|
|
37
|
+
export interface LineArrangementOptions {
|
|
38
|
+
orientation: LineOrientation;
|
|
39
|
+
spacing?: number;
|
|
40
|
+
startPoint?: Point;
|
|
41
|
+
endPoint?: Point;
|
|
42
|
+
faceDirection?: 'auto' | 'forward' | 'backward' | 'center' | number;
|
|
43
|
+
lineLength?: number;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Arc preset types
|
|
47
|
+
*/
|
|
48
|
+
export type ArcPreset = 'full' | 'half' | 'quarter' | 'three-quarter' | 'custom';
|
|
49
|
+
/**
|
|
50
|
+
* Options for circle arrangement
|
|
51
|
+
*/
|
|
52
|
+
export interface CircleArrangementOptions {
|
|
53
|
+
preset?: ArcPreset;
|
|
54
|
+
arcAngle?: number;
|
|
55
|
+
startAngle?: number;
|
|
56
|
+
radius?: number;
|
|
57
|
+
center?: Point;
|
|
58
|
+
faceDirection?: 'center' | 'outward' | 'tangent' | 'counter-tangent' | number;
|
|
59
|
+
distributeEvenly?: boolean;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Options for rotation transformation
|
|
63
|
+
*/
|
|
64
|
+
export interface RotationOptions {
|
|
65
|
+
centerX: number;
|
|
66
|
+
centerY: number;
|
|
67
|
+
angle: number;
|
|
68
|
+
adjustFacing?: boolean;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Mirror axis types
|
|
72
|
+
*/
|
|
73
|
+
export type MirrorAxis = 'horizontal' | 'vertical';
|
|
74
|
+
/**
|
|
75
|
+
* Options for mirror/flip transformation
|
|
76
|
+
*/
|
|
77
|
+
export interface MirrorOptions {
|
|
78
|
+
axis: MirrorAxis;
|
|
79
|
+
axisPosition?: number;
|
|
80
|
+
center?: Point;
|
|
81
|
+
mirrorFacing?: boolean;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* A bezier curve control point
|
|
85
|
+
*/
|
|
86
|
+
export interface BezierControlPoint {
|
|
87
|
+
x: number;
|
|
88
|
+
y: number;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Bounding box for collision detection
|
|
92
|
+
*/
|
|
93
|
+
export interface BoundingBox {
|
|
94
|
+
minX: number;
|
|
95
|
+
minY: number;
|
|
96
|
+
maxX: number;
|
|
97
|
+
maxY: number;
|
|
98
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "danceflow-geometry",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Geometry algorithms for dance choreography - centroid, spreader, arrangement, collision",
|
|
5
|
+
"keywords": ["geometry", "choreography", "dance", "formation", "canvas", "2d"],
|
|
6
|
+
"author": "Niv Kabiri",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/nivkabiri/danceflow.git",
|
|
11
|
+
"directory": "packages/danceflow-geometry"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "./dist/index.cjs",
|
|
15
|
+
"module": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"import": "./dist/index.js",
|
|
21
|
+
"require": "./dist/index.cjs"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": ["dist", "README.md"],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "vite build && tsc --emitDeclarationOnly",
|
|
27
|
+
"prepublishOnly": "npm run build",
|
|
28
|
+
"test": "vitest run",
|
|
29
|
+
"test:watch": "vitest"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"vite": "^6.1.0",
|
|
33
|
+
"typescript": "^5.8.2",
|
|
34
|
+
"vitest": "^1.2.0"
|
|
35
|
+
}
|
|
36
|
+
}
|