1 Reply Latest reply on Apr 29, 2010 10:41 PM by 794459



      I am trying to develop a graphical tool that can draw lines, cubes, spheres, triangles and polygon, The first three can be drawn by now. The triangle and polygon requires the code.

      I would like someone to give me a start with the transformation. The transformation is expected to take place when respective Jmenu options are selected. Can a sample code for a single transformation (let it be shearing along X-axis be provided). I can do the remaining in similar fashion. Also if possible tell me how to pick an individual object and conduct the transformations on it in the above said mode.

      The full code cannot be added due to the restriction of 7500. So I am adding the link to the same question that I asked in another forum.

      What I require is this.
      menu = new JMenu("View");
      menu.add(createMenuItem("View", "Triangle", this));
      menu.add(createMenuItem("View", "Polygon", this));
      //public BranchGroup triangle() {
      /*Require code for Triangle /*
      //public BranchGroup polygon() {
      /*require code for Polygon*/
      public void shearx()
          /*require sample code*/
      else if (command.equals("Triangle"))
      else if (command.equals("Polygon"))
      else if (menu.equals("Shear")) {
      if (command.equals("X-axis")) {
      Thank you
        • 1. Re: Transformations
          Look up the Transform 3D class. It allows you to construct
          transformations using (I believe) arbitrary 4x4 homogeneous matrices. A
          shear transformation along the x-axis can be represented as something

          1 1 0 0
          0 1 0 0
          0 0 1 0
          0 0 0 1

          You might
          first want to look inside the Transform 3D class to see whether it has a
          predefined shear transformation, though.