Skip to main content

Crate polyscope_rs

Crate polyscope_rs 

Source
Expand description

polyscope-rs: A Rust-native 3D visualization library for geometric data.

Polyscope is a viewer and user interface for 3D data such as meshes and point clouds. It allows you to register your data and quickly generate informative visualizations.

§Quick Start

use polyscope_rs::*;

fn main() -> Result<()> {
    // Initialize polyscope
    init()?;

    // Register a point cloud
    let points = vec![
        Vec3::new(0.0, 0.0, 0.0),
        Vec3::new(1.0, 0.0, 0.0),
        Vec3::new(0.0, 1.0, 0.0),
    ];
    register_point_cloud("my points", points);

    // Show the viewer
    show();

    Ok(())
}

§Architecture

Polyscope uses a paradigm of structures and quantities:

  • A structure is a geometric object in the scene (point cloud, mesh, etc.)
  • A quantity is data associated with a structure (scalar field, vector field, colors)

§Structures

Structs§

AppearanceSettings
Appearance settings for UI.
Camera
A 3D camera for viewing the scene.
CameraExtrinsics
Camera extrinsics parameters (position and orientation).
CameraIntrinsics
Camera intrinsics parameters.
CameraParameters
Combined camera parameters (intrinsics + extrinsics).
CameraSettings
Camera settings exposed in UI.
CameraView
A camera view structure for visualizing camera poses.
CameraViewHandle
Handle for a registered camera view.
ColorMap
A color map for mapping scalar values to colors.
ColorMapRegistry
Registry for managing color maps.
Context
The global context containing all polyscope state.
CurveNetwork
A curve network structure (nodes connected by edges).
CurveNetworkHandle
Handle for a registered curve network.
GizmoConfig
Configuration for a transformation gizmo.
GizmoSettings
Gizmo settings for UI.
Group
A group that can contain structures and other groups.
GroupHandle
Handle for a group.
GroupSettings
Settings for a single group in the UI.
Mat4
A 4x4 column major matrix.
Material
A material definition for rendering.
MaterialRegistry
Registry for managing materials.
Options
Global configuration options for polyscope.
PickResult
Result of a pick/selection operation.
PointCloud
A point cloud structure.
PointCloudHandle
Handle for a registered point cloud.
Registry
Registry for managing all structures in polyscope.
RenderContext
Render context passed to structures during drawing.
RenderEngine
The main rendering engine backed by wgpu.
SceneExtents
Scene extents information for UI display.
ScreenshotOptions
Options for taking screenshots.
ScreenshotRequest
A pending screenshot request.
SelectionInfo
Current selection info for UI.
SlicePlane
A slice plane that can cut through geometry.
SlicePlaneHandle
Handle for a slice plane.
SlicePlaneSelectionInfo
Selection info for slice plane gizmo manipulation.
SlicePlaneSettings
Settings for a single slice plane in the UI.
SlicePlaneUniforms
GPU-compatible slice plane uniforms.
SurfaceMesh
A surface mesh structure (triangular or polygonal).
SurfaceMeshHandle
Handle for a registered surface mesh.
Transform
A transformation represented as separate components.
Vec2
A 2-dimensional vector.
Vec3
A 3-dimensional vector.
Vec4
A 4-dimensional vector.
VolumeGrid
A regular 3D grid structure.
VolumeGridHandle
Handle for a registered volume grid.
VolumeMesh
A volume mesh structure (tetrahedral or hexahedral).
VolumeMeshHandle
Handle for a registered volume mesh.

Enums§

