11package com .thealgorithms .geometry ;
22
33import static org .junit .jupiter .api .Assertions .assertEquals ;
4- import static org .junit .jupiter .api .Assertions .assertTrue ;
5- import static org .junit .jupiter .api .Assertions .assertThrows ;
64import static org .junit .jupiter .api .Assertions .assertFalse ;
75import static org .junit .jupiter .api .Assertions .assertNotNull ;
6+ import static org .junit .jupiter .api .Assertions .assertThrows ;
7+ import static org .junit .jupiter .api .Assertions .assertTrue ;
88
99import java .awt .geom .Point2D ;
1010import java .util .ArrayList ;
@@ -172,8 +172,8 @@ void testGridPattern() {
172172 void testTriangleIntersections () {
173173 // Three segments forming a triangle
174174 List <Object > segments = List .of (newSegment (0 , 0 , 4 , 0 ), // base
175- newSegment (0 , 0 , 2 , 3 ), // left side
176- newSegment (4 , 0 , 2 , 3 ) // right side
175+ newSegment (0 , 0 , 2 , 3 ), // left side
176+ newSegment (4 , 0 , 2 , 3 ) // right side
177177 );
178178
179179 Set <Point2D .Double > intersections = BentleyOttmann .findIntersections (cast (segments ));
@@ -194,8 +194,6 @@ void testCrossingDiagonals() {
194194 assertEquals (1 , intersections .size ());
195195 }
196196
197-
198-
199197 @ Test
200198 void testVerySmallSegments () {
201199 List <Object > segments = List .of (newSegment (0.001 , 0.001 , 0.002 , 0.002 ), newSegment (0.001 , 0.002 , 0.002 , 0.001 ));
@@ -221,9 +219,9 @@ void testSegmentsShareCommonPoint() {
221219 void testSegmentsAtAngles () {
222220 // Segments at 45, 90, 135 degrees
223221 List <Object > segments = List .of (newSegment (0 , 2 , 4 , 2 ), // horizontal
224- newSegment (2 , 0 , 2 , 4 ), // vertical
225- newSegment (0 , 0 , 4 , 4 ), // 45 degrees
226- newSegment (0 , 4 , 4 , 0 ) // 135 degrees
222+ newSegment (2 , 0 , 2 , 4 ), // vertical
223+ newSegment (0 , 0 , 4 , 4 ), // 45 degrees
224+ newSegment (0 , 4 , 4 , 0 ) // 135 degrees
227225 );
228226
229227 Set <Point2D .Double > intersections = BentleyOttmann .findIntersections (cast (segments ));
@@ -262,8 +260,8 @@ void testPerformanceWithManySegments() {
262260 void testIssueExample () {
263261 // Example from the GitHub issue
264262 List <Object > segments = List .of (newSegment (1 , 1 , 5 , 5 ), // Segment A
265- newSegment (1 , 5 , 5 , 1 ), // Segment B
266- newSegment (3 , 0 , 3 , 6 ) // Segment C
263+ newSegment (1 , 5 , 5 , 1 ), // Segment B
264+ newSegment (3 , 0 , 3 , 6 ) // Segment C
267265 );
268266
269267 Set <Point2D .Double > intersections = BentleyOttmann .findIntersections (cast (segments ));
@@ -276,11 +274,10 @@ void testIssueExample() {
276274 @ Test
277275 void testEventTypeOrdering () {
278276 // Multiple events at the same point with different types
279- List <Object > segments = List .of (
280- newSegment (2 , 2 , 6 , 2 ), // ends at (2,2)
281- newSegment (0 , 2 , 2 , 2 ), // ends at (2,2)
282- newSegment (2 , 2 , 2 , 6 ), // starts at (2,2)
283- newSegment (2 , 0 , 2 , 2 ) // ends at (2,2)
277+ List <Object > segments = List .of (newSegment (2 , 2 , 6 , 2 ), // ends at (2,2)
278+ newSegment (0 , 2 , 2 , 2 ), // ends at (2,2)
279+ newSegment (2 , 2 , 2 , 6 ), // starts at (2,2)
280+ newSegment (2 , 0 , 2 , 2 ) // ends at (2,2)
284281 );
285282
286283 Set <Point2D .Double > intersections = BentleyOttmann .findIntersections (cast (segments ));
0 commit comments