Fix error handling in get_normalized_scale_factor()

This commit is contained in:
hasufell 2014-05-10 22:58:51 +02:00
parent 1fa87f9fbf
commit 4c8bb37e56
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020
1 changed files with 11 additions and 6 deletions

View File

@ -85,17 +85,22 @@ HE_vert *find_center(HE_obj const * const obj)
* to the size of 1.
*
* @param obj the object we want to scale
* @return the corresponding scale factor
* @return the corresponding scale factor, -1 on error
*/
float get_normalized_scale_factor(HE_obj const * const obj)
{
float max = obj->vertices[0].x +
obj->vertices[0].y + obj->vertices[0].z;
float min = obj->vertices[0].x +
obj->vertices[0].y + obj->vertices[0].z;
float max;
float min;
uint32_t i;
if (!obj)
return -1;
max = obj->vertices[0].x +
obj->vertices[0].y + obj->vertices[0].z;
min = obj->vertices[0].x +
obj->vertices[0].y + obj->vertices[0].z;
for (i = 0; i < obj->vc; i++) {
if ((obj->vertices[i].x +
obj->vertices[i].y +