• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Stellarium / stellarium / 15291801018

28 May 2025 04:52AM UTC coverage: 11.931% (-0.02%) from 11.951%
15291801018

push

github

alex-w
Added new set of navigational stars (XIX century)

0 of 6 new or added lines in 2 files covered. (0.0%)

14124 existing lines in 74 files now uncovered.

14635 of 122664 relevant lines covered (11.93%)

18291.42 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

68.6
/src/core/GeomMath.cpp
1
/*
2
 * Stellarium
3
 * Copyright (C) 2011-2012 Andrei Borza (from Scenery3d plug-in)
4
 * Copyright (C) 2016 Florian Schaukowitsch
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335, USA.
19
 */
20

21
#include "GeomMath.hpp"
22

23

24
AABBox::AABBox()
×
25
{
26
        *this = AABBox(Vec3f(std::numeric_limits<float>::infinity()),Vec3f(-std::numeric_limits<float>::infinity()));
×
27
}
×
28

29
AABBox::AABBox(const Vec3f& min, const Vec3f& max): min(min), max(max)
4✔
30
{
31
}
4✔
32

UNCOV
33
void AABBox::expand(const Vec3f &vec)
×
34
{
35
        min = Vec3f(        std::min(vec.v[0], min.v[0]),
×
UNCOV
36
                        std::min(vec.v[1], min.v[1]),
×
37
                        std::min(vec.v[2], min.v[2]));
×
38
        max = Vec3f(        std::max(vec.v[0], max.v[0]),
×
39
                        std::max(vec.v[1], max.v[1]),
×
40
                        std::max(vec.v[2], max.v[2]));
×
41
}
×
42

43
void AABBox::expand(const AABBox &box)
×
44
{
45
        expand(box.min);
×
UNCOV
46
        expand(box.max);
×
47
}
×
48

49
void AABBox::reset()
×
50
{
51
        //! use the constructor to avoid duplication
UNCOV
52
        *this = AABBox();
×
UNCOV
53
}
×
54

55
bool AABBox::isValid() const
4✔
56
{
57
        return (        min[0] < max[0] &&
4✔
58
                        min[1] < max[1] &&
8✔
59
                        min[2] < max[2]);
8✔
60
}
61

62
float AABBox::getVolume() const
4✔
63
{
64
        Vec3f diff = max - min;
4✔
65
        return diff[0]*diff[1]*diff[2];
4✔
66
}
67

68
Vec3f AABBox::getCorner(AABBox::Corner corner) const
32✔
69
{
70
        switch(corner)
32✔
71
        {
72
                case MinMinMin:
4✔
73
                        return min;
4✔
74
                case MaxMinMin:
4✔
75
                        return Vec3f(max.v[0], min.v[1], min.v[2]);
4✔
76
                case MaxMaxMin:
4✔
77
                        return Vec3f(max.v[0], max.v[1], min.v[2]);
4✔
78
                case MinMaxMin:
4✔
79
                        return Vec3f(min.v[0], max.v[1], min.v[2]);
4✔
80
                case MinMinMax:
4✔
81
                        return Vec3f(min.v[0], min.v[1], max.v[2]);
4✔
82
                case MaxMinMax:
4✔
83
                        return Vec3f(max.v[0], min.v[1], max.v[2]);
4✔
84
                case MaxMaxMax:
4✔
85
                        return max;
4✔
86
                case MinMaxMax:
4✔
87
                        return Vec3f(min.v[0], max.v[1], max.v[2]);
4✔
UNCOV
88
                default:
×
89
                        //! Invalid case
90
                        //! use a sNaN to detect bugs
UNCOV
91
                        return Vec3f(std::numeric_limits<float>::signaling_NaN());
×
92
        }
93
}
94

95
Vec4f AABBox::getPlane(AABBox::Face p) const
24✔
96
{
97
        switch(p)
24✔
98
        {
99
                case Front:
4✔
100
                        return Vec4f(0.0f, -1.0f, 0.0f, -min.v[1]);
4✔
101
                case Back:
4✔
102
                        return Vec4f(0.0f, 1.0f, 0.0f, max.v[1]);
4✔
103
                case Bottom:
4✔
104
                        return Vec4f(0.0f, 0.0f, -1.0f, -min.v[2]);
4✔
105
                case Top:
4✔
106
                        return Vec4f(0.0f, 0.0f, 1.0f, max.v[2]);
4✔
107
                case Left:
4✔
108
                        return Vec4f(-1.0f, 0.0f, 0.0f, -min.v[0]);
4✔
109
                case Right:
4✔
110
                        return Vec4f(1.0f, 0.0f, 0.0f, max.v[0]);
4✔
UNCOV
111
                default:
×
112
                        //! Invalid case
113
                        //! use a sNaN to detect bugs
UNCOV
114
                        return Vec4f(std::numeric_limits<float>::signaling_NaN());
×
115
        }
116
}
117

118
Vec3f AABBox::positiveVertex(Vec3f& normal) const
4✔
119
{
120
        Vec3f out = min;
4✔
121

122
        if(normal.v[0] >= 0.0f)
4✔
123
                out.v[0] = max.v[0];
4✔
124
        if(normal.v[1] >= 0.0f)
4✔
125
                out.v[1] = max.v[1];
4✔
126
        if(normal.v[2] >= 0.0f)
4✔
127
                out.v[2] = max.v[2];
4✔
128

129
        return out;
4✔
130
}
131

132
Vec3f AABBox::negativeVertex(Vec3f& normal) const
4✔
133
{
134
        Vec3f out = max;
4✔
135

136
        if(normal.v[0] >= 0.0f)
4✔
137
                out.v[0] = min.v[0];
4✔
138
        if(normal.v[1] >= 0.0f)
4✔
139
                out.v[1] = min.v[1];
4✔
140
        if(normal.v[2] >= 0.0f)
4✔
141
                out.v[2] = min.v[2];
4✔
142

143
        return out;
4✔
144
}
145

UNCOV
146
Line::Line(const Vec3f &p, const Vec3f &dir): startPoint(p), direction(dir)
×
147
{
148
        endPoint = startPoint + direction;
×
UNCOV
149
}
×
150

151
Vec3f Line::getPoint(float val) const
×
152
{
153
        return startPoint + (val*direction);
×
154
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc