Back to Stickman3D Tutorial <h2>3D Coordinate System and Rotation<a id="Stickman modification"></a></h2> This tutorial provides basic information about JavaFX 3D Coordinate System and Rotation of Stickman3D. In JavaFX, locations are described with x, y, z coordinates. Increasing coordinates go along the x-axis to the right, along the y-axis downwards, and along the z-axis out of the screen. See Fugure 1 <figure style="display: inline-block; border: 1px dotted gray; margin: 20px;"> <img src="../images/tutorials/stickman/3D_coord_sys.PNG" /> <figcaption style="text-align: center; border: 1px dotted blue;">Figure 1</figcaption> </figure> You can place 3D objects at the point p (0,0,0,) and move them to wherever you want. <figure style="display: inline-block; border: 1px dotted gray; margin: 20px;"> <img src="../images/tutorials/stickman/XYZ.gif" /> <figcaption style="text-align: center; border: 1px dotted blue;">Figure 2</figcaption> </figure> Because "Stickman 3D" consists of 3D objects, we can move these objects in 3D like the Figure 2. For this we have to create <b>"Translate</b>" object in convenient class and add in the relaying object's "<b>Transformation</b>" An<p align="center"> example of the class HeadFX </p> TriangleMesh mHeadTriangleMesh; public MeshView mHeadMeshView; public Group mHead; ... url = getClass().getClassLoader().getResource("BodyParts/Head.stl"); im = new StlMeshImporter(); im.read(url); mHead = new Group(); mHeadTriangleMesh = im.getImport(); ... mHeadMeshView = new MeshView(mHeadTriangleMesh); mHead.getChildren().add(mHeadMeshView); ... Translate translation = new Translate(mXTranslation, mYTranslation, mZTranslation); mHead.getTransforms().clear(); mHead.getTransforms().addAll(translation); <h2>Rotation</h2> "3D-Rotation" is harder in JavaFX. Stickman3D consists of few body parts(for example : DownBody, HeadFX, LeftUpperArm, LeftForeArm, LeftWris..., which are in Package de.dfki.stickman3D.body). Each body part has it's local coordinates system in 3D-dimension.In order to be the rotation right , it is necessary to pay attention to body parts dependence to each other. For example : if we make "LeftUpperArm" rotation , it will cause it's parts transformation which are in the group. ("LeftForeArm", "LeftWrist", "LeftFinger1...LeftFinger4"), so it's local coordinate system will change. <div class="image123"> <div style="float:left;"> <figure style="display: inline-block; border: 1px dotted gray; margin: 20px;"> <img src="../images/tutorials/stickman/start_Local_coor_sys.PNG" width="250"/> <figcaption style="text-align: center; border: 1px dotted blue;">Startposition and local coordynate<br/> systems for LeftUpperArm<br/> and LeftForeArm</figcaption> </figure> </div> <div style="float:left;"> <figure style="display: inline-block; border: 1px dotted gray; margin: 20px;"> <img src="../images/tutorials/stickman/after_Rotation.PNG" width="250"/> <figcaption style="text-align: center; border: 1px dotted blue;">After 30 degrees rotation<br/> on the X-axis</figcaption> </figure> </div> </div> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> In order to see , how rotation operates on any part and make it's visualization, we can use "RotationHelper" called "Rotation" in "Control Panel". Here we can see rotation effect beforehand and X,Y,Z convenient meanings. <img src="../images/tutorials/stickman/rot_effect.png"/> <h2></h2> <ul> <li><a href="tut_Stickman3D_Modification.html">Next: Stickman3D modication </a> </li> </ul>
Back to Stickman3D Tutorial