CodingLand/pkg/internal/land/vector2d.go
2024-07-18 22:59:03 +08:00

18 lines
223 B
Go

package land
import (
"fmt"
)
type Vector2D struct {
X, Y float64
}
func (p Vector2D) String() string {
return fmt.Sprintf("(%.2f, %.2f)", p.X, p.Y)
}
func (p Vector2D) IsZero() bool {
return p.X == 0 && p.Y == 0
}