26template<
typename Input,
typename Output,util::BiPredicate<Input> SLSLess = std::less<Input>,
bool InsertEventsFirst = false, util::BiPredicate<fishnet::math::DEFAULT_NUMERIC> EventQueueGreater = std::greater<fishnet::math::DEFAULT_NUMERIC>>
87 const static inline EventQueueGreater eventQueueGreater = EventQueueGreater {};
88 const static inline SLSLess slsLess = SLSLess {};
94 struct EventQueueGreaterPtr {
97 if constexpr(InsertEventsFirst)
103 return eventQueueGreater(rhs->eventPoint(), lhs->eventPoint());
112 bool operator()(
const Input * lhs,
const Input * rhs)
const noexcept {
113 return slsLess(*lhs,*rhs);
118 using SLS = std::set<const Input *,SLSOrdering>;
119 using EventQ = std::priority_queue<eventPointer,std::vector<eventPointer>,EventQueueGreaterPtr>;
126 queue.push(std::move(event));
137 void addSLS(
const Input * input)
noexcept {
146 return sls.contains(input);
158 return this->sls.lower_bound(&input);
162 return this->sls.upper_bound(&input);
174 for(
auto && event : events) {
180 for(
const auto & obj : objects) {
181 for(
auto && event : eventMapper(obj)){
187 Output
sweep(Output & output)
noexcept {
188 while(not queue.empty()){
189 queue.top()->process(*
this,output);
Interface for EventQueue events. process(...) is executed whenever an element is polled from the Even...
Definition SweepLine.hpp:36
const Input & getObject() const noexcept
Definition SweepLine.hpp:49
IEvent(const Input &obj)
Definition SweepLine.hpp:41
virtual ~IEvent()=default
virtual fishnet::math::DEFAULT_NUMERIC eventPoint() const noexcept=0
const Input * obj
Definition SweepLine.hpp:38
virtual void process(SweepLine< Input, Output, SLSLess, InsertEventsFirst, EventQueueGreater > &sweepLine, Output &output) const =0
virtual EventType type() const noexcept=0
Generic Sweep Line template Stores a Sweep Line Status (SLS), keeping track of the current state of t...
Definition SweepLine.hpp:27
const EventQ & getEventQueue() const noexcept
Definition SweepLine.hpp:165
void addEvents(util::forward_range_of< Input > auto const &objects, util::UnaryFunction< Input, std::vector< eventPointer > > auto eventMapper) noexcept
Definition SweepLine.hpp:179
auto upperBound(const Input &input) const noexcept
Definition SweepLine.hpp:161
SLS & getSLS() noexcept
Definition SweepLine.hpp:153
eventPointer nextEvent() noexcept
Definition SweepLine.hpp:133
void addEvents(util::forward_range_of< eventPointer > auto &&events) noexcept
Definition SweepLine.hpp:173
EventQ & getEventQueue() noexcept
Definition SweepLine.hpp:169
auto lowerBound(const Input &input) const noexcept
Definition SweepLine.hpp:157
void addSLS(const Input *input) noexcept
Definition SweepLine.hpp:137
bool containsSLS(const Input *input) noexcept
Definition SweepLine.hpp:145
std::unique_ptr< IEvent > eventPointer
Definition SweepLine.hpp:84
void removeSLS(const Input *input) noexcept
Definition SweepLine.hpp:141
Output sweep(Output &output) noexcept
Definition SweepLine.hpp:187
std::priority_queue< eventPointer, std::vector< eventPointer >, EventQueueGreaterPtr > EventQ
Definition SweepLine.hpp:119
std::set< const Input *, SLSOrdering > SLS
Definition SweepLine.hpp:118
const SLS & getSLS() const noexcept
Definition SweepLine.hpp:149
void removeEvent(eventPointer const &event) noexcept
Definition SweepLine.hpp:129
void addEvent(eventPointer event) noexcept
Definition SweepLine.hpp:125
Definition FunctionalConcepts.hpp:9
Definition CollectionConcepts.hpp:27
Definition BoundingBoxWrapper.hpp:5
EventType
Definition SweepLine.hpp:13
constexpr bool areEqual(T lhs, U rhs) noexcept
Definition Constants.hpp:31
Definition BFSClustering.hpp:5
Definition SweepLine.hpp:70
virtual void process(SweepLine< Input, Output, SLSLess, InsertEventsFirst, EventQueueGreater > &sweepLine, Output &output) const
Definition SweepLine.hpp:72
DefaultInsertEvent(const Input &obj)
Definition SweepLine.hpp:71
Definition SweepLine.hpp:77
virtual void process(SweepLine< Input, Output, SLSLess, InsertEventsFirst, EventQueueGreater > &sweepLine, Output &output) const
Definition SweepLine.hpp:79
DefaultRemoveEvent(const Input &obj)
Definition SweepLine.hpp:78
Definition SweepLine.hpp:56
InsertEvent(const Input &obj)
Definition SweepLine.hpp:57
virtual EventType type() const noexcept
Definition SweepLine.hpp:58
Definition SweepLine.hpp:63
RemoveEvent(const Input &obj)
Definition SweepLine.hpp:64
virtual EventType type() const noexcept
Definition SweepLine.hpp:65