Added XY method for Point{,F,F32} that returns the coordinates.
This commit is contained in:
parent
885f27689f
commit
d1d4aec900
3
point.go
3
point.go
@ -136,6 +136,9 @@ 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)) }
|
||||
|
||||
// XY returns the X and Y component of the coordinate.
|
||||
func (p Point) XY() (int, int) { return p.X, p.Y }
|
||||
|
||||
// MaxPt returns the point that is at the largest X & Y position of a and b.
|
||||
func MaxPt(a, b Point) Point {
|
||||
return Pt(ints.Max(a.X, b.X), ints.Max(a.Y, b.Y))
|
||||
|
@ -172,6 +172,9 @@ func (p PointF) ToInt() Point {
|
||||
return Point{int(p.X), int(p.Y)}
|
||||
}
|
||||
|
||||
// XY returns the X and Y component of the coordinate.
|
||||
func (p PointF) XY() (float64, float64) { return p.X, p.Y }
|
||||
|
||||
// MaxPtF returns the point that is at the largest X & Y position of a and b.
|
||||
func MaxPtF(a, b PointF) PointF {
|
||||
return PtF(Max(a.X, b.X), Max(a.Y, b.Y))
|
||||
|
@ -172,6 +172,9 @@ func (p PointF32) ToInt() Point {
|
||||
return Point{int(p.X), int(p.Y)}
|
||||
}
|
||||
|
||||
// XY returns the X and Y component of the coordinate.
|
||||
func (p PointF32) XY() (float32, float32) { return p.X, p.Y }
|
||||
|
||||
// MaxPtF32 returns the point that is at the largest X & Y position of a and b.
|
||||
func MaxPtF32(a, b PointF32) PointF32 {
|
||||
return PtF32(Max32(a.X, b.X), Max32(a.Y, b.Y))
|
||||
|
Loading…
Reference in New Issue
Block a user