AxisDirection
Axis direction for up/front vectors.
GizmoAction
Actions that can be triggered from the gizmo UI.
GizmoAxis
Axis for single-axis gizmo operations.
GizmoMode
The type of transformation gizmo.
GizmoSpace
The coordinate space for gizmo operations.
GroupsAction
Actions that can be triggered from the groups UI.
NavigationStyle
Camera navigation/interaction style.
ParamCoordsType
How to interpret UV coordinates.
ParamVizStyle
Visualization style for parameterization quantities.
PickElementType
Element type for pick results.
PolyscopeError
The main error type for polyscope-rs operations.
ProjectionMode
Camera projection mode.
QuantityKind
The kind of quantity (for categorization and UI).
ScreenshotError
Error type for screenshot operations.
SlicePlaneGizmoAction
Actions specific to slice plane gizmo manipulation.
SlicePlanesAction
Actions that can be triggered from the slice planes UI.
ViewAction
Actions that can be triggered from the view/controls UI.
VolumeCellType
Cell type for volume meshes.
VolumeGridVizMode
Visualization mode for volume grid scalar quantities.

Constants§

MAX_SLICE_PLANES
Maximum number of slice planes supported.

Traits§

HasQuantities
A structure that can have quantities attached to it.
IntoFaceList
Trait for face data that can be converted to the internal polygon format.
Pickable
Trait for objects that support picking/selection.
Quantity
Data associated with a structure that can be visualized.
Structure
A geometric object that can be visualized in polyscope.

Functions§

