Ver a proveniência
Fix inverse length in Vector2Normalize (#2189)
Following the pattern in Vector3Normalize.
pull/2194/head
HarriP
há 3 anos
committed by
GitHub
ascendente
cometimento
3cb4ef2599
Não foi encontrada uma chave conhecida para esta assinatura, na base de dados
ID da chave GPG: 4AEE18F83AFDEB23
1 ficheiros alterados com
3 adições e
2 eliminações
-
src/raymath.h
|
|
@ -328,8 +328,9 @@ RMAPI Vector2 Vector2Normalize(Vector2 v) |
|
|
|
|
|
|
|
if (length > 0) |
|
|
|
{ |
|
|
|
result.x = v.x*1.0f/length; |
|
|
|
result.y = v.y*1.0f/length; |
|
|
|
float ilength = 1.0f / length; |
|
|
|
result.x = v.x * ilength; |
|
|
|
result.y = v.y * ilength; |
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|