Flutter Engine
The Flutter Engine
BentleyOttmann1.cpp
Go to the documentation of this file.
1// Copyright 2023 Google LLC
2// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
3
5
9
10#include <optional>
11#include <utility>
12#include <vector>
13
14namespace bentleyottmann {
15
16std::optional<std::vector<Crossing>> bentley_ottmann_1(SkSpan<const Segment> segments) {
17 if (auto possibleEQ = EventQueue::Make(segments)) {
18 EventQueue eventQueue = std::move(possibleEQ.value());
19 SweepLine sweepLine;
20 while(eventQueue.hasMoreEvents()) {
21 eventQueue.handleNextEventPoint(&sweepLine);
22 }
23 return eventQueue.crossings();
24 }
25 return std::nullopt;
26}
27} // namespace bentleyottmann
std::vector< Crossing > crossings()
Definition: EventQueue.cpp:125
void handleNextEventPoint(SweepLineInterface *handler)
Definition: EventQueue.cpp:63
static std::optional< EventQueue > Make(SkSpan< const Segment > segments)
Definition: EventQueue.cpp:14
std::optional< std::vector< Crossing > > bentley_ottmann_1(SkSpan< const Segment > segments)