added geom and flag in main for deebug cli calls
This commit is contained in:
@@ -1,3 +1,20 @@
|
||||
package geom
|
||||
|
||||
//init
|
||||
import "math"
|
||||
|
||||
const EPS = 1e-6
|
||||
|
||||
type Vec struct {
|
||||
X, Y float64
|
||||
}
|
||||
|
||||
type Seg struct {
|
||||
A, B Vec
|
||||
}
|
||||
|
||||
func V(x, y float64) Vec { return Vec{x, y} }
|
||||
func Sub(a, b Vec) Vec { return Vec{a.X - b.X, a.Y - b.Y} }
|
||||
func Dot(a, b Vec) float64 { return a.X*b.X + a.Y*b.Y }
|
||||
func Cross(a, b Vec) float64 { return a.X*b.Y - a.Y*b.X }
|
||||
func Len(a Vec) float64 { return math.Hypot(a.X, a.Y) }
|
||||
func NearlyZero(x float64) bool { return math.Abs(x) < EPS }
|
||||
|
||||
Reference in New Issue
Block a user