Added Add2D methods for PointF{,32}.
- Add2D adds x, y values instead of a point (Add).
This commit is contained in:
parent
3eeedf121e
commit
f2705fcdf8
@ -22,6 +22,11 @@ func (p PointF) Add(q PointF) PointF {
|
||||
return PointF{p.X + q.X, p.Y + q.Y}
|
||||
}
|
||||
|
||||
// Add2D adds x and y to X and Y of point p and returns the sum.
|
||||
func (p PointF) Add2D(x, y float64) PointF {
|
||||
return PtF(p.X+x, p.Y+y)
|
||||
}
|
||||
|
||||
// AngleTo calculates the angle [0..2*Pi) from point p to point q.
|
||||
func (p PointF) AngleTo(q PointF) float64 {
|
||||
a := math.Atan((p.Y - q.Y) / (p.X - q.X))
|
||||
|
@ -22,6 +22,11 @@ func (p PointF32) Add(q PointF32) PointF32 {
|
||||
return PointF32{p.X + q.X, p.Y + q.Y}
|
||||
}
|
||||
|
||||
// Add2D adds x and y to X and Y of point p and returns the sum.
|
||||
func (p PointF32) Add2D(x, y float32) PointF32 {
|
||||
return PtF32(p.X+x, p.Y+y)
|
||||
}
|
||||
|
||||
// AngleTo calculates the angle [0..2*Pi) from point p to point q.
|
||||
func (p PointF32) AngleTo(q PointF32) float32 {
|
||||
a := float32(math.Atan(float64((p.Y - q.Y) / (p.X - q.X))))
|
||||
|
Loading…
Reference in New Issue
Block a user