views:

90

answers:

0

Hello

i've been working on this seemingly simple issue for more than 2 days. I would love it if you would help me out.

I have some code to produce a list of vectors (19) (thisPose ArrayList) corresponding to a pose for a skeleton:

    private ArrayList updatePose ( int poseIndex , ArrayList listOfUpdates )
    {   
        int i;
        ArrayList thisPose = new ArrayList();  
        ArrayList tr = new ArrayList();

        ArrayList nums = (ArrayList)numsList[poseIndex];

        for(i = 0; i < nums.Count; i += 2) {            
           TransformObj cur;
            Vector3 v1 = (Vector3)nums[i + 1];
            Vector3 v3 = (Vector3)nums[i];
            Quaternion thisQuaternion = QuaternionFromAxisAngle ( v3, v3.Length() );

            if( v3.Length() > Math.Pow(10,-8) )
                cur = new TransformObj ( thisQuaternion , 1.0, v1);
            else            
                cur = new TransformObj ( v1);

            if(filePrev[i / 2] >= 0)
                cur = ((TransformObj)tr[filePrev[i / 2]]).Multiply ( cur );

            thisPose.Add( cur.MultiplyWithVector( new Vector3(0, 0, 0) ));
            tr.Add(cur);

            thisPose[i/2] = Vector3.Multiply( (Vector3)thisPose[i/2] ,(float)0.0005);

            Quaternion cQuaternion = QuaternionFromAxisAngle ( new Vector3(1, 1, 1),  (float)(4 * Math.PI / 3 ) );
            thisPose[i/2] = MultiplyQuaternionAndVector ( cQuaternion , (Vector3)thisPose[i/2] );
        }
        return thisPose;
    }

using:

int[] filePrev = new int[]{-1, 0, 1, 2, 3, 0, 5, 6, 7, 0, 9, 9, 11, 12, 13, 9, 15, 16, 17};    

within the method, the nums ArrayList consists of the following 38 vectors:

v: -0.0250254 -0.00934205 -1.26306
v: -1031.46 946.599 922.532
v: -0.0194843 0.0568432 0.121606
v: 0 100.054 0
v: 0 0.0799654 0
v: 0 0 -425.477
v: 0.126552 0.351484 0.0883195
v: 0 0 -435.898
v: 0 -0.601974 0
v: 175.435 0 0
v: 0.0251119 0.0218503 -0.251097
v: 0 -100.054 0
v: 0 0.168678 0
v: 0 0 -425.477
v: -0.0247609 0.272914 -0.0187815
v: 0 0 -435.898
v: 0 -0.452158 0
v: 175.435 0 0
v: -1.99758E-05 0.0727399 0.0286016
v: -50 0 259.033
v: 0.205393 -0.127389 0.434131
v: 0 0 330.555
v: -0.502925 0.019719 0.0767161
v: 0 0 261.792
v: 0.72968 -0.143153 0.109099
v: 0 187.185 49.4561
v: 0.116146 -0.430137 -0.518831
v: 0 0 -295.832
v: -0.00958385 0.0218873 -0.000104887
v: 0 0 -274.368
v: 0.465736 -0.0151283 0.063763
v: 0 0 261.792
v: -0.669662 -0.0660955 -0.306066
v: 0 -187.185 49.4561
v: -0.116392 -0.335282 0.661388
v: 0 0 -295.832
v: -0.0882838 0.0118039 -0.000521391
v: 0 0 -274.368

how can i modify the location of anyone of the 19 skeleton nodes as the output of this method? AND reflect the new location in the nums values? (to be able to regenerate the updated location from these values in another program)