/**
* Center the object and make it (-1,-1,-1) to (1,1,1).
*/
private void resize() {
int i, j;
Vertex cur_vtx = new Vertex();
float biggest_dif;
Vertex[] limit = getLimits();
// Move object so it's centered on (0,0,0)
Vector3D offset = new Vector3D(-0.5f * (limit[0].x + limit[1].x),
-0.5f * (limit[0].y + limit[1].y),
-0.5f * (limit[0].z + limit[1].z));
if ((DEBUG & 64) != 0) {
System.out.println("Offset amount: (" +
offset.x + "," + offset.y + "," + offset.z + ")");
}
// Find the divide-by value for the normalization
biggest_dif = limit[1].x - limit[0].x;
if (biggest_dif < limit[1].y - limit[0].y)
biggest_dif = limit[1].y - limit[0].y;
if (biggest_dif < limit[1].z - limit[0].z)
biggest_dif = limit[1].z - limit[0].z;
biggest_dif /= 2.0f;
for (i = 0 ; i < coordList.size() ; i++) {
cur_vtx = (Vertex)coordList.get(i);
// cur_vtx.add(cur_vtx, offset);
Vector3D tmp = cur_vtx.getAdded(offset);
cur_vtx = new Vertex(tmp.x,tmp.y,tmp.z);
// Vector3D tmp = new Vector3D(offset);
// cur_vtx.addLocal(tmp);
// cur_vtx.addLocal(cur_vtx);