Added point conversion methods (from integer to float).

This commit is contained in:
Sander Schobers 2019-12-23 13:53:10 +01:00
parent 65e3a80e84
commit 4df2655b53

View File

@ -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) {