...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package s2
16
17
18
19
20
21
22
23
24
25 type laxPolyline struct {
26 vertices []Point
27 }
28
29 func laxPolylineFromPoints(vertices []Point) *laxPolyline {
30 return &laxPolyline{
31 vertices: append([]Point(nil), vertices...),
32 }
33 }
34
35 func laxPolylineFromPolyline(p Polyline) *laxPolyline {
36 return laxPolylineFromPoints(p)
37 }
38
39 func (l *laxPolyline) NumEdges() int { return maxInt(0, len(l.vertices)-1) }
40 func (l *laxPolyline) Edge(e int) Edge { return Edge{l.vertices[e], l.vertices[e+1]} }
41 func (l *laxPolyline) ReferencePoint() ReferencePoint { return OriginReferencePoint(false) }
42 func (l *laxPolyline) NumChains() int { return minInt(1, l.NumEdges()) }
43 func (l *laxPolyline) Chain(i int) Chain { return Chain{0, l.NumEdges()} }
44 func (l *laxPolyline) ChainEdge(i, j int) Edge { return Edge{l.vertices[j], l.vertices[j+1]} }
45 func (l *laxPolyline) ChainPosition(e int) ChainPosition { return ChainPosition{0, e} }
46 func (l *laxPolyline) Dimension() int { return 1 }
47 func (l *laxPolyline) IsEmpty() bool { return defaultShapeIsEmpty(l) }
48 func (l *laxPolyline) IsFull() bool { return defaultShapeIsFull(l) }
49 func (l *laxPolyline) typeTag() typeTag { return typeTagLaxPolyline }
50 func (l *laxPolyline) privateInterface() {}
51
View as plain text