Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/particles/qquickpointattractor.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | - | |||||||
2 | QQuickAttractorAffector::QQuickAttractorAffector(QQuickItem *parent) : | - | ||||||
3 | QQuickParticleAffector(parent), m_strength(0.0), m_x(0), m_y(0) | - | ||||||
4 | , m_physics(Velocity), m_proportionalToDistance(Linear) | - | ||||||
5 | { | - | ||||||
6 | } executed 4 times by 2 tests: end of block Executed by:
| 4 | ||||||
7 | - | |||||||
8 | bool QQuickAttractorAffector::affectParticle(QQuickParticleData *d, qreal dt) | - | ||||||
9 | { | - | ||||||
10 | if (m_strength == 0.0
| 0-22846 | ||||||
11 | return never executed: false;return false; never executed: return false; | 0 | ||||||
12 | qreal dx = m_x+m_offset.x() - d->curX(m_system); | - | ||||||
13 | qreal dy = m_y+m_offset.y() - d->curY(m_system); | - | ||||||
14 | qreal r = std::sqrt((dx*dx) + (dy*dy)); | - | ||||||
15 | qreal theta = std::atan2(dy,dx); | - | ||||||
16 | qreal ds = 0; | - | ||||||
17 | switch (m_proportionalToDistance){ | - | ||||||
18 | case never executed: InverseQuadratic:case InverseQuadratic: never executed: case InverseQuadratic: | 0 | ||||||
19 | ds = (m_strength / qMax<qreal>(1.,r*r)); | - | ||||||
20 | break; never executed: break; | 0 | ||||||
21 | case never executed: InverseLinear:case InverseLinear: never executed: case InverseLinear: | 0 | ||||||
22 | ds = (m_strength / qMax<qreal>(1.,r)); | - | ||||||
23 | break; never executed: break; | 0 | ||||||
24 | case never executed: Quadratic:case Quadratic: never executed: case Quadratic: | 0 | ||||||
25 | ds = (m_strength * qMax<qreal>(1.,r*r)); | - | ||||||
26 | break; never executed: break; | 0 | ||||||
27 | case never executed: Linear:case Linear: never executed: case Linear: | 0 | ||||||
28 | ds = (m_strength * qMax<qreal>(1.,r)); | - | ||||||
29 | break; never executed: break; | 0 | ||||||
30 | default executed 22846 times by 1 test: :default: Executed by:
executed 22846 times by 1 test: default: Executed by:
| 22846 | ||||||
31 | ds = m_strength; | - | ||||||
32 | } executed 22846 times by 1 test: end of block Executed by:
| 22846 | ||||||
33 | ds *= dt; | - | ||||||
34 | dx = ds * std::cos(theta); | - | ||||||
35 | dy = ds * std::sin(theta); | - | ||||||
36 | qreal vx,vy; | - | ||||||
37 | switch (m_physics){ | - | ||||||
38 | case executed 22846 times by 1 test: Position:case Position: Executed by:
executed 22846 times by 1 test: case Position: Executed by:
| 22846 | ||||||
39 | d->x = (d->x + dx); | - | ||||||
40 | d->y = (d->y + dy); | - | ||||||
41 | break; executed 22846 times by 1 test: break; Executed by:
| 22846 | ||||||
42 | case never executed: Acceleration:case Acceleration: never executed: case Acceleration: | 0 | ||||||
43 | d->setInstantaneousAX(d->ax + dx, m_system); | - | ||||||
44 | d->setInstantaneousAY(d->ay + dy, m_system); | - | ||||||
45 | break; never executed: break; | 0 | ||||||
46 | case never executed: Velocity:case Velocity: never executed: case Velocity: | 0 | ||||||
47 | default never executed: :default: never executed: default: | 0 | ||||||
48 | vx = d->curVX(m_system); | - | ||||||
49 | vy = d->curVY(m_system); | - | ||||||
50 | d->setInstantaneousVX(vx + dx, m_system); | - | ||||||
51 | d->setInstantaneousVY(vy + dy, m_system); | - | ||||||
52 | } never executed: end of block | 0 | ||||||
53 | - | |||||||
54 | return executed 22846 times by 1 test: true;return true; Executed by:
executed 22846 times by 1 test: return true; Executed by:
| 22846 | ||||||
55 | } | - | ||||||
56 | - | |||||||
57 | - | |||||||
Switch to Source code | Preprocessed file |