File tree 2 files changed +31
-1
lines changed
2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -189,6 +189,19 @@ public bool Contains(Polygon2d poly) {
189
189
}
190
190
191
191
192
+ public bool Contains ( Segment2d seg )
193
+ {
194
+ if ( outer . Contains ( seg ) == false )
195
+ return false ;
196
+ foreach ( var h in holes )
197
+ {
198
+ if ( h . Intersects ( seg ) )
199
+ return false ;
200
+ }
201
+ return true ;
202
+ }
203
+
204
+
192
205
public bool Intersects ( Polygon2d poly )
193
206
{
194
207
if ( outer . Intersects ( poly ) )
Original file line number Diff line number Diff line change @@ -335,6 +335,7 @@ public bool Contains(Polygon2d o) {
335
335
336
336
public bool Contains ( Segment2d o )
337
337
{
338
+ // [TODO] Add bbox check
338
339
if ( Contains ( o . P0 ) == false || Contains ( o . P1 ) == false )
339
340
return false ;
340
341
@@ -359,8 +360,24 @@ public bool Intersects(Polygon2d o) {
359
360
return false ;
360
361
}
361
362
363
+ public bool Intersects ( Segment2d o )
364
+ {
365
+ // [TODO] Add bbox check
366
+ if ( Contains ( o . P0 ) == true || Contains ( o . P1 ) == true )
367
+ return true ;
368
+
369
+ // [TODO] Add bbox check
370
+ foreach ( Segment2d seg in SegmentItr ( ) )
371
+ {
372
+ if ( seg . Intersects ( o ) )
373
+ return true ;
374
+ }
375
+ return false ;
376
+ }
377
+
378
+
362
379
363
- public List < Vector2d > FindIntersections ( Polygon2d o ) {
380
+ public List < Vector2d > FindIntersections ( Polygon2d o ) {
364
381
List < Vector2d > v = new List < Vector2d > ( ) ;
365
382
if ( ! this . GetBounds ( ) . Intersects ( o . GetBounds ( ) ) )
366
383
return v ;
You can’t perform that action at this time.
0 commit comments