code: 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;
  	}
docs: Checks if two chains intersect.
  @param rpeh second chain
  @param ignoreEndPoints flag to ignore intersections at the endpoints of the chains
  @return true if they intersect