/** * Viewpoint conversion utilities * * Converts between viewer camera state and BCF viewpoint format. * Handles coordinate system transformations and camera parameter mapping. */ import type { BCFViewpoint, BCFPerspectiveCamera, BCFOrthogonalCamera, BCFClippingPlane } from './types.js'; export interface ViewerCameraState { /** Camera position in world coordinates */ position: { x: number; y: number; z: number; }; /** Camera look-at target in world coordinates */ target: { x: number; y: number; z: number; }; /** Camera up vector */ up: { x: number; y: number; z: number; }; /** Field of view in radians */ fov: number; /** Is orthographic projection */ isOrthographic?: boolean; /** Orthographic scale (view-to-world) */ orthoScale?: number; } export interface ViewerSectionPlane { /** Axis: 'down' (Y), 'front' (Z), 'side' (X) */ axis: 'down' | 'front' | 'side'; /** Position as percentage (0-100) of model bounds */ position: number; /** Is the section plane enabled */ enabled: boolean; /** Is the plane flipped */ flipped: boolean; } export interface ViewerBounds { min: { x: number; y: number; z: number; }; max: { x: number; y: number; z: number; }; } /** * Convert viewer camera state to BCF perspective camera * * BCF uses direction vector instead of look-at point. * Direction = normalize(target - position) * * Also converts from viewer's Y-up to BCF's Z-up coordinate system. */ export declare function cameraToPerspective(camera: ViewerCameraState): BCFPerspectiveCamera; /** * Convert viewer camera state to BCF orthogonal camera * * Also converts from viewer's Y-up to BCF's Z-up coordinate system. */ export declare function cameraToOrthogonal(camera: ViewerCameraState, viewToWorldScale: number): BCFOrthogonalCamera; /** * Convert BCF perspective camera to viewer camera state * * BCF stores direction, but viewers need a look-at point. * We compute target = position + direction * distance * * Also converts from BCF's Z-up to viewer's Y-up coordinate system. * * @param camera - BCF perspective camera * @param targetDistance - Distance from eye to target (default: 10) */ export declare function perspectiveToCamera(camera: BCFPerspectiveCamera, targetDistance?: number): ViewerCameraState; /** * Convert BCF orthogonal camera to viewer camera state * * Also converts from BCF's Z-up to viewer's Y-up coordinate system. */ export declare function orthogonalToCamera(camera: BCFOrthogonalCamera, targetDistance?: number): ViewerCameraState; /** * Convert viewer section plane to BCF clipping plane * * ifc-lite uses percentage position (0-100) along an axis. * BCF uses absolute location and direction in world coordinates (Z-up). */ export declare function sectionPlaneToClippingPlane(sectionPlane: ViewerSectionPlane, bounds: ViewerBounds): BCFClippingPlane | null; /** * Convert BCF clipping plane to viewer section plane * * Determines the closest axis and calculates percentage position. * Converts from BCF coordinates (Z-up) to viewer coordinates (Y-up). */ export declare function clippingPlaneToSectionPlane(plane: BCFClippingPlane, bounds: ViewerBounds): ViewerSectionPlane; /** * Create a BCF viewpoint from viewer state * * For visibility: * - Use `hiddenGuids` when most entities are visible (defaultVisibility=true, exceptions=hidden) * - Use `visibleGuids` when most entities are hidden/isolated (defaultVisibility=false, exceptions=visible) */ export declare function createViewpoint(options: { camera: ViewerCameraState; sectionPlane?: ViewerSectionPlane; bounds?: ViewerBounds; snapshot?: string; snapshotData?: Uint8Array; selectedGuids?: string[]; hiddenGuids?: string[]; visibleGuids?: string[]; coloredGuids?: { color: string; guids: string[]; }[]; }): BCFViewpoint; /** * Extract viewer state from a BCF viewpoint */ export declare function extractViewpointState(viewpoint: BCFViewpoint, bounds?: ViewerBounds, targetDistance?: number): { camera?: ViewerCameraState; sectionPlane?: ViewerSectionPlane; selectedGuids: string[]; hiddenGuids: string[]; visibleGuids: string[]; coloredGuids: { color: string; guids: string[]; }[]; }; //# sourceMappingURL=viewpoint.d.ts.map