summaryrefslogtreecommitdiffstats
path: root/src/gui/math3d/qvectornd.h
Commit message (Collapse)AuthorAgeFilesLines
* Use SPDX license identifiersLucie Gérard2022-05-161-39/+3
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Add more support for structured bindingsGiuseppe D'Angelo2021-02-251-0/+79
| | | | | | | | | | | | | | | | | | | | | | | After QPoint(F), it's now the time of QSize(F) and QVectorND, which can be unambiguously decomposed. [ChangeLog][QtCore][QSize] QSize is now usable in a structured binding declaration. [ChangeLog][QtCore][QSizeF] QSizeF is now usable in a structured binding declaration. [ChangeLog][QtGui][QVector2D] QVector2D is now usable in a structured binding declaration. [ChangeLog][QtGui][QVector3D] QVector3D is now usable in a structured binding declaration. [ChangeLog][QtGui][QVector4D] QVector4D is now usable in a structured binding declaration. Change-Id: I67bb152f4210f2be27607179cd2ec522174cc483 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Make explicit that we expect co-ordinates to be finiteEdward Welbourne2021-02-041-2/+28
| | | | | | | | | | | | | | | | | | | The various spatial-vector, line, point, region and margin types have all long taken for granted that their co-ordinates are finite and, in particular, not NaN. Make this expectation explicit in the documentation. Added assertions where (chiefly) noexcept and (where the assertion would be a simple qIsFinite() call) constexpr didn't preclude doing so. Also assert against zero divisors that would lead to non-finite results. Make minor clean-ups to docs in the process. QMarginsF had several methods whose declaration, definition and docs weren't consistent in their parameter names. Task-number: QTBUG-89010 Change-Id: I601a830959d13a73dcb17ce31a1202a1486c8f7f Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Rationalize QVector[234]D's length-handlingEdward Welbourne2021-02-041-87/+28
| | | | | | | | Use qHypot() instead of casting to and from double so much, use qFuzzyCompare(_, 1.0f) rather than qFuzzyIsNull(_ - 1.0f). Change-Id: I70f38fe2d9aefe1ceb15e1a370f181a7856911b7 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* QVectorND: make some constructors explicitGiuseppe D'Angelo2021-01-181-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QVector2D has implicit conversions towards QVector3D/4D, and QVector3D has an implicit conversion towards QVector4D. Although in principle this is fine because it's not a data loss, it's still sketchy; for instance, it allows mixed operations to compile: vector2d + vector3d; vector4d - vector3d; vector3d * vector4d; // ! (Random observation: the conversion from QPoint(F) to QVectorND are actually already marked as explicit.) This is a leftover not done for Qt 6.0. I am not making these opt-out: having an implicit conversion here is outright *dangerous*, and any usage that fails to compile needs to be inspected to make sure it was the intended behavior. [ChangeLog][Potentially Source-Incompatible Changes] The QVector2D/3D/4D converting constructors from another QVectorND now explicit. This was done to prevent a category of bugs resulting from operations accidentally mixing QVectorND objects. Fixes: QTBUG-90327 Change-Id: Ifcd873f6a0d3fc10b9e68c935fe1f69f86a2340b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* De-inline qFuzzyCompare for QMatrix4x4 and QVector4DLars Knoll2020-11-191-23/+4
| | | | | Change-Id: Ic412d5cefcc1c41e90ee5cf98814469aec3a91f6 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Clean up QVector2D/3D/4DGiuseppe D'Angelo2020-11-191-0/+1105
In random order: * Remove code marked for removal in Qt 6. * Inline as much as possible. This should give us a massive speed boost in some simple operations where the function call overhead as much as the cost of body of the function itself (lengthSquared, dotProduct, etc.). * Plaster constexpr and noexcept, as much as possible; follow Lakos' rule. * Unexport the classes; selectively export only the symbols still defined out of line. * Add [[nodiscard]] to any non-trivial mathematical operation (e.g. calculate the length). * To avoid circular dependencies, centralize their implementation in one file. Leave the existing headers for compatibility with existing #include statements. * Change all the signatures of the classes' members to take QVectorND, QPointF, etc. objects by value, not by const ref. Usage in other classes (e.g. QMatrix4x4) has not been adjusted. Change-Id: Iaf5a4b5289fcdf704e77656793390b8e772e94a5 Reviewed-by: Andy Nichols <andy.nichols@qt.io>