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

paulmthompson / WhiskerToolbox / 17537238893

08 Sep 2025 01:48AM UTC coverage: 71.559% (+0.6%) from 70.935%
17537238893

push

github

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

36445 of 50930 relevant lines covered (71.56%)

1283.97 hits per line

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

74.07
/src/CoreGeometry/include/CoreGeometry/lines.hpp
1
#ifndef DATAMANAGER_LINES_HPP
2
#define DATAMANAGER_LINES_HPP
3

4
#include "CoreGeometry/points.hpp"
5

6
#include <cstdint>
7
#include <initializer_list>
8
#include <type_traits>
9
#include <vector>
10

11
class Line2D {
12
public:
13
    Line2D() = default;
6✔
14
    Line2D(std::vector<Point2D<float>> points) : points_(std::move(points)) {}
370✔
15

16
    /**
17
     * @brief Construct a Line2D from an initializer list of Point2D<float>.
18
     *
19
     * @pre None.
20
     * @post The line contains the provided points in the same order.
21
     */
22
    Line2D(std::initializer_list<Point2D<float>> points) : points_(points) {}
63✔
23

24
    /**
25
     * @brief Construct a Line2D from a variable number of Point2D<float> arguments.
26
     *
27
     * Enables parenthesis initialization like: Line2D(p1, p2, p3).
28
     *
29
     * @pre None.
30
     * @post The line contains the provided points in the same order.
31
     */
32
    template <typename... P,
33
              typename = std::enable_if_t<(std::conjunction_v<std::is_same<std::decay_t<P>, Point2D<float>>...>)>>
34
    explicit Line2D(P&&... pts) : points_{static_cast<Point2D<float>>(std::forward<P>(pts))...} {}
35

36
    size_t size() const {
9,002✔
37
        return points_.size();
9,002✔
38
    }
39

40
    Point2D<float> front() const {
26✔
41
        return points_.front();
26✔
42
    }
43

44
    bool empty() const {
675✔
45
        return points_.empty();
675✔
46
    }
47

48
    void push_back(Point2D<float> const & point) {
3,318✔
49
        points_.push_back(point);
3,318✔
50
    }
3,318✔
51

52
    Point2D<float> back() const {
133✔
53
        return points_.back();
133✔
54
    }
55
    Point2D<float> operator[](size_t index) const {
13,527✔
56
        return points_[index];
13,527✔
57
    }
58

59
    std::vector<Point2D<float>>::iterator begin() {
×
60
        return points_.begin();
×
61
    }
62

63
    std::vector<Point2D<float>>::iterator end() {
×
64
        return points_.end();
×
65
    }
66
    std::vector<Point2D<float>>::const_iterator begin() const {
47✔
67
        return points_.begin();
47✔
68
    }
69
    std::vector<Point2D<float>>::const_iterator end() const {
47✔
70
        return points_.end();
47✔
71
    }
72

73
    void erase(std::vector<Point2D<float>>::iterator it) {
74
        points_.erase(it);
75
    }
76

77
    void erase(std::vector<Point2D<float>>::iterator first, std::vector<Point2D<float>>::iterator last) {
×
78
        points_.erase(first, last);
×
79
    }
×
80

81
private:
82
    std::vector<Point2D<float>> points_; 
83

84
};
85

86

87
Line2D create_line(std::vector<float> const & x, std::vector<float> const & y);
88

89

90
void smooth_line(Line2D & line);
91

92
std::vector<uint8_t> line_to_image(Line2D & line, int height, int width);
93

94

95

96
#endif// DATAMANAGER_LINES_HPP
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