# Vector3 structure : Vector « Game « Android

Vector3 structure

```
public class Vector3 {

public float x,y,z;
public Vector3() {
x = y = z = 0;
}
public Vector3(float x, float y, float z) {
super();
this.x = x;
this.y = y;
this.z = z;
}
public Vector3(double d, double e, double f) {
this.x = (float) d;
this.y = (float) e;
this.z = (float) f;
}
public float getX() {
return x;
}
public void setX(float x) {
this.x = x;
}
public float getY() {
return y;
}
public void setY(float y) {
this.y = y;
}
public float getZ() {
return z;
}
public void setZ(float z) {
this.z = z;
}

return new Vector3(x+b.x, y+b.y, z+b.z);
}
public Vector3 sub(Vector3 b){
return new Vector3(x+b.x, y+b.y, z+b.z);
}
public Vector3 mul(float b){
return new Vector3(x+b, y+b, z+b);
}
public Vector3 div(float b){
return new Vector3(x+b, y+b, z+b);
}

}

```

### Related examples in the same category

 1 Wrapper activity demonstrating the use of the new SensorEvent rotation vector sensor, Sensor#TYPE_ROTATION_VECTOR TYPE_ROTATION_VECTOR}). 2 Vector2d structure 3 Vector2 Structure 4 Convenience library to do vector calculations 5 Vector3 6 Bit Vector 7 Compute the dot product of two vectors 8 Compute the cross product of two vectors 9 Compute the magnitude (length) of a vector