add pixel.Unit
This commit is contained in:
parent
6215259c1d
commit
6e27fc84e7
|
@ -49,6 +49,11 @@ func V(x, y float64) Vec {
|
|||
return Vec{x, y}
|
||||
}
|
||||
|
||||
// Unit returns a vector of length 1 facing the given angle.
|
||||
func Unit(angle float64) Vec {
|
||||
return Vec{1, 0}.Rotated(angle)
|
||||
}
|
||||
|
||||
// String returns the string representation of the vector u.
|
||||
//
|
||||
// u := pixel.V(4.5, -1.3)
|
||||
|
|
Loading…
Reference in New Issue