Slope calculates the slope (gradient) of a line.
(l *Line)
| 30 | |
| 31 | // Slope calculates the slope (gradient) of a line. |
| 32 | func Slope(l *Line) float64 { |
| 33 | return (l.P2.Y - l.P1.Y) / (l.P2.X - l.P1.X) |
| 34 | } |
| 35 | |
| 36 | // YIntercept calculates the Y-Intercept of a line from a specific Point. |
| 37 | func YIntercept(p *Point, slope float64) float64 { |
no outgoing calls