rectangle-union-area/geometry.h

43 lines
653 B
C
Raw Permalink Normal View History

2022-04-16 09:24:00 +02:00
//
// Created by maximilian on 16.04.22.
//
#ifndef PROG_GEOMETRY_H
#define PROG_GEOMETRY_H
#include <cstdint>
using Coordinate = int;
using Unit = uint64_t;
using Index = size_t;
struct Point {
Coordinate x;
Coordinate y;
};
struct Interval {
Coordinate left;
Coordinate right;
};
2022-04-16 11:34:29 +02:00
struct Rectangle {
Point bottom_left;
Point top_right;
// only for algorithm
Index i_left;
Index i_right;
};
struct RectCoord {
Coordinate coord;
Rectangle* rect; // guaranteed to be valid at all times
bool operator<(const RectCoord &other) {
return coord < other.coord;
}
};
2022-04-16 09:24:00 +02:00
#endif //PROG_GEOMETRY_H