Struct WindowCtx
Defined in File point_viz.h
Struct Documentation
-
struct WindowCtx
Context for input callbacks.
Public Functions
-
double aspect_ratio() const
return the aspect ratio of the viewport.
- Returns:
The aspect ratio of the viewport.
-
std::pair<double, double> normalized_coordinates(double x, double y) const
return 2d coordinates normalized to (-1, 1) in the y-axis, given viewport coordinates.
PointViz renders 2d images and labels in this coordinate system, and as such this method can be used to determine if a pixel in viewport coordinates falls within a 2d image.
- Parameters:
x[in] – X axis value of 2D viewport coordinate
y[in] – Y axis value of 2D viewport coordinate
- Returns:
2d coordinates normalized to (-1, 1) in the y-axis
-
std::pair<double, double> viewport_coordinates(double normalized_x, double normalized_y) const
the inverse of “normalized_coordinates”.
Given 2d coordinates normalized to (-1, 1) in the y-axis, return viewport coordinates.
- Parameters:
normalized_x[in] – X axis value of 2D normalized coordinate
normalized_y[in] – Y axis value of 2D normalized coordinate
- Returns:
2d coordinates in viewport pixel space.
Public Members
-
bool lbutton_down = {false}
True if the left mouse button is held.
-
bool mbutton_down = {false}
True if the middle mouse button is held.
-
double mouse_x = {0}
Current mouse x position.
-
double mouse_y = {0}
Current mouse y position.
-
int viewport_width = {0}
Current viewport width in pixels.
-
int viewport_height = {0}
Current viewport height in pixels.
-
int window_width = {0}
Current window width in screen coordinates.
-
int window_height = {0}
Current window height in screen coordinates.
-
double aspect_ratio() const