@ifc-lite/bcf 1.4.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.
@@ -0,0 +1,386 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+ import { generateUuid } from './guid.js';
5
+ /**
6
+ * Convert from viewer coordinates (Y-up) to BCF coordinates (Z-up)
7
+ */
8
+ function viewerToBcfCoords(p) {
9
+ return {
10
+ x: p.x,
11
+ y: -p.z,
12
+ z: p.y,
13
+ };
14
+ }
15
+ /**
16
+ * Convert from BCF coordinates (Z-up) to viewer coordinates (Y-up)
17
+ */
18
+ function bcfToViewerCoords(p) {
19
+ return {
20
+ x: p.x,
21
+ y: p.z,
22
+ z: -p.y,
23
+ };
24
+ }
25
+ // ============================================================================
26
+ // Camera Conversion
27
+ // ============================================================================
28
+ /**
29
+ * Convert viewer camera state to BCF perspective camera
30
+ *
31
+ * BCF uses direction vector instead of look-at point.
32
+ * Direction = normalize(target - position)
33
+ *
34
+ * Also converts from viewer's Y-up to BCF's Z-up coordinate system.
35
+ */
36
+ export function cameraToPerspective(camera) {
37
+ // Convert position and target to BCF coordinates (Z-up)
38
+ const bcfPosition = viewerToBcfCoords(camera.position);
39
+ const bcfTarget = viewerToBcfCoords(camera.target);
40
+ const bcfUp = viewerToBcfCoords(camera.up);
41
+ // Calculate direction vector in BCF coordinates
42
+ const dx = bcfTarget.x - bcfPosition.x;
43
+ const dy = bcfTarget.y - bcfPosition.y;
44
+ const dz = bcfTarget.z - bcfPosition.z;
45
+ const length = Math.sqrt(dx * dx + dy * dy + dz * dz);
46
+ const direction = length > 0.0001
47
+ ? { x: dx / length, y: dy / length, z: dz / length }
48
+ : { x: 0, y: 1, z: 0 }; // Default forward in BCF (positive Y)
49
+ // Normalize up vector
50
+ const upLength = Math.sqrt(bcfUp.x * bcfUp.x + bcfUp.y * bcfUp.y + bcfUp.z * bcfUp.z);
51
+ const upVector = upLength > 0.0001
52
+ ? { x: bcfUp.x / upLength, y: bcfUp.y / upLength, z: bcfUp.z / upLength }
53
+ : { x: 0, y: 0, z: 1 }; // Default up in BCF (positive Z)
54
+ // Convert FOV from radians to degrees
55
+ const fieldOfView = (camera.fov * 180) / Math.PI;
56
+ return {
57
+ cameraViewPoint: bcfPosition,
58
+ cameraDirection: direction,
59
+ cameraUpVector: upVector,
60
+ fieldOfView: Math.max(1, Math.min(179, fieldOfView)), // Clamp to valid range
61
+ };
62
+ }
63
+ /**
64
+ * Convert viewer camera state to BCF orthogonal camera
65
+ *
66
+ * Also converts from viewer's Y-up to BCF's Z-up coordinate system.
67
+ */
68
+ export function cameraToOrthogonal(camera, viewToWorldScale) {
69
+ // Convert position and target to BCF coordinates (Z-up)
70
+ const bcfPosition = viewerToBcfCoords(camera.position);
71
+ const bcfTarget = viewerToBcfCoords(camera.target);
72
+ const bcfUp = viewerToBcfCoords(camera.up);
73
+ // Calculate direction vector in BCF coordinates
74
+ const dx = bcfTarget.x - bcfPosition.x;
75
+ const dy = bcfTarget.y - bcfPosition.y;
76
+ const dz = bcfTarget.z - bcfPosition.z;
77
+ const length = Math.sqrt(dx * dx + dy * dy + dz * dz);
78
+ const direction = length > 0.0001
79
+ ? { x: dx / length, y: dy / length, z: dz / length }
80
+ : { x: 0, y: 1, z: 0 }; // Default forward in BCF
81
+ // Normalize up vector
82
+ const upLength = Math.sqrt(bcfUp.x * bcfUp.x + bcfUp.y * bcfUp.y + bcfUp.z * bcfUp.z);
83
+ const upVector = upLength > 0.0001
84
+ ? { x: bcfUp.x / upLength, y: bcfUp.y / upLength, z: bcfUp.z / upLength }
85
+ : { x: 0, y: 0, z: 1 }; // Default up in BCF
86
+ return {
87
+ cameraViewPoint: bcfPosition,
88
+ cameraDirection: direction,
89
+ cameraUpVector: upVector,
90
+ viewToWorldScale,
91
+ };
92
+ }
93
+ /**
94
+ * Convert BCF perspective camera to viewer camera state
95
+ *
96
+ * BCF stores direction, but viewers need a look-at point.
97
+ * We compute target = position + direction * distance
98
+ *
99
+ * Also converts from BCF's Z-up to viewer's Y-up coordinate system.
100
+ *
101
+ * @param camera - BCF perspective camera
102
+ * @param targetDistance - Distance from eye to target (default: 10)
103
+ */
104
+ export function perspectiveToCamera(camera, targetDistance = 10) {
105
+ // Calculate target in BCF coordinates
106
+ const bcfTarget = {
107
+ x: camera.cameraViewPoint.x + camera.cameraDirection.x * targetDistance,
108
+ y: camera.cameraViewPoint.y + camera.cameraDirection.y * targetDistance,
109
+ z: camera.cameraViewPoint.z + camera.cameraDirection.z * targetDistance,
110
+ };
111
+ // Convert to viewer coordinates (Y-up)
112
+ const viewerPosition = bcfToViewerCoords(camera.cameraViewPoint);
113
+ const viewerTarget = bcfToViewerCoords(bcfTarget);
114
+ const viewerUp = bcfToViewerCoords(camera.cameraUpVector);
115
+ // Convert FOV from degrees to radians
116
+ const fov = (camera.fieldOfView * Math.PI) / 180;
117
+ return {
118
+ position: viewerPosition,
119
+ target: viewerTarget,
120
+ up: viewerUp,
121
+ fov,
122
+ isOrthographic: false,
123
+ };
124
+ }
125
+ /**
126
+ * Convert BCF orthogonal camera to viewer camera state
127
+ *
128
+ * Also converts from BCF's Z-up to viewer's Y-up coordinate system.
129
+ */
130
+ export function orthogonalToCamera(camera, targetDistance = 10) {
131
+ // Calculate target in BCF coordinates
132
+ const bcfTarget = {
133
+ x: camera.cameraViewPoint.x + camera.cameraDirection.x * targetDistance,
134
+ y: camera.cameraViewPoint.y + camera.cameraDirection.y * targetDistance,
135
+ z: camera.cameraViewPoint.z + camera.cameraDirection.z * targetDistance,
136
+ };
137
+ // Convert to viewer coordinates (Y-up)
138
+ const viewerPosition = bcfToViewerCoords(camera.cameraViewPoint);
139
+ const viewerTarget = bcfToViewerCoords(bcfTarget);
140
+ const viewerUp = bcfToViewerCoords(camera.cameraUpVector);
141
+ return {
142
+ position: viewerPosition,
143
+ target: viewerTarget,
144
+ up: viewerUp,
145
+ fov: Math.PI / 4, // Default FOV for ortho (not used)
146
+ isOrthographic: true,
147
+ orthoScale: camera.viewToWorldScale,
148
+ };
149
+ }
150
+ // ============================================================================
151
+ // Section Plane Conversion
152
+ // ============================================================================
153
+ /**
154
+ * Convert viewer section plane to BCF clipping plane
155
+ *
156
+ * ifc-lite uses percentage position (0-100) along an axis.
157
+ * BCF uses absolute location and direction in world coordinates (Z-up).
158
+ */
159
+ export function sectionPlaneToClippingPlane(sectionPlane, bounds) {
160
+ if (!sectionPlane.enabled) {
161
+ return null;
162
+ }
163
+ // Calculate absolute position from percentage (in viewer coordinates)
164
+ const t = sectionPlane.position / 100;
165
+ let viewerLocation;
166
+ let viewerDirection;
167
+ switch (sectionPlane.axis) {
168
+ case 'down': // Y axis (viewer up/down)
169
+ viewerLocation = {
170
+ x: (bounds.min.x + bounds.max.x) / 2,
171
+ y: bounds.min.y + t * (bounds.max.y - bounds.min.y),
172
+ z: (bounds.min.z + bounds.max.z) / 2,
173
+ };
174
+ viewerDirection = sectionPlane.flipped ? { x: 0, y: 1, z: 0 } : { x: 0, y: -1, z: 0 };
175
+ break;
176
+ case 'front': // Z axis (viewer depth)
177
+ viewerLocation = {
178
+ x: (bounds.min.x + bounds.max.x) / 2,
179
+ y: (bounds.min.y + bounds.max.y) / 2,
180
+ z: bounds.min.z + t * (bounds.max.z - bounds.min.z),
181
+ };
182
+ viewerDirection = sectionPlane.flipped ? { x: 0, y: 0, z: 1 } : { x: 0, y: 0, z: -1 };
183
+ break;
184
+ case 'side': // X axis
185
+ viewerLocation = {
186
+ x: bounds.min.x + t * (bounds.max.x - bounds.min.x),
187
+ y: (bounds.min.y + bounds.max.y) / 2,
188
+ z: (bounds.min.z + bounds.max.z) / 2,
189
+ };
190
+ viewerDirection = sectionPlane.flipped ? { x: 1, y: 0, z: 0 } : { x: -1, y: 0, z: 0 };
191
+ break;
192
+ }
193
+ // Convert to BCF coordinates (Z-up)
194
+ return {
195
+ location: viewerToBcfCoords(viewerLocation),
196
+ direction: viewerToBcfCoords(viewerDirection),
197
+ };
198
+ }
199
+ /**
200
+ * Convert BCF clipping plane to viewer section plane
201
+ *
202
+ * Determines the closest axis and calculates percentage position.
203
+ * Converts from BCF coordinates (Z-up) to viewer coordinates (Y-up).
204
+ */
205
+ export function clippingPlaneToSectionPlane(plane, bounds) {
206
+ // Convert from BCF coordinates to viewer coordinates
207
+ const viewerLocation = bcfToViewerCoords(plane.location);
208
+ const viewerDirection = bcfToViewerCoords(plane.direction);
209
+ // Determine primary axis based on direction (in viewer coordinates)
210
+ const absX = Math.abs(viewerDirection.x);
211
+ const absY = Math.abs(viewerDirection.y);
212
+ const absZ = Math.abs(viewerDirection.z);
213
+ let axis;
214
+ let position;
215
+ let flipped;
216
+ if (absY >= absX && absY >= absZ) {
217
+ // Y axis dominant (down) in viewer
218
+ axis = 'down';
219
+ const range = bounds.max.y - bounds.min.y;
220
+ position = range > 0 ? ((viewerLocation.y - bounds.min.y) / range) * 100 : 50;
221
+ flipped = viewerDirection.y > 0;
222
+ }
223
+ else if (absZ >= absX) {
224
+ // Z axis dominant (front) in viewer
225
+ axis = 'front';
226
+ const range = bounds.max.z - bounds.min.z;
227
+ position = range > 0 ? ((viewerLocation.z - bounds.min.z) / range) * 100 : 50;
228
+ flipped = viewerDirection.z > 0;
229
+ }
230
+ else {
231
+ // X axis dominant (side)
232
+ axis = 'side';
233
+ const range = bounds.max.x - bounds.min.x;
234
+ position = range > 0 ? ((viewerLocation.x - bounds.min.x) / range) * 100 : 50;
235
+ flipped = viewerDirection.x > 0;
236
+ }
237
+ // Clamp position to valid range
238
+ position = Math.max(0, Math.min(100, position));
239
+ return {
240
+ axis,
241
+ position,
242
+ enabled: true,
243
+ flipped,
244
+ };
245
+ }
246
+ // ============================================================================
247
+ // Viewpoint Factory
248
+ // ============================================================================
249
+ /**
250
+ * Create a BCF viewpoint from viewer state
251
+ *
252
+ * For visibility:
253
+ * - Use `hiddenGuids` when most entities are visible (defaultVisibility=true, exceptions=hidden)
254
+ * - Use `visibleGuids` when most entities are hidden/isolated (defaultVisibility=false, exceptions=visible)
255
+ */
256
+ export function createViewpoint(options) {
257
+ const { camera, sectionPlane, bounds, snapshot, snapshotData, selectedGuids, hiddenGuids, visibleGuids, coloredGuids, } = options;
258
+ const viewpoint = {
259
+ guid: generateUuid(),
260
+ };
261
+ // Add camera
262
+ if (camera.isOrthographic && camera.orthoScale !== undefined) {
263
+ viewpoint.orthogonalCamera = cameraToOrthogonal(camera, camera.orthoScale);
264
+ }
265
+ else {
266
+ viewpoint.perspectiveCamera = cameraToPerspective(camera);
267
+ }
268
+ // Add clipping plane
269
+ if (sectionPlane?.enabled && bounds) {
270
+ const clippingPlane = sectionPlaneToClippingPlane(sectionPlane, bounds);
271
+ if (clippingPlane) {
272
+ viewpoint.clippingPlanes = [clippingPlane];
273
+ }
274
+ }
275
+ // Add snapshot
276
+ if (snapshot) {
277
+ viewpoint.snapshot = snapshot;
278
+ }
279
+ if (snapshotData) {
280
+ viewpoint.snapshotData = snapshotData;
281
+ }
282
+ // Add components
283
+ const hasSelection = selectedGuids && selectedGuids.length > 0;
284
+ const hasHidden = hiddenGuids && hiddenGuids.length > 0;
285
+ const hasVisible = visibleGuids && visibleGuids.length > 0;
286
+ const hasColoring = coloredGuids && coloredGuids.length > 0;
287
+ if (hasSelection || hasHidden || hasVisible || hasColoring) {
288
+ viewpoint.components = {};
289
+ if (hasSelection) {
290
+ viewpoint.components.selection = selectedGuids.map((guid) => ({ ifcGuid: guid }));
291
+ }
292
+ // Visibility: use visibleGuids (isolation) or hiddenGuids (normal), not both
293
+ if (hasVisible) {
294
+ // Isolation mode: everything hidden by default, exceptions are visible
295
+ viewpoint.components.visibility = {
296
+ defaultVisibility: false,
297
+ exceptions: visibleGuids.map((guid) => ({ ifcGuid: guid })),
298
+ };
299
+ }
300
+ else if (hasHidden) {
301
+ // Normal mode: everything visible by default, exceptions are hidden
302
+ viewpoint.components.visibility = {
303
+ defaultVisibility: true,
304
+ exceptions: hiddenGuids.map((guid) => ({ ifcGuid: guid })),
305
+ };
306
+ }
307
+ if (hasColoring) {
308
+ viewpoint.components.coloring = coloredGuids.map(({ color, guids }) => ({
309
+ color,
310
+ components: guids.map((guid) => ({ ifcGuid: guid })),
311
+ }));
312
+ }
313
+ }
314
+ return viewpoint;
315
+ }
316
+ /**
317
+ * Extract viewer state from a BCF viewpoint
318
+ */
319
+ export function extractViewpointState(viewpoint, bounds, targetDistance = 10) {
320
+ let camera;
321
+ let sectionPlane;
322
+ // Extract camera
323
+ if (viewpoint.perspectiveCamera) {
324
+ camera = perspectiveToCamera(viewpoint.perspectiveCamera, targetDistance);
325
+ }
326
+ else if (viewpoint.orthogonalCamera) {
327
+ camera = orthogonalToCamera(viewpoint.orthogonalCamera, targetDistance);
328
+ }
329
+ // Extract section plane
330
+ if (viewpoint.clippingPlanes && viewpoint.clippingPlanes.length > 0 && bounds) {
331
+ sectionPlane = clippingPlaneToSectionPlane(viewpoint.clippingPlanes[0], bounds);
332
+ }
333
+ // Extract selected GUIDs
334
+ const selectedGuids = [];
335
+ if (viewpoint.components?.selection) {
336
+ for (const comp of viewpoint.components.selection) {
337
+ if (comp.ifcGuid) {
338
+ selectedGuids.push(comp.ifcGuid);
339
+ }
340
+ }
341
+ }
342
+ // Extract visibility GUIDs
343
+ const hiddenGuids = [];
344
+ const visibleGuids = [];
345
+ if (viewpoint.components?.visibility) {
346
+ const { defaultVisibility, exceptions } = viewpoint.components.visibility;
347
+ if (exceptions) {
348
+ for (const comp of exceptions) {
349
+ if (comp.ifcGuid) {
350
+ if (defaultVisibility === false) {
351
+ // Isolation mode: exceptions are the visible entities
352
+ visibleGuids.push(comp.ifcGuid);
353
+ }
354
+ else {
355
+ // Normal mode: exceptions are the hidden entities
356
+ hiddenGuids.push(comp.ifcGuid);
357
+ }
358
+ }
359
+ }
360
+ }
361
+ }
362
+ // Extract colored GUIDs
363
+ const coloredGuids = [];
364
+ if (viewpoint.components?.coloring) {
365
+ for (const coloring of viewpoint.components.coloring) {
366
+ const guids = [];
367
+ for (const comp of coloring.components) {
368
+ if (comp.ifcGuid) {
369
+ guids.push(comp.ifcGuid);
370
+ }
371
+ }
372
+ if (guids.length > 0) {
373
+ coloredGuids.push({ color: coloring.color, guids });
374
+ }
375
+ }
376
+ }
377
+ return {
378
+ camera,
379
+ sectionPlane,
380
+ selectedGuids,
381
+ hiddenGuids,
382
+ visibleGuids,
383
+ coloredGuids,
384
+ };
385
+ }
386
+ //# sourceMappingURL=viewpoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"viewpoint.js","sourceRoot":"","sources":["../src/viewpoint.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAiB/D,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AA4DzC;;GAEG;AACH,SAAS,iBAAiB,CAAC,CAAU;IACnC,OAAO;QACL,CAAC,EAAE,CAAC,CAAC,CAAC;QACN,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACP,CAAC,EAAE,CAAC,CAAC,CAAC;KACP,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,iBAAiB,CAAC,CAAU;IACnC,OAAO;QACL,CAAC,EAAE,CAAC,CAAC,CAAC;QACN,CAAC,EAAE,CAAC,CAAC,CAAC;QACN,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;KACR,CAAC;AACJ,CAAC;AAED,+EAA+E;AAC/E,oBAAoB;AACpB,+EAA+E;AAE/E;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAyB;IAC3D,wDAAwD;IACxD,MAAM,WAAW,GAAG,iBAAiB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACvD,MAAM,SAAS,GAAG,iBAAiB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACnD,MAAM,KAAK,GAAG,iBAAiB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAE3C,gDAAgD;IAChD,MAAM,EAAE,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,CAAC,CAAC;oBACjC,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,wBAAwB;IACxB,MAAM,YAAY,GAAyC,EAAE,CAAC;IAC9D,IAAI,SAAS,CAAC,UAAU,EAAE,QAAQ,EAAE,CAAC;QACnC,KAAK,MAAM,QAAQ,IAAI,SAAS,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;YACrD,MAAM,KAAK,GAAa,EAAE,CAAC;YAC3B,KAAK,MAAM,IAAI,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC;gBACvC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;oBACjB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBAC3B,CAAC;YACH,CAAC;YACD,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACrB,YAAY,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;YACtD,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO;QACL,MAAM;QACN,YAAY;QACZ,aAAa;QACb,WAAW;QACX,YAAY;QACZ,YAAY;KACb,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { BCFProject } from './types.js';
2
+ /**
3
+ * Write a BCFProject to a .bcfzip file
4
+ *
5
+ * @param project - BCF project to write
6
+ * @returns Blob containing the .bcfzip file
7
+ */
8
+ export declare function writeBCF(project: BCFProject): Promise<Blob>;
9
+ //# sourceMappingURL=writer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"writer.d.ts","sourceRoot":"","sources":["../src/writer.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,UAAU,EAeX,MAAM,YAAY,CAAC;AAGpB;;;;;GAKG;AACH,wBAAsB,QAAQ,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAsBjE"}