Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2013
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Vector3
  2. {
  3. float[] mainArray;  //referencja na główną tablicę
  4.  
  5. static List<Vector3> CreateForArray(float[] mainArray)
  6. {
  7.     List<Vector3> arrayList = new ArrayList<Vector>();
  8.     for(int i = 0; i < mainArray.length / 3; i++)
  9.     {
  10.         Vector3 v = new Vector3(i*3, mainArray);
  11.         arrayList.add(v);
  12.     }
  13.    
  14.     return arrayList;
  15.  
  16. }
  17.  
  18. int offset;
  19.  
  20. Vector3(int offset, float[] mainArray)
  21. {
  22.    this.offset = offset;
  23.    this.mainArray = mainArray;
  24. }
  25.  
  26. float getX()
  27. {
  28.    return mainArray[offset];
  29. }
  30. float getY()
  31. {
  32.    return mainArray[offset + 1];
  33. }
  34.  
  35. float getZ()
  36. {
  37.    return mainArray[offset + 2];
  38. }
  39.  
  40. void set(float x, float y, float z)
  41. {
  42.  mainArray[offset] = x;
  43.  mainArray[offset + 1] = y;
  44.  mainArray[offset + 2] = z;
  45. }
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement