@@ -10,152 +10,58 @@ import org.scalatest.matchers.*
10
10
11
11
class TilingGrowthEdgeSpec extends AnyFlatSpec with Helper with should.Matchers {
12
12
13
- " A tiling" can " have some polygons added to an edge" in {
14
- square.maybeGrowEdge(1 -- 2 , Polygon (4 ), BEFORE_PERIMETER ).unsafe.allLabels shouldBe
15
- """ <svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" viewBox="-25.0 -75.0 100.0 150.0" xmlns="http://www.w3.org/2000/svg">
16
- | <g>
17
- | <title>Tiling</title>
18
- | <desc>Finite tessellation of regular polygons</desc>
19
- | <g style="stroke:black">
20
- | <title>Edges</title>
21
- | <desc>Sides of the regular polygons</desc>
22
- | <line x1="0.0" y1="0.0" x2="50.0" y2="0.0"/>
23
- | <line x1="50.0" y1="0.0" x2="50.0" y2="50.0"/>
24
- | <line x1="50.0" y1="50.0" x2="0.0" y2="50.0"/>
25
- | <line x1="0.0" y1="0.0" x2="0.0" y2="50.0"/>
26
- | <line x1="50.0" y1="0.0" x2="50.0" y2="-50.0"/>
27
- | <line x1="50.0" y1="-50.0" x2="0.0" y2="-50.0"/>
28
- | <line x1="0.0" y1="0.0" x2="0.0" y2="-50.0"/>
29
- | </g>
30
- | <polygon style="fill:none;stroke:blue;stroke-width:2" points="0.0,0.0 0.0,50.0 50.0,50.0 50.0,0.0 50.0,-50.0 0.0,-50.0"/>
31
- | <g style="fill:#4a4a4a;text-anchor:middle;font-family:Arial,Helvetica,sans-serif">
32
- | <title>Node labels</title>
33
- | <desc>Each node showing its value</desc>
34
- | <text x="50.0" y="-50.0">5</text>
35
- | <text x="0.0" y="0.0">1</text>
36
- | <text x="0.0" y="-50.0">6</text>
37
- | <text x="50.0" y="0.0">2</text>
38
- | <text x="50.0" y="50.0">3</text>
39
- | <text x="0.0" y="50.0">4</text>
40
- | </g>
41
- | </g>
42
- | <metadata>
43
- | <rdf:RDF>
44
- | <cc:Work>
45
- | <dc:source rdf:resource="https://github.com/scala-tessella/tessella">Tessella</dc:source>
46
- | <cc:license rdf:resource="https://www.apache.org/licenses/LICENSE-2.0"/>
47
- | </cc:Work>
48
- | </rdf:RDF>
49
- | </metadata>
50
- |</svg>""" .stripMargin
51
- }
13
+ // "A tiling" can "have some polygons added to an edge" in {
14
+ // square.maybeGrowEdge(1--2, Polygon(4), BEFORE_PERIMETER).unsafe.allLabels shouldBe
15
+ // """<svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" viewBox="-25.0 -75.0 100.0 150.0" xmlns="http://www.w3.org/2000/svg">
16
+ // | <g>
17
+ // | <title>Tiling</title>
18
+ // | <desc>Finite tessellation of regular polygons</desc>
19
+ // | <g style="stroke:black">
20
+ // | <title>Edges</title>
21
+ // | <desc>Sides of the regular polygons</desc>
22
+ // | <line x1="0.0" y1="0.0" x2="50.0" y2="0.0"/>
23
+ // | <line x1="50.0" y1="0.0" x2="50.0" y2="50.0"/>
24
+ // | <line x1="50.0" y1="50.0" x2="0.0" y2="50.0"/>
25
+ // | <line x1="0.0" y1="0.0" x2="0.0" y2="50.0"/>
26
+ // | <line x1="50.0" y1="0.0" x2="50.0" y2="-50.0"/>
27
+ // | <line x1="50.0" y1="-50.0" x2="0.0" y2="-50.0"/>
28
+ // | <line x1="0.0" y1="0.0" x2="0.0" y2="-50.0"/>
29
+ // | </g>
30
+ // | <polygon style="fill:none;stroke:blue;stroke-width:2" points="0.0,0.0 0.0,50.0 50.0,50.0 50.0,0.0 50.0,-50.0 0.0,-50.0"/>
31
+ // | <g style="fill:#4a4a4a;text-anchor:middle;font-family:Arial,Helvetica,sans-serif">
32
+ // | <title>Node labels</title>
33
+ // | <desc>Each node showing its value</desc>
34
+ // | <text x="50.0" y="-50.0">5</text>
35
+ // | <text x="0.0" y="0.0">1</text>
36
+ // | <text x="0.0" y="-50.0">6</text>
37
+ // | <text x="50.0" y="0.0">2</text>
38
+ // | <text x="50.0" y="50.0">3</text>
39
+ // | <text x="0.0" y="50.0">4</text>
40
+ // | </g>
41
+ // | </g>
42
+ // | <metadata>
43
+ // | <rdf:RDF>
44
+ // | <cc:Work>
45
+ // | <dc:source rdf:resource="https://github.com/scala-tessella/tessella">Tessella</dc:source>
46
+ // | <cc:license rdf:resource="https://www.apache.org/licenses/LICENSE-2.0"/>
47
+ // | </cc:Work>
48
+ // | </rdf:RDF>
49
+ // | </metadata>
50
+ // |</svg>""".stripMargin
51
+ // }
52
52
53
- it can " NOT have a polygon added to a non existing edge" in {
54
- Tiling .squareNet(2 , 2 ).unsafe.maybeGrowEdge(1 -- 5 , Polygon (4 ), BEFORE_PERIMETER ) shouldBe
55
- Left (
56
- """ Tiling can add polygons only to perimeter edges:
57
- | found unknown edge 1--5.
58
- |See SVG:
59
- |<svg viewBox="-25.0 -125.0 150.0 150.0" xmlns="http://www.w3.org/2000/svg">
60
- | <g>
61
- | <title>Tiling with invalid addition</title>
62
- | <desc>Adding to unknown edge 1--5</desc>
63
- | <g style="stroke:red;stroke-width:1">
64
- | <title>Highlighted</title>
65
- | <desc>Edges</desc>
66
- | <line x1="0.0" y1="0.0" x2="50.0" y2="-50.0"/>
67
- | </g>
68
- | <g>
69
- | <title>Tiling</title>
70
- | <desc>Finite tessellation of regular polygons</desc>
71
- | <g style="stroke:black">
72
- | <title>Edges</title>
73
- | <desc>Sides of the regular polygons</desc>
74
- | <line x1="0.0" y1="0.0" x2="50.0" y2="0.0"/>
75
- | <line x1="0.0" y1="-50.0" x2="50.0" y2="-50.0"/>
76
- | <line x1="0.0" y1="-100.0" x2="50.0" y2="-100.0"/>
77
- | <line x1="50.0" y1="0.0" x2="100.0" y2="0.0"/>
78
- | <line x1="50.0" y1="-50.0" x2="100.0" y2="-50.0"/>
79
- | <line x1="50.0" y1="-100.0" x2="100.0" y2="-100.0"/>
80
- | <line x1="0.0" y1="0.0" x2="0.0" y2="-50.0"/>
81
- | <line x1="0.0" y1="-50.0" x2="0.0" y2="-100.0"/>
82
- | <line x1="50.0" y1="0.0" x2="50.0" y2="-50.0"/>
83
- | <line x1="50.0" y1="-50.0" x2="50.0" y2="-100.0"/>
84
- | <line x1="100.0" y1="0.0" x2="100.0" y2="-50.0"/>
85
- | <line x1="100.0" y1="-50.0" x2="100.0" y2="-100.0"/>
86
- | </g>
87
- | <polygon style="fill:none;stroke:blue;stroke-width:2" points="0.0,0.0 50.0,0.0 100.0,0.0 100.0,-50.0 100.0,-100.0 50.0,-100.0 0.0,-100.0 0.0,-50.0"/>
88
- | <g style="fill:#4a4a4a;text-anchor:middle;font-family:Arial,Helvetica,sans-serif">
89
- | <title>Node labels</title>
90
- | <desc>Each node showing its value</desc>
91
- | <text x="50.0" y="-50.0">5</text>
92
- | <text x="0.0" y="0.0">1</text>
93
- | <text x="100.0" y="-50.0">6</text>
94
- | <text x="100.0" y="-100.0">9</text>
95
- | <text x="50.0" y="0.0">2</text>
96
- | <text x="0.0" y="-100.0">7</text>
97
- | <text x="100.0" y="0.0">3</text>
98
- | <text x="50.0" y="-100.0">8</text>
99
- | <text x="0.0" y="-50.0">4</text>
100
- | </g>
101
- | </g>
102
- | </g>
103
- |</svg>""" .stripMargin
104
- )
53
+ " A tiling" can " NOT have a polygon added to a non existing edge" in {
54
+ Tiling .squareNet(2 , 2 ).unsafe.maybeGrowEdge(1 -- 5 , Polygon (4 ), BEFORE_PERIMETER ).left.getOrElse(" " ).take(83 ) shouldBe
55
+ """ Tiling can add polygons only to perimeter edges:
56
+ | found unknown edge 1--5.
57
+ |See SVG:""" .stripMargin
105
58
}
106
59
107
60
it can " NOT have a polygon added to a non perimeter edge" in {
108
- Tiling .squareNet(2 , 2 ).unsafe.maybeGrowEdge(2 -- 5 , Polygon (4 ), BEFORE_PERIMETER ) shouldBe
109
- Left (
110
- """ Tiling can add polygons only to perimeter edges:
111
- | found inner edge 2--5.
112
- |See SVG:
113
- |<svg viewBox="-25.0 -125.0 150.0 150.0" xmlns="http://www.w3.org/2000/svg">
114
- | <g>
115
- | <title>Tiling with invalid addition</title>
116
- | <desc>Adding to inner edge 2--5</desc>
117
- | <g style="stroke:red;stroke-width:3">
118
- | <title>Highlighted</title>
119
- | <desc>Edges</desc>
120
- | <line x1="50.0" y1="0.0" x2="50.0" y2="-50.0"/>
121
- | </g>
122
- | <g>
123
- | <title>Tiling</title>
124
- | <desc>Finite tessellation of regular polygons</desc>
125
- | <g style="stroke:black">
126
- | <title>Edges</title>
127
- | <desc>Sides of the regular polygons</desc>
128
- | <line x1="0.0" y1="0.0" x2="50.0" y2="0.0"/>
129
- | <line x1="0.0" y1="-50.0" x2="50.0" y2="-50.0"/>
130
- | <line x1="0.0" y1="-100.0" x2="50.0" y2="-100.0"/>
131
- | <line x1="50.0" y1="0.0" x2="100.0" y2="0.0"/>
132
- | <line x1="50.0" y1="-50.0" x2="100.0" y2="-50.0"/>
133
- | <line x1="50.0" y1="-100.0" x2="100.0" y2="-100.0"/>
134
- | <line x1="0.0" y1="0.0" x2="0.0" y2="-50.0"/>
135
- | <line x1="0.0" y1="-50.0" x2="0.0" y2="-100.0"/>
136
- | <line x1="50.0" y1="0.0" x2="50.0" y2="-50.0"/>
137
- | <line x1="50.0" y1="-50.0" x2="50.0" y2="-100.0"/>
138
- | <line x1="100.0" y1="0.0" x2="100.0" y2="-50.0"/>
139
- | <line x1="100.0" y1="-50.0" x2="100.0" y2="-100.0"/>
140
- | </g>
141
- | <polygon style="fill:none;stroke:blue;stroke-width:2" points="0.0,0.0 50.0,0.0 100.0,0.0 100.0,-50.0 100.0,-100.0 50.0,-100.0 0.0,-100.0 0.0,-50.0"/>
142
- | <g style="fill:#4a4a4a;text-anchor:middle;font-family:Arial,Helvetica,sans-serif">
143
- | <title>Node labels</title>
144
- | <desc>Each node showing its value</desc>
145
- | <text x="50.0" y="-50.0">5</text>
146
- | <text x="0.0" y="0.0">1</text>
147
- | <text x="100.0" y="-50.0">6</text>
148
- | <text x="100.0" y="-100.0">9</text>
149
- | <text x="50.0" y="0.0">2</text>
150
- | <text x="0.0" y="-100.0">7</text>
151
- | <text x="100.0" y="0.0">3</text>
152
- | <text x="50.0" y="-100.0">8</text>
153
- | <text x="0.0" y="-50.0">4</text>
154
- | </g>
155
- | </g>
156
- | </g>
157
- |</svg>""" .stripMargin
158
- )
61
+ Tiling .squareNet(2 , 2 ).unsafe.maybeGrowEdge(2 -- 5 , Polygon (4 ), BEFORE_PERIMETER ).left.getOrElse(" " ).take(81 ) shouldBe
62
+ """ Tiling can add polygons only to perimeter edges:
63
+ | found inner edge 2--5.
64
+ |See SVG:""" .stripMargin
159
65
}
160
66
161
67
val strange : Tiling =
0 commit comments