33 lines
833 B
C++
33 lines
833 B
C++
|
|
#include "task3.hpp"
|
|
#include "task3.Image.hpp"
|
|
#include "task3.Root.hpp"
|
|
#include "task2.Line.hpp"
|
|
#include "task2.Polyline.hpp"
|
|
#include "task2.Circle.hpp"
|
|
|
|
namespace task3 {
|
|
|
|
|
|
|
|
using namespace task2;
|
|
|
|
BBox plot_image(std::filesystem::path filepath, const std::vector<task2::Line>& lines, const std::vector<task2::Polyline>& polylines,
|
|
const std::vector<task2::Circle>& circles) {
|
|
|
|
// Initialize bounding box with a default value
|
|
Vec2i min_point = {INT_MAX, INT_MAX};
|
|
Vec2i max_point = {INT_MIN, INT_MIN};
|
|
|
|
// Iterate over all lines
|
|
for (const auto& line : lines) {
|
|
// Update bounding box
|
|
auto [p1, p2] = line;
|
|
min_point = min(min_point, line.bbox().min);
|
|
max_point = max(max_point, line.bbox().max);
|
|
}
|
|
|
|
return BBox{min_point, max_point};
|
|
}
|
|
|
|
} // namespace task3
|