void UpdateRotation(HyperCube cube, Trackball trackball, Vector4 A_, Vector4 B_) { float[] A = new float[4] { A_.x, A_.y, A_.z, A_.w }; float[] B = new float[4] { B_.x, B_.y, B_.z, B_.w }; trackball.rotate(A, B); for (int i = 0; i < 16; i++) { float[] src = new float[4]; src [0] = cube.srcVertices [i].x; src [1] = cube.srcVertices [i].y; src [2] = cube.srcVertices [i].z; src [3] = cube.srcVertices [i].w; float[] dst = new float[4]; trackball.transform(src, dst); cube.updatepoint4(dst, i); cube.update_edges(); } }
// Use this for initialization void Start() { box = this.GetComponent <Transform> (); trackball = new Trackball(4); cube = new HyperCube(box); box.position = new Vector3(0f, 1.5f, -0.9f); A_ = new Vector3(); B_ = new Vector3(); isbutton = false; A = new Vector4(); B = new Vector4(); //radius = Trackball.GetComponent<SphereCollider> ().radius; radius = 1.0f; }