Vector3 structure : Vector « Game « Android

Home
Android
1.2D Graphics
2.Animation
3.Core Class
4.Database
5.Date Type
6.Development
7.File
8.Game
9.Hardware
10.Media
11.Network
12.Security
13.UI
14.User Event
Android » Game » Vector 
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 = (floatd;
    this.y = (floate;
    this.z = (floatf;
  }
  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;
  }
  
  public Vector3 add(Vector3 b){
    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
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.