hello, im trying to write the following script and am a bit stuck:
Given a single joint name - the script will return a list of its immediate children. The list will be ordered based on the closeness of alignment of each joint to the parent joint-with those closest to the parent joints axis being at the top of the list. If two child joints are aligned exactly along the parents axis\vector of alignment- then the nearer of the two will be higher in the list.
ok.. so ive written the main part of this script- it works out the main axis of alignment of the parent joint- from this i can assume that a good normalised vector will be 1 in that particular axis (this is assuming the local rot axis points down a specified axis completyely in x,y or z- which it should..).
It then works out the vectors from the parent joint to each of the children. So all i need to do is sort the children based on this info- ie the nearer to 1 that each of the child joints relevant axis lies-in terms of its normalised vector..the higher in the list they should be returned- thus the closer to the parents vector\axis they are..
But now im really stuck with the actual ordering bit- i just cannot work out how to use this info to resort the original list..can anyone help?does anyone understand? or is my explanation confusing?
i dabbled with a "bubble sort" method but it just didnt seem to work...
cheers joojaa- u must be permanently attached to a machine! (but im glad you are...
anyhow- ive done it another way- by just returning a single string rather than an array for the purpose i need-which makes things a whole lot easier..doing something like this:
CODE for ($i=0; $i< `size $Jchild`; ++$i) { float $largestAxisSoFar; if($i == 0) { $alignedJoint = $Jchild[0]; $largestAxisSoFar = $mainAxisUnit[$i]; } else { if($mainAxisUnit[$i] > $largestAxisSoFar) { print ($Jchild[$i]+" axis of "+$mainAxisUnit[$i]+" is bigger than "+$Jchild[$i-1]+" of "+ $mainAxisUnit[$i-1]+"\n"); $alignedJoint = $Jchild[$i]; $largestAxisSoFar = $mainAxisUnit[$i]; } } }
return $alignedJoint;
But now another question..
say a joint has 2 children- and one is perfectly aligned along its axis but far away and the other is slightly of that axis but much nearer..well the normalised vector of the parent to that second child is actually closer to 1 in the important axis than the other more aligned child..
this is annoying and means my script will return the wrong result- any ideas on how i can get a better indication of "alignedness"?
QUOTE(tarticus @ 10/13/06, 04:27 PM) [snapback]249907[/snapback] cheers joojaa- u must be permanently attached to a machine! (but im glad you are...
well i monitor about 7 feeds constantly in the bacground (my computers have constantly 7 rss feeds comming in and i have about 12 windows on average opena at a time)
anybody got any other ideas on how to find the most "aligned with" child joint of a joint..assuming you know the joint axis of the parent joint...?
i am doing this: getting normalised vectors for each child joint between them and the parent- normalising the results using unit- isolating only the number or axis that corresponds to the parent joints known local rotation axis- making this number positive if it is negative- finding the biggest value of this number from all of the child joints- and matching this number aganst its owner and returning the owner as the "most aligned".