David Thielemann 991f3184cc Updated tests for the int rather than int64 update | 1 tahun lalu | |
---|---|---|
LICENSE | 1 tahun lalu | |
README.md | 1 tahun lalu | |
go.mod | 1 tahun lalu | |
point.go | 1 tahun lalu | |
point_test.go | 1 tahun lalu |
A 2 dimensional Point.
Get it go get git.red-green.com/david/point2d
package main
import (
"fmt"
"git.red-green.com/david/point2d"
)
func main() {
var p *point2d.Point = new(point2d.Point)
fmt.Println(p) // Automatically calls p.String()
p.Set(3, 2) // Set's the Point's position to (3, 2)
if p.Equal(3, 2) {
fmt.Println("p is equal (3, 2)")
} else {
fmt.Println("p is not equal (3, 2), p is", p.String())
}
var p2 *point2d.Point = point2d.AsPoint(3, 9)
var dist int = p.DistanceTo(&p2)
fmt.Printf("p is %d away from p2\n", dist)
}