![]() |
Qt 6.x
The Qt SDK
|
#include <QtCore/qglobal.h>#include <QtCore/qalgorithms.h>#include <cmath>
Include dependency graph for qmath.h:Go to the source code of this file.
Classes | |
| struct | QtPrivate::QHypotType< R, F > |
| class | QtPrivate::QHypotHelper< T > |
Namespaces | |
| namespace | QtPrivate |
| \macro QT_NAMESPACE | |
Macros | |
| #define | _USE_MATH_DEFINES |
| #define | undef_USE_MATH_DEFINES |
| #define | QT_SINE_TABLE_SIZE 256 |
| #define | M_E (2.7182818284590452354) |
| #define | M_LOG2E (1.4426950408889634074) |
| #define | M_LOG10E (0.43429448190325182765) |
| #define | M_LN2 (0.69314718055994530942) |
| #define | M_LN10 (2.30258509299404568402) |
| #define | M_PI (3.14159265358979323846) |
| #define | M_PI_2 (1.57079632679489661923) |
| #define | M_PI_4 (0.78539816339744830962) |
| #define | M_1_PI (0.31830988618379067154) |
| #define | M_2_PI (0.63661977236758134308) |
| #define | M_2_SQRTPI (1.12837916709551257390) |
| #define | M_SQRT2 (1.41421356237309504880) |
| #define | M_SQRT1_2 (0.70710678118654752440) |
Functions | |
| template<typename T > | |
| int | qCeil (T v) |
| template<typename T > | |
| int | qFloor (T v) |
| template<typename T > | |
| auto | qFabs (T v) |
| template<typename T > | |
| auto | qSin (T v) |
| template<typename T > | |
| auto | qCos (T v) |
| template<typename T > | |
| auto | qTan (T v) |
| template<typename T > | |
| auto | qAcos (T v) |
| template<typename T > | |
| auto | qAsin (T v) |
| template<typename T > | |
| auto | qAtan (T v) |
| template<typename T1 , typename T2 > | |
| auto | qAtan2 (T1 y, T2 x) |
| template<typename T > | |
| auto | qSqrt (T v) |
| template<typename F , typename ... Fs> | |
| auto | qHypot (F first, Fs... rest) |
| template<typename Tx , typename Ty > | |
| auto | qHypot (Tx x, Ty y) |
| template<typename T > | |
| auto | qLn (T v) |
| template<typename T > | |
| auto | qExp (T v) |
| template<typename T1 , typename T2 > | |
| auto | qPow (T1 x, T2 y) |
| qreal | qFastSin (qreal x) |
| qreal | qFastCos (qreal x) |
| constexpr float | qDegreesToRadians (float degrees) |
| constexpr double | qDegreesToRadians (double degrees) |
| constexpr long double | qDegreesToRadians (long double degrees) |
| template<typename T , std::enable_if_t< std::is_integral_v< T >, bool > = true> | |
| constexpr double | qDegreesToRadians (T degrees) |
| constexpr float | qRadiansToDegrees (float radians) |
| constexpr double | qRadiansToDegrees (double radians) |
| constexpr long double | qRadiansToDegrees (long double radians) |
| constexpr quint32 | QtPrivate::qConstexprNextPowerOfTwo (quint32 v) |
| constexpr quint64 | QtPrivate::qConstexprNextPowerOfTwo (quint64 v) |
| constexpr quint32 | QtPrivate::qConstexprNextPowerOfTwo (qint32 v) |
| constexpr quint64 | QtPrivate::qConstexprNextPowerOfTwo (qint64 v) |
| constexpr quint32 | qNextPowerOfTwo (quint32 v) |
| constexpr quint64 | qNextPowerOfTwo (quint64 v) |
| constexpr quint32 | qNextPowerOfTwo (qint32 v) |
| constexpr quint64 | qNextPowerOfTwo (qint64 v) |
| constexpr unsigned long | qNextPowerOfTwo (unsigned long v) |
| constexpr unsigned long | qNextPowerOfTwo (long v) |
Variables | |
| Q_CORE_EXPORT const qreal | qt_sine_table [QT_SINE_TABLE_SIZE] |
| auto qAcos | ( | T | v | ) |
Definition at line 72 of file qmath.h.
Referenced by addCircle(), QQuick3DQuaternionUtils::lookAt(), and rotationQuaternionForLookAt().
Here is the caller graph for this function:| auto qAtan | ( | T | v | ) |
Definition at line 84 of file qmath.h.
Referenced by QQC2::QStyleHelper::angle(), EaseOvershoot(), and QSSGRenderCamera::verticalFov().
Here is the caller graph for this function:| auto qAtan2 | ( | T1 | y, |
| T2 | x | ||
| ) |
Definition at line 90 of file qmath.h.
Referenced by QQuickFrictionAffector::affectParticle(), QQuickMaterialRipple::anchorPoint(), QLineF::angle(), computeAngle(), QQuickParentChangePrivate::doChange(), QQuickSvgParser::pathArc(), pathArc(), qt_fetch_conical_gradient_template(), QQuickParentAnimation::transition(), and AVFMediaPlayer::videoOrientationForAssetTrack().
Here is the caller graph for this function:| int qCeil | ( | T | v | ) |
Definition at line 36 of file qmath.h.
Referenced by QFontEngine::alphaMapForGlyph(), QSvgAnimateColor::apply(), QGridLayoutItem::box(), QQuickStyleItemTextField::calculateGeometry(), QQuickTextInputPrivate::calculateImplicitWidthForText(), QQuickBorderImagePrivate::calculateRects(), QtWaylandClient::QWaylandWindow::commit(), QQuickStyleItem::contentSize(), QDistanceFieldData::create(), QtWaylandClient::QWaylandWindow::damage(), QCommandLinkButtonPrivate::descriptionHeight(), QTextLayout::draw(), drawCellBorder(), QTextLayout::drawCursor(), QPaintEngine::drawImage(), QRasterPaintEngine::drawImage(), drawTextItemDecoration(), QTextDocumentLayout::dynamicPageCount(), QQuickLayout::effectiveSizeHints_helper(), QQuickFlickablePrivate::fixup(), QTimeLine::frameForTime(), QSSGMesh::Mesh::fromAssetData(), QSSGMesh::Mesh::fromRuntimeData(), generateWavyPixmap(), getLineHeightParams(), QRasterPaintEnginePrivate::getPenFunc(), intmaxlog(), QPrintPreviewWidgetPrivate::layoutPages(), QQuickTextPrivate::lineHeightOffset(), QScrollerPrivate::nextSnapPos(), QSGOpenVGPainterNode::paint(), QSGSoftwarePainterNode::paint(), QSGDefaultPainterNode::paint(), QQuickBasicDial::paint(), QStaticTextPrivate::paintText(), QQuickSvgParser::pathArc(), pathArc(), QAccessibleBridgeUtils::performEffectiveAction(), QTextureGlyphCache::populate(), QQC2::qDrawBorderPixmap(), QSGSoftwareHelpers::qDrawBorderPixmap(), qt_findAtNxFile(), qt_scale_image_16bit(), qt_scale_image_32bit(), qt_transform_image(), read_jpeg_image(), QSSGMesh::MeshInternal::readMeshData(), QMdi::RegularTiler::rearrange(), QComboBoxPrivate::recomputeSizeHint(), QSGRhiDistanceFieldGlyphCache::requestGlyphs(), QMdiAreaPrivate::resizeToMinimumTileSize(), QSvgAnimateTransform::resolveMatrix(), QHighDpiScaling::roundScaleFactor(), QSvgPaintEngine::saveGradientStops(), QIconLoaderEngine::scaledPixmap(), segmentCount(), QWindowsIntegration::setApplicationBadge(), QQuickTextPrivate::setupTextLayout(), QLabelPrivate::sizeForWidth(), QWasmAudioSink::start(), QSGRhiDistanceFieldGlyphCache::storeGlyphs(), QQC2_NAMESPACE::QMacStyle::subControlRect(), QMacStyle::subControlRect(), QQC2_NAMESPACE::QMacStyle::subElementRect(), QQC2::QCommonStyle::subElementRect(), QMacStyle::subElementRect(), QCommonStyle::subElementRect(), QItemDelegatePrivate::textLayoutBounds(), QItemDelegate::textRectangle(), QRectF::toAlignedRect(), toRectMin(), QQuickMaterialBusyIndicatorNode::updateCurrentTime(), updateDirtySkeletons(), QSGBasicInternalImageNode::updateGeometry(), QSGBasicInternalRectangleNode::updateGeometry(), QSGBasicInternalImageNode::updateGeometry(), QQuickIconImagePrivate::updateIcon(), QQuickTextInputPrivate::updateLayout(), QQuickImage::updatePaintNode(), QQuickShaderEffectSource::updatePaintNode(), QQuickTextPrivate::updateSize(), QQuick3DSkin::updateSpatialNode(), QQuick3DTexture::updateSpatialNode(), QQC2::QCommonStylePrivate::viewItemSize(), and QSSGQmlUtilities::writeQmlForAnimation().
| auto qCos | ( | T | v | ) |
Definition at line 60 of file qmath.h.
Referenced by QQuickFrictionAffector::affectParticle(), QQuickGravityAffector::affectParticle(), QQuickMaterialRipple::anchorPoint(), QQC2::calcArrow(), QQC2::QStyleHelper::calcLines(), QQC2::QStyleHelper::calcRadialPos(), QQuickEllipseExtruder::extrude(), QLineF::fromPolar(), QDebugDrawHelper::generateCapsuleGeometry(), QT_BEGIN_NAMESPACE::generateMeshLevelsOfDetail(), QDebugDrawHelper::generateSphereGeometry(), makeDistanceField(), QQuickSvgParser::pathArc(), pathArc(), pathArcSegment(), pathArcSegment(), qt_normalFromRotation(), qt_t_for_arc_angle(), QTransform::rotate(), QTransform::rotateRadians(), QQuickAngleDirection::sample(), QLineF::setAngle(), QSSGMaterialShaderGenerator::setRhiMaterialProperties(), and transformFromLine().
Here is the caller graph for this function:
|
inlineconstexpr |
|
inlineconstexpr |
Definition at line 260 of file qmath.h.
References M_PI.
Referenced by QQuickGravityAffector::affectParticle(), QGeoCoordinatePrivate::atDistanceAndAzimuth(), QGeoCoordinate::azimuthTo(), degToRad(), QGeoCoordinate::distanceTo(), QOpenGL2PaintEngineExPrivate::drawPixmapFragments(), QQuaternion::fromAxisAndAngle(), QQuaternion::fromAxisAndAngle(), QQuaternion::fromEulerAngles(), QLineF::fromPolar(), QT_BEGIN_NAMESPACE::generateMeshLevelsOfDetail(), QQuickImageParticle::initialize(), makeDistanceField(), BasicOperations::paintEvent(), parseTransformationMatrix(), QQuickSvgParser::pathArc(), pathArcSegment(), QDoubleMatrix4x4::perspective(), QMatrix4x4::perspective(), QMatrix4x4::projectedRotate(), qDegreesToRadians(), qt_fromEulerRotation(), qt_normalFromRotation(), qt_t_for_arc_angle(), QLocationUtils::radians(), AVFMediaEncoder::record(), QSvgAnimateTransform::resolveMatrix(), QDoubleMatrix4x4::rotate(), QMatrix4x4::rotate(), QTransform::rotate(), QLineF::setAngle(), QSSGMaterialShaderGenerator::setRhiMaterialProperties(), QSpanData::setup(), setupCameraForShadowMap(), setupCubeReflectionCameras(), setupCubeShadowCameras(), transformFromLine(), QWindowsTabletSupport::translateTabletPacketEvent(), QOpenGL2PaintEngineExPrivate::updateBrushUniforms(), QQuick3DPerspectiveCamera::updateSpatialNode(), QT_BEGIN_NAMESPACE::QQuickShapeCurveMaterialShader::updateUniformData(), QQuickShapeConicalGradientRhiShader::updateUniformData(), and QSSGParticleRenderer::updateUniformsForParticles().
Here is the caller graph for this function:
|
inlineconstexpr |
|
inlineconstexpr |
Definition at line 276 of file qmath.h.
References qDegreesToRadians().
Here is the call graph for this function:| auto qFabs | ( | T | v | ) |
Definition at line 48 of file qmath.h.
Referenced by EVRCustomPresenter::IsRateSupported(), and Scheduler::processSample().
Here is the caller graph for this function:Definition at line 250 of file qmath.h.
References d, M_PI, qt_sine_table, and QT_SINE_TABLE_SIZE.
Referenced by QOpenGL2PaintEngineExPrivate::drawPixmapFragments(), QTriangulatingStroker::process(), and QSGBasicInternalRectangleNode::updateGeometry().
Here is the caller graph for this function:Definition at line 240 of file qmath.h.
References d, M_PI, qt_sine_table, and QT_SINE_TABLE_SIZE.
Referenced by QOpenGL2PaintEngineExPrivate::drawPixmapFragments(), QTriangulatingStroker::process(), and QSGBasicInternalRectangleNode::updateGeometry().
Here is the caller graph for this function:| int qFloor | ( | T | v | ) |
Definition at line 42 of file qmath.h.
Referenced by QQuickGridViewPrivate::addVisibleItems(), QQuick3DParticleScaleAffector::affectParticle(), QFontEngine::alphaMapForGlyph(), QSvgAnimateColor::apply(), QQuickGridViewPrivate::applyInsertionChange(), QQuickTableViewPrivate::calculateTopLeft(), QtWaylandClient::QWaylandWindow::commit(), QtWaylandClient::QWaylandWindow::damage(), QDirectFbBlitter::drawCachedGlyphs(), QRasterPaintEngine::drawCachedGlyphs(), QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(), drawCellBorder(), QPaintEngine::drawImage(), QRasterPaintEngine::drawImage(), QX11PaintEngine::drawPoints(), drawTextItemDecoration(), fetchTransformed_fetcher(), fetchTransformedBilinear_slow_fetcher(), QX11PaintEnginePrivate::fillPolygon_dev(), firstDayOfYear(), QQuickFlickablePrivate::fixup(), generateWavyPixmap(), QWaylandOutputPrivate::handleWindowPixelSizeChanged(), QWaylandOutput::initialize(), QWaylandSurface::inputRegionContains(), QJalaliCalendar::julianDayToDate(), QPrintPreviewWidgetPrivate::layoutPages(), QWindowsFontEngine::minRightBearing(), QRhi::mipLevelsForSize(), QScrollerPrivate::nextSnapPos(), QSGOpenVGPainterNode::paint(), QSGSoftwarePainterNode::paint(), QSGDefaultPainterNode::paint(), QQuickBasicDial::paint(), QQuickStyledTextPrivate::parseImageAttributes(), QSGTextMaskMaterial::populate(), QQuickPathView::positionViewAtIndex(), qDrawEdge(), qt_curves_for_arc(), qt_find_ellipse_coords(), qt_image_convolute_filter(), qt_scale_image_16bit(), qt_scale_image_32bit(), qt_transform_image(), QQuickGridViewPrivate::resetColumns(), QHighDpiScaling::roundScaleFactor(), QBackingStore::scroll(), QRectF::toAlignedRect(), toRectMin(), QSGBasicInternalImageNode::updateGeometry(), QSGBasicInternalImageNode::updateGeometry(), and QDoubleValidatorPrivate::validateWithLocale().
| auto qHypot | ( | F | first, |
| Fs... | rest | ||
| ) |
Definition at line 145 of file qmath.h.
References QtPrivate::QHypotHelper< T >::add().
Here is the call graph for this function:| auto qHypot | ( | Tx | x, |
| Ty | y | ||
| ) |
| auto qLn | ( | T | v | ) |
Definition at line 168 of file qmath.h.
Referenced by intmaxlog().
Here is the caller graph for this function:
|
inlineconstexpr |
Definition at line 378 of file qmath.h.
References qNextPowerOfTwo().
Here is the call graph for this function:Definition at line 363 of file qmath.h.
References qNextPowerOfTwo().
Here is the call graph for this function:Definition at line 368 of file qmath.h.
References qNextPowerOfTwo().
Here is the call graph for this function:Definition at line 335 of file qmath.h.
References Q_ASSERT, and QtPrivate::qConstexprNextPowerOfTwo().
Referenced by QSGRhiAtlasTexture::Manager::Manager(), QSSGRhiContext::checkAndAdjustForNPoT(), QSGPlainTexture::commitTextureOperations(), QTextureGlyphCache::fillInPendingGlyphs(), QTextureGlyphCache::populate(), QV4::MarkStack::push(), qCalculateGrowingBlockSize(), qNextPowerOfTwo(), qNextPowerOfTwo(), qNextPowerOfTwo(), qNextPowerOfTwo(), QOpenGLTextureUploader::textureImage(), and QOpenGL2PaintEngineExPrivate::updateBrushTexture().
Here is the call graph for this function:
Here is the caller graph for this function:Definition at line 349 of file qmath.h.
References Q_ASSERT, Q_UINT64_C, and QtPrivate::qConstexprNextPowerOfTwo().
Here is the call graph for this function:
|
inlineconstexpr |
Definition at line 373 of file qmath.h.
References qNextPowerOfTwo().
Here is the call graph for this function:| auto qPow | ( | T1 | x, |
| T2 | y | ||
| ) |
Definition at line 180 of file qmath.h.
Referenced by QWindowsFontEngineData::QWindowsFontEngineData(), QAudio::convertVolume(), QGeoTiledMappingManagerEngineNokia::evaluateCopyrightsText(), QODBCResult::exec(), expblur(), QColorTrcLut::fromGamma(), growthFactorBelowPreferredSize(), QQuickWheelHandler::handleEventPoint(), and AVFMediaPlayer::videoOrientationForAssetTrack().
Here is the caller graph for this function:
|
inlineconstexpr |
|
inlineconstexpr |
Definition at line 281 of file qmath.h.
References M_PI.
Referenced by QLineF::angle(), QQuickContext2D::arc(), QGeoCoordinatePrivate::atDistanceAndAzimuth(), QGeoCoordinate::azimuthTo(), QSSGRenderCamera::computeFrustumPerspective(), QLocationUtils::degrees(), QQuickParentChangePrivate::doChange(), QQuaternion::getAxisAndAngle(), QQuaternion::getEulerAngles(), QQuick3DCamera::lookAt(), QQuick3DQuaternionUtils::lookAt(), QQuickJSContext2DPrototype::method_createConicalGradient(), radToDeg(), QQuickContext2D::rotate(), rotationQuaternionForLookAt(), setCameraProperties(), setLightProperties(), setTextureProperties(), setupCubeReflectionCameras(), setupCubeShadowCameras(), QtAndroidInput::touchAdd(), QQuickParentAnimation::transition(), QWindowsTabletSupport::translateTabletPacketEvent(), and AVFMediaPlayer::videoOrientationForAssetTrack().
Here is the caller graph for this function:
|
inlineconstexpr |
| auto qSin | ( | T | v | ) |
Definition at line 54 of file qmath.h.
Referenced by QQuick3DParticleScaleAffector::affectParticle(), QQuickFrictionAffector::affectParticle(), QQuickGravityAffector::affectParticle(), QQuickMaterialRipple::anchorPoint(), QQC2::calcArrow(), QQC2::QStyleHelper::calcLines(), QQC2::QStyleHelper::calcRadialPos(), QQuickEllipseExtruder::extrude(), QLineF::fromPolar(), QDebugDrawHelper::generateCapsuleGeometry(), QDebugDrawHelper::generateSphereGeometry(), makeDistanceField(), QQuickSvgParser::pathArc(), pathArc(), pathArcSegment(), pathArcSegment(), qt_normalFromRotation(), qt_t_for_arc_angle(), QTransform::rotate(), QTransform::rotateRadians(), QQuickAngleDirection::sample(), QLineF::setAngle(), and transformFromLine().
Here is the caller graph for this function:| auto qTan | ( | T | v | ) |
Definition at line 66 of file qmath.h.
Referenced by parseTransformationMatrix(), QSvgAnimateTransform::resolveMatrix(), and QSSGRenderCamera::verticalFov().
Here is the caller graph for this function:
|
extern |
Definition at line 9 of file qmath.cpp.
Referenced by qFastCos(), and qFastSin().