/src/s2geometry/src/s2/s2shapeutil_shape_edge.h
Line | Count | Source |
1 | | // Copyright 2013 Google Inc. All Rights Reserved. |
2 | | // |
3 | | // Licensed under the Apache License, Version 2.0 (the "License"); |
4 | | // you may not use this file except in compliance with the License. |
5 | | // You may obtain a copy of the License at |
6 | | // |
7 | | // http://www.apache.org/licenses/LICENSE-2.0 |
8 | | // |
9 | | // Unless required by applicable law or agreed to in writing, software |
10 | | // distributed under the License is distributed on an "AS-IS" BASIS, |
11 | | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | | // See the License for the specific language governing permissions and |
13 | | // limitations under the License. |
14 | | // |
15 | | |
16 | | // Author: ericv@google.com (Eric Veach) |
17 | | |
18 | | #ifndef S2_S2SHAPEUTIL_SHAPE_EDGE_H_ |
19 | | #define S2_S2SHAPEUTIL_SHAPE_EDGE_H_ |
20 | | |
21 | | #include <cstdint> |
22 | | |
23 | | #include "s2/_fp_contract_off.h" // IWYU pragma: keep |
24 | | #include "s2/s2point.h" |
25 | | #include "s2/s2shape.h" |
26 | | #include "s2/s2shapeutil_shape_edge_id.h" |
27 | | |
28 | | namespace s2shapeutil { |
29 | | |
30 | | // A class representing a ShapeEdgeId together with the two endpoints of that |
31 | | // edge. It should be passed by reference. |
32 | | struct ShapeEdge { |
33 | | public: |
34 | | ShapeEdge() = default; |
35 | | ShapeEdge(int32_t shape_id, int32_t edge_id, const S2Shape::Edge& edge); |
36 | 0 | ShapeEdgeId id() const { return id_; } |
37 | 0 | const S2Point& v0() const { return edge_.v0; } |
38 | 0 | const S2Point& v1() const { return edge_.v1; } |
39 | | |
40 | | private: |
41 | | ShapeEdgeId id_; |
42 | | S2Shape::Edge edge_; |
43 | | }; |
44 | | |
45 | | |
46 | | ////////////////// Implementation details follow //////////////////// |
47 | | |
48 | | inline ShapeEdge::ShapeEdge(int32_t shape_id, int32_t edge_id, |
49 | | const S2Shape::Edge& edge) |
50 | 0 | : id_(shape_id, edge_id), edge_(edge) {} |
51 | | |
52 | | } // namespace s2shapeutil |
53 | | |
54 | | #endif // S2_S2SHAPEUTIL_SHAPE_EDGE_H_ |