Merge pull request #178 from JupiterRider/master
Update Vector2Angle in raymath.go (again)
This commit is contained in:
commit
99078f2467
1 changed files with 3 additions and 8 deletions
|
@ -39,15 +39,10 @@ func Vector2Distance(v1, v2 Vector2) float32 {
|
|||
return float32(math.Sqrt(float64((v1.X-v2.X)*(v1.X-v2.X) + (v1.Y-v2.Y)*(v1.Y-v2.Y))))
|
||||
}
|
||||
|
||||
// Vector2Angle - Calculate angle between two vectors in X-axis
|
||||
// Vector2Angle - Calculate angle from two vectors in radians
|
||||
func Vector2Angle(v1, v2 Vector2) float32 {
|
||||
angle := math.Atan2(float64(Vector2CrossProduct(v2, v1)), float64(Vector2DotProduct(v2, v1))) * 180 / Pi
|
||||
|
||||
if angle < 0 {
|
||||
angle += 360.0
|
||||
}
|
||||
|
||||
return float32(angle)
|
||||
result := math.Atan2(float64(v2.Y), float64(v2.X)) - math.Atan2(float64(v1.Y), float64(v1.X))
|
||||
return float32(result)
|
||||
}
|
||||
|
||||
// Vector2Scale - Scale vector (multiply by value)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue