From 4df2655b53c7458f01d72c185bb2a46883fab9d8 Mon Sep 17 00:00:00 2001 From: Sander Schobers Date: Mon, 23 Dec 2019 13:53:10 +0100 Subject: [PATCH] Added point conversion methods (from integer to float). --- point.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/point.go b/point.go index 587f7f8..2e3d092 100644 --- a/point.go +++ b/point.go @@ -97,6 +97,12 @@ func (p Point) Sub(p2 Point) Point { return Pt(p.X-p2.X, p.Y-p2.Y) } +// ToF returns the floating point representation of p. +func (p Point) ToF() PointF { return PtF(float64(p.X), float64(p.Y)) } + +// ToF32 returns the floating point representation of p. +func (p Point) ToF32() PointF32 { return PtF32(float32(p.X), float32(p.Y)) } + // MinMaxPoints returns the extremes of all the given points. func MinMaxPoints(p ...Point) (min Point, max Point) { if 0 == len(p) {