Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
|
#include <QtCore/qglobal.h>
#include <QtCore/qalgorithms.h>
#include <cmath>
Go to the source code of this file.
Classes | |
struct | QtPrivate::QHypotType< R, F > |
class | QtPrivate::QHypotHelper< T > |
Namespaces | |
namespace | QtPrivate |
\macro QT_NO_KEYWORDS > | |
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] |
#define M_1_PI (0.31830988618379067154) |
Definition at line 221 of file qmath.h.
Referenced by addCircle(), and qt_fetch_conical_gradient_template().
#define M_E (2.7182818284590452354) |
Definition at line 189 of file qmath.h.
Referenced by QV4::Heap::MathObject::init().
#define M_LN10 (2.30258509299404568402) |
Definition at line 205 of file qmath.h.
Referenced by QV4::Heap::MathObject::init().
#define M_LN2 (0.69314718055994530942) |
Definition at line 201 of file qmath.h.
Referenced by QV4::Heap::MathObject::init().
#define M_LOG10E (0.43429448190325182765) |
Definition at line 197 of file qmath.h.
Referenced by QV4::Heap::MathObject::init().
#define M_LOG2E (1.4426950408889634074) |
Definition at line 193 of file qmath.h.
Referenced by QV4::Heap::MathObject::init().
#define M_PI (3.14159265358979323846) |
Definition at line 209 of file qmath.h.
Referenced by QSvgFeColorMatrix::QSvgFeColorMatrix(), BezierEase::_cos(), QQuickContext2D::addArcTo(), QQuick3DParticleScaleAffector::affectParticle(), QQuick3DParticleWander::affectParticle(), QSvgFeGaussianBlur::apply(), calculatePeripheralPoints(), QDeclarativeCircleMapItemPrivate::calculatePeripheralPointsGreatCircle(), QDeclarativeCircleMapItemPrivate::calculatePeripheralPointsSimple(), QAmbisonicDecoderFilter::configure(), QWebMercator::coordToMercator(), createMarkerNode(), distributionGGX(), QCoreGraphicsPaintEngine::drawEllipse(), QSvgMarker::drawMarkersForNode(), QLocationUtils::earthMeanCircumference(), QQuickEllipseExtruder::extrude(), fillPrefilterValues(), QDebugDrawHelper::generateCapsuleGeometry(), QDebugDrawHelper::generateSphereGeometry(), QDeclarativeGeoMapItemUtils::greaterCirclePath(), QQuickDragHandler::handlePointerEventImpl(), importanceSampleGGX(), QV4::Heap::MathObject::init(), QWebMercator::mercatorToCoord(), QV4::MathObject::method_atan2(), QQuickSvgParser::pathArc(), qDegreesToRadians(), qDegreesToRadians(), qDegreesToRadians(), qFastCos(), qFastSin(), qRadiansToDegrees(), qRadiansToDegrees(), qRadiansToDegrees(), QTuioToken::setAngle(), setCameraProperties(), QQuickUniversalBusyIndicatorNode::sync(), toUserAngleDeg(), and QSGBasicInternalRectangleNode::updateGeometry().
#define M_PI_2 (1.57079632679489661923) |
Definition at line 213 of file qmath.h.
Referenced by QQC2_NAMESPACE::QMacStyle::drawControl(), QMacStyle::drawControl(), and QMacStylePrivate::setupVerticalInvertedXform().
#define M_SQRT1_2 (0.70710678118654752440) |
Definition at line 237 of file qmath.h.
Referenced by QV4::Heap::MathObject::init().
#define M_SQRT2 (1.41421356237309504880) |
Definition at line 233 of file qmath.h.
Referenced by QV4::Heap::MathObject::init().
#define QT_SINE_TABLE_SIZE 256 |
Definition at line 32 of file qmath.h.
Referenced by qFastCos(), and qFastSin().
auto qAcos | ( | T | v | ) |
Definition at line 72 of file qmath.h.
Referenced by addCircle(), QQuick3DQuaternionUtils::lookAt(), and rotationQuaternionForLookAt().
auto qAtan | ( | T | v | ) |
Definition at line 84 of file qmath.h.
Referenced by QQC2::QStyleHelper::angle(), EaseOvershoot(), and QSSGRenderCamera::verticalFov().
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().
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(), QQuickStyleItem::contentSize(), QDistanceFieldData::create(), QCommandLinkButtonPrivate::descriptionHeight(), QTextLayout::draw(), drawCellBorder(), QTextLayout::drawCursor(), QPaintEngine::drawImage(), QRasterPaintEngine::drawImage(), drawTextItemDecoration(), QTextDocumentLayout::dynamicPageCount(), QQuickLayout::effectiveSizeHints_helper(), 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(), QSvgPattern::patternImage(), QAccessibleBridgeUtils::performEffectiveAction(), QTextureGlyphCache::populate(), QQC2::qDrawBorderPixmap(), QSGSoftwareHelpers::qDrawBorderPixmap(), qt_convertMargins(), 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(), 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().
|
inlineconstexpr |
|
inlineconstexpr |
Definition at line 260 of file qmath.h.
References M_PI.
Referenced by QQuickGravityAffector::affectParticle(), QGeoCoordinatePrivate::atDistanceAndAzimuth(), QGeoCoordinate::azimuthTo(), QSSGUtils::degToRad(), QGeoCoordinate::distanceTo(), QOpenGL2PaintEngineExPrivate::drawPixmapFragments(), 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::QSGCurveFillMaterialShader::updateUniformData(), QQuickShapeConicalGradientRhiShader::updateUniformData(), and QSSGParticleRenderer::updateUniformsForParticles().
|
inlineconstexpr |
|
inlineconstexpr |
Definition at line 276 of file qmath.h.
References qDegreesToRadians().
auto qFabs | ( | T | v | ) |
Definition at line 48 of file qmath.h.
Referenced by EVRCustomPresenter::IsRateSupported().
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().
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().
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(), QDirectFbBlitter::drawCachedGlyphs(), QRasterPaintEngine::drawCachedGlyphs(), QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(), drawCellBorder(), QPaintEngine::drawImage(), QRasterPaintEngine::drawImage(), QX11PaintEngine::drawPoints(), drawTextItemDecoration(), fetchTransformed_fetcher(), fetchTransformedBilinear_slow_fetcher(), QX11PaintEnginePrivate::fillPolygon_dev(), firstDayOfYear(), 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_convertPointsToPixels(), 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().
auto qHypot | ( | Tx | x, |
Ty | y ) |
auto qLn | ( | T | v | ) |
Definition at line 168 of file qmath.h.
Referenced by intmaxlog().
|
inlineconstexpr |
Definition at line 378 of file qmath.h.
References qNextPowerOfTwo().
Definition at line 363 of file qmath.h.
References qNextPowerOfTwo().
Definition at line 368 of file qmath.h.
References qNextPowerOfTwo().
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().
Definition at line 349 of file qmath.h.
References Q_ASSERT, Q_UINT64_C, and QtPrivate::qConstexprNextPowerOfTwo().
|
inlineconstexpr |
Definition at line 373 of file qmath.h.
References qNextPowerOfTwo().
auto qPow | ( | T1 | x, |
T2 | y ) |
Definition at line 180 of file qmath.h.
Referenced by QWindowsFontEngineData::QWindowsFontEngineData(), QAudio::convertVolume(), QGeoTiledMappingManagerEngineNokia::evaluateCopyrightsText(), QODBCResult::exec(), QT_BEGIN_NAMESPACE::expblur(), growthFactorBelowPreferredSize(), QQuickWheelHandler::handleEventPoint(), QColorTrcLut::setFromGamma(), and AVFMediaPlayer::videoOrientationForAssetTrack().
|
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(), QQuick3DCamera::lookAt(), QQuick3DQuaternionUtils::lookAt(), QQuickJSContext2DPrototype::method_createConicalGradient(), QSSGUtils::radToDeg(), QQuickContext2D::rotate(), rotationQuaternionForLookAt(), setCameraProperties(), setLightProperties(), setTextureProperties(), setupCubeReflectionCameras(), setupCubeShadowCameras(), QtAndroidInput::touchAdd(), QQuickParentAnimation::transition(), QWindowsTabletSupport::translateTabletPacketEvent(), and AVFMediaPlayer::videoOrientationForAssetTrack().
|
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().
auto qTan | ( | T | v | ) |
Definition at line 66 of file qmath.h.
Referenced by parseTransformationMatrix(), QSvgAnimateTransform::resolveMatrix(), and QSSGRenderCamera::verticalFov().
|
extern |
Definition at line 9 of file qmath.cpp.
Referenced by qFastCos(), and qFastSin().