Editing
Appendix/Ramblings/VirtualReality
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=====Explicit Specification of Translate and Rotate Instructions===== Here we present a COLLADA-formatted (.dae) file that is similar — and in some respects, identical — to the file presented above as ''Example #4''. The new 3D model that is generated by this file consists of three identically colored cubes, as above, but here in ''Example #5'' … * The originating cube is centered on the origin (X,Y,Z) = (0,0,0) of the coordinate system; that is, in the subsection of the .dae file titled, '''<library_geometries>''', each cube edge extends from -20 to + 20 instead of (as in ''Example #4'') from 0 to + 40. * In the subsection of the .dae file titled, '''<library_vsual_scenes>''', the location and orientation of each of the three spawned cubes is determined by the explicit commands, '''<translate>''' and '''<rotate>''', instead of (as in ''Example #4'') by the consolidated '''<matrix>''' command. On my Mac, the filename of this ''Example #5'' COLLADA-formatted (.dae) file is: '''/Dropbox/3Dviewers/Cube/FirstCube/colladaOther20_HBook.dae''' <table border="0" align="center" width="80%" cellpadding="5"> <tr><th align="center" colspan="3">Example #5 — Another Cube Trio</th></tr> <tr><td align="left" colspan="2"> <div style="height: 400px; width: 700px; overflow: scroll;"> <pre> <?xml version="1.0" encoding="UTF-8" standalone="no" ?> <COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1"> <asset> <contributor> <authoring_tool>Google SketchUp 8.0.11752</authoring_tool> </contributor> <created>2012-04-27T21:07:03Z</created> <modified>2012-04-27T21:07:03Z</modified> <unit meter="0.0254" name="inch" /> <up_axis>Z_UP</up_axis> </asset> <library_visual_scenes> <visual_scene id="ID1"> <node name="SketchUp"> <node id="ID2" name="instance_0"> <translate>0.0 45.0 45.0</translate> <instance_node url="#ID3" /> </node> <node id="ID28" name="instance_1"> <translate>0.0 0.0 0.0</translate> <instance_node url="#ID3" /> </node> <node id="ID29" name="instance_2"> <translate>120.0 0.0 0.0</translate> <rotate> 0 0 1 -90</rotate> <rotate> 1 0 0 -90</rotate> <rotate> 0 1 0 -90</rotate> <!-- NOTE: Mac's Preview app excutes these rotations from the bottom (first) to the top (last). For example, this one does Y-rot, then X-rot, then Z-rot --> <instance_node url="#ID3" /> </node> </node> </visual_scene> </library_visual_scenes> <library_nodes> <node id="ID3" name="cube_component"> <instance_geometry url="#ID4"> <bind_material> <technique_common> <instance_material symbol="Material2" target="#ID6"> <bind_vertex_input semantic="UVSET0" input_semantic="TEXCOORD" input_set="0" /> </instance_material> </technique_common> </bind_material> </instance_geometry> <instance_geometry url="#ID12"> <bind_material> <technique_common> <instance_material symbol="Material2" target="#ID13"> <bind_vertex_input semantic="UVSET0" input_semantic="TEXCOORD" input_set="0" /> </instance_material> </technique_common> </bind_material> </instance_geometry> <instance_geometry url="#ID20"> <bind_material> <technique_common> <instance_material symbol="Material2" target="#ID21"> <bind_vertex_input semantic="UVSET0" input_semantic="TEXCOORD" input_set="0" /> </instance_material> </technique_common> </bind_material> </instance_geometry> </node> </library_nodes> <library_geometries> <geometry id="ID4"> <mesh> <source id="ID7"> <float_array id="ID10" count="48"> 20.0 20.0 -20.0 -20.0 -20.0 -20.0 -20.0 20.0 -20.0 20.0 -20.0 -20.0 -20.0 20.0 20.0 20.0 20.0 -20.0 -20.0 20.0 -20.0 20.0 20.0 20.0 20.0 20.0 -20.0 20.0 -20.0 20.0 20.0 -20.0 -20.0 20.0 20.0 20.0 20.0 -20.0 20.0 -20.0 20.0 20.0 -20.0 -20.0 20.0 20.0 20.0 20.0</float_array> <technique_common> <accessor count="16" source="#ID10" stride="3"> <param name="X" type="float" /> <param name="Y" type="float" /> <param name="Z" type="float" /> </accessor> </technique_common> </source> <source id="ID8"> <float_array id="ID11" count="48">0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 1 0 0 1 0 0 1 0 0 1 0 1 0 0 1 0 0 1 0 0 1 0 0 0 0 1 0 0 1 0 0 1 0 0 1</float_array> <technique_common> <accessor count="16" source="#ID11" stride="3"> <param name="X" type="float" /> <param name="Y" type="float" /> <param name="Z" type="float" /> </accessor> </technique_common> </source> <vertices id="ID9"> <input semantic="POSITION" source="#ID7" /> <input semantic="NORMAL" source="#ID8" /> </vertices> <triangles count="8" material="Material2"> <input offset="0" semantic="VERTEX" source="#ID9" /> <p>0 1 2 1 0 3 4 5 6 5 4 7 8 9 10 9 8 11 12 13 14 13 12 15</p> </triangles> </mesh> </geometry> <geometry id="ID12"> <mesh> <source id="ID15"> <float_array id="ID18" count="12">20.0 -20.0 20.0 -20.0 -20.0 -20.0 20.0 -20.0 -20.0 -20.0 -20.0 20.0</float_array> <technique_common> <accessor count="4" source="#ID18" stride="3"> <param name="X" type="float" /> <param name="Y" type="float" /> <param name="Z" type="float" /> </accessor> </technique_common> </source> <source id="ID16"> <float_array id="ID19" count="12">-0 -1 -0 -0 -1 -0 -0 -1 -0 -0 -1 -0</float_array> <technique_common> <accessor count="4" source="#ID19" stride="3"> <param name="X" type="float" /> <param name="Y" type="float" /> <param name="Z" type="float" /> </accessor> </technique_common> </source> <vertices id="ID17"> <input semantic="POSITION" source="#ID15" /> <input semantic="NORMAL" source="#ID16" /> </vertices> <triangles count="2" material="Material2"> <input offset="0" semantic="VERTEX" source="#ID17" /> <p>0 1 2 1 0 3</p> </triangles> </mesh> </geometry> <geometry id="ID20"> <mesh> <source id="ID23"> <float_array id="ID26" count="12">-20.0 20.0 20.0 -20.0 -20.0 -20.0 -20.0 -20.0 20.0 -20.0 20.0 -20.0</float_array> <technique_common> <accessor count="4" source="#ID26" stride="3"> <param name="X" type="float" /> <param name="Y" type="float" /> <param name="Z" type="float" /> </accessor> </technique_common> </source> <source id="ID24"> <float_array id="ID27" count="12">-1 0 0 -1 0 0 -1 0 0 -1 0 0</float_array> <technique_common> <accessor count="4" source="#ID27" stride="3"> <param name="X" type="float" /> <param name="Y" type="float" /> <param name="Z" type="float" /> </accessor> </technique_common> </source> <vertices id="ID25"> <input semantic="POSITION" source="#ID23" /> <input semantic="NORMAL" source="#ID24" /> </vertices> <triangles count="2" material="Material2"> <input offset="0" semantic="VERTEX" source="#ID25" /> <p>0 1 2 1 0 3</p> </triangles> </mesh> </geometry> </library_geometries> <library_materials> <material id="ID6" name="material"> <instance_effect url="#ID5" /> </material> <material id="ID13" name="Color_005_"> <instance_effect url="#ID14" /> </material> <material id="ID21" name="Color_A06_"> <instance_effect url="#ID22" /> </material> </library_materials> <library_effects> <effect id="ID5"> <profile_COMMON> <technique sid="COMMON"> <lambert> <diffuse> <color>0 0 1 1</color> </diffuse> </lambert> </technique> </profile_COMMON> </effect> <effect id="ID14"> <profile_COMMON> <technique sid="COMMON"> <lambert> <diffuse> <color>0 1 0 1</color> </diffuse> </lambert> </technique> </profile_COMMON> </effect> <effect id="ID22"> <profile_COMMON> <technique sid="COMMON"> <lambert> <diffuse> <color>0.8 0 0 1</color> </diffuse> </lambert> </technique> </profile_COMMON> </effect> </library_effects> <scene> <instance_visual_scene url="#ID1" /> </scene> </COLLADA> </pre> </div> </td> <td align="center" rowspan="1" bgcolor="lightgrey">[[File:ColladaOther20_HBook.png|250px|ColladaOther20HBook]]</td> </tr> </table> The 2D, projected image that is shown here to the right of the ''Example #5'' COLLADA code presents the trio of cubes viewed from a particular camera distance and angle. Each of the three cubes is associated with a particular "node" and has been tagged with a unique ID number inside of the subsection of the code titled, '''<visual_scene>''': * '''ID28''' is the node/tag assigned to the cube that appears in the 2D projected image at the bottom-center of the trio; because '''<translate>''' X, Y, Z '''</translate>''' = '''<translate>''' 0.0 0.0 0.0 '''</translate>''', we appreciate that the center of this cube lies at the origin of the 3D coordinate system. * '''ID2''' is the node/tag assigned to the cube that appears in the upper-left position among the trio; according to the relevant '''<translate>''' instruction, the center of this cube has been shifted from the coordinate-system origin by 45.0 units in both the Y and Z directions. * '''ID29''' is the node/tag assigned to the cube that appears in the upper-right position among the trio; according to its '''<translate>''' instruction, the center of this cube has been shifted from the coordinate-system origin by 120.0 units in the X direction. From the text of the COLLADA-formatted code (displayed here in the scrolling window of ''Example #5''), we see that in addition to undergoing a translation, the cube tagged with '''ID29''' also has undergone three rotations. As seen in the projected 2D image, the result is that — relative to either one of the other two cubes, which have not undergone rotations — the ''green'' face of the cube has effectively swapped positions with a ''blue'' cube face. More specifically, here is what has happened to this cube in the 3D model. Reading the three '''<rotate>''' instructions from the bottom, up: * (First) the cube was rotated counter-clockwise by 90° about the Y-axis — the red face rolled under the cube and it was replaced with the blue face that was originally on the top of the cube. * (Second) the cube was rotated counter-clockwise by 90° about the X-axis — the green face rolled to the top of the cube and the (previously hidden) red face rolled from under the cube to the position previously occupied by the green face; and the location of the visible blue face remained unchanged. * (Third) the cube was rotated counter-clockwise by 90° about the Z-axis — the red face moved into the position previously occupied by the visible blue face while a separate (previously hidden) blue face rolled into the position previously held by the red face; and the location of the green face remained unchanged. <font color="red"><b>VERY IMPORTANT NOTE:</b></font> The ''ordering'' of the rotation instructions in three dimensions is critically important. For example, It is not possible to explain the final orientation of the cube tagged with '''ID29''' by reading and carrying out the three '''<rotate>''' commands from the top, down.
Summary:
Please note that all contributions to JETohlineWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
JETohlineWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Tiled Menu
Table of Contents
Old (VisTrails) Cover
Appendices
Variables & Parameters
Key Equations
Special Functions
Permissions
Formats
References
lsuPhys
Ramblings
Uploaded Images
Originals
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information