improve doc on vec

This commit is contained in:
faiface 2016-11-19 14:34:37 +01:00
parent 3763c9aa0f
commit 86f0b0f8ca
1 changed files with 5 additions and 1 deletions

6
vec.go
View File

@ -37,7 +37,11 @@ func V(x, y float64) Vec {
return Vec(complex(x, y))
}
// String returns the string representation of a vector u as "Vec(x, y)".
// String returns the string representation of a vector u.
//
// u := pixel.V(4.5, -1.3)
// u.String() // returns "Vec(4.5, -1.3)"
// fmt.Println(u) // Vec(4.5, -1.3)
func (u Vec) String() string {
return fmt.Sprintf("Vec(%v, %v)", u.X(), u.Y())
}