| Conditions | 2 |
| Paths | 2 |
| Total Lines | 11 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 34 | public static function fromTwoPoints(Point $a, Point $b) |
||
| 35 | { |
||
| 36 | if ($a->getX() === $b->getX()) { |
||
| 37 | throw new \RuntimeException('Line can be defined only by two points with different X'); |
||
| 38 | } |
||
| 39 | |||
| 40 | $k = ($a->getY() - $b->getY()) / ($a->getX() - $b->getX()); |
||
| 41 | $n = $a->getY() - $k * $a->getX(); |
||
| 42 | |||
| 43 | return new LinearFunction($k, $n); |
||
| 44 | } |
||
| 45 | |||
| 56 |