Skip to content

Instantly share code, notes, and snippets.

@thisMagpie
Created January 7, 2013 15:36
Show Gist options
  • Select an option

  • Save thisMagpie/4475883 to your computer and use it in GitHub Desktop.

Select an option

Save thisMagpie/4475883 to your computer and use it in GitHub Desktop.
Belongs in Vector3D
//sets the x y and z coordinate in a more compact way (saves a bit of space when calling the coordinates)
public void setDim(int i, double dimension) {
switch (i) {
case 0:
x = dimension;
break;
case 1:
y = dimension;
break;
case 2:
z = dimension;
break;
}
}
/* *********************** */
/* ******* Getters ******* */
/* *********************** */
//returns the x, y and z coordinates respectively
public double getDim(int i) {
double dimension = 0.0;
switch (i) {
case 0:
dimension = x;
break;
case 1:
dimension = y;
break;
case 2:
dimension = z;
break;
}
return dimension;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment