wx_BGI_Graphics
Classic BGI-compatible graphics API with modern OpenGL extension API
Loading...
Searching...
No Matches
bgi_ucs.h
Go to the documentation of this file.
1#pragma once
2
3#include "bgi_types.h"
4
5#include <glm/glm.hpp>
6#include <glm/gtc/matrix_transform.hpp>
7
21namespace bgi
22{
23
24 // -------------------------------------------------------------------------
25 // Frame construction helpers
26 // -------------------------------------------------------------------------
27
39 CoordSystem ucsFromNormal(float nx, float ny, float nz,
40 float ox, float oy, float oz);
41
48
49 // -------------------------------------------------------------------------
50 // Transform matrices
51 // -------------------------------------------------------------------------
52
58 glm::mat4 ucsLocalToWorldMatrix(const CoordSystem &cs);
59
64 glm::mat4 ucsWorldToLocalMatrix(const CoordSystem &cs);
65
66 // -------------------------------------------------------------------------
67 // Point transforms
68 // -------------------------------------------------------------------------
69
78 float wx, float wy, float wz,
79 float &lx, float &ly, float &lz);
80
89 float lx, float ly, float lz,
90 float &wx, float &wy, float &wz);
91
92 // -------------------------------------------------------------------------
93 // World extents helpers
94 // -------------------------------------------------------------------------
95
100 void worldExtentsExpand(WorldExtents &extents, float x, float y, float z);
101
106 glm::vec3 worldExtentsCentre(const WorldExtents &extents);
107
112 glm::vec3 worldExtentsHalfSize(const WorldExtents &extents);
113
114} // namespace bgi
Definition bgi_camera.h:28
glm::mat4 ucsLocalToWorldMatrix(const CoordSystem &cs)
Returns the 4×4 matrix that transforms a point from UCS local space to world space.
void worldExtentsExpand(WorldExtents &extents, float x, float y, float z)
Expands extents to include the point (x, y, z).
glm::vec3 worldExtentsHalfSize(const WorldExtents &extents)
Returns the half-extents (half-size of each axis) as a vec3.
void ucsLocalToWorld(const CoordSystem &cs, float lx, float ly, float lz, float &wx, float &wy, float &wz)
Transforms a UCS local point into world-space coordinates.
CoordSystem ucsFromNormal(float nx, float ny, float nz, float ox, float oy, float oz)
Constructs a right-handed orthonormal frame from a surface normal.
void ucsOrthonormalise(CoordSystem &cs)
Orthonormalises the three axis vectors of a CoordSystem in-place using the Gram-Schmidt process.
glm::mat4 ucsWorldToLocalMatrix(const CoordSystem &cs)
Returns the 4×4 matrix that transforms a point from world space to UCS local space.
glm::vec3 worldExtentsCentre(const WorldExtents &extents)
Returns the centre of the AABB as a vec3.
void ucsWorldToLocal(const CoordSystem &cs, float wx, float wy, float wz, float &lx, float &ly, float &lz)
Transforms a world-space point into UCS local coordinates.
A named user coordinate system (UCS).
Definition bgi_types.h:415
Axis-aligned bounding box (AABB) representing the programmer's declared drawing extents in world spac...
Definition bgi_types.h:475