Added point conversion methods (from integer to float).
This commit is contained in:
parent
65e3a80e84
commit
4df2655b53
6
point.go
6
point.go
@ -97,6 +97,12 @@ func (p Point) Sub(p2 Point) Point {
|
|||||||
return Pt(p.X-p2.X, p.Y-p2.Y)
|
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.
|
// MinMaxPoints returns the extremes of all the given points.
|
||||||
func MinMaxPoints(p ...Point) (min Point, max Point) {
|
func MinMaxPoints(p ...Point) (min Point, max Point) {
|
||||||
if 0 == len(p) {
|
if 0 == len(p) {
|
||||||
|
Loading…
Reference in New Issue
Block a user