|
1 | 1 | package org.openrndr.extra.composition |
2 | 2 |
|
3 | | -import org.openrndr.math.Vector2 |
4 | | -import org.openrndr.shape.Circle |
5 | | -import org.openrndr.shape.LineSegment |
6 | | -import org.openrndr.shape.Rectangle |
7 | 3 | import org.openrndr.shape.Shape |
8 | 4 | import kotlin.test.Test |
9 | 5 | import kotlin.test.assertEquals |
10 | 6 | import kotlin.test.assertNull |
11 | | -import kotlin.test.assertTrue |
12 | 7 |
|
13 | 8 | class TestComposition { |
14 | 9 | val composition = let { _ -> |
@@ -43,46 +38,3 @@ class TestComposition { |
43 | 38 | assertNull(composition.findImage("shape")) |
44 | 39 | } |
45 | 40 | } |
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