Exemplo n.º 1
0
        void UpdateRotation(Cell cell, 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 < 24; i++)
            {
                float[] src = new float[4];
                src [0] = cell.srcVertices [i].x;
                src [1] = cell.srcVertices [i].y;
                src [2] = cell.srcVertices [i].z;
                src [3] = cell.srcVertices [i].w;
                float[] dst = new float[4];

                trackball.transform(src, dst);

                cell.updatepoint4(dst, i);
                cell.update_edges();
            }
        }
Exemplo n.º 2
0
        public void UpdateRotation(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);
        }
Exemplo n.º 3
0
 // Use this for initialization
 void Start()
 {
     box       = this.GetComponent <Transform>();
     trackball = new Trackball(4);
     cell      = new FourDshape(box);
     A_        = new Vector3();
     B_        = new Vector3();
     isbutton  = false;
     A         = new Vector4();
     B         = new Vector4();
     radius    = 1.0f;
     UpdateRotation(cell, trackball, A, B);
 }
Exemplo n.º 4
0
 // Use this for initialization
 void Start()
 {
     box          = this.GetComponent <Transform> ();
     trackball    = new Trackball(4);
     cell         = new Cell(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;
 }
Exemplo n.º 5
0
 // Use this for initialization
 void Start()
 {
     box       = this.GetComponent <Transform>();
     trackball = new Trackball(4);
     cell      = new FourDshape(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;
     UpdateRotation(cell, trackball, A, B);
 }
Exemplo n.º 6
0
 void Awake()
 {
     neighbors    = new Vector4[8];
     neighbors[0] = new Vector4(1, 0, 0, 0) * 0.175f * 2f;
     neighbors[1] = new Vector4(-1, 0, 0, 0) * 0.175f * 2f;
     neighbors[2] = new Vector4(0, 1, 0, 0) * 0.175f * 2f;
     neighbors[3] = new Vector4(0, -1, 0, 0) * 0.175f * 2f;
     neighbors[4] = new Vector4(0, 0, 1, 0) * 0.175f * 2f;
     neighbors[5] = new Vector4(0, 0, -1, 0) * 0.175f * 2f;
     neighbors[6] = new Vector4(0, 0, 0, 1) * 0.175f * 2f;
     neighbors[7] = new Vector4(0, 0, 0, -1) * 0.175f * 2f;
     root.GetComponent <Renderer>().material = mat[1];
     toggle           = 0;
     trackball        = new Trackball(4);
     A_               = new Vector3();
     B_               = new Vector3();
     isTriggerPressed = false;
     A           = new Vector4();
     B           = new Vector4();
     radius      = 1.0f;
     cloneList   = new List <GameObject>();
     leftmanager = leftcontroller.GetComponent <LeftManager>();
 }