Normal returns the left hand normal of the line segment l
()
| 369 | |
| 370 | // Normal returns the left hand normal of the line segment l |
| 371 | func (l *Line) Normal() Point { |
| 372 | dx := l.P2.X - l.P1.X |
| 373 | dy := l.P2.Y - l.P1.Y |
| 374 | inverse := Point{dy, -dx} |
| 375 | unit, _ := inverse.Normalize() |
| 376 | |
| 377 | return unit |
| 378 | } |
| 379 | |
| 380 | // IdentityMatrix returns a new identity matrix. |
| 381 | func IdentityMatrix() *Matrix { |