2024-07-18 05:59:06 +00:00
|
|
|
package land
|
2024-07-18 04:23:16 +00:00
|
|
|
|
2024-07-18 09:46:36 +00:00
|
|
|
import "fmt"
|
|
|
|
|
2024-07-18 04:23:16 +00:00
|
|
|
type Vector2D struct {
|
|
|
|
X, Y float64
|
|
|
|
}
|
2024-07-18 09:21:25 +00:00
|
|
|
|
2024-07-18 09:46:36 +00:00
|
|
|
func (p Vector2D) String() string {
|
|
|
|
return fmt.Sprintf("(%.2f, %.2f)", p.X, p.Y)
|
|
|
|
}
|
|
|
|
|
2024-07-18 09:21:25 +00:00
|
|
|
func (p Vector2D) IsZero() bool {
|
|
|
|
return p.X == 0 && p.Y == 0
|
|
|
|
}
|