server
Viser server setup utilities.
compute_grid_size(pos: np.ndarray, padding: float = 1.2) -> float
¶
Compute grid size based on trajectory extent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pos
|
ndarray
|
Position array of shape (N, 3) |
required |
padding
|
float
|
Padding factor (1.2 = 20% padding) |
1.2
|
Returns:
| Type | Description |
|---|---|
float
|
Grid size (width and height) |
Source code in openscvx/plotting/viser/server.py
compute_velocity_colors(vel: np.ndarray, cmap_name: str = 'viridis') -> np.ndarray
¶
Compute RGB colors based on velocity magnitude.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vel
|
ndarray
|
Velocity array of shape (N, 3) |
required |
cmap_name
|
str
|
Matplotlib colormap name |
'viridis'
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Array of RGB colors with shape (N, 3), values in [0, 255] |
Source code in openscvx/plotting/viser/server.py
create_server(pos: np.ndarray, dark_mode: bool = True, show_grid: bool = True) -> viser.ViserServer
¶
Create a viser server with basic scene setup.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pos
|
ndarray
|
Position array for computing grid size |
required |
dark_mode
|
bool
|
Whether to use dark theme |
True
|
show_grid
|
bool
|
Whether to show the grid (default True) |
True
|
Returns:
| Type | Description |
|---|---|
ViserServer
|
ViserServer instance with grid and origin frame |