Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
modules
bentleyottmann
src
BruteForceCrossings.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
4
#include "
modules/bentleyottmann/include/BruteForceCrossings.h
"
5
6
#include "
modules/bentleyottmann/include/Segment.h
"
7
8
#include <optional>
9
#include <vector>
10
11
namespace
bentleyottmann
{
12
std::optional<std::vector<Crossing>>
brute_force_crossings
(
SkSpan<const Segment>
segments) {
13
std::vector<Crossing> answer;
14
if
(segments.
size
() >= 2) {
15
for
(
auto
i0 = segments.
begin
(); i0 != segments.
end
() - 1; ++i0) {
16
for
(
auto
i1 = i0 + 1; i1 != segments.
end
(); ++i1) {
17
if
(
auto
possiblePoint =
intersect
(*i0, *i1)) {
18
answer.push_back({*i0, *i1, possiblePoint.value()});
19
}
20
}
21
}
22
}
23
return
answer;
24
}
25
}
// namespace bentleyottmann
BruteForceCrossings.h
Segment.h
SkSpan
Definition
SkSpan_impl.h:65
SkSpan::begin
constexpr T * begin() const
Definition
SkSpan_impl.h:90
SkSpan::end
constexpr T * end() const
Definition
SkSpan_impl.h:91
SkSpan::size
constexpr size_t size() const
Definition
SkSpan_impl.h:95
bentleyottmann
Definition
BentleyOttmann1.h:12
bentleyottmann::brute_force_crossings
std::optional< std::vector< Crossing > > brute_force_crossings(SkSpan< const Segment > segments)
Definition
BruteForceCrossings.cpp:12
bentleyottmann::intersect
std::optional< Point > intersect(const Segment &s0, const Segment &s1)
Definition
Segment.cpp:97
Generated on Fri Apr 26 2024 06:16:16 for Flutter Engine by
1.9.8