[x3d-public] Help multiplying out 2 transforms.

John Carlson yottzumm at gmail.com
Wed Dec 9 22:50:18 PST 2020


I need help multiplying out two transforms so that my HAnim model will have
the correct HAnim translations and centers.   The transform code is below.
You will need to do an initial multiplication of the two transforms, then
apply it to translating sites and segments (translations) and joints
(centers) found in the hand and foot skeleton code.  We would also like to
write out all  the new translations and centers to two files with the below
HTML record as a template (fill in name and center or translation). We want
an output file for center records and a file for translation records.

    <tr>
      <td><span class="Code">l_talocrural</span></td>
      <td><span class="Code">0.1101 0.0656 -0.0736</span></td>
    </tr>


==================================
       undef($file);
        if ($parent_joint eq "l_talocrural") {
                $file = "HAnimModelFootLeft.x3d";
                $trans =  "<Transform scale='0.15 0.15 0.15'
translation='0.08 0.06 -0.025' rotation='1 0 0 -1.57'> <!-- Transform left
foot -->\n";
                $trans .= "<Transform> <!-- Empty Transform left foot
-->\n";
        } elsif ($parent_joint eq "r_talocrural") {
                $file = "HAnimModelFootRight.x3d";
                $trans = "<Transform scale='0.15 0.15 0.15'
translation='-0.05 0.06 -0.025' rotation='1 0 0 -1.57'><!-- Transform right
foot -->\n";
                $trans .= "<Transform> <!-- Empty Transform right foot
-->\n";
        } elsif ($parent_joint eq "l_radiocarpal") {
                $file = "HAnimModelHandLeft.x3d";
                $trans = "<Transform scale='0.2 0.2 0.2' translation='0.20
0.85 -0.05' rotation='0 0 1 -3.14'> <!-- Transform left hand -->\n";
                $trans .= "<Transform rotation='0 1 0 -1.57'> <!--
Transform left hand -->\n";
        } elsif ($parent_joint eq "r_radiocarpal") {
                $file = "HAnimModelHandRight.x3d";
                $trans = "<Transform scale='0.2 0.2 0.2' translation='-0.20
0.85 -0.05' rotation='0 0 1 -3.14'> <!-- Transform right hand -->\n";
                $trans .= "<Transform rotation='0 1 0 1.57'> <!-- Transform
right hand -->\n";
        }
        if ($file) {
                my $namespace = $file;
                $namespace =~ s/\.x3d//;
                $namespace =~ s/<//;
                $namespace =~ s/^(.*)/_$1/;
                $trailing_humanoid .= "<HAnimSegment
USE='hanim_".$parent_segment.$namespace."' containerField='segments'/>\n";
                print "<HAnimSegment
DEF='hanim_".$parent_segment.$namespace."'
name='".$parent_segment.$namespace."'>\n";
                print "$trans\n";
                # print "<Inline url='"$file"'/>";
                parseX3D($namespace, "<$file");
                print "</Transform>\n";
                print "</Transform>\n";
                print "</HAnimSegment>\n";
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20201210/8f40ff8e/attachment.html>


More information about the x3d-public mailing list