@@ -82,19 +82,18 @@ defmodule Scenic.Primitive.QuadTest do
82
82
assert Quad . contains_point? ( @ convex , { 100 , 520 } ) == false
83
83
end
84
84
85
-
86
85
# ============================================================================
87
86
# expand
88
87
89
88
# only works if it is square...
90
- defp quad_square_area ( { { x0 , y0 } , { x1 , y1 } , { x2 , y2 } , { x3 , y3 } } ) do
89
+ defp quad_square_area ( { { x0 , y0 } , { x1 , _ } , { _ , y2 } , _ } ) do
91
90
w = abs ( x1 - x0 ) * 1.0
92
91
h = abs ( y2 - y0 ) * 1.0
93
92
w * h
94
93
end
95
94
96
95
test "expand clockwise works" do
97
- quad = { { 10 , 10 } , { 20 , 10 } , { 20 , 20 } , { 10 , 20 } }
96
+ quad = { { 10 , 10 } , { 20 , 10 } , { 20 , 20 } , { 10 , 20 } }
98
97
expanded = Quad . expand ( quad , 2 )
99
98
shrunk = Quad . expand ( quad , - 2 )
100
99
@@ -103,13 +102,11 @@ defmodule Scenic.Primitive.QuadTest do
103
102
end
104
103
105
104
test "expand counter-clockwise works" do
106
- quad = { { 10 , 20 } , { 20 , 20 } , { 20 , 10 } , { 10 , 10 } }
105
+ quad = { { 10 , 20 } , { 20 , 20 } , { 20 , 10 } , { 10 , 10 } }
107
106
expanded = Quad . expand ( quad , 2 )
108
107
shrunk = Quad . expand ( quad , - 2 )
109
108
110
109
assert quad_square_area ( expanded ) > quad_square_area ( quad )
111
110
assert quad_square_area ( shrunk ) < quad_square_area ( quad )
112
111
end
113
-
114
-
115
112
end
0 commit comments