You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+20-8Lines changed: 20 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,23 @@
1
1
# dsga : Data Structures for Geometric Algorithms
2
2
3
-
**dsga** is a single header-only **C++20 library** that implements the **vectors** and **matrices** from the OpenGL Shading Language 4.6 specification ([pdf](https://www.khronos.org/registry/OpenGL/specs/gl/GLSLangSpec.4.60.pdf) | [html](https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.60.html)). It is inspired by the spec, but does deviate in some small ways, mostly to make it work well in C++20. It is not intended to be used for rendering, just for sharing the fundamental data structures and associated functions. Our requirements in general are for things like 3D CAD/CAM applications and other geometric and algebraic things. See [motivation](docs/MOTIVATION.md) for more details. This library does not use SIMD instructions or types under the hood, beyond whatever the compiler provides through optimization.
3
+
**dsga** is a single header-only **C++20 library** that implements the **vectors** and **matrices** from the OpenGL Shading Language 4.6 specification ([pdf](https://www.khronos.org/registry/OpenGL/specs/gl/GLSLangSpec.4.60.pdf) | [html](https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.60.html)). It is inspired by the spec, but does deviate in some small ways, mostly to make it work well in C++20. It is intended to be used for [array programming](https://en.wikipedia.org/wiki/Array_programming) other than rendering. Our requirements in general are for things like 3D CAD/CAM applications and other geometric and algebraic things. See [motivation](docs/MOTIVATION.md) for more details. This library does _not_ use SIMD instructions or types under the hood, beyond whatever the compiler provides through optimization.
* Large __Breaking Change__ - minimized how vectors of length == 1 behave as vectors. Most dsga operations and functions treat length == 1 vectors as scalars, returning scalar results (mostly through refactoring the underlying execution machinery). Use of the non-GLSL types iscal, uscal, bscal, scal, fscal, dscal, etc., is generally discouraged.
15
+
* Small __Breaking Change__ - reverted/removed ```std::initializer_list``` constructors added in v1.5.0.
16
+
* Added ```within_tolerance()``` comparison functions, that fit well with ```within_distance()``` and ```within_box()```.
17
+
18
+
* v1.5.0
19
+
* Small __Breaking Change__ - added ```std::initializer_list``` constructors to ```basic_vector``` and ```basic_matrix``` - if not enough components, then fill rest with zeros - if too many components, just use the components necessary to fill the vector or matrix.
20
+
* Fixed ```indexed_vector``` iterator classes to use signed types for indexing into storage (fixes iterator subtraction and ```reverse_iterator``` usage, as the iterators are random-access).
Our programming environment is ```c++20```, not a GLSL shader program, so the entire GLSL Shading language specification is a super-set of what we are trying to achieve. We really just want the vector and matrix data structures (and their corresponding functions and behavior) to be usable in a ```c++20``` environment.
207
+
Our programming environment is ```C++20```, not a GLSL shader program, so the entire GLSL Shading language specification is a super-set of what we are trying to achieve. We really just want the vector and matrix data structures (and their corresponding functions and behavior) to be usable in a ```C++20``` environment. Another term for this type of programming is [array programming](https://en.wikipedia.org/wiki/Array_programming).
197
208
198
209
The following links to the shading specification should help with understanding what we are trying to implement with this header-only library.
199
210
@@ -311,10 +322,11 @@ This is a c++20 library, so that needs to be the minimum standard that you tell
311
322
312
323
## Status
313
324
314
-
Current version: `v1.5.0`
325
+
Current version: `v2.0.0`
315
326
316
327
* Everything major has some tests, but code coverage is not 100%.
@@ -361,7 +373,7 @@ The tests have been most recently run on:
361
373
[doctest] Status: SUCCESS!
362
374
```
363
375
364
-
* **clang 18.1.3** on Windows, [official binaries](https://github.com/llvm/llvm-project/releases/tag/llvmorg-18.1.3), with MSVC and/or gcc 13.2.0 installed:
376
+
* **clang 18.1.5** on Windows, [official binaries](https://github.com/llvm/llvm-project/releases/tag/llvmorg-18.1.5), with MSVC and/or gcc 13.2.0 installed:
365
377
366
378
Performs all the unit tests except where there is lack of support for ```std::is_corresponding_member<>```, and this is protected with a feature test macro.
367
379
@@ -374,7 +386,7 @@ Performs all the unit tests except where there is lack of support for ```std::is
374
386
[doctest] Status: SUCCESS!
375
387
```
376
388
377
-
### Ubuntu Noble Numbat preview running in WSL2 for Windows 11
389
+
### Ubuntu 24.04 LTS running in WSL2 for Windows 11
378
390
379
391
* **gcc 14.0.1**
380
392
@@ -387,7 +399,7 @@ Performs all the unit tests except where there is lack of support for ```std::is
387
399
[doctest] Status: SUCCESS!
388
400
```
389
401
390
-
* **clang 18.1.0rc2**
402
+
* **clang 18.1.3**
391
403
392
404
Performs all the unit tests except where there is lack of support for ```std::is_corresponding_member<>```, and this is protected with a feature test macro.
Applies a lambda/function/function object/callable to every element of a vector, in an unspecified order. The callable must take either a ```T``` or ```const T &```, and it must return a ```T```. Returns a vector of the results.
584
+
Applies a lambda/function/function object/callable to every element of a vector, in element order (order only matters if callable is side-effecting and/or has state). The callable must take either a ```T``` or ```const T &```, and it must return a ```T```. Returns a vector of the results.
585
585
586
586
##### ```vector_base::shift```
587
587
```c++
@@ -1822,6 +1822,7 @@ Most of the functions perform their operation component-wise. There are some fun
1822
1822
* [```none```](#none)
1823
1823
* [```logicalNot```](#logicalnot)
1824
1824
* Tolerance Checking Functions
1825
+
* [```within_tolerance```](#within_tolerance)
1825
1826
* [```within_distance```](#within_distance)
1826
1827
* [```within_box```](#within_box)
1827
1828
* Other Vector Functions
@@ -1976,15 +1977,15 @@ Not in GLSL. May or may not actually be faster that ```rsqrt()```, for which thi
const vector_base<W2, U, C2, D2> &tolerance) noexcept;
2401
+
```
2402
+
Not in GLSL. Is a vector of values (or a single value) the same as 0 within a tolerance (or vector of tolerances). The tolerance is a less-than-or-equal comparison. Tolerances need to be non-negative, or the function will assert.
const vector_base<W3, U, 1, D3> &tolerance) noexcept;
2388
2423
```
2389
-
Not in GLSL. It compares the Euclidean distance between two vectors to see if they are within the tolerance. The tolerance is a strictly less-than comparison. Tolerances need to be non-negative.
2424
+
Not in GLSL. It compares the Euclidean distance between two vectors to see if the distance is 0 within the tolerance. The tolerance is a less-than-or-equal comparison. Tolerances need to be non-negative, or the function will assert.
const vector_base<W3, U, C2, D3> &tolerance) noexcept;
2404
2445
```
2405
-
Not in GLSL. This represents a bounding-box tolerance check, which aggregates the component-wise tolerance checks. These functions can take a single tolerance or a vector of tolerances. All the vector elements must be within tolerance or the whole answer is false. The tolerance is a strictly less-than comparison. All tolerances need to be non-negative.
2446
+
Not in GLSL. This represents a bounding-box tolerance check, which aggregates the component-wise tolerance checks. These functions can take a single tolerance or a vector of tolerances and check if the differences of the value(s) are 0 within the tolerance(s). All the vector elements must be within tolerance or the whole answer is false. The tolerance is a less-than-or-equal comparison. All tolerances need to be non-negative, or the function will assert.
Not in GLSL. Runtime function for swizzling. Returns a stand-alone ```dsga::basic_vector``` version of a swizzle, instead of a ```dsga::indexed_vector``` data member. If the index arguments are invalid (out of bounds), this function will throw a ```std::out_of_range()``` exception. Inspired by the [Odin Programming Language](https://odin-lang.org/docs/overview/#swizzle-operations).
2458
+
Not in GLSL. Runtime function for swizzling. Returns a stand-alone ```dsga::basic_vector``` version of a swizzle, instead of a ```dsga::indexed_vector``` data member. Will return a scalar value if only one index argument. If the index arguments are invalid (out of bounds), this function will throw a ```std::out_of_range()``` exception. Inspired by the [Odin Programming Language](https://odin-lang.org/docs/overview/#swizzle-operations).
2414
2459
2415
2460
### Scalar Functions
2416
2461
Scalar versions of most of the vector free functions exist. It is not recommended to use them if there is a function in the C++ Standard Library that does the same thing.
* Large __Breaking Change__ - minimized how vectors of length == 1 behave as vectors. Most dsga operations and functions treat length == 1 vectors as scalars, returning scalar results (mostly through refactoring the underlying execution machinery). Use of the non-GLSL types iscal, uscal, bscal, scal, fscal, dscal, etc., is generally discouraged.
5
+
* Small __Breaking Change__ - reverted/removed ```std::initializer_list``` constructors added in v1.5.0.
6
+
* Moved vector relational functions above the other vector functions (for use in assertions).
7
+
* Added ```within_tolerance()``` comparison functions, that fit well with ```within_distance()``` and ```within_box()```.
8
+
* Upgraded to cxcm v1.1.2.
9
+
* Minor type constraint (concepts) refactoring.
10
+
* Other minor refactoring.
11
+
* Added changelog.
12
+
13
+
### v1.5.0
14
+
* Small __Breaking Change__ - added ```std::initializer_list``` constructors to ```basic_vector``` and ```basic_matrix``` - if not enough components, then fill rest with zeros - if too many components, just use the components necessary to fill the vector or matrix.
15
+
* Fixed ```indexed_vector``` iterator classes to use signed types for indexing into storage (fixes iterator subtraction and ```reverse_iterator``` usage, as the iterators are random-access).
16
+
17
+
### v1.4.1
18
+
* Minor refactoring.
19
+
* Comment removal and/or updating.
20
+
* Removed Microsoft VS2019 support (latest version of VS2019 does not compile dsga).
0 commit comments