Skip to content

Commit 388d1fb

Browse files
committed
add small missing docs for windows, cameras, ui scale, quantity removal
1 parent e503558 commit 388d1fb

File tree

6 files changed

+129
-0
lines changed

6 files changed

+129
-0
lines changed

cpp/source/basics/camera_controls.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ These functions control the current viewing camera in for the Polyscope scene, a
44
```cpp
55
#include "polyscope/polyscope.h"
66

7+
// set the size of the window
8+
polyscope::view::setWindowSize(600, 800);
9+
710
// change the default up-direction or front-direction for the scene
811
polyscope::view::setUpDir(polyscope::UpDir::ZUp);
912
polyscope::view::setFrontDir(polyscope::FrontDir::NegYFront);
@@ -34,6 +37,35 @@ polyscope::view::setCameraParametersForCurrentView(cam_params):
3437
polyscope::CameraView* cam = polyscope::registerCameraView("cam1", params)
3538
```
3639
40+
## Window Controls
41+
42+
Get and set the size of the window which appears on the user's display.
43+
44+
??? func "`#!cpp void view::setWindowSize(int width, int height)`"
45+
46+
Set the size of the window.
47+
48+
Note that for some platforms, on high-DPI screens the pixel buffer resolution may be different from the logical size. This is the logical size.
49+
50+
??? func "`#!cpp std::tuple<int, int> getWindowSize()`"
51+
52+
Get the current size of the window.
53+
54+
Note that for some platforms, on high-DPI screens the pixel buffer resolution may be different from the logical size. This is the logical size.
55+
56+
??? func "`#!cpp std::tuple<int, int> getBufferSize()`"
57+
58+
Get the current pixel buffer resolution of the window.
59+
60+
Note that for some platforms, on high-DPI screens the pixel buffer resolution may be different from the logical size. This is the pixel buffer size.
61+
62+
??? func "`#!cpp void view::setWindowResizable(bool newVal)`"
63+
64+
If `false`, the window will be locked to size and the OS will not allow it to be resized. (Default: `true`)
65+
66+
There is also a corresponding `getWindowResizable()`.
67+
68+
3769
## Manipulating the Current View
3870
3971
These settings affect the 3D camera view in polyscope. It is often convenient to set them just before calling `polyscope::init()`, but they may set be anywhere.

cpp/source/basics/program_options.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,22 @@ polyscope::init();
126126

127127
If this option is `true`, the scene will be redrawn on every main loop iteration no matter what, circumventing the lazy drawing features. Default: `false`.
128128

129+
??? func "`#!cpp float options::uiScale`"
130+
131+
##### ui scale
132+
133+
A scale factor for all UI elements (text, buttons, panels). Can be useful for increase font sizes on high DPI screens. `2.0` means make everything twice as large.
134+
135+
This factor should also be incorporated into any user-defined widths in custom UIs, to ensure spacing remains correct as scaling is changed, like:
136+
137+
```
138+
ImGui::PushItemWidth(100 * polyscope::options::uiScale);
139+
```
140+
141+
If `-1`, a sensible value will be guessed at initialization time. This value is saved and restored between settings if the preferences file is enabled.
142+
143+
Default: `-1.`
144+
129145
??? func "`#!cpp bool options::buildGui`"
130146

131147
##### build gui

cpp/source/structures/structure_management.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,22 @@ If no longer needed, structures can be removed by name or by pointer. Removing a
8888
8989
Remove all structures from the scene.
9090
91+
## Quantities
92+
93+
Quantities, like scalar functions, color fields, vector fields, and more, can be associated with structures. See the available options for each kind of structure.
94+
95+
Quantities can be removed from a structure by name.
96+
97+
??? func "`#!cpp void Structure::removeQuantity(std::string name, bool errorIfAbsent = false)`"
98+
99+
Remove a quantity from the structure by name.
100+
101+
102+
??? func "`#!cpp void Structure::removeAllQuantities()`"
103+
104+
Remove all quantities which have been added to the structure.
105+
106+
91107
## Structure options
92108
93109
These basic options are shared by all structures. Structure options are managed as [persistent values]([[url.prefix]]/basics/parameters/#persistent-values), and thus will persist if a new structure is registered with the same name.

py/source/basics/camera_controls.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,35 @@ ps.set_view_camera_parameters(cam_params)
3535
ps_cam = ps.register_camera_view("cam1", cam_params)
3636
```
3737

38+
## Window Controls
39+
40+
Get and set the size of the window which appears on the user's display.
41+
42+
??? func "`#!python set_window_size(width, height)`"
43+
44+
Set the size of the window.
45+
46+
Note that for some platforms, on high-DPI screens the pixel buffer resolution may be different from the logical size. This is the logical size.
47+
48+
??? func "`#!python get_window_size()`"
49+
50+
Get the current size of the window. Returns a `(width, height)` tuple.
51+
52+
Note that for some platforms, on high-DPI screens the pixel buffer resolution may be different from the logical size. This is the logical size.
53+
54+
??? func "`#!python get_buffer_size()`"
55+
56+
Get the current pixel buffer resolution of the window. Returns a `(width, height)` tuple.
57+
58+
Note that for some platforms, on high-DPI screens the pixel buffer resolution may be different from the logical size. This is the pixel buffer size.
59+
60+
??? func "`#!python set_window_resizable(is_resizable)`"
61+
62+
If `false`, the window will be locked to size and the OS will not allow it to be resized. (Default: `true`)
63+
64+
There is also a corresponding `get_window_resizable()`.
65+
66+
3867
## Manipulating the Current View
3968

4069
These settings affect the 3D camera view in polyscope. It is often convenient to set them just before calling `ps.init()`, but they may set be anywhere.

py/source/basics/program_options.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,25 @@ ps.init()
130130

131131
If this option is `True`, the scene will be redrawn on every main loop iteration no matter what, circumventing the lazy drawing features. Default: `False`.
132132

133+
??? func "`#!python set_ui_scale(scale)`"
134+
135+
##### ui scale
136+
137+
A scale factor for all UI elements (text, buttons, panels). Can be useful for increase font sizes on high DPI screens. `2.0` means make everything twice as large.
138+
139+
There is also a corresponding `get_ui_scale()`.
140+
141+
This factor should also be incorporated into any user-defined widths in custom UIs, to ensure spacing remains correct as scaling is changed, like:
142+
143+
```
144+
psim.PushItemWidth(100 * ps.get_ui_scale());
145+
```
146+
147+
If `-1`, a sensible value will be guessed at initialization time. This value is saved and restored between settings if the preferences file is enabled.
148+
149+
Default: `-1.`
150+
151+
133152
??? func "`#!python set_build_gui(b)`"
134153

135154
##### build gui

py/source/structures/structure_management.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,23 @@ ps.remove_all_structures()
6767
Remove all structures from the scene.
6868

6969

70+
## Quantities
71+
72+
Quantities, like scalar functions, color fields, vector fields, and more, can be associated with structures. See the available options for each kind of structure.
73+
74+
Quantities can be removed from a structure by name.
75+
76+
77+
??? func "`#!python Structure.remove_quantity(name, error_if_absent=False)`"
78+
79+
Remove a quantity from the structure by name.
80+
81+
82+
??? func "`#!python Structure.remove_all_quantities()`"
83+
84+
Remove all quantities which have been added to the structure.
85+
86+
7087
## Structure options
7188

7289
These basic options are shared by all structures. Structure options are managed as [persistent values]([[url.prefix]]/basics/parameters/#persistent-values), and thus will persist if a new structure is registered with the same name.

0 commit comments

Comments
 (0)