public boolean intersects ( PhysicalEntityChain rpeh , boolean ignoreEndPoints ) { for ( PhysicalEntity pe1 : pes ) { for ( PhysicalEntity pe2 : rpeh . pes ) { if ( pe1 == pe2 ) { if ( ignoreEndPoints ) { if ( ( pes [ 0 ] == pe1 || pes [ pes . length - 1 ] == pe1 ) && ( rpeh . pes [ 0 ] == pe2 || rpeh . pes [ rpeh . pes . length - 1 ] == pe2 ) ) { continue ; } } return true ; } } } return false ; }
Checks if two chains intersect .