当前位置: 首页>>代码示例>>C++>>正文


C++ qFuzzyIsNull函数代码示例

本文整理汇总了C++中qFuzzyIsNull函数的典型用法代码示例。如果您正苦于以下问题:C++ qFuzzyIsNull函数的具体用法?C++ qFuzzyIsNull怎么用?C++ qFuzzyIsNull使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了qFuzzyIsNull函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: draw

void ShadowEffect::draw(QPainter *painter)
{
    if (m_blurRadius < 0 && qFuzzyIsNull(m_xOffset) && qFuzzyIsNull(m_yOffset)) {
        drawSource(painter);
        return;
    }

    PixmapPadMode mode = PadToEffectiveBoundingRect;
    if (painter->paintEngine()->type() == QPaintEngine::OpenGL2) {
        mode = NoPad;
    }

    // Draw pixmap in device coordinates to avoid pixmap scaling.
    QPoint offset;
    const QPixmap pixmap = sourcePixmap(Qt::DeviceCoordinates, &offset, mode);
    if (pixmap.isNull()) {
        return;
    }

    QTransform restoreTransform = painter->worldTransform();
    painter->setWorldTransform(QTransform());
    if (m_shadow.isNull()) {
        m_shadow = generateShadow(pixmap);
    }
    // Draw shadow (draw it twice to darken it)
    painter->drawImage(offset, m_shadow);
    painter->drawImage(offset, m_shadow);
    // Draw the actual pixmap
    painter->drawPixmap(offset, pixmap);
    painter->setWorldTransform(restoreTransform);
}
开发者ID:KDE,项目名称:homerun,代码行数:31,代码来源:shadoweffect.cpp

示例2: QVector3D

void CameraController::update( double t )
{
    if ( !m_camera )
        return;

    // Store the time
    const float dt = t - m_time;
    m_time = t;

    // Update the camera position and orientation
    Camera::CameraTranslationOption option = m_viewCenterFixed
                                         ? Camera::DontTranslateViewCenter
                                         : Camera::TranslateViewCenter;
    m_camera->translate( dt * QVector3D( m_vx, m_vy, m_vz ), option );

    if ( !qFuzzyIsNull( m_panAngle ) )
    {
        m_camera->pan( m_panAngle );
        m_panAngle = 0.0f;
    }

    if ( !qFuzzyIsNull( m_tiltAngle ) )
    {
        m_camera->tilt( m_tiltAngle );
        m_tiltAngle = 0.0f;
    }
}
开发者ID:QtOpenGL,项目名称:opengl-demos,代码行数:27,代码来源:cameracontroller.cpp

示例3: v

bool QgsGeometryUtils::segmentIntersection( const QgsPointV2 &p1, const QgsPointV2 &p2, const QgsPointV2 &q1, const QgsPointV2 &q2, QgsPointV2 &inter, double tolerance )
{
  QgsVector v( p2.x() - p1.x(), p2.y() - p1.y() );
  QgsVector w( q2.x() - q1.x(), q2.y() - q1.y() );
  double vl = v.length();
  double wl = w.length();

  if ( qFuzzyIsNull( vl ) || qFuzzyIsNull( wl ) )
  {
    return false;
  }
  v = v / vl;
  w = w / wl;

  if ( !QgsGeometryUtils::lineIntersection( p1, v, q1, w, inter ) )
    return false;

  double lambdav = QgsVector( inter.x() - p1.x(), inter.y() - p1.y() ) *  v;
  if ( lambdav < 0. + tolerance || lambdav > vl - tolerance )
    return false;

  double lambdaw = QgsVector( inter.x() - q1.x(), inter.y() - q1.y() ) * w;
  if ( lambdaw < 0. + tolerance || lambdaw >= wl - tolerance )
    return false;

  return true;
}
开发者ID:spatialthoughts,项目名称:QGIS,代码行数:27,代码来源:qgsgeometryutils.cpp

示例4: p

