The camera OccViewer.Camera in LWV defines the perspective and orientation of the viewer, allowing for flexible navigation and precise visualization of 3D models. The camera system provides extensive control over parameters, enabling seamless integration with various viewing and manipulation scenarios.

The OccViewer.WasmCameraParams interface represents the primary attributes of the camera, closely mirroring the Graphic3d_Camera class in OpenCascade.

Camera Parameters:

  • Eye: The camera's position in 3D space.
  • Up Vector: Defines the upward direction relative to the camera.
  • Direction: The camera's look-at vector.
  • Distance: Distance from the camera to the target point.
  • Scale: Adjusts the relative viewport scale.

Key Features:

  • Projection Modes: Supports both perspective and orthographic projections, with adjustable field of view (FOV) for perspective mode.
  • Navigation Controls: Enables orbiting, panning, and zooming, with options to restrict or allow specific operations.
  • Automatic Fitting: Fits selected or all objects into view, or fits a specific bounding box defined by minimum and maximum coordinates.
  • Orientation Management: Allows setting predefined orientations and locking the Z-axis for stable rotation.
  • Transformations: Supports applying transformations to the camera's position, direction, and up vector.

Advanced Options:

  • Orbit Acceleration: Adjusts the speed of orbiting for fine-tuned navigation.
  • Max Zoom Limit: Configurable to prevent excessive zooming.
  • Dynamic Updates: Updates the viewer automatically when camera parameters are modified.

Integration and Management The camera is managed through the ViewManager and can be accessed via the OccViewer.camera property. Developers can programmatically set camera parameters, manipulate its orientation, and synchronize it with user interactions for a smooth and responsive visualization experience.

// fit all objects into view
OccViewerModule.camera.fitAllObjects(true, false);
// switch to perspective projection
OccViewerModule.camera.isPerspectiveProjection = false;