fix atan2f input conditional
Suspicious conditional found by PVS-Studio T48917 Original code (from Blender’s initial open-source commit!) looks like it’s testing inputs to atan2f, to avoid undefined function values. Passing xn=0 does *not* always evaluate to 0 though… I’m not sure if this is a coding error or was done for a desired visual result. Also changed xn==0 to xn>=0 to avoid function call in more cases. Good description and visualization of atan2f function: http://en.cppreference.com/w/c/numeric/math/atan2
This commit is contained in:
parent
164575af29
commit
bd11d917c1
Notes:
blender-bot
2023-02-14 07:44:22 +01:00
Referenced by issue #48988, BBones Ease in/out don´t update the mesh deformation at current frame Referenced by issue #48935, Dinamic Paint Bug. Close blender
|
@ -1006,7 +1006,7 @@ HaloRen *RE_inithalo(Render *re, ObjectRen *obr, Material *ma,
|
|||
|
||||
xn= har->xs - 0.5f*re->winx*(hoco1[0]/hoco1[3]);
|
||||
yn= har->ys - 0.5f*re->winy*(hoco1[1]/hoco1[3]);
|
||||
if (xn==0.0f || (xn==0.0f && yn==0.0f)) zn= 0.0f;
|
||||
if (yn == 0.0f && xn >= 0.0f) zn = 0.0f;
|
||||
else zn = atan2f(yn, xn);
|
||||
|
||||
har->sin = sinf(zn);
|
||||
|
@ -1136,7 +1136,7 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater
|
|||
|
||||
xn= har->xs - 0.5f*re->winx*(hoco1[0]/hoco1[3]);
|
||||
yn= har->ys - 0.5f*re->winy*(hoco1[1]/hoco1[3]);
|
||||
if (xn==0.0f || (xn==0.0f && yn==0.0f)) zn= 0.0;
|
||||
if (yn == 0.0f && xn >= 0.0f) zn = 0.0f;
|
||||
else zn = atan2f(yn, xn);
|
||||
|
||||
har->sin = sinf(zn);
|
||||
|
|
Loading…
Reference in New Issue