void GenerationWidget::paintEvent(QPaintEvent*)
{
    QPainter p(this);
    p.fillRect(rect(), Qt::black);
    if (mImage.isNull() || qFuzzyIsNull(mImageAspectRatio) || qFuzzyIsNull(mImageAspectRatio))
        return;
    if (mWindowAspectRatio < mImageAspectRatio) {
        const int h = int(width() / mImageAspectRatio);
        mDestRect = QRect(0, (height()-h)/2, width(), h);
    }
    else {
        const int w = int(height() * mImageAspectRatio);
        mDestRect = QRect((width()-w)/2, 0, w, height());
    }
    p.drawImage(mDestRect, mImage);
    const qreal invScale = 1 / qSqrt(mDestRect.width() * mDestRect.height());
    p.translate(mDestRect.x(), mDestRect.y());
    p.scale(mDestRect.width(), mDestRect.height());
    p.setBrush(Qt::transparent);
    p.setRenderHint(QPainter::Antialiasing);
    if (mSplicedGene.color().isValid() && !mSplices.empty()) {
        p.setPen(QPen(Qt::green, 1.2 * invScale));
        for (QVector<Gene>::const_iterator g = mSplices.constBegin(); g != mSplices.constEnd(); ++g)
            p.drawPolygon(g->polygon());
        p.setPen(QPen(Qt::red, 1.3 * invScale));
        p.drawPolygon(mSplicedGene.polygon());
        mSplicedGene = Gene();
        mSplices.clear();
    }
    if (!mHighlighted.isEmpty()) {
        p.setPen(QPen(QColor(255, 0, 200), 1.3 * invScale));
        p.setBrush(Qt::transparent);
        p.drawPolygon(mHighlighted);
    }
}
开发者ID:superkartoffel,项目名称:evo-cubist,代码行数:35,代码来源:generationwidget.cpp

示例5: locker

void NormalMapScene::update( float t )
{
    QMutexLocker locker( &m_mutex );

    // Nothing to do here
    Q_UNUSED( t );

    // Rotate the cube
    if ( m_rotate )
    {
        m_theta += m_rotationSpeed;
        if ( m_theta > 360.0f )
            m_theta -= 360.0f;
    }
    m_modelMatrix.setToIdentity();
    m_modelMatrix.rotate( m_theta, 0.0f, 1.0f, 0.0f );

    // Update the camera position and orientation
    Camera::CameraTranslationOption option = m_viewCenterFixed
                                           ? Camera::DontTranslateViewCenter
                                           : Camera::TranslateViewCenter;
    m_camera->translate( QVector3D( m_vx, m_vy, m_vz ), option );

    if ( !qFuzzyIsNull( m_panAngle ) )
    {
        m_camera->pan( m_panAngle );
        m_panAngle = 0.0f;
    }

    if ( !qFuzzyIsNull( m_tiltAngle ) )
    {
        m_camera->tilt( m_tiltAngle );
        m_tiltAngle = 0.0f;
    }
}
开发者ID:QtOpenGL,项目名称:opengl-demos,代码行数:35,代码来源:normalmapscene.cpp

示例6: QVector3D

void NoiseScene::update( float t )
{
    // Store the time to pass into the shader
    m_time = t;

    // Rotate the cube
    if ( m_rotate )
    {
        m_theta += 0.5f;
        if ( m_theta > 360.0f )
            m_theta -= 360.0f;
    }
    m_modelMatrix.setToIdentity();
    m_modelMatrix.rotate( m_theta, 0.0f, 1.0f, 0.0f );

    // Update the camera position and orientation
    Camera::CameraTranslationOption option = m_viewCenterFixed
                                           ? Camera::DontTranslateViewCenter
                                           : Camera::TranslateViewCenter;
    m_camera->translate( QVector3D( m_vx, m_vy, m_vz ), option );

    if ( !qFuzzyIsNull( m_panAngle ) )
    {
        m_camera->pan( m_panAngle );
        m_panAngle = 0.0f;
    }

    if ( !qFuzzyIsNull( m_tiltAngle ) )
    {
        m_camera->tilt( m_tiltAngle );
        m_tiltAngle = 0.0f;
    }
}
开发者ID:QtOpenGL,项目名称:opengl-demos,代码行数:33,代码来源:noisescene.cpp

