function result = isHittingObstacle(position, L1, L2) result = position(2) >= L1 || position(2) <= -L1 || ... (-L2 <= position(1) && position(1) <= L2 && -L2 <= position(2) && position(2) <= L2); end