HikoGUI
A low latency retained GUI
|
Files | |
file | aarectangle.hpp |
file | alignment.hpp |
types and utilities for alignment. | |
file | corner_radii.hpp |
Defined the corner_radii type. | |
file | extent2.hpp |
Defined the geo::extent, extent2 and extent3 types. | |
file | extent3.hpp |
Defined the geo::extent, extent2 and extent3 types. | |
file | line_end_cap.hpp |
Defined line_end_cap. | |
file | line_join_style.hpp |
Defines line_join_style. | |
file | line_segment.hpp |
Defines line_segment. | |
file | lookat.hpp |
Defines lookat. | |
Data Structures | |
class | hi::v1::aarectangle |
Class which represents an axis-aligned rectangle. More... | |
class | hi::v1::alignment |
Horizontal/Vertical alignment combination. More... | |
class | hi::v1::corner_radii |
The 4 radii of the corners of a quad or rectangle. More... | |
class | hi::v1::extent2 |
A high-level geometric extent. More... | |
class | hi::v1::extent3 |
A high-level geometric extent. More... | |
class | hi::v1::line_segment |
Line segment. More... | |
class | hi::v1::lookat |
Perspective transform. More... | |
class | hi::v1::margins |
The left, bottom, right and top margins. More... | |
class | hi::v1::perspective |
Perspective transform. More... | |
struct | hi::v1::box_constraints |
2D constraints. More... | |
Functions | |
constexpr std::optional< float > | hi::v1::make_guideline (vertical_alignment alignment, float bottom, float top, float guideline_width) |
Create a guideline between two points. | |
constexpr std::optional< float > | hi::v1::make_guideline (horizontal_alignment alignment, float left, float right, float guideline_width=0.0f) |
Create a guideline between two points. | |
constexpr axis | hi::v1::operator& (axis const &lhs, axis const &rhs) noexcept |
AND the axis. | |
constexpr axis | hi::v1::operator| (axis const &lhs, axis const &rhs) noexcept |
OR the axis. | |
constexpr bool | hi::v1::to_bool (axis const &rhs) noexcept |
Check if any of the axis are set. | |
hi_export_module (hikogui.geometry :margins) | |
geometry/margins.hpp | |
std::pair< std::size_t, std::size_t > | v1::parse_spreadsheet_address (std::string_view address, std::size_t start_column_nr=0, std::size_t start_row_nr=0) |
Parse a spreadsheet address. | |
std::tuple< std::size_t, std::size_t, std::size_t, std::size_t > | v1::parse_spreadsheet_range (std::string_view address, std::size_t start_column_nr=0, std::size_t start_row_nr=0) |
Parse a spreadsheet range. | |
The simd
is an array of numbers, with many mathematical operations on the array of numbers. The simd
is designed to be useable in constexpr and easily to vectorize by the optimizer.
The f32x4
is an simd<float,4>
.
Many of the operations on a f32x4
are hand optimized using the intel intrinsics on SSE registers.
A vector is a direction and distance.
When transforming a vector, only scale, rotation and shear have effect.
Both vector2
and vector3
are implemented as a f32x4
homogeneous 4D coordinate with w = 0.0.
A point is a location in space.
A point can be transformed in the same way as a vector and also be translated.
Both point2
and point3
are implemented as a f32x4
homogeneous 4D coordinate with w = 1.0.
An extent is a width, height and depth.
An extent can be transformed like a vector.
Both extent2
and extent3
are implemented as a f32x4
homogeneous 4D coordinate with w = 0.0.
Corner shapes are 4 floating point numbers, one for the corner in the left-bottom, right-bottom, left-top and right-top corner. Each number has the following meaning:
0.0
Sharp corner,>0.0
Radius of a rounded corner,<0.0
Radius of a cut corner.A 4D red, green, blue and alpha value. A color
can be transformed like a vector3
. In this case, the alpha value is ignored and copied into the result.
A rectangle
is a closed plane in three dimensions.
A rectangle
can be transformed like a point3
.
It should be implemented as a point3
in the left-bottom corner and two vector3
s to the upper and right corners. However, it is currently implemented as 4 points, one for each corner.
The aarectangle
class is a 2D axis-aligned rectangle.
When transforming an axis aligned rectangle in 3D or with rotation, the result will be a normal rectangle
. A rectangle can be converted back to an aarectangle
, as a bounding rectangle around the transformed rectangle.
An aarectangle
is implemented as a f32x4
where:
x
: left-bottom point xy
: left-bottom point yz
: right-top point xw
: right-top point yThe mat
class is a 4x4 homogeneous transformation matrix in column-major order. Internally, this a vec
for each column.
Vector * matrix multiplications are performed as if the vector is a column.
All origins (0, 0, 0) are at the bottom-left-far corner. With the x-axis pointing right, y-axis pointing up, z-axis pointing toward the camera. This is the same coordinate system as OpenGL; a right-handed coordinate system.
This is true for:
The coordinates in a window and widgets are in pixels.
With the center of the left bottom pixel having the coordinates (0.5, 0.5).
The alignment of borders to pixels is the responsibility of the widget that draws itself. The widget has access to the draw_context::draw_box_including_border()
function to position the border's edge to the edge of the given rectangle, if the rectangle is rounded to integer coordinates; the rectangle, border and pixel will share the same edge.
Z-coordinate for a window is between 0.0
(far) to 100.0
(near).
For better precision we use a reverse-z method, to combine 1/z together with float with linear precision.
0.0
.1.0
nearer.25.0
nearer.The coordinates in an image are in pixels. With the center of the left bottom pixel having the coordinates (0.5, 0.5).
The coordinates in a path are free from scale and origin, when rendering a path to an image, the path should be first be transformed to image coordinates.
Glyph coordinates are in the number of Em units. X-axis pointing right, Y-axis pointing up. The origin (0,0) is on the crossing of the base line and left side bearing. Vertices of front faces are specified in counter clockwise order.
Corners are enumerated as follows:
0
: far bottom left1
: far bottom right2
: far top left3
: far top right4
: near bottom left5
: near bottom right6
: near top left7
: near top rightWhen corners are packed in a 4D vector:
x
: bottom-lefty
: bottom-rightz
: top-leftw
: top-rightWhen edges are packed in a 4D vector:
x
: bottom-edgey
: left-edgez
: top-edgew
: right-edgeA front facing triangle has the vertex ordered in counter-clockwise direction.
Quads are defined as two front facing triangles.
The vertex index order is: 0, 1, 2, 2, 1, 3
.
As illustrated below:
|
strong |
An enumeration of the 3 axis for 3D geometry.
It can be used as flags/mask for a set of axis.
|
strong |
Horizontal alignment.
|
strong |
|
strong |
The way two lines should be joined.
|
strong |
hi_export_module | ( | hikogui.geometry :margins | ) |
|
constexpr |
Create a guideline between two points.
The horizontal guideline is may used to create alignment for text or numerics. The guideline_width should probably be set to zero.
alignment | The horizontal alignment where to put the guideline. |
left | The x-coordinate of the left. |
right | The x-coordinate of the right. |
guideline_width | The thickness of the guideline |
std::nullopt | No alignment, or guideline does not fit in the space. |
|
constexpr |
Create a guideline between two points.
The vertical guideline is mostly used to create a baseline; in this case the guideline_width is set to the cap-height of a font.
alignment | The vertical alignment how to place the guideline. |
bottom | The y-coordinate of the bottom. |
top | The y-coordinate of the top. |
guideline_width | The thickness of the guideline |
nullopt | No alignment, or guideline does not fit in the space. |
AND the axis.
OR the axis.
|
inline |
Parse a spreadsheet address.
address | The address to parse. |
start_column_nr | A relative column in the address is added to the start-column. |
start_row_nr | A relative row in the address is added to the start-row. |
|
inline |
Parse a spreadsheet range.
address | A spreadsheet address in the form "A1" or "A1:B3" |
start_column_nr | The start column for relative column addressing. |
start_row_nr | The start row for relative row addressing. |
|
constexprnoexcept |
Check if any of the axis are set.