示例7: quadraticRoots

static inline int quadraticRoots(qreal a, qreal b, qreal c,
                                 qreal *x1, qreal *x2)
{
    if (qFuzzyIsNull(a)) {
        if (qFuzzyIsNull(b))
            return 0;
        *x1 = *x2 = (-c / b);
        return 1;
    } else {
        const qreal det = b * b - 4 * a * c;
        if (qFuzzyIsNull(det)) {
            *x1 = *x2 = -b / (2 * a);
            return 1;
        }
        if (det > 0) {
            if (qFuzzyIsNull(b)) {
                *x2 = qSqrt(-c / a);
                *x1 = -(*x2);
                return 2;
            }
            const qreal stableA = b / (2 * a);
            const qreal stableB = c / (a * stableA * stableA);
            const qreal stableC = -1 - qSqrt(1 - stableB);
            *x2 = stableA * stableC;
            *x1 = (stableA * stableB) / stableC;
            return 2;
        } else
            return 0;
    }
}
开发者ID:Afreeca,项目名称:qt,代码行数:30,代码来源:qbezier.cpp

示例8: Q_D

void Camera::setMotionAdjustment(const QVector3D& vector)
{
    Q_D(Camera);
    if (d->motionAdjustment != vector) {
        d->motionAdjustment = vector;
        if (vector.x() == 0.0f && vector.y() == 0.0f) {
            // If the vector is centered, then don't perform any rotations.
            d->motionQuaternion = QQuaternion();
        } else {
            // Determine the pan and tilt angles from the vector.
            QVector3D view = -vector.normalized();
            if (view.z() < 0.0f)
                view = -view;
            qreal xangle = asin(view.x()) * 180.0f / M_PI;
            qreal yangle = asin(-view.y()) * 180.0f / M_PI;

            // Construct the pan and tilt quaternions.
            if (qFuzzyIsNull(xangle))
                d->motionQuaternion = tilt(yangle);
            else if (qFuzzyIsNull(yangle))
                d->motionQuaternion = pan(xangle);
            else
                d->motionQuaternion = tilt(yangle) * pan(xangle);
        }
        emit viewChanged();
    }
}
开发者ID:kaltsi,项目名称:qt-mobility,代码行数:27,代码来源:camera.cpp

示例9: doRunFilter

void ptFilter_WaveletDenoise::doRunFilter(ptImage *AImage) {
  AImage->toLab();

  const double LStrength = FConfig.value(CLStrength).toDouble();
  const double AStrength = FConfig.value(CAStrength).toDouble();
  const double BStrength = FConfig.value(CBStrength).toDouble();
  const double strengthDiv = (log(TheProcessor->m_ScaleFactor)/log(0.5)) + 1.0;

  if (!qFuzzyIsNull(LStrength)) {
    AImage->WaveletDenoise(
          ChMask_L,
          LStrength / strengthDiv,
          FConfig.value(CLSoftness).toDouble(),
          true,
          FConfig.value(CSharpness).toDouble(),
          FConfig.value(CAnisotropy).toDouble(),
          FConfig.value(CGradientSmooth).toDouble(),
          FConfig.value(CTensorSmooth).toDouble());
  }

  if (!qFuzzyIsNull(AStrength)) {
    AImage->WaveletDenoise(
        ChMask_a,
        AStrength /strengthDiv,
        FConfig.value(CASoftness).toDouble());
  }

  if (!qFuzzyIsNull(BStrength)) {
    AImage->WaveletDenoise(
        ChMask_a,
        BStrength /strengthDiv,
        FConfig.value(CBSoftness).toDouble());
  }
}
开发者ID:divyang4481,项目名称:photivo,代码行数:34,代码来源:ptFilter_WaveletDenoise.cpp

示例10: Q_UNUSED

