Skip to content

Commit b1b66c4

Browse files
committed
Merge branch 'master' into colorBrewerPalette
2 parents b1bd506 + e6c0092 commit b1b66c4

1 file changed

Lines changed: 0 additions & 48 deletions

File tree

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
package org.openrndr.extra.composition
22

3-
import org.openrndr.math.Vector2
4-
import org.openrndr.shape.Circle
5-
import org.openrndr.shape.LineSegment
6-
import org.openrndr.shape.Rectangle
73
import org.openrndr.shape.Shape
84
import kotlin.test.Test
95
import kotlin.test.assertEquals
106
import kotlin.test.assertNull
11-
import kotlin.test.assertTrue
127

138
class TestComposition {
149
val composition = let { _ ->
@@ -43,46 +38,3 @@ class TestComposition {
4338
assertNull(composition.findImage("shape"))
4439
}
4540
}
46-
47-
class TestCompositionIntersections {
48-
val bounds = Rectangle(Vector2.ZERO, 640.0, 480.0)
49-
val outline = Shape(
50-
listOf(
51-
Circle(bounds.center, 70.0).contour.reversed,
52-
Circle(bounds.center, 100.0).contour,
53-
)
54-
)
55-
56-
val radius = outline.bounds.dimensions.length / 2
57-
val off = outline.bounds.center
58-
val num = radius.toInt()
59-
60-
@Test
61-
fun `use a shape as a mask for line segments`() {
62-
// Make sure intersections do not fail randomly, which was fixed in
63-
// https://github.com/openrndr/orx/commit/e8f50b3dd153ed82de121e9017cf42f6ea95ac8e
64-
val svg = List(50) {
65-
println("intersection test $it")
66-
drawComposition {
67-
lineSegments(List(num) { segNum ->
68-
val yNorm = (segNum / (num - 1.0))
69-
val x = ((segNum % 2) * 2.0 - 1.0) * radius
70-
val y = (yNorm * 2.0 - 1.0) * radius
71-
val start = Vector2(-x, y) + off
72-
val end = Vector2(x, y) + off
73-
LineSegment(start, end)
74-
})
75-
clipMode = ClipMode.INTERSECT
76-
shape(outline)
77-
}
78-
}
79-
80-
val shapes = svg.last().findShapes()
81-
val dimensions = svg.last().bounds.dimensions
82-
83-
assertTrue(shapes.isNotEmpty(), "shapes should not be empty")
84-
assertTrue(shapes.first().shape.contours.isNotEmpty(), "contour should not be empty")
85-
assertTrue(dimensions.x > 0.0, "dimensions.x should be greater than 0.0")
86-
assertTrue(dimensions.y > 0.0, "dimensions.y should be greater than 0.0")
87-
}
88-
}

0 commit comments

Comments
 (0)