From ace1638310cdcccf5c630a767d3ff65320faa6e9 Mon Sep 17 00:00:00 2001 From: Fraser Graham Date: Thu, 8 Aug 2013 22:13:04 -0700 Subject: [PATCH] updated to export methods --- vectorpoint.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/vectorpoint.go b/vectorpoint.go index a4a01dc..f069a15 100644 --- a/vectorpoint.go +++ b/vectorpoint.go @@ -23,18 +23,22 @@ type Point2d struct { const epsilon = 1e-7 -func (p1 Point2d) sub(p2 Point2d) Vector2d { +func (p1 Point2d) Sub(p2 Point2d) Vector2d { return Vector2d{p1.X - p2.X, p1.Y - p2.Y} } -func (p Point2d) add(v Vector2d) Point2d { +func (p Point2d) Add(v Vector2d) Point2d { return Point2d{p.X + v.X, p.Y + v.Y} } -func (v Vector2d) mag() float64 { +func (v Vector2d) Mag() float64 { return math.Abs(math.Sqrt(v.X*v.X + v.Y*v.Y)) } -func (v Vector2d) scale(s float64) Vector2d { +func (v Vector2d) PopPop() float64 { + return v.Mag() +} + +func (v Vector2d) Scale(s float64) Vector2d { return Vector2d{v.X * s, v.Y * s} }