ShivaVG: check for zero before dividing.

This commit is contained in:
Thomas Geymayer 2014-06-21 12:26:58 +02:00
parent f2f1b36df9
commit fc9f3abfbb

View File

@ -124,11 +124,13 @@ int shLineLineXsection(SHVector2 *o1, SHVector2 *v1,
SHfloat DX = rightU * (-v2->y) - rightD * (-v2->x); SHfloat DX = rightU * (-v2->y) - rightD * (-v2->x);
/*SHfloat DY = v1.x * rightD - v1.y * rightU;*/ /*SHfloat DY = v1.x * rightD - v1.y * rightU;*/
SHfloat t1 = DX / D; SHfloat t1;
if (D == 0.0f) if (D == 0.0f)
return 0; return 0;
t1 = DX / D;
xsection->x = o1->x + t1*v1->x; xsection->x = o1->x + t1*v1->x;
xsection->y = o1->y + t1*v1->y; xsection->y = o1->y + t1*v1->y;
return 1; return 1;