// Copyright 2023 Google LLC // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. #include "modules/bentleyottmann/include/BentleyOttmann1.h" #include "modules/bentleyottmann/include/EventQueue.h" #include "modules/bentleyottmann/include/Segment.h" #include "modules/bentleyottmann/include/SweepLine.h" #include #include #include namespace bentleyottmann { std::optional> bentley_ottmann_1(SkSpan segments) { if (auto possibleEQ = EventQueue::Make(segments)) { EventQueue eventQueue = std::move(possibleEQ.value()); SweepLine sweepLine; while(eventQueue.hasMoreEvents()) { eventQueue.handleNextEventPoint(&sweepLine); } return eventQueue.crossings(); } return std::nullopt; } } // namespace bentleyottmann