void TerrainTessellationScene::update( float t )
{
    Q_UNUSED( t );
    m_theta += 0.2;
    if ( m_theta > 360.0f )
        m_theta -= 360.0f;

    m_modelMatrix.setToIdentity();
    m_modelMatrix.scale( 50.0f );
    m_modelMatrix.translate( -5.0f, 0.0f, 0.0f );

    // Update the camera position and orientation
    Camera::CameraTranslationOption option = m_viewCenterFixed
                                           ? Camera::DontTranslateViewCenter
                                           : Camera::TranslateViewCenter;
    m_camera->translate( QVector3D( m_vx, m_vy, m_vz ), option );

    if ( !qFuzzyIsNull( m_panAngle ) )
    {
        m_camera->pan( m_panAngle );
        m_panAngle = 0.0f;
    }

    if ( !qFuzzyIsNull( m_tiltAngle ) )
    {
        m_camera->tilt( m_tiltAngle );
        m_tiltAngle = 0.0f;
    }
}
开发者ID:QtOpenGL,项目名称:opengl-demos,代码行数:29,代码来源:terraintessellationscene.cpp

示例11: insert

void QQuickTextNodeEngine::BinaryTreeNode::insert(QVarLengthArray<BinaryTreeNode, 16> *binaryTree, const QGlyphRun &glyphRun, SelectionState selectionState,
                                             QQuickTextNode::Decorations decorations, const QColor &textColor,
                                             const QColor &backgroundColor, const QPointF &position)
{
    QRectF searchRect = glyphRun.boundingRect();
    searchRect.translate(position);

    if (qFuzzyIsNull(searchRect.width()) || qFuzzyIsNull(searchRect.height()))
        return;

    decorations |= (glyphRun.underline() ? QQuickTextNode::Underline : QQuickTextNode::NoDecoration);
    decorations |= (glyphRun.overline()  ? QQuickTextNode::Overline  : QQuickTextNode::NoDecoration);
    decorations |= (glyphRun.strikeOut() ? QQuickTextNode::StrikeOut : QQuickTextNode::NoDecoration);
    decorations |= (backgroundColor.isValid() ? QQuickTextNode::Background : QQuickTextNode::NoDecoration);

    qreal ascent = glyphRun.rawFont().ascent();
    insert(binaryTree, BinaryTreeNode(glyphRun,
                                      selectionState,
                                      searchRect,
                                      decorations,
                                      textColor,
                                      backgroundColor,
                                      position,
                                      ascent));
}
开发者ID:Sagaragrawal,项目名称:2gisqt5android,代码行数:25,代码来源:qquicktextnodeengine.cpp

示例12: addCircle

static bool addCircle(const QBezier *b, qreal offset, QBezier *o)
{
    QPointF normals[3];

    normals[0] = QPointF(b->y2 - b->y1, b->x1 - b->x2);
    qreal dist = qSqrt(normals[0].x()*normals[0].x() + normals[0].y()*normals[0].y());
    if (qFuzzyIsNull(dist))
        return false;
    normals[0] /= dist;
    normals[2] = QPointF(b->y4 - b->y3, b->x3 - b->x4);
    dist = qSqrt(normals[2].x()*normals[2].x() + normals[2].y()*normals[2].y());
    if (qFuzzyIsNull(dist))
        return false;
    normals[2] /= dist;

    normals[1] = QPointF(b->x1 - b->x2 - b->x3 + b->x4, b->y1 - b->y2 - b->y3 + b->y4);
    normals[1] /= -1*qSqrt(normals[1].x()*normals[1].x() + normals[1].y()*normals[1].y());

    qreal angles[2];
    qreal sign = 1.;
    for (int i = 0; i < 2; ++i) {
        qreal cos_a = normals[i].x()*normals[i+1].x() + normals[i].y()*normals[i+1].y();
        if (cos_a > 1.)
            cos_a = 1.;
        if (cos_a < -1.)
            cos_a = -1;
        angles[i] = qAcos(cos_a)/Q_PI;
    }

    if (angles[0] + angles[1] > 1.) {
        // more than 180 degrees
        normals[1] = -normals[1];
        angles[0] = 1. - angles[0];
        angles[1] = 1. - angles[1];
        sign = -1.;

    }

    QPointF circle[3];
    circle[0] = QPointF(b->x1, b->y1) + normals[0]*offset;
    circle[1] = QPointF(qreal(0.5)*(b->x1 + b->x4), qreal(0.5)*(b->y1 + b->y4)) + normals[1]*offset;
    circle[2] = QPointF(b->x4, b->y4) + normals[2]*offset;

    for (int i = 0; i < 2; ++i) {
        qreal kappa = qreal(2.0) * KAPPA * sign * offset * angles[i];

        o->x1 = circle[i].x();
        o->y1 = circle[i].y();
        o->x2 = circle[i].x() - normals[i].y()*kappa;
        o->y2 = circle[i].y() + normals[i].x()*kappa;
        o->x3 = circle[i+1].x() + normals[i+1].y()*kappa;
        o->y3 = circle[i+1].y() - normals[i+1].x()*kappa;
        o->x4 = circle[i+1].x();
        o->y4 = circle[i+1].y();

        ++o;
    }
    return true;
}
开发者ID:Afreeca,项目名称:qt,代码行数:59,代码来源:qbezier.cpp

