@nice2dev/spatial-core 1.0.10
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 +160 -0
- package/dist/bim/index.d.ts +366 -0
- package/dist/bim/index.d.ts.map +1 -0
- package/dist/bim/index.js +60 -0
- package/dist/bim/index.js.map +1 -0
- package/dist/cad/index.d.ts +329 -0
- package/dist/cad/index.d.ts.map +1 -0
- package/dist/cad/index.js +124 -0
- package/dist/cad/index.js.map +1 -0
- package/dist/ecad/index.d.ts +316 -0
- package/dist/ecad/index.d.ts.map +1 -0
- package/dist/ecad/index.js +11 -0
- package/dist/ecad/index.js.map +1 -0
- package/dist/export/index.d.ts +93 -0
- package/dist/export/index.d.ts.map +1 -0
- package/dist/export/index.js +522 -0
- package/dist/export/index.js.map +1 -0
- package/dist/floor-plan/index.d.ts +248 -0
- package/dist/floor-plan/index.d.ts.map +1 -0
- package/dist/floor-plan/index.js +228 -0
- package/dist/floor-plan/index.js.map +1 -0
- package/dist/grid/index.d.ts +160 -0
- package/dist/grid/index.d.ts.map +1 -0
- package/dist/grid/index.js +319 -0
- package/dist/grid/index.js.map +1 -0
- package/dist/import/import.worker.d.ts +28 -0
- package/dist/import/import.worker.d.ts.map +1 -0
- package/dist/import/import.worker.js +52 -0
- package/dist/import/import.worker.js.map +1 -0
- package/dist/import/index.d.ts +111 -0
- package/dist/import/index.d.ts.map +1 -0
- package/dist/import/index.js +1092 -0
- package/dist/import/index.js.map +1 -0
- package/dist/import/workerImport.d.ts +56 -0
- package/dist/import/workerImport.d.ts.map +1 -0
- package/dist/import/workerImport.js +207 -0
- package/dist/import/workerImport.js.map +1 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +86 -0
- package/dist/index.js.map +1 -0
- package/dist/interior/index.d.ts +241 -0
- package/dist/interior/index.d.ts.map +1 -0
- package/dist/interior/index.js +101 -0
- package/dist/interior/index.js.map +1 -0
- package/dist/measurement/index.d.ts +186 -0
- package/dist/measurement/index.d.ts.map +1 -0
- package/dist/measurement/index.js +400 -0
- package/dist/measurement/index.js.map +1 -0
- package/dist/objects/index.d.ts +288 -0
- package/dist/objects/index.d.ts.map +1 -0
- package/dist/objects/index.js +463 -0
- package/dist/objects/index.js.map +1 -0
- package/dist/serialization/index.d.ts +421 -0
- package/dist/serialization/index.d.ts.map +1 -0
- package/dist/serialization/index.js +412 -0
- package/dist/serialization/index.js.map +1 -0
- package/dist/topology/index.d.ts +252 -0
- package/dist/topology/index.d.ts.map +1 -0
- package/dist/topology/index.js +525 -0
- package/dist/topology/index.js.map +1 -0
- package/dist/transitions/index.d.ts +141 -0
- package/dist/transitions/index.d.ts.map +1 -0
- package/dist/transitions/index.js +160 -0
- package/dist/transitions/index.js.map +1 -0
- package/dist/unified/index.d.ts +225 -0
- package/dist/unified/index.d.ts.map +1 -0
- package/dist/unified/index.js +474 -0
- package/dist/unified/index.js.map +1 -0
- package/dist/virtualization/QuadTree.d.ts +68 -0
- package/dist/virtualization/QuadTree.d.ts.map +1 -0
- package/dist/virtualization/QuadTree.js +228 -0
- package/dist/virtualization/QuadTree.js.map +1 -0
- package/dist/virtualization/ViewportCulling.d.ts +92 -0
- package/dist/virtualization/ViewportCulling.d.ts.map +1 -0
- package/dist/virtualization/ViewportCulling.js +123 -0
- package/dist/virtualization/ViewportCulling.js.map +1 -0
- package/dist/virtualization/index.d.ts +9 -0
- package/dist/virtualization/index.d.ts.map +1 -0
- package/dist/virtualization/index.js +9 -0
- package/dist/virtualization/index.js.map +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interior Design — Furniture, decoration, lighting, materials,
|
|
3
|
+
* room planner, shopping, budget, styles, colors, mood boards,
|
|
4
|
+
* feng shui, ergonomics, accessibility.
|
|
5
|
+
*
|
|
6
|
+
* PRO-2.5 — 15 items
|
|
7
|
+
*
|
|
8
|
+
* @module @nice2dev/spatial-core/interior
|
|
9
|
+
*/
|
|
10
|
+
export type FurnitureCategory = 'seating' | 'table' | 'storage' | 'bed' | 'desk' | 'shelf' | 'wardrobe' | 'sofa' | 'cabinet' | 'lighting' | 'rug' | 'mirror' | 'curtain' | 'appliance' | 'bathroom' | 'kitchen' | 'outdoor' | 'decoration';
|
|
11
|
+
export interface CatalogFurnitureItem {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
category: FurnitureCategory;
|
|
15
|
+
/** Dimensions in mm */
|
|
16
|
+
width: number;
|
|
17
|
+
depth: number;
|
|
18
|
+
height: number;
|
|
19
|
+
/** 3D model reference */
|
|
20
|
+
modelUrl?: string;
|
|
21
|
+
/** Thumbnail */
|
|
22
|
+
thumbnailUrl?: string;
|
|
23
|
+
brand?: string;
|
|
24
|
+
sku?: string;
|
|
25
|
+
price?: number;
|
|
26
|
+
currency?: string;
|
|
27
|
+
/** Material tags */
|
|
28
|
+
materials: string[];
|
|
29
|
+
colors: string[];
|
|
30
|
+
/** Weight in kg */
|
|
31
|
+
weight?: number;
|
|
32
|
+
/** Parametric — can user adjust dimensions? */
|
|
33
|
+
parametric?: boolean;
|
|
34
|
+
tags: string[];
|
|
35
|
+
}
|
|
36
|
+
export type DecorationTarget = 'wall' | 'floor' | 'ceiling';
|
|
37
|
+
export type DecorationKind = 'paint' | 'wallpaper' | 'tile' | 'panel' | 'carpet' | 'hardwood' | 'laminate' | 'vinyl' | 'stone' | 'plaster' | 'brick';
|
|
38
|
+
export interface DecorationOption {
|
|
39
|
+
id: string;
|
|
40
|
+
target: DecorationTarget;
|
|
41
|
+
kind: DecorationKind;
|
|
42
|
+
name: string;
|
|
43
|
+
color?: string;
|
|
44
|
+
/** Seamless texture URL */
|
|
45
|
+
textureUrl?: string;
|
|
46
|
+
/** Price per m² */
|
|
47
|
+
pricePerSqm?: number;
|
|
48
|
+
brand?: string;
|
|
49
|
+
}
|
|
50
|
+
export type LightType = 'point' | 'spot' | 'directional' | 'area' | 'strip' | 'natural';
|
|
51
|
+
export interface LightFixture {
|
|
52
|
+
id: string;
|
|
53
|
+
name: string;
|
|
54
|
+
type: LightType;
|
|
55
|
+
/** Lumens */
|
|
56
|
+
brightness: number;
|
|
57
|
+
/** Kelvin */
|
|
58
|
+
colorTemperature: number;
|
|
59
|
+
/** Beam angle (degrees, for spot) */
|
|
60
|
+
beamAngle?: number;
|
|
61
|
+
/** Wattage */
|
|
62
|
+
wattage: number;
|
|
63
|
+
/** IES profile URL */
|
|
64
|
+
iesUrl?: string;
|
|
65
|
+
/** Dimmable? */
|
|
66
|
+
dimmable: boolean;
|
|
67
|
+
/** Position in room */
|
|
68
|
+
position: {
|
|
69
|
+
x: number;
|
|
70
|
+
y: number;
|
|
71
|
+
z: number;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
export interface LightingSimulation {
|
|
75
|
+
roomId: string;
|
|
76
|
+
fixtures: LightFixture[];
|
|
77
|
+
/** Lux values at floor level sampled on a grid */
|
|
78
|
+
luxGrid: {
|
|
79
|
+
cols: number;
|
|
80
|
+
rows: number;
|
|
81
|
+
values: number[];
|
|
82
|
+
};
|
|
83
|
+
averageLux: number;
|
|
84
|
+
minLux: number;
|
|
85
|
+
maxLux: number;
|
|
86
|
+
}
|
|
87
|
+
export type InteriorMaterialCategory = 'fabric' | 'wood' | 'metal' | 'stone' | 'glass' | 'plastic' | 'ceramic' | 'leather' | 'composite';
|
|
88
|
+
export interface MaterialSwatch {
|
|
89
|
+
id: string;
|
|
90
|
+
name: string;
|
|
91
|
+
category: InteriorMaterialCategory;
|
|
92
|
+
color: string;
|
|
93
|
+
textureUrl?: string;
|
|
94
|
+
roughness: number;
|
|
95
|
+
metalness: number;
|
|
96
|
+
opacity: number;
|
|
97
|
+
}
|
|
98
|
+
export type InteriorRoomType = 'living' | 'bedroom' | 'kitchen' | 'bathroom' | 'office' | 'dining' | 'hallway' | 'laundry' | 'garage' | 'studio';
|
|
99
|
+
export interface LayoutSuggestion {
|
|
100
|
+
id: string;
|
|
101
|
+
score: number;
|
|
102
|
+
placements: Array<{
|
|
103
|
+
furnitureId: string;
|
|
104
|
+
x: number;
|
|
105
|
+
y: number;
|
|
106
|
+
rotation: number;
|
|
107
|
+
}>;
|
|
108
|
+
reasoning: string;
|
|
109
|
+
}
|
|
110
|
+
export type ArFormat = 'usdz' | 'glb' | 'gltf';
|
|
111
|
+
export interface ArExportOptions {
|
|
112
|
+
format: ArFormat;
|
|
113
|
+
/** Include lights in export? */
|
|
114
|
+
includeLighting?: boolean;
|
|
115
|
+
/** Scale relative to real world */
|
|
116
|
+
scale?: number;
|
|
117
|
+
/** Texture quality 0-1 */
|
|
118
|
+
textureQuality?: number;
|
|
119
|
+
}
|
|
120
|
+
export interface ShoppingItem {
|
|
121
|
+
furnitureId: string;
|
|
122
|
+
name: string;
|
|
123
|
+
quantity: number;
|
|
124
|
+
unitPrice: number;
|
|
125
|
+
currency: string;
|
|
126
|
+
subtotal: number;
|
|
127
|
+
storeUrl?: string;
|
|
128
|
+
inStock?: boolean;
|
|
129
|
+
}
|
|
130
|
+
export interface ShoppingList {
|
|
131
|
+
projectName: string;
|
|
132
|
+
items: ShoppingItem[];
|
|
133
|
+
total: number;
|
|
134
|
+
currency: string;
|
|
135
|
+
}
|
|
136
|
+
export declare function buildShoppingList(projectName: string, items: Omit<ShoppingItem, 'subtotal'>[]): ShoppingList;
|
|
137
|
+
export type BudgetCategory = 'furniture' | 'decoration' | 'lighting' | 'appliances' | 'labor' | 'other';
|
|
138
|
+
export interface BudgetEntry {
|
|
139
|
+
id: string;
|
|
140
|
+
category: BudgetCategory;
|
|
141
|
+
description: string;
|
|
142
|
+
planned: number;
|
|
143
|
+
actual: number;
|
|
144
|
+
currency: string;
|
|
145
|
+
}
|
|
146
|
+
export interface BudgetSummary {
|
|
147
|
+
entries: BudgetEntry[];
|
|
148
|
+
totalPlanned: number;
|
|
149
|
+
totalActual: number;
|
|
150
|
+
remaining: number;
|
|
151
|
+
overBudget: boolean;
|
|
152
|
+
}
|
|
153
|
+
export declare function computeBudget(entries: BudgetEntry[]): BudgetSummary;
|
|
154
|
+
export type InteriorStyle = 'modern' | 'classic' | 'industrial' | 'scandinavian' | 'minimalist' | 'bohemian' | 'mid-century' | 'art-deco' | 'japandi' | 'farmhouse' | 'coastal' | 'mediterranean' | 'contemporary';
|
|
155
|
+
export interface StylePreset {
|
|
156
|
+
style: InteriorStyle;
|
|
157
|
+
primaryColors: string[];
|
|
158
|
+
accentColors: string[];
|
|
159
|
+
materials: InteriorMaterialCategory[];
|
|
160
|
+
furnitureTags: string[];
|
|
161
|
+
description: string;
|
|
162
|
+
}
|
|
163
|
+
export type ColorHarmony = 'complementary' | 'analogous' | 'triadic' | 'split-complementary' | 'tetradic' | 'monochromatic';
|
|
164
|
+
export interface ColorPalette {
|
|
165
|
+
harmony: ColorHarmony;
|
|
166
|
+
baseColor: string;
|
|
167
|
+
colors: string[];
|
|
168
|
+
}
|
|
169
|
+
/** Generate a harmony palette from a hex base color. */
|
|
170
|
+
export declare function generateColorPalette(baseHex: string, harmony: ColorHarmony): ColorPalette;
|
|
171
|
+
export interface MoodBoardItem {
|
|
172
|
+
id: string;
|
|
173
|
+
type: 'image' | 'color' | 'text' | 'material' | 'furniture';
|
|
174
|
+
/** Display position on board */
|
|
175
|
+
x: number;
|
|
176
|
+
y: number;
|
|
177
|
+
width: number;
|
|
178
|
+
height: number;
|
|
179
|
+
/** Image URL or color hex or text content or ref ID */
|
|
180
|
+
content: string;
|
|
181
|
+
label?: string;
|
|
182
|
+
}
|
|
183
|
+
export interface MoodBoard {
|
|
184
|
+
id: string;
|
|
185
|
+
name: string;
|
|
186
|
+
items: MoodBoardItem[];
|
|
187
|
+
style?: InteriorStyle;
|
|
188
|
+
}
|
|
189
|
+
export interface InteriorComparisonSnapshot {
|
|
190
|
+
id: string;
|
|
191
|
+
label: string;
|
|
192
|
+
/** Base64 or URL of rendered image */
|
|
193
|
+
imageUrl: string;
|
|
194
|
+
timestamp: number;
|
|
195
|
+
}
|
|
196
|
+
export type FengShuiElement = 'wood' | 'fire' | 'earth' | 'metal' | 'water';
|
|
197
|
+
export type CompassDirection = 'N' | 'NE' | 'E' | 'SE' | 'S' | 'SW' | 'W' | 'NW' | 'center';
|
|
198
|
+
export interface FengShuiRule {
|
|
199
|
+
id: string;
|
|
200
|
+
name: string;
|
|
201
|
+
element: FengShuiElement;
|
|
202
|
+
direction: CompassDirection;
|
|
203
|
+
description: string;
|
|
204
|
+
priority: 'must' | 'should' | 'nice';
|
|
205
|
+
}
|
|
206
|
+
export interface FengShuiAudit {
|
|
207
|
+
score: number;
|
|
208
|
+
passed: FengShuiRule[];
|
|
209
|
+
violations: Array<FengShuiRule & {
|
|
210
|
+
suggestion: string;
|
|
211
|
+
}>;
|
|
212
|
+
}
|
|
213
|
+
export interface ErgonomicsCheck {
|
|
214
|
+
deskHeight: number;
|
|
215
|
+
chairHeight: number;
|
|
216
|
+
monitorDistance: number;
|
|
217
|
+
monitorHeight: number;
|
|
218
|
+
keyboardAngle: number;
|
|
219
|
+
score: number;
|
|
220
|
+
issues: Array<{
|
|
221
|
+
metric: string;
|
|
222
|
+
value: number;
|
|
223
|
+
recommended: string;
|
|
224
|
+
severity: 'info' | 'warning' | 'error';
|
|
225
|
+
}>;
|
|
226
|
+
}
|
|
227
|
+
export interface AccessibilityIssue {
|
|
228
|
+
id: string;
|
|
229
|
+
type: 'doorway-width' | 'turning-radius' | 'ramp-slope' | 'grab-bar' | 'knee-clearance' | 'reach-range' | 'floor-surface' | 'light-level';
|
|
230
|
+
description: string;
|
|
231
|
+
severity: 'info' | 'warning' | 'error';
|
|
232
|
+
/** Affected element/room ID */
|
|
233
|
+
elementId?: string;
|
|
234
|
+
recommendation: string;
|
|
235
|
+
}
|
|
236
|
+
export interface AccessibilityAudit {
|
|
237
|
+
standard: 'ADA' | 'EN-17210' | 'ISO-21542';
|
|
238
|
+
score: number;
|
|
239
|
+
issues: AccessibilityIssue[];
|
|
240
|
+
}
|
|
241
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/interior/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,MAAM,MAAM,iBAAiB,GACzB,SAAS,GACT,OAAO,GACP,SAAS,GACT,KAAK,GACL,MAAM,GACN,OAAO,GACP,UAAU,GACV,MAAM,GACN,SAAS,GACT,UAAU,GACV,KAAK,GACL,QAAQ,GACR,SAAS,GACT,WAAW,GACX,UAAU,GACV,SAAS,GACT,SAAS,GACT,YAAY,CAAC;AAEjB,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,uBAAuB;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,yBAAyB;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB;IACpB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,mBAAmB;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+CAA+C;IAC/C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAMD,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAC5D,MAAM,MAAM,cAAc,GACtB,OAAO,GACP,WAAW,GACX,MAAM,GACN,OAAO,GACP,QAAQ,GACR,UAAU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,IAAI,EACA,eAAe,GACf,gBAAgB,GAChB,YAAY,GACZ,UAAU,GACV,gBAAgB,GAChB,aAAa,GACb,eAAe,GACf,aAAa,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;IACvC,+BAA+B;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,KAAK,GAAG,UAAU,GAAG,WAAW,CAAC;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,kBAAkB,EAAE,CAAC;CAC9B"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interior Design — Furniture, decoration, lighting, materials,
|
|
3
|
+
* room planner, shopping, budget, styles, colors, mood boards,
|
|
4
|
+
* feng shui, ergonomics, accessibility.
|
|
5
|
+
*
|
|
6
|
+
* PRO-2.5 — 15 items
|
|
7
|
+
*
|
|
8
|
+
* @module @nice2dev/spatial-core/interior
|
|
9
|
+
*/
|
|
10
|
+
export function buildShoppingList(projectName, items) {
|
|
11
|
+
const withSubtotals = items.map((i) => ({ ...i, subtotal: i.quantity * i.unitPrice }));
|
|
12
|
+
const total = withSubtotals.reduce((s, i) => s + i.subtotal, 0);
|
|
13
|
+
return {
|
|
14
|
+
projectName,
|
|
15
|
+
items: withSubtotals,
|
|
16
|
+
total,
|
|
17
|
+
currency: items[0]?.currency ?? 'EUR',
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export function computeBudget(entries) {
|
|
21
|
+
const totalPlanned = entries.reduce((s, e) => s + e.planned, 0);
|
|
22
|
+
const totalActual = entries.reduce((s, e) => s + e.actual, 0);
|
|
23
|
+
return {
|
|
24
|
+
entries,
|
|
25
|
+
totalPlanned,
|
|
26
|
+
totalActual,
|
|
27
|
+
remaining: totalPlanned - totalActual,
|
|
28
|
+
overBudget: totalActual > totalPlanned,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/** Generate a harmony palette from a hex base color. */
|
|
32
|
+
export function generateColorPalette(baseHex, harmony) {
|
|
33
|
+
// Convert hex to HSL
|
|
34
|
+
const r = parseInt(baseHex.slice(1, 3), 16) / 255;
|
|
35
|
+
const g = parseInt(baseHex.slice(3, 5), 16) / 255;
|
|
36
|
+
const b = parseInt(baseHex.slice(5, 7), 16) / 255;
|
|
37
|
+
const max = Math.max(r, g, b), min = Math.min(r, g, b);
|
|
38
|
+
let h = 0;
|
|
39
|
+
const l = (max + min) / 2;
|
|
40
|
+
const s = max === min ? 0 : l > 0.5 ? (max - min) / (2 - max - min) : (max - min) / (max + min);
|
|
41
|
+
if (max !== min) {
|
|
42
|
+
const d = max - min;
|
|
43
|
+
if (max === r) {
|
|
44
|
+
h = ((g - b) / d + (g < b ? 6 : 0)) * 60;
|
|
45
|
+
}
|
|
46
|
+
else if (max === g) {
|
|
47
|
+
h = ((b - r) / d + 2) * 60;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
h = ((r - g) / d + 4) * 60;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const hslToHex = (hh, ss, ll) => {
|
|
54
|
+
hh = ((hh % 360) + 360) % 360;
|
|
55
|
+
const a = ss * Math.min(ll, 1 - ll);
|
|
56
|
+
const f = (n) => {
|
|
57
|
+
const k = (n + hh / 30) % 12;
|
|
58
|
+
const color = ll - a * Math.max(-1, Math.min(k - 3, 9 - k, 1));
|
|
59
|
+
return Math.round(255 * Math.max(0, Math.min(1, color)))
|
|
60
|
+
.toString(16)
|
|
61
|
+
.padStart(2, '0');
|
|
62
|
+
};
|
|
63
|
+
return `#${f(0)}${f(8)}${f(4)}`;
|
|
64
|
+
};
|
|
65
|
+
let hues;
|
|
66
|
+
switch (harmony) {
|
|
67
|
+
case 'complementary':
|
|
68
|
+
hues = [h, h + 180];
|
|
69
|
+
break;
|
|
70
|
+
case 'analogous':
|
|
71
|
+
hues = [h - 30, h, h + 30];
|
|
72
|
+
break;
|
|
73
|
+
case 'triadic':
|
|
74
|
+
hues = [h, h + 120, h + 240];
|
|
75
|
+
break;
|
|
76
|
+
case 'split-complementary':
|
|
77
|
+
hues = [h, h + 150, h + 210];
|
|
78
|
+
break;
|
|
79
|
+
case 'tetradic':
|
|
80
|
+
hues = [h, h + 90, h + 180, h + 270];
|
|
81
|
+
break;
|
|
82
|
+
case 'monochromatic':
|
|
83
|
+
return {
|
|
84
|
+
harmony,
|
|
85
|
+
baseColor: baseHex,
|
|
86
|
+
colors: [
|
|
87
|
+
hslToHex(h, s, Math.max(0, l - 0.2)),
|
|
88
|
+
hslToHex(h, s, Math.max(0, l - 0.1)),
|
|
89
|
+
baseHex,
|
|
90
|
+
hslToHex(h, s, Math.min(1, l + 0.1)),
|
|
91
|
+
hslToHex(h, s, Math.min(1, l + 0.2)),
|
|
92
|
+
],
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
harmony,
|
|
97
|
+
baseColor: baseHex,
|
|
98
|
+
colors: hues.map((hh) => hslToHex(hh, s, l)),
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interior/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAmNH,MAAM,UAAU,iBAAiB,CAC/B,WAAmB,EACnB,KAAuC;IAEvC,MAAM,aAAa,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;IACvF,MAAM,KAAK,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,C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AG,CAAC,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC;YAC7B,MAAM;QACR,KAAK,UAAU;YACb,IAAI,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC;YACrC,MAAM;QACR,KAAK,eAAe;YAClB,OAAO;gBACL,OAAO;gBACP,SAAS,EAAE,OAAO;gBAClB,MAAM,EAAE;oBACN,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC;oBACpC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC;oBACpC,OAAO;oBACP,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC;oBACpC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC;iBACrC;aACF,CAAC;IACN,CAAC;IAED,OAAO;QACL,OAAO;QACP,SAAS,EAAE,OAAO;QAClB,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;KAC7C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Measurement Utilities — Distance, angle, area calculations.
|
|
3
|
+
*
|
|
4
|
+
* Consolidates from:
|
|
5
|
+
* - cadModeUtils.ts (measurement functions)
|
|
6
|
+
* - modelEditorUtils.ts (measureDistance, measureAngle)
|
|
7
|
+
*
|
|
8
|
+
* @module @nice2dev/spatial-core/measurement
|
|
9
|
+
*/
|
|
10
|
+
import type { Point2D, Point3D } from '../grid/index';
|
|
11
|
+
/** Unit system. */
|
|
12
|
+
export type UnitSystem = 'metric' | 'imperial';
|
|
13
|
+
/** Length unit. */
|
|
14
|
+
export type LengthUnit = 'm' | 'cm' | 'mm' | 'ft' | 'in' | 'yd';
|
|
15
|
+
/** Area unit. */
|
|
16
|
+
export type AreaUnit = 'm²' | 'cm²' | 'ft²' | 'in²' | 'yd²' | 'acre' | 'ha';
|
|
17
|
+
/** Angle unit. */
|
|
18
|
+
export type AngleUnit = 'deg' | 'rad';
|
|
19
|
+
/** Measurement result. */
|
|
20
|
+
export interface MeasurementResult {
|
|
21
|
+
value: number;
|
|
22
|
+
unit: string;
|
|
23
|
+
formatted: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Convert length between units.
|
|
27
|
+
*/
|
|
28
|
+
export declare function convertLength(value: number, from: LengthUnit, to: LengthUnit): number;
|
|
29
|
+
/**
|
|
30
|
+
* Convert area between units.
|
|
31
|
+
*/
|
|
32
|
+
export declare function convertArea(value: number, from: AreaUnit, to: AreaUnit): number;
|
|
33
|
+
/**
|
|
34
|
+
* Convert degrees to radians.
|
|
35
|
+
*/
|
|
36
|
+
export declare function degToRad(degrees: number): number;
|
|
37
|
+
/**
|
|
38
|
+
* Convert radians to degrees.
|
|
39
|
+
*/
|
|
40
|
+
export declare function radToDeg(radians: number): number;
|
|
41
|
+
/**
|
|
42
|
+
* Calculate distance between two 2D points.
|
|
43
|
+
*/
|
|
44
|
+
export declare function distance2D(a: Point2D, b: Point2D): number;
|
|
45
|
+
/**
|
|
46
|
+
* Calculate distance between two 3D points.
|
|
47
|
+
*/
|
|
48
|
+
export declare function distance3D(a: Point3D, b: Point3D): number;
|
|
49
|
+
/**
|
|
50
|
+
* Calculate Manhattan distance (taxicab distance).
|
|
51
|
+
*/
|
|
52
|
+
export declare function manhattanDistance2D(a: Point2D, b: Point2D): number;
|
|
53
|
+
/**
|
|
54
|
+
* Calculate Manhattan distance in 3D.
|
|
55
|
+
*/
|
|
56
|
+
export declare function manhattanDistance3D(a: Point3D, b: Point3D): number;
|
|
57
|
+
/**
|
|
58
|
+
* Calculate total length of a polyline.
|
|
59
|
+
*/
|
|
60
|
+
export declare function polylineLength(points: Point2D[]): number;
|
|
61
|
+
/**
|
|
62
|
+
* Calculate perimeter of a polygon.
|
|
63
|
+
*/
|
|
64
|
+
export declare function polygonPerimeter(points: Point2D[]): number;
|
|
65
|
+
/**
|
|
66
|
+
* Calculate angle between two points (from origin).
|
|
67
|
+
*/
|
|
68
|
+
export declare function angleBetweenPoints(a: Point2D, b: Point2D): number;
|
|
69
|
+
/**
|
|
70
|
+
* Calculate angle at vertex B in triangle ABC.
|
|
71
|
+
*/
|
|
72
|
+
export declare function angleAtVertex(a: Point2D, b: Point2D, c: Point2D): number;
|
|
73
|
+
/**
|
|
74
|
+
* Calculate angle between two vectors.
|
|
75
|
+
*/
|
|
76
|
+
export declare function angleBetweenVectors(v1: Point2D, v2: Point2D): number;
|
|
77
|
+
/**
|
|
78
|
+
* Normalize angle to 0-360 degrees.
|
|
79
|
+
*/
|
|
80
|
+
export declare function normalizeAngle(angle: number): number;
|
|
81
|
+
/**
|
|
82
|
+
* Snap angle to nearest increment.
|
|
83
|
+
*/
|
|
84
|
+
export declare function snapAngle(angle: number, increment: number): number;
|
|
85
|
+
/**
|
|
86
|
+
* Calculate area of a polygon (Shoelace formula).
|
|
87
|
+
*/
|
|
88
|
+
export declare function polygonArea(points: Point2D[]): number;
|
|
89
|
+
/**
|
|
90
|
+
* Calculate area of a rectangle.
|
|
91
|
+
*/
|
|
92
|
+
export declare function rectangleArea(width: number, height: number): number;
|
|
93
|
+
/**
|
|
94
|
+
* Calculate area of a circle.
|
|
95
|
+
*/
|
|
96
|
+
export declare function circleArea(radius: number): number;
|
|
97
|
+
/**
|
|
98
|
+
* Calculate area of a triangle from three points.
|
|
99
|
+
*/
|
|
100
|
+
export declare function triangleArea(a: Point2D, b: Point2D, c: Point2D): number;
|
|
101
|
+
/**
|
|
102
|
+
* Calculate midpoint between two points.
|
|
103
|
+
*/
|
|
104
|
+
export declare function midpoint2D(a: Point2D, b: Point2D): Point2D;
|
|
105
|
+
/**
|
|
106
|
+
* Calculate midpoint between two 3D points.
|
|
107
|
+
*/
|
|
108
|
+
export declare function midpoint3D(a: Point3D, b: Point3D): Point3D;
|
|
109
|
+
/**
|
|
110
|
+
* Calculate centroid of a polygon.
|
|
111
|
+
*/
|
|
112
|
+
export declare function polygonCentroid(points: Point2D[]): Point2D;
|
|
113
|
+
/**
|
|
114
|
+
* Interpolate between two points.
|
|
115
|
+
*/
|
|
116
|
+
export declare function lerp2D(a: Point2D, b: Point2D, t: number): Point2D;
|
|
117
|
+
/**
|
|
118
|
+
* Interpolate between two 3D points.
|
|
119
|
+
*/
|
|
120
|
+
export declare function lerp3D(a: Point3D, b: Point3D, t: number): Point3D;
|
|
121
|
+
/**
|
|
122
|
+
* Project point onto line segment.
|
|
123
|
+
*/
|
|
124
|
+
export declare function projectPointOnLine(point: Point2D, lineStart: Point2D, lineEnd: Point2D): {
|
|
125
|
+
point: Point2D;
|
|
126
|
+
t: number;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Calculate perpendicular distance from point to line.
|
|
130
|
+
*/
|
|
131
|
+
export declare function pointToLineDistance(point: Point2D, lineStart: Point2D, lineEnd: Point2D): number;
|
|
132
|
+
/**
|
|
133
|
+
* Format length with unit.
|
|
134
|
+
*/
|
|
135
|
+
export declare function formatLength(value: number, unit?: LengthUnit, precision?: number): MeasurementResult;
|
|
136
|
+
/**
|
|
137
|
+
* Format area with unit.
|
|
138
|
+
*/
|
|
139
|
+
export declare function formatArea(value: number, unit?: AreaUnit, precision?: number): MeasurementResult;
|
|
140
|
+
/**
|
|
141
|
+
* Format angle.
|
|
142
|
+
*/
|
|
143
|
+
export declare function formatAngle(radians: number, unit?: AngleUnit, precision?: number): MeasurementResult;
|
|
144
|
+
/**
|
|
145
|
+
* Auto-format length with appropriate unit.
|
|
146
|
+
*/
|
|
147
|
+
export declare function autoFormatLength(meters: number, system?: UnitSystem, precision?: number): MeasurementResult;
|
|
148
|
+
/**
|
|
149
|
+
* Auto-format area with appropriate unit.
|
|
150
|
+
*/
|
|
151
|
+
export declare function autoFormatArea(sqMeters: number, system?: UnitSystem, precision?: number): MeasurementResult;
|
|
152
|
+
declare const _default: {
|
|
153
|
+
convertLength: typeof convertLength;
|
|
154
|
+
convertArea: typeof convertArea;
|
|
155
|
+
degToRad: typeof degToRad;
|
|
156
|
+
radToDeg: typeof radToDeg;
|
|
157
|
+
distance2D: typeof distance2D;
|
|
158
|
+
distance3D: typeof distance3D;
|
|
159
|
+
manhattanDistance2D: typeof manhattanDistance2D;
|
|
160
|
+
manhattanDistance3D: typeof manhattanDistance3D;
|
|
161
|
+
polylineLength: typeof polylineLength;
|
|
162
|
+
polygonPerimeter: typeof polygonPerimeter;
|
|
163
|
+
angleBetweenPoints: typeof angleBetweenPoints;
|
|
164
|
+
angleAtVertex: typeof angleAtVertex;
|
|
165
|
+
angleBetweenVectors: typeof angleBetweenVectors;
|
|
166
|
+
normalizeAngle: typeof normalizeAngle;
|
|
167
|
+
snapAngle: typeof snapAngle;
|
|
168
|
+
polygonArea: typeof polygonArea;
|
|
169
|
+
rectangleArea: typeof rectangleArea;
|
|
170
|
+
circleArea: typeof circleArea;
|
|
171
|
+
triangleArea: typeof triangleArea;
|
|
172
|
+
midpoint2D: typeof midpoint2D;
|
|
173
|
+
midpoint3D: typeof midpoint3D;
|
|
174
|
+
polygonCentroid: typeof polygonCentroid;
|
|
175
|
+
lerp2D: typeof lerp2D;
|
|
176
|
+
lerp3D: typeof lerp3D;
|
|
177
|
+
projectPointOnLine: typeof projectPointOnLine;
|
|
178
|
+
pointToLineDistance: typeof pointToLineDistance;
|
|
179
|
+
formatLength: typeof formatLength;
|
|
180
|
+
formatArea: typeof formatArea;
|
|
181
|
+
formatAngle: typeof formatAngle;
|
|
182
|
+
autoFormatLength: typeof autoFormatLength;
|
|
183
|
+
autoFormatArea: typeof autoFormatArea;
|
|
184
|
+
};
|
|
185
|
+
export default _default;
|
|
186
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/measurement/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAMtD,mBAAmB;AACnB,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,UAAU,CAAC;AAE/C,mBAAmB;AACnB,MAAM,MAAM,UAAU,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEhE,iBAAiB;AACjB,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,IAAI,CAAC;AAE5E,kBAAkB;AAClB,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,KAAK,CAAC;AAEtC,0BAA0B;AAC1B,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AAqCD;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU,GAAG,MAAM,CAGrF;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,GAAG,MAAM,CAG/E;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;GAEG;AACH,wBAAgB,QAAQ,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