Skip to content

Commit b724582

Browse files
committed
Better patterns
1 parent ca87034 commit b724582

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+832
-393
lines changed

.jvm/src/test/scala/io/github/scala_tessella/tessella/TilingCoordsSpec.scala

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import org.scalatest.matchers.*
1717
class TilingCoordsSpec extends AnyFlatSpec with should.Matchers {
1818

1919
"A tiling made of triangles" can "return its coords" in {
20-
tri4x4Reticulate.coords.almostEqualsMap(
20+
p333333_4by4_reticulate.coords.almostEqualsMap(
2121
Map(
2222
1 -> Point(),
2323
2 -> Point(1, 0),
@@ -40,7 +40,7 @@ class TilingCoordsSpec extends AnyFlatSpec with should.Matchers {
4040
}
4141

4242
"A tiling made of hexagons" can "return its coords" in {
43-
hex4x4Reticulate.coords.almostEqualsMap(
43+
p666_4by4_reticulate.coords.almostEqualsMap(
4444
Map(
4545
1 -> Point(),
4646
2 -> Point(1, 0),
@@ -96,7 +96,7 @@ class TilingCoordsSpec extends AnyFlatSpec with should.Matchers {
9696
}
9797

9898
it can "be rendered as SVG" in {
99-
prettyPrinter.format(hex4x4Reticulate.toSVG()) shouldBe
99+
prettyPrinter.format(p666_4by4_reticulate.toSVG()) shouldBe
100100
"""<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="-50.0 -25.0 375.0 526.313972" xmlns="http://www.w3.org/2000/svg">
101101
| <g>
102102
| <title>Tiling</title>
@@ -216,7 +216,7 @@ class TilingCoordsSpec extends AnyFlatSpec with should.Matchers {
216216
}
217217

218218
"A tiling made of squares" can "return its coords" in {
219-
sqr4x4Reticulate.coords.almostEqualsMap(
219+
p4444_4by4_reticulate.coords.almostEqualsMap(
220220
Map(
221221
1 -> Point(),
222222
2 -> Point(1, 0),
@@ -249,7 +249,7 @@ class TilingCoordsSpec extends AnyFlatSpec with should.Matchers {
249249
}
250250

251251
it can "be rendered as polygons SVG" in {
252-
sqr4x4Reticulate.withPolygons shouldBe
252+
p4444_4by4_reticulate.withPolygons shouldBe
253253
"""<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 -225.0 250.0 250.0" xmlns="http://www.w3.org/2000/svg">
254254
| <g>
255255
| <title>Tiling</title>

.jvm/src/test/scala/io/github/scala_tessella/tessella/TilingGrowthNodeSpec.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ class TilingGrowthNodeSpec extends AnyFlatSpec with Helper with should.Matchers
399399
}
400400

401401
it can "NOT have a polygon added to a non existing node" in {
402-
Tiling.squareNet(2, 2).unsafe.maybeGrowNode(Node(100), Vertex(Polygon(4)), BEFORE_PERIMETER) shouldBe
402+
Tiling.pattern_4444(2, 2).unsafe.maybeGrowNode(Node(100), Vertex(Polygon(4)), BEFORE_PERIMETER) shouldBe
403403
Left(
404404
"""Tiling can add polygons only to perimeter nodes:
405405
| found unknown node 100.
@@ -448,7 +448,7 @@ class TilingGrowthNodeSpec extends AnyFlatSpec with Helper with should.Matchers
448448
}
449449

450450
it can "NOT have a polygon added to a non perimeter node" in {
451-
Tiling.squareNet(2, 2).unsafe.maybeGrowNode(Node(5), Vertex(Polygon(4)), BEFORE_PERIMETER) shouldBe
451+
Tiling.pattern_4444(2, 2).unsafe.maybeGrowNode(Node(5), Vertex(Polygon(4)), BEFORE_PERIMETER) shouldBe
452452
Left(
453453
"""Tiling can add polygons only to perimeter nodes:
454454
| found inner node 5.

.jvm/src/test/scala/io/github/scala_tessella/tessella/TilingUniformitySpec.scala

+20-20
Original file line numberDiff line numberDiff line change
@@ -208,21 +208,21 @@ class TilingUniformitySpec extends AnyFlatSpec with Helper with should.Matchers
208208
// }
209209

210210
"A sqr4x4Reticulate" can "return the nodes belonging to each different gonality" in {
211-
sqr4x4Reticulate.groupGonals shouldBe
211+
p4444_4by4_reticulate.groupGonals shouldBe
212212
Map(
213213
Vector(4, 4, 4, 4) -> List(14, 9, 13, 17, 12, 7, 18, 8, 19)
214214
).mapKeys(_.map(Node(_)))
215215
}
216216

217217
it can "have its nodes grouped in uniform sets" in {
218-
sqr4x4Reticulate.groupUniforms shouldBe
218+
p4444_4by4_reticulate.groupUniforms shouldBe
219219
Map(
220220
(Vector(4, 4, 4, 4), List()) -> Vector(14, 9, 13, 17, 12, 7, 18, 8, 19)
221221
).mapValues2(_.map(Node(_)))
222222
}
223223

224224
it can "have an uniformity value 1" in {
225-
sqr4x4Reticulate.uniformity shouldBe
225+
p4444_4by4_reticulate.uniformity shouldBe
226226
1
227227
}
228228

@@ -276,31 +276,31 @@ class TilingUniformitySpec extends AnyFlatSpec with Helper with should.Matchers
276276
}
277277

278278
"A triangleTriangleOfSide5" can "have its nodes grouped in uniform sets" in {
279-
triangleTriangleOfSide5.groupUniforms shouldBe
279+
p333333_triangle.groupUniforms shouldBe
280280
Map(
281281
(Vector(3, 3, 3, 3, 3, 3), List()) -> Vector(5, 14, 9, 13, 12, 8)
282282
).mapValues2(_.map(Node(_)))
283283
}
284284

285285
it can "have uniformity value 1" in {
286-
triangleTriangleOfSide5.uniformity shouldBe
286+
p333333_triangle.uniformity shouldBe
287287
1
288288
}
289289

290290
"A hexTrianguloidOfSide4" can "have its nodes grouped in uniform sets" in {
291-
hexTrianguloidOfSide4.groupUniforms shouldBe
291+
p666_triangle.groupUniforms shouldBe
292292
Map(
293293
(Vector(6, 6, 6), List()) -> Vector(14, 13, 22, 12, 16, 23, 15, 28, 21)
294294
).mapValues2(_.map(Node(_)))
295295
}
296296

297297
it can "have uniformity value 1" in {
298-
hexTrianguloidOfSide4.uniformity shouldBe
298+
p666_triangle.uniformity shouldBe
299299
1
300300
}
301301

302-
"A uniform3gonal2" can "have its nodes grouped in uniform sets" in {
303-
uniform3gonal2.groupUniforms shouldBe
302+
"A tiling with pattern [2x(3₆);(3₄.6)]" can "have its nodes grouped in uniform sets" in {
303+
p2x333333_33336.groupUniforms shouldBe
304304
Map(
305305
(Vector(3, 3, 3, 3, 3, 3), List(0)) -> Vector(51, 55, 50, 53, 56, 57, 54),
306306
(Vector(3, 3, 3, 3, 6), List()) -> Vector(14, 33, 13, 35, 15, 24, 37, 34, 17, 22, 27, 26, 23),
@@ -309,12 +309,12 @@ class TilingUniformitySpec extends AnyFlatSpec with Helper with should.Matchers
309309
}
310310

311311
it can "have uniformity value 3" in {
312-
uniform3gonal2.uniformity shouldBe
312+
p2x333333_33336.uniformity shouldBe
313313
3
314314
}
315315

316-
"A 5-uniform 3-Archimedean tiling" can "have its nodes grouped in uniform sets" in {
317-
uniform5gonal3.groupUniforms shouldBe
316+
"A tiling with pattern [2x(3₆);2x(3₄.6);(3.3.6.6)]" can "have its nodes grouped in uniform sets" in {
317+
p2x333333_2x33336_3366.groupUniforms shouldBe
318318
Map(
319319
(Vector(3, 3, 3, 3, 3, 3), List(0)) -> Vector(101, 106, 102, 113, 108, 104),
320320
(Vector(3, 3, 3, 3, 6), List(1)) -> Vector(37, 78, 33, 48, 23, 47, 34, 64),
@@ -325,7 +325,7 @@ class TilingUniformitySpec extends AnyFlatSpec with Helper with should.Matchers
325325
}
326326

327327
it can "have uniformity value 5 and gonality value 3" in {
328-
(uniform5gonal3.gonality, uniform5gonal3.uniformity) shouldBe
328+
(p2x333333_2x33336_3366.gonality, p2x333333_2x33336_3366.uniformity) shouldBe
329329
(3, 5)
330330
}
331331

@@ -344,7 +344,7 @@ class TilingUniformitySpec extends AnyFlatSpec with Helper with should.Matchers
344344
}
345345

346346
"A 7 uniform tiling [(3₆);2x(3₂.6₂);4x(6₃)]" can "have its nodes grouped in uniform sets" in {
347-
uniform7gonal3.groupUniforms shouldBe
347+
p333333_2x3366_4x666.groupUniforms shouldBe
348348
Map(
349349
(Vector(6, 6, 6), List(1)) -> Vector(111, 159, 33, 75, 123, 69, 138, 84, 61, 137, 97, 112, 48, 83, 76, 98, 47, 62),
350350
(Vector(3, 3, 6, 6), List(1)) -> Vector(110, 92, 153, 78, 64, 49, 81, 67, 154, 139, 82, 77, 96, 63, 95),
@@ -357,7 +357,7 @@ class TilingUniformitySpec extends AnyFlatSpec with Helper with should.Matchers
357357
}
358358

359359
it can "have them grouped by vertex" in {
360-
uniform7gonal3.groupUniformsNestedComplete shouldBe
360+
p333333_2x3366_4x666.groupUniformsNestedComplete shouldBe
361361
Map(
362362
Vector(3, 3, 6, 6) -> List(
363363
(List(0), Vector(170, 142, 52, 93, 65, 156, 169, 141, 66, 155, 108, 3, 80, 18, 51, 4, 79, 94)),
@@ -376,7 +376,7 @@ class TilingUniformitySpec extends AnyFlatSpec with Helper with should.Matchers
376376
}
377377

378378
it can "have uniformity value 7 and gonality value 3" in {
379-
(uniform7gonal3.gonality, uniform7gonal3.uniformity) shouldBe
379+
(p333333_2x3366_4x666.gonality, p333333_2x3366_4x666.uniformity) shouldBe
380380
(3, 7)
381381
}
382382

@@ -547,14 +547,14 @@ class TilingUniformitySpec extends AnyFlatSpec with Helper with should.Matchers
547547

548548
"A 3-uniform 2-Archimedean tiling [2x(3₆);(3₄.6)]" can "be described" in {
549549
val t: Tiling =
550-
uniform3gonal2
550+
p2x333333_33336
551551
(t.gonality, t.uniformity) shouldBe
552552
(2, 3)
553553
}
554554

555555
"A 4-uniform 4-Archimedean tiling [(3₆);(3₄.6);(3₂.6₂);(6₃)]" can "be described" in {
556556
val t: Tiling =
557-
uniform4gonal4
557+
p333333_33336_3366_666
558558
(t.gonality, t.uniformity) shouldBe
559559
(4, 4)
560560
}
@@ -785,7 +785,7 @@ class TilingUniformitySpec extends AnyFlatSpec with Helper with should.Matchers
785785
}
786786

787787
"Another smaller tiling [(3.4.6.4)]" can "be examined for outer polygon strips from perimeter node 22" in {
788-
triSqrHexHexoid.outerOrderedStripFromSingle(Node(22)) shouldBe
788+
p3464.outerOrderedStripFromSingle(Node(22)) shouldBe
789789
List(
790790
(List(6), false),
791791
(List(4), false),
@@ -797,7 +797,7 @@ class TilingUniformitySpec extends AnyFlatSpec with Helper with should.Matchers
797797
}
798798

799799
val matrix: Map[Node, List[(List[Int], Boolean)]] =
800-
triSqrHexHexoid.outerOrderedStripFrom(triSqrHexHexoid.graphEdges.nodes.diff(triSqrHexHexoid.perimeter.toRingNodes))
800+
p3464.outerOrderedStripFrom(p3464.graphEdges.nodes.diff(p3464.perimeter.toRingNodes))
801801

802802
it can "be examined for outer polygon strips from all nodes" in {
803803
matrix shouldBe

.jvm/src/test/scala/io/github/scala_tessella/tessella/conversion/SVGAnimationSpec.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package io.github.scala_tessella.tessella
22
package conversion
33

4-
import Outliers.sqr3x3Growth
4+
import Outliers.p4444_3by3_grown
55
import SVG.*
66

77
import org.scalatest.*
@@ -12,7 +12,7 @@ class SVGAnimationSpec extends AnyFlatSpec with Helper with should.Matchers {
1212

1313
"A tiling" can "be converted to an animation showing the nodes growth" in {
1414
prettyPrinter.format(
15-
sqr3x3Growth.toSVG(
15+
p4444_3by3_grown.toSVG(
1616
labelledNodes = LabelledNodes.NONE,
1717
showGrowth = true
1818
)

.jvm/src/test/scala/io/github/scala_tessella/tessella/conversion/SVGExtraSpec.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package conversion
33

44
import SVG.*
55
import SVGExtra.*
6-
import Outliers.hexTrianguloidOfSide4
6+
import Outliers.p666_triangle
77

88
import org.scalatest.*
99
import org.scalatest.flatspec.*
@@ -13,7 +13,7 @@ class SVGExtraSpec extends AnyFlatSpec with Helper with should.Matchers {
1313

1414
"A tiling" can "be concentric" in {
1515
prettyPrinter.format(
16-
hexTrianguloidOfSide4.toNestedPerimetersSVG()
16+
p666_triangle.toNestedPerimetersSVG()
1717
) shouldBe
1818
"""<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="-50.0 -25.0 375.0 396.410162" xmlns="http://www.w3.org/2000/svg">
1919
| <g style="stroke:purple;stroke-width:5;fill:none">

src/main/paradox/regular.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ can be created.
99
### Fast reticulate method
1010

1111
```scala
12-
Tiling.triangleNet(4, 4)
12+
Tiling.pattern_333333(4, 4)
1313
```
1414
```raw
1515
<div style="width: 420px;">
@@ -22,7 +22,7 @@ Tiling.triangleNet(4, 4)
2222
```
2323

2424
```scala
25-
Tiling.triangleTriangle(4)
25+
Tiling.pattern_333333_triangle(4)
2626
```
2727
```raw
2828
<div style="width: 420px;">
@@ -37,7 +37,7 @@ Tiling.triangleTriangle(4)
3737
### Slow growth method
3838

3939
```scala
40-
TilingGrowth.growFullVertex(FullVertex.s("(3₆)"), 60) // same as Tiling.triangularHex(3)
40+
TilingGrowth.growFullVertex(FullVertex.s("(3₆)"), 60) // same as Tiling.pattern_333333(3)
4141
```
4242
```raw
4343
<div style="width: 600px;">
@@ -54,7 +54,7 @@ TilingGrowth.growFullVertex(FullVertex.s("(3₆)"), 60) // same as Tiling.triang
5454
### Fast reticulate method
5555

5656
```scala
57-
Tiling.squareNet(4, 4)
57+
Tiling.pattern_4444(4, 4)
5858
```
5959
```raw
6060
<div style="width: 440px;">
@@ -69,7 +69,7 @@ Tiling.squareNet(4, 4)
6969
### Slow growth method
7070

7171
```scala
72-
TilingGrowth.growFullVertex(FullVertex.s("(4₄)"), 9) // same as Tiling.squareNet(3)
72+
TilingGrowth.growFullVertex(FullVertex.s("(4₄)"), 9) // same as Tiling.pattern_4444(3)
7373
```
7474
```raw
7575
<div style="width: 360px;">
@@ -86,7 +86,7 @@ TilingGrowth.growFullVertex(FullVertex.s("(4₄)"), 9) // same as Tiling.squareN
8686
### Fast reticulate methods
8787

8888
```scala
89-
Tiling.hexagonNet(4, 4)
89+
Tiling.pattern_666(4, 4)
9090
```
9191
```raw
9292
<div style="width: 640px;">
@@ -99,7 +99,7 @@ Tiling.hexagonNet(4, 4)
9999
```
100100

101101
```scala
102-
Tiling.hexTrianguloid(4)
102+
Tiling.pattern_666_trianguloid(4)
103103
```
104104
```raw
105105
<div style="width: 640px;">
@@ -114,7 +114,7 @@ Tiling.hexTrianguloid(4)
114114
### Slow growth method
115115

116116
```scala
117-
TilingGrowth.growFullVertex(FullVertex.s("(6₃)"), 19) // same as Tiling.hexagonalHexoid(3)
117+
TilingGrowth.growFullVertex(FullVertex.s("(6₃)"), 19) // same as Tiling.pattern_666(3)
118118
```
119119
```raw
120120
<div style="width: 800px;">

0 commit comments

Comments
 (0)