/** Expand the interval so that it contains the given point "p". */ public function addPoint($p) { if (isEmpty()) { return R1Interval::fromPoint($p); } else { if ($p < $this->lo()) { return new R1Interval($p, $this->hi()); } else { if ($p > $this->hi()) { return new R1Interval($this->lo(), $p); } else { return new R1Interval($this->lo(), $this->hi()); } } } }