add_slice_plane
Adds a new slice plane to cut through geometry.
add_slice_plane_with_pose
Adds a slice plane with a specific pose.
apply_camera_settings
Syncs CameraSettings from UI to the actual Camera.
apply_gizmo_settings
Applies gizmo settings from UI.
apply_group_settings
Applies UI settings to a group.
apply_selection_transform
Applies transform from selection info to the selected structure.
apply_slice_plane_gizmo_transform
Applies gizmo transform to the selected slice plane.
apply_slice_plane_settings
Applies UI settings to a slice plane.
camera_to_settings
Creates CameraSettings from the current Camera state.
clear_file_drop_callback
Clears the file drop callback.
create_group
Creates a new group for organizing structures.
deselect_slice_plane_gizmo
Deselects the current slice plane from gizmo.
deselect_structure
Deselects the currently selected structure.
get_all_groups
Returns all group names.
get_all_slice_planes
Returns all slice plane names.
get_camera_view
Gets a registered camera view by name.
get_curve_network
Gets a registered curve network by name.
get_curve_network_transform
Gets the transform of a curve network by name.
get_gizmo_mode
Returns the current gizmo mode.
get_gizmo_settings
Gets gizmo settings for UI.
get_gizmo_space
Returns the current gizmo coordinate space.
get_group
Gets an existing group by name.
get_group_settings
Gets all groups as UI settings.
get_point_cloud
Gets a registered point cloud by name.
get_point_cloud_transform
Gets the transform of a point cloud by name.
get_scene_extents
Gets scene extents from the global context.
get_selected_structure
Returns the currently selected structure, if any.
get_selected_transform
Gets the transform of the currently selected structure.
get_selection_info
Gets selection info for UI.
get_slice_plane
Gets an existing slice plane by name.
get_slice_plane_selection_info
Gets slice plane selection info for gizmo rendering.
get_slice_plane_settings
Gets all slice planes as UI settings.
get_surface_mesh
Gets a registered surface mesh by name.
get_surface_mesh_transform
Gets the transform of a surface mesh by name.
get_volume_grid
Gets a registered volume grid by name.
get_volume_mesh
Gets a registered volume mesh by name.
get_volume_mesh_transform
Gets the transform of a volume mesh by name.
handle_gizmo_action
Handles a gizmo UI action.
handle_group_action
Handles a group UI action.
handle_slice_plane_action
Handles a slice plane UI action. Returns the new list of settings after the action.
has_selection
Returns whether any structure is currently selected.
init
Initializes polyscope with default settings.
is_gizmo_visible
Returns whether the gizmo is visible.
is_initialized
Returns whether polyscope has been initialized.
load_blendable_material
Loads a blendable (4-channel, RGB-tintable) matcap material from disk.
load_blendable_material_ext
Loads a blendable material using a base path and extension.
load_static_material
Loads a static (single-texture, non-RGB-tintable) matcap material from disk.
register_camera_view
Registers a camera view with polyscope using camera parameters.
register_camera_view_look_at
Registers a camera view from position, target, and up direction.
register_curve_network
Registers a curve network with explicit edges.
register_curve_network_line
Registers a curve network as a connected line (0-1-2-3-…).
register_curve_network_loop
Registers a curve network as a closed loop (0-1-2-…-n-0).
register_curve_network_segments
Registers a curve network as separate segments (0-1, 2-3, 4-5, …).
register_floating_color_image
Registers a floating color image (not attached to any structure).
register_floating_scalar_image
Registers a floating scalar image (not attached to any structure).
register_hex_mesh
Registers a hexahedral mesh with polyscope.
register_point_cloud
Registers a point cloud with polyscope.
register_surface_mesh
Registers a surface mesh with polyscope.
register_tet_mesh
Registers a tetrahedral mesh with polyscope.
register_volume_grid
Registers a volume grid with polyscope.
register_volume_grid_uniform
Registers a volume grid with uniform dimensions.
register_volume_mesh
Registers a generic volume mesh with polyscope.
remove_all_floating_quantities
Removes all floating quantities.
remove_all_groups
Removes all groups.
remove_all_slice_planes
Removes all slice planes.
remove_all_structures
Removes all structures.
remove_everything
Removes all structures, groups, slice planes, floating quantities, and clears callbacks.
remove_floating_quantity
Removes a floating quantity by name.
remove_group
Removes a group by name.
remove_slice_plane
Removes a slice plane by name.
remove_structure
Removes a structure by name.
render_to_file
Renders the current scene to a file.
render_to_image
Renders the current scene to a raw RGBA pixel buffer.
reset_selected_transform
Resets the transform of the currently selected structure to identity.
screenshot
Requests a screenshot with an auto-generated filename.
screenshot_to_file
Requests a screenshot to be saved to a specific file.
screenshot_to_file_with_options
Requests a screenshot to be saved to a specific file with custom options.
screenshot_with_options
Requests a screenshot with custom options.
select_slice_plane_for_gizmo
Selects a slice plane for gizmo manipulation.
select_structure
Selects a structure for gizmo manipulation.
set_auto_compute_extents
Sets auto-compute scene extents option.
set_curve_network_transform
Sets the transform of a curve network by name.
set_file_drop_callback
Sets a callback that is invoked when files are dropped onto the polyscope window.
set_gizmo_mode
Sets the gizmo mode (translate, rotate, or scale).
set_gizmo_snap_rotate
Sets the rotation snap value for the gizmo (in degrees).
set_gizmo_snap_scale
Sets the scale snap value for the gizmo.
set_gizmo_snap_translate
Sets the translation snap value for the gizmo.
set_gizmo_space
Sets the gizmo coordinate space (world or local).
set_gizmo_visible
Sets whether the gizmo is visible.
set_point_cloud_transform
Sets the transform of a point cloud by name.
set_selected_transform
Sets the transform of the currently selected structure.
set_surface_mesh_transform
Sets the transform of a surface mesh by name.
set_volume_mesh_transform
Sets the transform of a volume mesh by name.
show
Shows the polyscope viewer window.
shutdown
Shuts down polyscope and releases all resources.
with_camera_view
Executes a closure with mutable access to a registered camera view.
with_camera_view_ref
Executes a closure with immutable access to a registered camera view.
with_context
Access the global context for reading.
with_context_mut
Access the global context for writing.
with_curve_network
Executes a closure with mutable access to a registered curve network.
with_curve_network_ref
Executes a closure with immutable access to a registered curve network.
with_point_cloud
Executes a closure with mutable access to a registered point cloud.
with_point_cloud_ref
Executes a closure with immutable access to a registered point cloud.
with_surface_mesh
Executes a closure with mutable access to a registered surface mesh.
with_surface_mesh_ref
Executes a closure with immutable access to a registered surface mesh.
with_volume_grid
Executes a closure with mutable access to a registered volume grid.
with_volume_grid_ref
Executes a closure with immutable access to a registered volume grid.
with_volume_mesh
Executes a closure with mutable access to a registered volume mesh.
with_volume_mesh_ref
Executes a closure with immutable access to a registered volume mesh.

Type Aliases§

Result
A specialized Result type for polyscope-rs operations.