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!
==Ellipsoid== Here, we have added another desirable element to the visual scene, specifically, one octant of the surface of an ellipsoid whose axis ratios are b/a = 0.75 and c/a = 0.50. We generated the data needed to define the relevant vertices and polygons using a home-developed fortran algorithm. This data was printed out from the fortran code in a format that created a new <geometry id="EllipsoidOctant"> subsection for the COLLADA-based xml file; see the Example #9 code presented immediately below. <table border="0" align="center" width="80%"> <tr><th align="center" colspan="2">Example #9A — Building One Octant of an Ellipsoid</th></tr> <tr><td align="left"> <div style="height: 400px; width: 700px; overflow: scroll;"> <pre> <?xml version="1.0" encoding="utf-8"?> <COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1"> <!-- On 23 September 2019 I copied the following cube-animation file from github: https://github.com/chinedufn/collada-dae-parser/blob/master/test/fixture/animated-blender-cube.dae I have made substantial modifications in order to better understand how the animation instructions actually work. THIS FILE NAME: Dropbox/3Dviewers/Clock/Arrow07.PERFECT.dae It uses "polylist" and correct implementation of "normals" for all polygons of the Clock. It also displays **two** clocks: [Initially, we made one spin and the other not.] It also adds a red "minute hand" to the clock; now, this is the only segment that spins. --> <asset> <contributor> <author>jet53man</author> <authoring_tool>Raw XML</authoring_tool> </contributor> <created>2019-09-24</created> <modified>2019-09-29</modified> <unit name="meter" meter="1"/> <up_axis>Z_UP</up_axis> </asset> <library_images/> <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="InnerID5"> <profile_COMMON> <technique sid="COMMON"> <lambert> <diffuse> <color>0.4 0.0 0.7 0.4</color> </diffuse> </lambert> </technique> </profile_COMMON> </effect> <effect id="ArrowID5"> <profile_COMMON> <technique sid="COMMON"> <lambert> <diffuse> <color>1.0 0.0 0.0 1.0</color> </diffuse> </lambert> </technique> </profile_COMMON> </effect> <effect id="EllipID5"> <profile_COMMON> <technique sid="COMMON"> <lambert> <diffuse> <color>0.0 1.0 0.0 0.9</color> </diffuse> </lambert> </technique> </profile_COMMON> </effect> </library_effects> <library_materials> <material id="ID6" name="material"> <instance_effect url="#ID5" /> </material> <material id="InnerID6" name="Inner_material"> <instance_effect url="#InnerID5" /> </material> <material id="ArrowID6" name="Arrow_material"> <instance_effect url="#ArrowID5" /> </material> <material id="EllipID6" name="Ellip_material"> <instance_effect url="#EllipID5" /> </material> </library_materials> <library_nodes> <node id="ID3" name="cube_component"> <instance_geometry url="#Clock_OuterEdge"> <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="#Clock_InnerEdge"> <bind_material> <technique_common> <instance_material symbol="Material2" target="#InnerID6"> <bind_vertex_input semantic="UVSET0" input_semantic="TEXCOORD" input_set="0" /> </instance_material> </technique_common> </bind_material> </instance_geometry> </node> <node id="ArrowID3" name="cube_component"> <instance_geometry url="#Clock_ArrowEdge"> <bind_material> <technique_common> <instance_material symbol="Material2" target="#ArrowID6"> <bind_vertex_input semantic="UVSET0" input_semantic="TEXCOORD" input_set="0" /> </instance_material> </technique_common> </bind_material> </instance_geometry> </node> <node id="EllipID3" name="ellipsoid_component"> <instance_geometry url="#EllipsoidOctant"> <bind_material> <technique_common> <instance_material symbol="Material2" target="#EllipID6"> <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="Clock_OuterEdge"> <mesh> <!-- ********************************************** * * Insert first portion of clock's structure * ********************************************** --> <source id="Clock_Positions"> <float_array id="Coordinates01" count="123"> 0.0 1.0 0.2 1.0 1.0 0.2 1.0 0.0 0.2 1.0 -1.0 0.2 0.0 -1.0 0.2 -1.0 -1.0 0.2 -1.0 0.0 0.2 -1.0 1.0 0.2 0.0 1.0 -0.2 1.0 1.0 -0.2 1.0 0.0 -0.2 1.0 -1.0 -0.2 0.0 -1.0 -0.2 -1.0 -1.0 -0.2 -1.0 0.0 -0.2 -1.0 1.0 -0.2 0.9 0.0 0.2 0.779423 0.45 0.2 0.45 0.779423 0.2 0.0 0.9 0.2 -0.45 0.779423 0.2 -0.779423 0.45 0.2 -0.9 0.0 0.2 -0.779423 -0.45 0.2 -0.45 -0.779423 0.2 0.0 -0.9 0.2 0.45 -0.779423 0.2 0.779423 -0.45 0.2 -0.9 0.0 -0.2 -0.779423 0.45 -0.2 -0.45 0.779423 -0.2 -0.0 0.9 -0.2 0.45 0.779423 -0.2 0.779423 0.45 -0.2 0.9 0.0 -0.2 0.779423 -0.45 -0.2 0.45 -0.779423 -0.2 -0.0 -0.9 -0.2 -0.45 -0.779423 -0.2 -0.779423 -0.45 -0.2 0.0 0.0 -0.2</float_array> <technique_common> <accessor source="#Coordinates01" count="41" stride="3"> <param name="X" type="float" /> <param name="Y" type="float" /> <param name="Z" type="float" /> </accessor> </technique_common> </source> <source id="Clock_Normals"> <float_array id="InnerNormals01" count="18"> 1.0 0.0 0.0 -1.0 0.0 0.0 0.0 1.0 0.0 0.0 -1.0 0.0 0.0 0.0 1.0 0.0 0.0 -1.0 </float_array> <technique_common> <accessor source="#Normals01" count="6" stride="3"> <param name="X" type="float" /> <param name="Y" type="float" /> <param name="Z" type="float" /> </accessor> </technique_common> </source> <vertices id="Clock_Vertices"> <input semantic="POSITION" source="#Clock_Positions" /> </vertices> <polylist count="56" material="Material2"> <input semantic="VERTEX" source="#Clock_Vertices" offset="0" /> <input semantic="NORMAL" source="#Clock_Normals" offset="1" /> <vcount> 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3</vcount> <p> 0 2 1 2 8 2 1 2 9 2 8 2 7 2 0 2 15 2 0 2 8 2 15 2 1 0 2 0 9 0 2 0 10 0 9 0 2 0 3 0 10 0 3 0 11 0 10 0 3 3 4 3 11 3 4 3 12 3 11 3 4 3 5 3 12 3 5 3 13 3 12 3 5 1 6 1 13 1 6 1 14 1 13 1 6 1 7 1 14 1 7 1 15 1 14 1 2 4 17 4 16 4 2 4 1 4 17 4 1 4 18 4 17 4 1 4 0 4 18 4 0 4 19 4 18 4 0 4 20 4 19 4 0 4 7 4 20 4 7 4 21 4 20 4 7 4 6 4 21 4 6 4 22 4 21 4 6 4 23 4 22 4 6 4 5 4 23 4 5 4 24 4 23 4 5 4 4 4 24 4 4 4 25 4 24 4 4 4 26 4 25 4 4 4 3 4 26 4 3 4 27 4 26 4 3 4 2 4 27 4 2 4 16 4 27 4 14 5 29 5 28 5 14 5 15 5 29 5 15 5 30 5 29 5 15 5 8 5 30 5 8 5 31 5 30 5 8 5 32 5 31 5 8 5 9 5 32 5 9 5 33 5 32 5 9 5 10 5 33 5 10 5 34 5 33 5 10 5 35 5 34 5 10 5 11 5 35 5 11 5 36 5 35 5 11 5 12 5 36 5 12 5 37 5 36 5 12 5 38 5 37 5 12 5 13 5 38 5 13 5 39 5 38 5 13 5 14 5 39 5 14 5 28 5 39 5 </p> </polylist> </mesh> </geometry> <geometry id="Clock_InnerEdge"> <mesh> <!-- ********************************************** * * Insert second portion of clock's structure * ********************************************** --> <source id="Clock_InnerPositions"> <float_array id="InnerCoordinates01" count="123"> 0.0 1.0 0.2 1.0 1.0 0.2 1.0 0.0 0.2 1.0 -1.0 0.2 0.0 -1.0 0.2 -1.0 -1.0 0.2 -1.0 0.0 0.2 -1.0 1.0 0.2 0.0 1.0 -0.2 1.0 1.0 -0.2 1.0 0.0 -0.2 1.0 -1.0 -0.2 0.0 -1.0 -0.2 -1.0 -1.0 -0.2 -1.0 0.0 -0.2 -1.0 1.0 -0.2 0.9 0.0 0.2 0.779423 0.45 0.2 0.45 0.779423 0.2 0.0 0.9 0.2 -0.45 0.779423 0.2 -0.779423 0.45 0.2 -0.9 0.0 0.2 -0.779423 -0.45 0.2 -0.45 -0.779423 0.2 0.0 -0.9 0.2 0.45 -0.779423 0.2 0.779423 -0.45 0.2 -0.9 0.0 -0.2 -0.779423 0.45 -0.2 -0.45 0.779423 -0.2 -0.0 0.9 -0.2 0.45 0.779423 -0.2 0.779423 0.45 -0.2 0.9 0.0 -0.2 0.779423 -0.45 -0.2 0.45 -0.779423 -0.2 -0.0 -0.9 -0.2 -0.45 -0.779423 -0.2 -0.779423 -0.45 -0.2 0.0 0.0 -0.2</float_array> <technique_common> <accessor source="#InnerCoordinates01" count="41" stride="3"> <param name="X" type="float" /> <param name="Y" type="float" /> <param name="Z" type="float" /> </accessor> </technique_common> </source> <source id="Clock_InnerNormals"> <float_array id="InnerNormals01" count="54"> 1.0 0.0 0.0 -1.0 0.0 0.0 0.0 1.0 0.0 0.0 -1.0 0.0 0.0 0.0 1.0 0.0 0.0 -1.0 -0.965926 -0.258819 0.0 -0.707107 -0.707107 0.0 -0.258819 -0.965926 0.0 0.258819 -0.965926 0.0 0.707107 -0.707107 0.0 0.965926 -0.258819 0.0 0.965926 0.258819 0.0 0.707107 0.707107 0.0 0.258819 0.965926 0.0 -0.258819 0.965926 0.0 -0.707107 0.707107 0.0 -0.965926 0.258819 0.0 </float_array> <technique_common> <accessor source="#InnerNormals01" count="18" stride="3"> <param name="X" type="float" /> <param name="Y" type="float" /> <param name="Z" type="float" /> </accessor> </technique_common> </source> <vertices id="Clock_InnerVertices"> <input semantic="POSITION" source="#Clock_InnerPositions" /> </vertices> <polylist count="24" material="Material2"> <input semantic="VERTEX" source="#Clock_InnerVertices" offset="0" /> <input semantic="NORMAL" source="#Clock_InnerNormals" offset="1"/> <vcount>4 4 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3</vcount> <p> 16 6 17 6 33 6 34 6 17 7 18 7 32 7 33 7 18 8 19 8 31 8 32 8 19 9 20 9 30 9 31 9 20 10 21 10 29 10 30 10 21 11 22 11 28 11 29 11 22 12 23 12 39 12 28 12 23 13 24 13 38 13 39 13 24 14 25 14 37 14 38 14 25 15 26 15 36 15 37 15 26 16 27 16 35 16 36 16 27 17 16 17 34 17 35 17 28 5 29 5 40 5 29 5 30 5 40 5 30 5 31 5 40 5 31 5 32 5 40 5 32 5 33 5 40 5 33 5 34 5 40 5 34 5 35 5 40 5 35 5 36 5 40 5 36 5 37 5 40 5 37 5 38 5 40 5 38 5 39 5 40 5 39 5 28 5 40 5 </p> </polylist> </mesh> </geometry> <geometry id="Clock_ArrowEdge"> <mesh> <!-- ********************************************** * * Insert arrow portion of clock's structure * ********************************************** --> <source id="Clock_ArrowPositions"> <float_array id="ArrowCoordinates01" count="30"> 0.0 0.85 0.25 0.1 0.0 0.25 0.0 -0.2 0.25 -0.1 0.0 0.25 0.0 0.85 0.05 0.1 0.0 0.05 0.0 -0.2 0.05 -0.1 0.0 0.05 0.0 0.0 0.25 0.0 0.0 0.05 </float_array> <technique_common> <accessor source="#ArrowCoordinates01" count="10" stride="3"> <param name="X" type="float" /> <param name="Y" type="float" /> <param name="Z" type="float" /> </accessor> </technique_common> </source> <source id="Clock_ArrowNormals"> <float_array id="ArrowNormals01" count="18"> 0 0 1 0 0 -1 0.993151 0.116841 0.0 0.447214 -0.894427 0.0 -0.447214 -0.894427 0.0 -0.993151 0.116841 0.0 </float_array> <technique_common> <accessor source="#ArrowNormals01" count="6" stride="3"> <param name="X" type="float" /> <param name="Y" type="float" /> <param name="Z" type="float" /> </accessor> </technique_common> </source> <vertices id="Clock_ArrowVertices"> <input semantic="POSITION" source="#Clock_ArrowPositions" /> </vertices> <polylist count="12" material="Material2"> <input semantic="VERTEX" source="#Clock_ArrowVertices" offset="0" /> <input semantic="NORMAL" source="#Clock_ArrowNormals" offset="1"/> <vcount>3 3 3 3 3 3 3 3 4 4 4 4</vcount> <p> 0 0 8 0 1 0 1 0 8 0 2 0 2 0 8 0 3 0 3 0 8 0 0 0 4 1 5 1 9 1 5 1 6 1 9 1 6 1 7 1 9 1 7 1 4 1 9 1 0 2 1 2 5 2 4 2 1 3 2 3 6 3 5 3 2 4 3 4 7 4 6 4 3 5 0 5 4 5 7 5 </p> </polylist> </mesh> </geometry> <geometry id="EllipsoidOctant"> <mesh> <source id="Ellipsoid_Positions"> <float_array id="Ellipsoid_Coordinates" count="135"> 0.0000 0.0000 0.5000 0.0000 0.7500 0.0000 0.1000 0.7462 0.0000 0.2000 0.7348 0.0000 0.3000 0.7155 0.0000 0.4000 0.6874 0.0000 0.5000 0.6495 0.0000 0.6000 0.6000 0.0000 0.7000 0.5356 0.0000 0.8000 0.4500 0.0000 0.9000 0.3269 0.0000 1.0000 0.0000 0.0000 0.0000 0.7262 0.1250 0.0968 0.7225 0.1250 0.1936 0.7115 0.1250 0.2905 0.6927 0.1250 0.3873 0.6656 0.1250 0.4841 0.6289 0.1250 0.5809 0.5809 0.1250 0.6778 0.5186 0.1250 0.7746 0.4357 0.1250 0.8714 0.3165 0.1250 0.9682 0.0000 0.1250 0.0000 0.6495 0.2500 0.0866 0.6463 0.2500 0.1732 0.6364 0.2500 0.2598 0.6196 0.2500 0.3464 0.5953 0.2500 0.4330 0.5625 0.2500 0.5196 0.5196 0.2500 0.6062 0.4638 0.2500 0.6928 0.3897 0.2500 0.7794 0.2831 0.2500 0.8660 0.0000 0.2500 0.0000 0.4961 0.3750 0.0661 0.4936 0.3750 0.1323 0.4861 0.3750 0.1984 0.4732 0.3750 0.2646 0.4547 0.3750 0.3307 0.4296 0.3750 0.3969 0.3969 0.3750 0.4630 0.3543 0.3750 0.5292 0.2976 0.3750 0.5953 0.2162 0.3750 0.6614 0.0000 0.3750 </float_array> <technique_common> <accessor source="#Ellipsoid_Coordinates" count=" 45" stride="3"> <param name="X" type="float" /> <param name="Y" type="float" /> <param name="Z" type="float" /> </accessor> </technique_common> </source> <source id="Ellipsoid_Normals"> <float_array id="Ellipsoid_Normals01" count="210"> 0.0092 0.2443 0.9696 0.0276 0.2419 0.9699 0.0460 0.2371 0.9704 0.0644 0.2295 0.9712 0.0829 0.2190 0.9722 0.1015 0.2051 0.9735 0.1203 0.1868 0.9750 0.1393 0.1627 0.9768 0.1587 0.1289 0.9789 0.1854 0.0567 0.9810 0.0237 0.6314 0.7751 0.0237 0.6314 0.7751 0.0713 0.6261 0.7764 0.0713 0.6261 0.7764 0.1193 0.6154 0.7792 0.1193 0.6154 0.7792 0.1680 0.5985 0.7833 0.1680 0.5985 0.7833 0.2176 0.5746 0.7890 0.2176 0.5746 0.7890 0.2685 0.5422 0.7962 0.2685 0.5422 0.7962 0.3211 0.4987 0.8051 0.3211 0.4987 0.8051 0.3760 0.4393 0.8159 0.3760 0.4393 0.8159 0.4344 0.3529 0.8287 0.4344 0.3529 0.8287 0.5149 0.1575 0.8427 0.5149 0.1575 0.8427 0.0320 0.8520 0.5226 0.0320 0.8520 0.5226 0.0964 0.8461 0.5242 0.0964 0.8461 0.5242 0.1617 0.8340 0.5276 0.1617 0.8340 0.5276 0.2287 0.8148 0.5328 0.2287 0.8148 0.5328 0.2981 0.7871 0.5400 0.2981 0.7871 0.5400 0.3708 0.7488 0.5493 0.3708 0.7488 0.5493 0.4481 0.6958 0.5613 0.4481 0.6958 0.5613 0.5315 0.6209 0.5762 0.5315 0.6209 0.5762 0.6239 0.5069 0.5947 0.6239 0.5069 0.5947 0.7533 0.2304 0.6160 0.7533 0.2304 0.6160 0.0369 0.9817 0.1870 0.0369 0.9817 0.1870 0.1112 0.9759 0.1878 0.1112 0.9759 0.1878 0.1869 0.9639 0.1894 0.1869 0.9639 0.1894 0.2652 0.9449 0.1919 0.2652 0.9449 0.1919 0.3473 0.9172 0.1954 0.3473 0.9172 0.1954 0.4348 0.8780 0.2001 0.4348 0.8780 0.2001 0.5298 0.8227 0.2061 0.5298 0.8227 0.2061 0.6353 0.7421 0.2139 0.6353 0.7421 0.2139 0.7564 0.6146 0.2240 0.7564 0.6146 0.2240 0.9292 0.2842 0.2361 0.9292 0.2842 0.2361 </float_array> <technique_common> <accessor source="#Ellipsoid_Normals01" count=" 70" stride="3"> <param name="X" type="float" /> <param name="Y" type="float" /> <param name="Z" type="float" /> </accessor> </technique_common> </source> <vertices id="Ellipsoid_Vertices"> <input semantic="POSITION" source="#Ellipsoid_Positions" /> </vertices> <polylist count=" 70" material="Material2"> <input semantic="VERTEX" source="#Ellipsoid_Vertices" offset="0" /> <input semantic="NORMAL" source="#Ellipsoid_Normals" offset="1" /> <vcount> 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 </vcount> <p> 0 0 35 0 34 0 0 1 36 1 35 1 0 2 37 2 36 2 0 3 38 3 37 3 0 4 39 4 38 4 0 5 40 5 39 5 0 6 41 6 40 6 0 7 42 7 41 7 0 8 43 8 42 8 0 9 44 9 43 9 34 10 24 10 23 10 34 11 35 11 24 11 35 12 25 12 24 12 35 13 36 13 25 13 36 14 26 14 25 14 36 15 37 15 26 15 37 16 27 16 26 16 37 17 38 17 27 17 38 18 28 18 27 18 38 19 39 19 28 19 39 20 29 20 28 20 39 21 40 21 29 21 40 22 30 22 29 22 40 23 41 23 30 23 41 24 31 24 30 24 41 25 42 25 31 25 42 26 32 26 31 26 42 27 43 27 32 27 43 28 33 28 32 28 43 29 44 29 33 29 23 30 13 30 12 30 23 31 24 31 13 31 24 32 14 32 13 32 24 33 25 33 14 33 25 34 15 34 14 34 25 35 26 35 15 35 26 36 16 36 15 36 26 37 27 37 16 37 27 38 17 38 16 38 27 39 28 39 17 39 28 40 18 40 17 40 28 41 29 41 18 41 29 42 19 42 18 42 29 43 30 43 19 43 30 44 20 44 19 44 30 45 31 45 20 45 31 46 21 46 20 46 31 47 32 47 21 47 32 48 22 48 21 48 32 49 33 49 22 49 12 50 2 50 1 50 12 51 13 51 2 51 13 52 3 52 2 52 13 53 14 53 3 53 14 54 4 54 3 54 14 55 15 55 4 55 15 56 5 56 4 56 15 57 16 57 5 57 16 58 6 58 5 58 16 59 17 59 6 59 17 60 7 60 6 60 17 61 18 61 7 61 18 62 8 62 7 62 18 63 19 63 8 63 19 64 9 64 8 64 19 65 20 65 9 65 20 66 10 66 9 66 20 67 21 67 10 67 21 68 11 68 10 68 21 69 22 69 11 69 </p> </polylist> </mesh> </geometry> </library_geometries> <library_animations> <animation id="Cube_rotation_euler_Z"> <source id="Cube_rotation_euler_Z-input"> <!-- <float_array id="Cube_rotation_euler_Z-input-array" count="5">0 0.2083333 0.4166666 0.625 0.8333333</float_array> --> <!-- <float_array id="Cube_rotation_euler_Z-input-array" count="5">0 0.4167 0.8333 1.25 1.666</float_array> --> <float_array id="Cube_rotation_euler_Z-input-array" count="17">0 0.25 0.5 0.75 1.0 1.25 1.5 1.75 2.0 2.25 2.5 2.75 3.0 3.25 3.5 3.75 4.0</float_array> <technique_common> <accessor source="#Cube_rotation_euler_Z-input-array" count="5" stride="1"> <param name="TIME" type="float"/> </accessor> </technique_common> </source> <source id="Cube_rotation_euler_Z-output"> <!-- <float_array id="Cube_rotation_euler_Z-output-array" count="5">0 -22.5 -45 -67.5 -90</float_array> --> <float_array id="Cube_rotation_euler_Z-output-array" count="17">0 -22.5 -45 -67.5 -90 -112.5 -135.0 -157.5 -180.0 -202.5 -225.0 -247.5 -270.0 -292.5 -315.0 -337.5 -360.0</float_array> <technique_common> <accessor source="#Cube_rotation_euler_Z-output-array" count="5" stride="1"> <param name="ANGLE" type="float"/> </accessor> </technique_common> </source> <sampler id="Cube_rotation_euler_Z-sampler"> <input semantic="INPUT" source="#Cube_rotation_euler_Z-input"/> <input semantic="OUTPUT" source="#Cube_rotation_euler_Z-output"/> </sampler> <channel source="#Cube_rotation_euler_Z-sampler" target="jetman/rotationZ.ANGLE"/> </animation> <animation id="Cube_scale_Z"> <source id="Cube_scale_Z-input"> <!-- <float_array id="Cube_scale_Z-input-array" count="5">0 0.2083333 0.4166666 0.625 0.8333333</float_array> --> <float_array id="Cube_scale_Z-input-array" count="5">0 0.0694 0.1389 0.2083 0.2778</float_array> <technique_common> <accessor source="#Cube_scale_Z-input-array" count="5" stride="1"> <param name="TIME" type="float"/> </accessor> </technique_common> </source> <source id="Cube_scale_Z-output"> <!-- <float_array id="Cube_scale_Z-output-array" count="5">0.5 0.4 0.3 0.2 0.1</float_array> --> <float_array id="Cube_scale_Z-output-array" count="5">1.0 1.0 1.0 1.0 1.0</float_array> <technique_common> <accessor source="#Cube_scale_Z-output-array" count="5" stride="1"> <param name="Z" type="float"/> </accessor> </technique_common> </source> <sampler id="Cube_scale_Z-sampler"> <input semantic="INPUT" source="#Cube_scale_Z-input"/> <input semantic="OUTPUT" source="#Cube_scale_Z-output"/> </sampler> <channel source="#Cube_scale_Z-sampler" target="jetman/scale.Z"/> </animation> </library_animations> <library_controllers/> <library_visual_scenes> <visual_scene id="EntireLayout"> <!-- *********** * * Evidently, it is important for the "id" of this node to be shared * with the "directory" name that is used in the animation "channel" * instructions. For example, "jetman" is used here. * *********** --> <node id="TwoClocks"> <node id="firstclock" name="instance_1"> <translate>0.0 1.0 0.0</translate> <rotate sid="rotationX">1 0 0 90</rotate> <rotate sid="rotationZ">0 0 1 0</rotate> <!-- <rotate sid="rotationY">0 1 0 90</rotate> --> <scale sid="scale">1 1 1</scale> <instance_node url="#ID3" /> </node> <node id="jetman" name="instance_Arrow"> <translate>0.0 1.0 0.0</translate> <rotate sid="rotationX">1 0 0 90</rotate> <rotate sid="rotationZ">0 0 1 0</rotate> <!-- <rotate sid="rotationY">0 1 0 90</rotate> --> <scale sid="scale">1 1 1</scale> <instance_node url="#ArrowID3" /> </node> <extra> <technique profile="FCOLLADA"> <start_time>0</start_time> <end_time>4.0</end_time> </technique> </extra> <node id="secondClock" name="instance_2"> <translate>10.0 0.0 0.0</translate> <!-- <rotate sid="rotationZ">0 0 1 90</rotate> --> <rotate sid="rotationX">1 0 0 90</rotate> <rotate sid="rotationY">0 1 0 -90</rotate> <scale sid="scale">1 1 1</scale> <instance_node url="#ID3" /> </node> <node id="EllipScene" name="instance_Ellip"> <translate>10.0 0.0 0.0</translate> <!-- <rotate sid="rotationZ">0 0 1 90</rotate> --> <rotate sid="rotationX">1 0 0 90</rotate> <rotate sid="rotationY">0 1 0 -90</rotate> <scale sid="scale">5.0 5.0 5.0</scale> <instance_node url="#EllipID3" /> </node> </node> </visual_scene> </library_visual_scenes> <scene> <instance_visual_scene url="#EntireLayout" /> </scene> </COLLADA> </pre> </div> </td> <td align="center" bgcolor="lightgrey">[[File:EllipsoidOctantMerged54.png|250px|EllipsoidOctantMerged54]]</td> </tr></table> Here we document the various lines of the COLLADA-based <xml> code that require a unique new "id" tag when a new geometry node is added: [[File:FlowChartEllipsoidOctant2.png|right|Flow Chart]] <ul> <li><b><library_effects></b></li> <ul> <li><effect id="<font color="orange">EllipID5</font>"></li> </ul> <li><b><library_materials></b></li> <ul> <li><material id="<font color="lightgreen">EllipID6</font>" name="Ellip_material"></li> <li><instance_effect url="#<font color="orange">EllipID5</font>" /></li> </ul> <li><b><library_nodes></b></li> <ul> <li><node id="<font color="lightblue">EllipID3</font>" name="ellipsoid_component"></li> <li><instance_geometry url="#<font color="pink">EllipsoidOctant</font>"></li> <li><instance_material symbol="Material2" target="#<font color="lightgreen">EllipID6</font>"></li> </ul> <li><b><library_geometries></b> — this group provided by fortran output</li> <ul> <li><geometry id="<font color="pink">EllipsoidOctant</font>"></li> <li><source id="Ellipsoid_Positions"></li> <li><float_array id="Ellipsoid_Coordinates" count="135"></li> <li><accessor source="#Ellipsoid_Coordinates" count=" 45" stride="3"></li> <li><source id="Ellipsoid_Normals"></li> <li><float_array id="Ellipsoid_Normals01" count="210"></li> <li> <accessor source="#Ellipsoid_Normals01" count=" 70" stride="3"></li> <li><vertices id="Ellipsoid_Vertices"></li> <li><input semantic="POSITION" source="#Ellipsoid_Positions" /></li> <li><polylist count=" 70" material="Material2"></li> <li><input semantic="VERTEX" source="#Ellipsoid_Vertices" offset="0" /></li> <li><input semantic="NORMAL" source="#Ellipsoid_Normals" offset="1" /></li> </ul> <li><b><library_visual_scenes></b></li> <ul> <li><node id="EllipScene" name="instance_Ellip"></li> <li><instance_node url="#<font color="lightblue">EllipID3</font>" /></li> </ul> </ul> <table border="0" align="center" width="90%"> <tr><th align="center" colspan="2">Example #9B — FORTRAN code that Generated Vertices & Polygons</th></tr> <tr><td align="left"> <div style="height: 400px; width: 100%; overflow: scroll;"> <pre> Program ThreeDEllipsoids !!!!!!!! ! ! Surface of one Octant of the Ellipsoid ! !!!!!!!! ! real*8 bovera,covera real*8 zlayer(5),xvalue(4,11),yvalue real*8 pt3xx(200),pt3yy(200),pt3zz(200) real*8 xmax,dx real*8 x1,y1,z1,x2,y2,z2,x3,y3,z3,xnorm,ynorm,znorm integer n,nzmax,m,mxmax,ncount,npt integer ell,nverts,numtri,nt1,nt2,nfloats integer ellmin,ellmax,nzslice integer triangle(200,4) 501 format(8x,'pt num',6x,'x',10x,'y',10x,'z',/) 502 format(I10,3F15.7) 503 format(//,5x,'nverts = ',I5,/) 504 format(/,6x,'Triangle No.',3x,'Vertex1',3x,'Vertex2',3x,'Vertex3') 505 format(I10,5x,3I10,5x,3f13.5) 507 format(//,5x,'numtri = ',I5,/) 510 format(/,'nzslice, numtri, ellmin, ellmax = ',4I8) 599 format('<geometry id="EllipsoidOctant">') 600 format(2x,'<mesh>') 601 format('<source id="Ellipsoid_Positions">',/,'<float_array id="Ellipsoid_Coordinates" count="',I3,'">'/) 602 format(3F10.4) 603 format('</float_array>') 604 format('<technique_common>') 605 format(2x,'<accessor source="#Ellipsoid_Coordinates" count="',I5,& &'" stride="3">') 606 format(8x,'<param name="X" type="float" />') 607 format(8x,'<param name="Y" type="float" />') 608 format(8x,'<param name="Z" type="float" />') 609 format(2x,'</accessor>',/,'</technique_common>',/,'</source>') 610 format('<source id="Ellipsoid_Normals">',/,'<float_array id="Ellipsoid_Normals01" count="',I3,'">'/) 611 format(2x,'<accessor source="#Ellipsoid_Normals01" count="',I5,& &'" stride="3">') 612 format('<vertices id="Ellipsoid_Vertices">') 613 format(2x,'<input semantic="POSITION"',& &' source="#Ellipsoid_Positions" />') 614 format('</vertices>') 615 format('<polylist count="',I5,'" material="Material2">') 616 format(2x,'<input semantic="VERTEX"',& &' source="#Ellipsoid_Vertices" offset="0" />') 617 format(2x,'<input semantic="NORMAL"',& &' source="#Ellipsoid_Normals" offset="1" />',/,'<vcount></vcount>',/,'<p>') 618 format('</p>',/,'</polylist>') 619 format(2x,'</mesh>') 620 format('</geometry>') 621 format(6I5) ! zlayer is z/a; its vector length is (nzmax+1). ! xvalue is x/a; its array lengths are (nzmax,mxmax+1). ! yvalue is y/a. bovera = 0.75d0 covera = 0.50d0 nzmax = 4 mxmax = 10 zlayer(nzmax+1) = covera pt3xx(1) = 0.0d0 pt3yy(1) = 0.0d0 pt3zz(1) = zlayer(nzmax+1) ncount = 1 do n = 1,nzmax zlayer(n) = covera*dfloat((n-1))/dfloat(nzmax) xmax = dsqrt(1.0d0 - (zlayer(n)/covera)**2) dx = xmax/dfloat(mxmax) do m = 1,mxmax+1 xvalue(n,m) = dfloat(m-1)*dx ncount = ncount+1 if(m.eq.(mxmax+1))then yvalue = 0.0d0 else yvalue = bovera*dsqrt(1.0d0 - (zlayer(n)/covera)**2 - xvalue(n,m)**2) endif pt3xx(ncount) = xvalue(n,m) pt3yy(ncount) = yvalue pt3zz(ncount) = zlayer(n) enddo enddo nverts = ncount nfloats = 3*nverts ! write(*,503)nverts write(*,599) write(*,600) write(*,601)nfloats ! write(*,501) ! do n=1,ncount ! npt = n - 1 ! write(*,502)npt,pt3xx(n),pt3yy(n),pt3zz(n) ! enddo do n=1,ncount write(*,602)pt3xx(n),pt3yy(n),pt3zz(n) enddo write(*,603) write(*,604) write(*,605)nverts !!! !!! Finished determining coordinates of all [nzmax x (mxmax+1) + 1] vertices. !!! !!! Now identify triangles ! write(*,504) nt1 = 0 nt2 = nverts - mxmax numtri = 0 do ell=1,mxmax triangle(ell,1) = nt1 triangle(ell,2) = nt2-1 triangle(ell,3) = nt2 triangle(ell,4) = ell-1 nt2 = nt2 + 1 ! write(*,505)triangle(numtri+1,4),triangle(numtri+1,1),& ! &triangle(numtri+1,2),triangle(numtri+1,3) numtri = numtri+1 enddo numtri = numtri+1 do nzslice=1,nzmax-1 !!!!! ! ! Phase 2 ! !!!!! ! nzslice=1 ellmin = nverts - nzslice*(mxmax+1) ellmax = ellmin + mxmax - 1 ! numtri = numtri+1 ! write(*,510)nzslice,numtri,ellmin,ellmax do ell=ellmin,ellmax triangle(numtri,1) = ell triangle(numtri,2) = ell-(mxmax+1) triangle(numtri,3) = ell - mxmax triangle(numtri,4) = numtri-1 numtri = numtri + 1 triangle(numtri,1) = ell triangle(numtri,2) = ell - mxmax triangle(numtri,3) = ell + 1 triangle(numtri,4) = numtri-1 numtri = numtri + 1 enddo enddo numtri = numtri-1 !!!!! ! ! write(*,507)numtri ! !!!!! nfloats=3*numtri write(*,606) write(*,607) write(*,608) write(*,609) write(*,610)nfloats do nt1=1,numtri n1st = triangle(nt1,1) n2nd = triangle(nt1,2) n3rd = triangle(nt1,3) x1 = pt3xx(n1st+1) y1 = pt3yy(n1st+1) z1 = pt3zz(n1st+1) x2 = pt3xx(n2nd+1) y2 = pt3yy(n2nd+1) z2 = pt3zz(n2nd+1) x3 = pt3xx(n3rd+1) y3 = pt3yy(n3rd+1) z3 = pt3zz(n3rd+1) call Normals(x1,y1,z1,x2,y2,z2,x3,y3,z3,xnorm,ynorm,znorm) ! write(*,505)triangle(nt1,4),triangle(nt1,1),& ! &triangle(nt1,2),triangle(nt1,3),xnorm,ynorm,znorm write(*,602)xnorm,ynorm,znorm enddo write(*,603) write(*,604) write(*,611)numtri write(*,606) write(*,607) write(*,608) write(*,609) write(*,612) write(*,613) write(*,614) write(*,615)numtri write(*,616) write(*,617) ! do nt1=1,numtri write(*,621)triangle(nt1,1),triangle(nt1,4),& & triangle(nt1,3),triangle(nt1,4),& & triangle(nt1,2),triangle(nt1,4) enddo ! write(*,618) write(*,619) write(*,620) stop end program ThreeDEllipsoids Subroutine Normals(x1,y1,z1,x2,y2,z2,x3,y3,z3,xnorm,ynorm,znorm) real*8 x1,y1,z1,x2,y2,z2,x3,y3,z3,xnorm,ynorm,znorm real*8 xlength,ylength,zlength,length xlength = (y2-y1)*(z3-z1) - (y3-y1)*(z2-z1) ylength = (z2-z1)*(x3-x1) - (z3-z1)*(x2-x1) zlength = (x2-x1)*(y3-y1) - (x3-x1)*(y2-y1) length = dsqrt(xlength**2 + ylength**2 + zlength**2) xnorm = -xlength/length ynorm = -ylength/length znorm = -zlength/length return end </pre> </div> </td> </tr></table> In the fortran code, "Subroutine Normals" is called upon to determine the normal (unit vector) to the plane that is uniquely defined by each individual triangle. It accomplishes this as follows. The vectors that extend from the coordinate origin to, respectively, the 1<sup>st</sup>, 2<sup>nd</sup> and 3<sup>rd</sup> vertex of the relevant triangle are defined by the expressions, <table border="0" cellpadding="5" align="center"> <tr> <td align="right"> <math>~{\vec{x}}_1</math> </td> <td align="center"> <math>~=</math> </td> <td align="left"> <math>~\hat\imath x_1 + \hat\jmath y_1 + \hat{k} z_1 \, ,</math> </td> </tr> <tr> <td align="right"> <math>~{\vec{x}}_2</math> </td> <td align="center"> <math>~=</math> </td> <td align="left"> <math>~\hat\imath x_2 + \hat\jmath y_2 + \hat{k} z_2 \, ,</math> </td> </tr> <tr> <td align="right"> <math>~{\vec{x}}_3</math> </td> <td align="center"> <math>~=</math> </td> <td align="left"> <math>~\hat\imath x_3 + \hat\jmath y_3 + \hat{k} z_3 \, .</math> </td> </tr> </table> The vector that points from the first vertex — associated with coordinate point <math>~(x_1, y_1, z_1)</math> — to the second vertex — associated with coordinate point <math>~(x_2, y_2, z_2)</math> — is, <table border="0" cellpadding="5" align="center"> <tr> <td align="right"> <math>~{\vec{x}}_{12}</math> </td> <td align="center"> <math>~=</math> </td> <td align="left"> <math>~{\vec{x}}_2 - {\vec{x}}_1</math> </td> <td align="center"> <math>~=</math> </td> <td align="center"> <math>~\hat\imath(x_2 - x_1) + \hat\jmath(y_2 - y_1) + \hat{k}(z_2 - z_1) \, ;</math> </td> </tr> </table> this vector aligns with one of the three edges of the triangle. Likewise, the vector that points from the first vertex to the third vertex and therefore aligns with one of the other two edges of the triangle is, <table border="0" cellpadding="5" align="center"> <tr> <td align="right"> <math>~{\vec{x}}_{13}</math> </td> <td align="center"> <math>~=</math> </td> <td align="left"> <math>~{\vec{x}}_3 - {\vec{x}}_1</math> </td> <td align="center"> <math>~=</math> </td> <td align="center"> <math>~\hat\imath(x_3 - x_1) + \hat\jmath(y_3 - y_1) + \hat{k}(z_3 - z_1) \, .</math> </td> </tr> </table> A vector, <math>~\vec{h}_\perp</math>, that is normal to the face of this specific triangle will be given by the cross product of these two vectors, that is, <table border="0" cellpadding="5" align="center"> <tr> <td align="right"> <math>~\vec{h}_\perp</math> </td> <td align="center"> <math>~=</math> </td> <td align="left"> <math>~{\vec{x}}_{12} \times {\vec{x}}_{13}</math> </td> </tr> <tr> <td align="right"> </td> <td align="center"> <math>~=</math> </td> <td align="left"> <math>~ \hat\imath[(y_2-y_1)(z_3-z_1) - (y_3 - y_1)(z_2-z_1)] </math> </td> </tr> <tr> <td align="right"> </td> <td align="center"> </td> <td align="left"> <math>~ + \hat\jmath[(z_2-z_1)(x_3-x_1) - (z_3 - z_1)(x_2-x_1)] </math> </td> </tr> <tr> <td align="right"> </td> <td align="center"> </td> <td align="left"> <math>~ + \hat{k} [(x_2-x_1)(y_3-y_1) - (x_3 - x_1)(y_2-y_1)] \, . </math> </td> </tr> </table> Hence, the unit vector that is normal to the face of this triangle is, <table border="0" cellpadding="5" align="center"> <tr> <td align="right"> <math>~\hat{n}_\perp</math> </td> <td align="center"> <math>~=</math> </td> <td align="left"> <math>~\pm ~\frac{\vec{h}_\perp}{| \vec{h}_\perp |} \, .</math> </td> </tr> </table> (Whether the inferior or superior sign is chosen will depend on the circumstances. Usually the sign is chosen such that the normal vector points ''away from'' the face of the triangle that is part of the outward-facing surface and therefore will be illuminated.) For completeness, we note that the vector magnitude that serves to normalize the right-hand side of this equation is defined by the expression, <table border="0" cellpadding="5" align="center"> <tr> <td align="right"> <math>~| \vec{h}_\perp |</math> </td> <td align="center"> <math>~=</math> </td> <td align="left"> <math>~\sqrt{ [(y_2-y_1)(z_3-z_1) - (y_3 - y_1)(z_2-z_1)]^2 + [(z_2-z_1)(x_3-x_1) - (z_3 - z_1)(x_2-x_1)]^2 + [(x_2-x_1)(y_3-y_1) - (x_3 - x_1)(y_2-y_1)]^2 } \, . </math> </td> </tr> </table>
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