示例13: fuzzyCompare

static inline bool fuzzyCompare( double a, double b ) 
{
#if QT_VERSION < 0x040600
    const int eps = 0.000000000001;
    return ( ( qAbs(a) <= eps ) && ( qAbs(b) <= eps ) ) || qFuzzyCompare(a, b);
#else
    return ( qFuzzyIsNull(a) && qFuzzyIsNull(b) ) || qFuzzyCompare(a, b);
#endif
}
开发者ID:Au-Zone,项目名称:qwt,代码行数:9,代码来源:splinetest.cpp

示例14: locker

void InstancedHistogramScene::update( float t )
{
    QMutexLocker locker( &m_mutex );

    // Update the data being plotted
    if ( m_updatesEnabled )
    {
        const float xMin = -15.0f, xMax = 15.0f;
        const float zMin = -15.0f, zMax = 15.0f;
        const float dx = ( xMax - xMin ) / static_cast<float>( xPoints - 1 );
        const float dz = ( zMax - zMin ) / static_cast<float>( zPoints - 1 );
        int i = 0;
        const float A = 5.0;
        for ( int zi = 0; zi < zPoints; ++zi )
        {
            float z = zMin + static_cast<float>( zi ) * dz;

            for ( int xi = 0; xi < xPoints; ++xi )
            {
                float x = xMin + static_cast<float>( xi ) * dx;

                double r = sqrt( x * x + z * z );
                float y = A * ( sinf( m_frequency * t ) + cosf( m_frequency * t ) ) * j0( m_spatialFrequency * r );

                m_data[3 * i]     = x;
                m_data[3 * i + 1] = y;
                m_data[3 * i + 2] = z;
                ++i;
            }
        }
    }

    // Store the time to pass into the shader
    const float dt = t - m_time;
    m_time = t;

    // Update the camera position and orientation
    Camera::CameraTranslationOption option = m_viewCenterFixed
                                           ? Camera::DontTranslateViewCenter
                                           : Camera::TranslateViewCenter;
    m_camera->translate( QVector3D( m_vx * dt, m_vy * dt, m_vz * dt ), option );

    if ( !qFuzzyIsNull( m_panAngle ) )
    {
        m_camera->pan( m_panAngle * dt );
        m_panAngle = 0.0f;
    }

    if ( !qFuzzyIsNull( m_tiltAngle ) )
    {
        m_camera->tilt( m_tiltAngle * dt );
        m_tiltAngle = 0.0f;
    }
}
开发者ID:QtOpenGL,项目名称:opengl-demos,代码行数:54,代码来源:instancedhistogramscene.cpp

示例15: Q_D

void IRWidget::paintEvent(QPaintEvent *)
{
  Q_D(IRWidget);

  if (d->irFrame.isNull() || qFuzzyIsNull(d->imageAspectRatio) || qFuzzyIsNull(d->windowAspectRatio))
    return;

  QPainter p(this);
  p.fillRect(rect(), Qt::gray);
  p.drawImage(d->destRect, d->irFrame);
}
开发者ID:ola-ct,项目名称:whiteboard-minus-one,代码行数:11,代码来源:irwidget.cpp


注:本文中的qFuzzyIsNull函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。