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

paulmthompson / WhiskerToolbox / 17270491352

27 Aug 2025 02:57PM UTC coverage: 65.333%. Remained the same
17270491352

push

github

paulmthompson
Merge branch 'main' of https://github.com/paulmthompson/WhiskerToolbox

352 of 628 new or added lines in 92 files covered. (56.05%)

357 existing lines in 24 files now uncovered.

26429 of 40453 relevant lines covered (65.33%)

1119.34 hits per line

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

19.23
/src/CoreGeometry/src/lines.cpp
1
#include "CoreGeometry/lines.hpp"
2

3
#include <cmath>
4
#include <cstdint>
5

6

7

8
Line2D create_line(std::vector<float> const & x, std::vector<float> const & y) {
172✔
9
    auto new_line = Line2D();
172✔
10

11
    for (std::size_t i = 0; i < x.size(); i++) {
2,984✔
12
        new_line.push_back(Point2D<float>{x[i], y[i]});
2,812✔
13
    }
14

15
    return new_line;
172✔
16
}
×
17

18

19
void smooth_line(Line2D & line) {
×
20
    if (line.size() < 3) return;// No need to smooth if less than 3 points
×
21

22
    Line2D smoothed_line;
×
23
    smoothed_line.push_back(line.front());// First point remains the same
×
24

25
    for (std::size_t i = 1; i < line.size() - 1; ++i) {
×
26
        float const smoothed_x = (line[i - 1].x + line[i].x + line[i + 1].x) / 3.0f;
×
27
        float const smoothed_y = (line[i - 1].y + line[i].y + line[i + 1].y) / 3.0f;
×
28
        smoothed_line.push_back(Point2D<float>{smoothed_x, smoothed_y});
×
29
    }
30

31
    smoothed_line.push_back(line.back());// Last point remains the same
×
32
    line = std::move(smoothed_line);
×
33
}
×
34

35

36
std::vector<uint8_t> line_to_image(Line2D & line, int height, int width) {
×
37
    auto image = std::vector<uint8_t>(static_cast<size_t>(height * width));
×
38

39
    for (auto point: line) {
×
40
        auto x = std::lround(point.x);
×
41
        auto y = std::lround(point.y);
×
42

NEW
43
        if (x >= 0 && x < width && y >= 0 && y < height) {
×
NEW
44
            auto index = static_cast<size_t>(width * y + x);
×
NEW
45
            image[index] = 255;
×
46
        }
47
    }
48

UNCOV
49
    return image;
×
50
}
51

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

© 2026 Coveralls, Inc