Incomplete work for porting translate()

This commit is contained in:
Alessandro Ranellucci 2013-08-05 10:48:38 +02:00
parent 515d5707c9
commit 04d5d1bb9b
7 changed files with 36 additions and 10 deletions

View file

@ -87,17 +87,19 @@ stl_translate(stl_file *stl, float x, float y, float z)
{
for(j = 0; j < 3; j++)
{
stl->facet_start[i].vertex[j].x -= (stl->stats.min.x - x);
stl->facet_start[i].vertex[j].y -= (stl->stats.min.y - y);
stl->facet_start[i].vertex[j].z -= (stl->stats.min.z - z);
stl->facet_start[i].vertex[j].x += x;
stl->facet_start[i].vertex[j].y += y;
stl->facet_start[i].vertex[j].z += z;
}
}
stl->stats.max.x -= (stl->stats.min.x - x);
stl->stats.max.y -= (stl->stats.min.y - y);
stl->stats.max.z -= (stl->stats.min.z - z);
stl->stats.min.x = x;
stl->stats.min.y = y;
stl->stats.min.z = z;
stl->stats.min.x += x;
stl->stats.min.y += y;
stl->stats.min.z += z;
stl->stats.max.x += x;
stl->stats.max.y += y;
stl->stats.max.z += z;
stl_invalidate_shared_vertices(stl);
}
void
@ -128,6 +130,8 @@ stl_scale(stl_file *stl, float factor)
stl->facet_start[i].vertex[j].z *= factor;
}
}
stl_invalidate_shared_vertices(stl);
}
static void calculate_normals(stl_file *stl)