| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include <cstddef> | ||
| 4 | #include <cstdint> | ||
| 5 | #include <string> | ||
| 6 | #include <tuple> | ||
| 7 | #include <vector> | ||
| 8 | |||
| 9 | #include "task/include/task.hpp" | ||
| 10 | |||
| 11 | namespace kamalagin_a_binary_image_convex_hull { | ||
| 12 | |||
| 13 | struct Point { | ||
| 14 | int x = 0; | ||
| 15 | int y = 0; | ||
| 16 | |||
| 17 | bool operator==(const Point &other) const { | ||
| 18 | return x == other.x && y == other.y; | ||
| 19 | } | ||
| 20 | }; | ||
| 21 | |||
| 22 |
1/2✓ Branch 1 taken 182 times.
✗ Branch 2 not taken.
|
1274 | struct BinaryImage { |
| 23 | int rows = 0; | ||
| 24 | int cols = 0; | ||
| 25 | std::vector<uint8_t> data; | ||
| 26 | |||
| 27 | [[nodiscard]] bool At(int r, int c) const { | ||
| 28 | return r >= 0 && r < rows && c >= 0 && c < cols && | ||
| 29 | data[(static_cast<size_t>(r) * static_cast<size_t>(cols)) + static_cast<size_t>(c)] != 0; | ||
| 30 | } | ||
| 31 | |||
| 32 | [[nodiscard]] size_t Index(int r, int c) const { | ||
| 33 |
4/4✓ Branch 0 taken 525 times.
✓ Branch 1 taken 250 times.
✓ Branch 2 taken 30 times.
✓ Branch 3 taken 6 times.
|
1011 | return (static_cast<size_t>(r) * static_cast<size_t>(cols)) + static_cast<size_t>(c); |
| 34 | } | ||
| 35 | }; | ||
| 36 | |||
| 37 | using Hull = std::vector<Point>; | ||
| 38 | using HullList = std::vector<Hull>; | ||
| 39 | |||
| 40 | using InType = BinaryImage; | ||
| 41 | using OutType = HullList; | ||
| 42 | using TestType = std::tuple<int, std::string>; | ||
| 43 | using BaseTask = ppc::task::Task<InType, OutType>; | ||
| 44 | |||
| 45 | } // namespace kamalagin_a_binary_image_convex_hull | ||
| 46 |