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 // Original author: ericv@google.com (Eric Veach) 17 // Converted to D: madric@gmail.com (Vijay Nayar) 18 19 module s2.shapeutil.shape_edge; 20 21 import s2.s2point; 22 import s2.s2shape; 23 import s2.shapeutil.shape_edge_id; 24 25 26 // A class representing a ShapeEdgeId together with the two endpoints of that 27 // edge. It should be passed by reference. 28 class ShapeEdge { 29 public: 30 this() {} 31 this(in S2Shape shape, int edge_id) { 32 this(shape.id(), edge_id, shape.edge(edge_id)); 33 } 34 35 this(int shape_id, int edge_id, in S2Shape.Edge edge) { 36 _id = ShapeEdgeId(shape_id, edge_id); 37 _edge = edge; 38 } 39 40 ShapeEdgeId id() const { 41 return _id; 42 } 43 44 ref const(S2Point) v0() const { 45 return _edge.v0; 46 } 47 48 ref const(S2Point) v1() const { 49 return _edge.v1; 50 } 51 52 private: 53 ShapeEdgeId _id; 54 S2Shape.Edge _edge; 55 }