1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//! Initialization and lifecycle management for polyscope-rs.
//!
//! This module provides the core functions to initialize, run, and shut down
//! the polyscope visualization system.
use crateResult;
/// Initializes polyscope with default settings.
///
/// This must be called before any other polyscope functions. It sets up the
/// global state required for structure registration and rendering.
///
/// # Errors
///
/// Returns an error if polyscope has already been initialized.
///
/// # Example
///
/// ```no_run
/// use polyscope_rs::*;
///
/// fn main() -> Result<()> {
/// init()?;
/// // Now you can register structures and call show()
/// Ok(())
/// }
/// ```
/// Returns whether polyscope has been initialized.
/// Shuts down polyscope and releases all resources.
///
/// This clears all registered structures and resets the global state.
/// After calling this, you can call [`init()`] again to reinitialize.
///
/// Note: This is typically not needed as resources are cleaned up when
/// the program exits. It's mainly useful for tests or when you need to
/// reset the visualization state.
/// Shows the polyscope viewer window.
///
/// This function opens the interactive 3D viewer and blocks until the window
/// is closed (by pressing ESC or clicking the close button).
///
/// Before calling `show()`, you should:
/// 1. Call [`init()`] to initialize polyscope
/// 2. Register structures using `register_*()` functions
/// 3. Optionally add quantities to structures
///
/// # Example
///
/// ```no_run
/// use polyscope_rs::*;
///
/// fn main() -> Result<()> {
/// init()?;
///
/// // Register some geometry
/// let points = vec![Vec3::ZERO, Vec3::X, Vec3::Y];
/// register_point_cloud("my points", points);
///
/// // Open the viewer (blocks until closed)
/// show();
///
/// Ok(())
/// }
/// ```