xref: /aosp_15_r20/external/skia/modules/bentleyottmann/include/SweepLine.h (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1*c8dee2aaSAndroid Build Coastguard Worker // Copyright 2023 Google LLC
2*c8dee2aaSAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
3*c8dee2aaSAndroid Build Coastguard Worker 
4*c8dee2aaSAndroid Build Coastguard Worker #ifndef SweepLine_DEFINED
5*c8dee2aaSAndroid Build Coastguard Worker #define SweepLine_DEFINED
6*c8dee2aaSAndroid Build Coastguard Worker 
7*c8dee2aaSAndroid Build Coastguard Worker #include "modules/bentleyottmann/include/EventQueueInterface.h"
8*c8dee2aaSAndroid Build Coastguard Worker #include "modules/bentleyottmann/include/Segment.h"
9*c8dee2aaSAndroid Build Coastguard Worker 
10*c8dee2aaSAndroid Build Coastguard Worker #include <cstdint>
11*c8dee2aaSAndroid Build Coastguard Worker #include <vector>
12*c8dee2aaSAndroid Build Coastguard Worker 
13*c8dee2aaSAndroid Build Coastguard Worker namespace bentleyottmann {
14*c8dee2aaSAndroid Build Coastguard Worker struct Point;
15*c8dee2aaSAndroid Build Coastguard Worker 
16*c8dee2aaSAndroid Build Coastguard Worker class SweepLine : public SweepLineInterface {
17*c8dee2aaSAndroid Build Coastguard Worker public:
18*c8dee2aaSAndroid Build Coastguard Worker     SweepLine();
19*c8dee2aaSAndroid Build Coastguard Worker 
20*c8dee2aaSAndroid Build Coastguard Worker     void handleDeletions(Point eventPoint, const DeletionSegmentSet& removing) override;
21*c8dee2aaSAndroid Build Coastguard Worker 
22*c8dee2aaSAndroid Build Coastguard Worker     void handleInsertionsAndCheckForNewCrossings(Point eventPoint,
23*c8dee2aaSAndroid Build Coastguard Worker                                                  const InsertionSegmentSet& inserting,
24*c8dee2aaSAndroid Build Coastguard Worker                                                  EventQueueInterface* queue) override;
25*c8dee2aaSAndroid Build Coastguard Worker 
26*c8dee2aaSAndroid Build Coastguard Worker private:
27*c8dee2aaSAndroid Build Coastguard Worker     friend struct SweepLineTestingPeer;
28*c8dee2aaSAndroid Build Coastguard Worker 
29*c8dee2aaSAndroid Build Coastguard Worker     void verify(int32_t y) const;
30*c8dee2aaSAndroid Build Coastguard Worker 
31*c8dee2aaSAndroid Build Coastguard Worker     std::vector<Segment> fSweepLine;
32*c8dee2aaSAndroid Build Coastguard Worker };
33*c8dee2aaSAndroid Build Coastguard Worker }  // namespace bentleyottmann
34*c8dee2aaSAndroid Build Coastguard Worker #endif  // SweepLine_DEFINED
35