How to add two objects on scene and how to rotate them?

I am beginer on 3d. I am trying do write applet where are 3x3x3 rubic.
My plans are to have 27 litle cubes. There are 6 flats (9 cubes in a flat) so i have six objects groups. My problem at this moment is that i cant find out how to make two objets. Each of this two objects consists from couple more litle objects. Some of litle objects can be in first and second big object. For example it can be two flats of rubic (corner).
Is anybody have some examples or somehow to hepl me to find out.
Thanks a lot

I have code :
import java.applet.Applet;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import com.sun.j3d.utils.applet.MainFrame;
import com.sun.j3d.utils.behaviors.mouse.*;
import com.sun.j3d.utils.universe.SimpleUniverse;
import javax.media.j3d.*;
import javax.vecmath.AxisAngle4f;
import javax.vecmath.Color3f;
import javax.vecmath.Vector3f;
public class RubicApplet extends Applet implements MouseListener
     TransformGroup objRotate = null;
public BranchGroup createSceneGraph(SimpleUniverse su,Canvas3D canvas)
     // Create the root of the branch graph
     BranchGroup objRoot = new BranchGroup();
     objRoot.setCapability(BranchGroup.ALLOW_DETACH);
Transform3D transform = new Transform3D();
     transform.setRotation(new AxisAngle4f(.5f,1f,1f,.5f));
BoundingSphere behaveBounds = new BoundingSphere();
// create Cube and RotateBehavior objects
objRotate = new TransformGroup(transform);
objRotate.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
objRotate.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
objRotate.setCapability(TransformGroup.ENABLE_PICK_REPORTING);
// Colors
Color3f gray = new Color3f(0.2f,0.2f,0.2f);
Color3f red = new Color3f(1.0f,0.0f,0.0f);
Color3f white = new Color3f(1.0f,1.0f,1.0f);
Color3f yellow = new Color3f(1.0f,1.0f,0.0f);
Color3f green = new Color3f(0.0f,1.0f,0.0f);
Color3f blue = new Color3f(0.0f,0.0f,1.0f);
Color3f purple = new Color3f(1.0f,0.0f,1.0f);
     // Object possition
float x=-0.5f;
float y=-0.5f;
float z=-0.5f;
objRoot.addChild(objRotate);
     // colors for: back, front, right, left, bottom, top
Color3f[] myColors0 = {white,gray,gray,red,blue,gray};
RCube cube1 = new RCube(myColors0,new Vector3f(x-1,y-1,z-1));
     // colors for: back, front, right, left, bottom, top
Color3f[] myColors1 = {gray,gray,gray,red,blue,gray};
     RCube cube2 = new RCube(myColors1,new Vector3f(x-1,y-1,z+1));
     // colors for: back, front, right, left, bottom, top
Color3f[] myColors2 = {gray,yellow,gray,red,blue,gray};
     RCube cube3 = new RCube(myColors2,new Vector3f(x-1,y-1,z+3));
// colors for: back, front, right, left, bottom, top
Color3f[] myColors3 = {white,gray,gray,red,gray,gray};
     RCube cube4 = new RCube(myColors3,new Vector3f(x-1,y+1,z-1));
objRotate.addChild(cube1);
objRotate.addChild(cube2);
objRotate.addChild(cube3);
objRotate.addChild(cube4);
MouseRotate myMouseRotate = new MouseRotate();
myMouseRotate.setTransformGroup(objRotate);
myMouseRotate.setSchedulingBounds(new BoundingSphere());
objRoot.addChild(myMouseRotate);
MouseTranslate myMouseTranslate = new MouseTranslate();
myMouseTranslate.setTransformGroup(objRotate);
myMouseTranslate.setSchedulingBounds(new BoundingSphere());
objRoot.addChild(myMouseTranslate);
MouseZoom myMouseZoom = new MouseZoom();
myMouseZoom.setTransformGroup(objRotate);
myMouseZoom.setSchedulingBounds(new BoundingSphere());
objRoot.addChild(myMouseZoom);
// Let Java 3D perform optimizations on this scene graph.
objRoot.compile();
     return objRoot;
public RubicApplet()
setLayout(new BorderLayout());
GraphicsConfiguration config =SimpleUniverse.getPreferredConfiguration();
Canvas3D canvas3D = new Canvas3D(config);
canvas3D.addMouseListener(this);
add("Center", canvas3D);
SimpleUniverse simpleU = new SimpleUniverse(canvas3D);
BranchGroup scene = createSceneGraph(simpleU,canvas3D);
     simpleU.getViewingPlatform().setNominalViewingTransform();
simpleU.addBranchGraph(scene);
public static void main(String[] args)
Frame frame = new MainFrame(new RubicApplet(), 600, 600);
     public void mouseClicked(MouseEvent e)
     public void mouseEntered(MouseEvent e)
     public void mouseExited(MouseEvent e)
     public void mousePressed(MouseEvent e)
     public void mouseReleased(MouseEvent e)
I need to rotate with some event two cubes and with some other event rotate three cubes

Similar Messages

  • How to add standard text in PO and how it is maintained ?

    How to add standard text (paragraph) in PO and how it is maintained ?

    Hi
    Please go through this document.which has a step by step
    Working with Frequently Used Texts
    Use
    You can copy texts from various sources to create PO texts:
    Standard texts
    Certain standard texts are supplied with the system and can be assigned to a purchasing document in Customizing.
    The content of some standard texts is predefined by your system administrator.
    You can also create standard texts yourself and copy them into purchasing documents.
    Master records
    Database fields
    Activities
    Creating Standard Texts
    You can create your own standard texts via Tools ® SAPscript ® Standard text.
    Inserting Standard Texts
    You can insert your standard text on the long text screen via Insert ® Text ® Standard.
    For more information, refer to the Basis documentation under BC Word Processing with the SAPscript Editor:  Including Texts.
    You can display the print preview via Text ® Print ® Print preview.
    Inserting Texts from the Master Record
    There are three ways of linking texts from a master record with a purchasing document. The relevant settings are made for each text type in Customizing for Purchasing. The indicator in the status column shows the nature of the linkage.
    Option                                              Indicator in status column
    The text is copied:               
    It is then independent of the text                 None
    in the master record. Changes to
    the text in the material master record
    have no influence on the text in the document.
    The text is displayed only:
    It cannot be adopted.                                          N
    The text is offered for copying:
    It can be copied via Header or Item ® Texts ® Adopt text. (In requisitions: Goto ® Texts ® Adopt text.) Changes made in the master record will also be adopted in the document until such time as you copy the text.
    Inserting Texts from Database Fields
    You can include the content of a database field at any point in the text on the long text screen. A value specific to the relevant document is displayed in the printed document.
    Choose Insert ® Symbols ® Program symbols.
    Choose DDIC fields.
    Search for the relevant table/structure (in the case of PO items, this is EKPO) and then choose ENTER .
    Choose the relevant table field.
    Choose Text ® Print preview to see the print preview.
    Reward if useful
    Aasif

  • How to Add New Object?

    HI,
    Any body can say how to add new object. For Example: The Document need to link with Invoice Transaction (T.Code: VF01, Table: VBRK/VBRP).
    Points will be rewarded, if information is useful.
    Tks
    Mani.

    Hi
    You can create New objects using the T.code: SE80.
    You can make an object link to SAP objects that are not shown in the possible entries list. To do this, proceed as follows:
    1. In the standard system, there are already two special screens for the module pools SAPLCV130 and SAPLCV140 for the linked SAP object.
    You must create two new screens with the same number for the module pools SAPLCV130 and SAPLCV140. The processing logic must follow that of screen 1204 in program SAPLVC130.
    2. Create function module OBJECT_CHECK_XXXX (XXXX = object name) If the object can be classified, this function module already exists .
    Otherwise copy the function module for linking equipment DOCUMENT_CHECK_EQUI and change it as required for the new object.
    Regards
    S.Sivakumar
    Reward points if useful----

  • How to add two columns in OBIEE report?

    Hi to All,
    Can anyone tell me how to add two columns in OBIEE report and get that result in a new column?
    Thanks in Advance,
    Thenmozhi

    Assume you already have two columns SalesAmt1 and SalesAmt2, and you want to derive 3rd column say SalesAmt3 which would be the sum of SalesAmt1 and SalesAmt2.
    For this, as I mentioned above pull SalesAmt1 and SalesAmt2 columns in Report. Now pull another column (say SalesAmt1) and open the fx. Clear the contents of fx. Now locate the columns button in the bottom of the fx. From Here, first select SalesAmt1 and + sign and the select SalesAmt2.
    Now in this new column, the fx should look like SalesAmt1 + SalesAmt2.
    Let me know if you are looking for something else.
    Thanks

  • How to add two X Axis in the Column chart?Need Help

    Hi,
    I have a requirement to add two X axis in the SSRS column chart.Can someone please help how to add two X axis. I tried the secondary axis for horizontal axis but current x axis is shifting to other side, second X axis is not coming.
    Regards
    Jon

    Hi Jon,
    According to your description, you want to add secondary X axis for one series in a column chart, right?
    The secondary axis is useful when comparing two value sets with two distinct data ranges that share a common category. In Reporting Services, it’s not supported to create two X axis for one series. We can create secondary X axis when there are two series
    in a column chart. As we tested in our local environment, we can add secondary X axis for specific series. Please refer to the screenshots below:
    So I would like to know what’s your exact needs about creating two X axis for one series. If possible please share some detail information about your data and expected looking of the chart.
    Reference: Plot Data on a Secondary Axis (Report Builder and SSRS)
    If you have any question, please feel free to ask.
    Best regards,
    Qiuyun Yu

  • How to add two zeros end of field

    how to add two zeros end of field?

    Hi srinu,
    If it's a number field, then just multiply by 100.
    If it's a string, then just use CONCATENATE and add the '00' to your existing string.
    Hope this helps.
    SL

  • How to compare two Objects !!!!

    Hi All,
    I know that this question has been asked 100 times till now. But trust me I have checked all of them but couldn`t find answer. Here is my question:
    I have an objecs. In that object I am setting (Id,Name,DOJ). Now I want to check whether the object I am trying to save in database already exists or not. If exists then I need to check whether all the setters are same for the two objects. Now can anyone tell me ,how to compare two objects directly without comparing the setters individually.
    Thanks in advance.

    pavan13 wrote:
    That is pretty good idea. However I have a query. Does that code actually compare all the setters in a two beans. I don`t want to check each setter seperately.Well, it's pretty meaningless to talk about "comparing setters", setters are methods, they don't have values to compare. Because equals is inside the class, you can simply compare the fields that get set by the setters. "Properties" is probably a better name.
    In principal you could write something that tried to find all relevant fields and compare them, using reflection or bean info stuff. The resulting code would be about 50 times longer and take about 50 times longer to run. It's hardly asking a lot to put three comparisons between && operators.
    Remember, though, not to compare string fields with ==, you should call .equals on the string fields.
    p.s. don't let the bean terminology confuse you. Beans are just ordinary objects which follow a few rules. Personally I wish the term had never been coined.
    Edited by: malcolmmc on Dec 6, 2007 4:15 PM

  • How to add two different page numbers in a single page

    How to add two different page numbers in a single page? One is for page number of the whole article, the other one is for page number for each chapter in the article.

    It's quite complicated, see
    Two Page Numbering Schemes in the Same Document.
    Regards, Hans Vogelaar (http://www.eileenslounge.com)

  • 1- How do I animate a layer? and how do I add the clips that I've edited into the whole video?

    I'm super new to this. All I need are some simple instructions to these questions: 1- How do I animate a layer? and how do I add the clips that I've edited into the whole video? I know there's probably something on Adobe's website telling me these things, but I prefer this kind of thing.

    Rick has pointed you to a good set of resources. (I may be biased, since I created those resources.)
    Here is a larger set of resources for learning After Effects:
    http://adobe.ly/AE_basics

  • How to add new currency in ORCO and ORBO

    Hi, I have successfully install ORCO, ORBO and ORPOS. I followed Implementation Guide, Volume 1 – Implementation Solutions to add new currency in ORPOS.
    But I still do not know how to add new currency in CO and BO.
    I try to use import parameter feature in ORCO and ORBO to import xml, the result said "Success" but there is no changes.
    Please help show how I could achieve this.

    I change the FL_CNY_BASE into 1 already. POS is OK now. But BO is not regconize that there is a new currency. I'm trying to go to
    Admin -> Job Manager -> Available Import -> Import BackOffice Parameters
    and try to import xml file that contain belowing content.
    <?xml version="1.0" encoding="UTF-8" ?>
    <CurrencyImport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="CurrencyImport.xsd" Priority="0" FillType="FullIncremental" Version="1.0" Batch="1" CreationDate="2001-12-17T09:30:47.0Z" ExpirationDate="2027-12-17T09:30:47.0Z">
    <!-- Example of adding a Currency. -->
    <Currency ChangeType="ADD" ISOCode="MYR" IssuingCountryCode="MY" Name="MYR" IssuingCountryNationality="Malaysian" IsBaseCurrency="true" Scale="2" Priority="0" />
    <ExchangeRate ChangeType="ADD" CurrencyCode="MYR" MinimumAmount="0.00" EffectiveDate="2008-05-26" ExpirationDate="2050-06-02" ToBuyAmount="2" ToSellAmount="2" ServiceFeeAmount="0.00" />
    </CurrencyImport>
    The result said it success but I still cannot see any change.
    Is there is any other things I should make change at BO? Any property file that I should make change? BO and CO is web application so the structure of files are not the same as POS. I can't following the same thing when I had made with POS for BO and CO.
    Thanks for you helping

  • How to add Two Columns in SQL

    How to add Two Columns in SQL
    For Example
    Jan Feb
    215 NULL
    How to add these two values in SQL

    Anything + NULL is NULL.
    Check this:
    SQL> SELECT 1 + NULL from dual;
        1+NULL
    SQL> You have to do this:
    SQL> with t as (SELECT 235 JAN, NULL FEB FROM dual)
      2  SELECT NVL(JAN,0) + NVL(FEB,0) FROM t;
    NVL(JAN,0)+NVL(FEB,0)
                      235
    SQL>

  • How to add my html title tag and html meta name and meta keywords

    how to add my html title tag and html meta name and meta keywords in iweb 09

    Like you will see on Roddy's page iWeb SEO Tool will do the job very easily:
    Click to view full size
    Click to view full size
    It remembers what tags went to which pages so they are easily reapplied when you have to republish.
    OT

  • How can i do with labview program,when i have 20 different values,and 1 want to add it with constant value.and how to get the results?

    how can i do with labview program,when i have   20 different values,and 1 want to add it with constant value.and how to get the results?

    Why do the 20 values have to be different? The same code should work even if some are equal.
    What do you mean by "get the result"? The result is available at the output terminal and all you need is a wire to get it where you need it. That could be an indicator, another operation, or even a hardware device.
    What is the data type of the 20 values? An array? A cluster? A bunch of scalars? A waveform? Dynamic data?
    LabVIEW Champion . Do more with less code and in less time .

  • How to install FLEX in SAP WAS and How to deploy project into SAP EP ?

    Hi.
    I want to create SAP EP Contents using FLEX and I have serveral question about this.
    1. How to install Flex into SAP EP and What do I have to install ?
    2. When we developing SAP EP Contents using FLEX,
        Which Tool do I have to use ? (NWDS or Flex Builder)
    3. After we develop contents, How can I deploy into SAP EP and
       How to create iView for Flex Application ?
    Sorry for many question.
    Kindly explain this.
    Regads, Arnold.

    Hi Arnold,
    here my answers to your questions:
    1) You don't need to install flex under EP, you need only adobe flash player 9 on EP
    2) If you want to develop a SAP Ep cont using Flex, you need adobe flex builder 2 or 3 (ide based).
    3)You can store under any EP folder (es. KM) the .swf  object and html page of FLEX application, create an iView and call the url link
    or load the .swf as mime object in BSP on backend syst, include in a bsp page and create iView for bsp..
    Regards
    Raffaele

  • How many types of authentications in sharepoint and how to implement those authentication in sharepoint?

    Hi All,
    How many types of authentications in sharepoint and how to implement those authentication in sharepoint?
    can any one explain the above things with examples?
    Thanks in Advance!

    In addition to
    A Sai Gunaranjan you can also check this URL for Sharepoint 2010:
    http://technet.microsoft.com/en-us/library/cc288475(v=office.14).aspx
    http://www.codeproject.com/Tips/382312/SharePoint-2010-Form-Based-Authentication
    ***If my post is answer for your query please mark as answer***
    ***If my answer is helpful please vote***

Maybe you are looking for

  • UK Payroll : Pension Fund Implementation

    Dear Techies, I am new in UK Payroll, Can you please guide me what are all the details we need from the core user as a part of configuration of Pension Fund. As I know we need Pension Calculation Scheme & Pension Calrulation Rule to do the same, If a

  • Ipod Video 30gb isn't recognized by My Computer or Itunes.

    My ipod is not recognized by any pc I connect it to. When I connect the usb cable all it does is charge the Ipod itself but it doesn't connect. I tried the 5r's of apple but none of them work. How do I fix this with out going to the apple center to p

  • DDL is not working on table!

    Hi all' I have a problem in one of my db schema. All of a sudden all views and triggers vanished and one of the tables is not allowing any ddl showing that resources are busy so lock could not be acquired . Instant help is needed. Thanks in advance

  • Collecting and bundling messages - transformation n- 1 messages problem

    Hi guys, I try to implement the scenario with collecting and bundling messages. I have a question: when you look at the samples in Basis6.40 SW Component, namespace http://sap.com/xi/XI/System/Patterns, there is an example, which uses message mapping

  • Setting Undo/Redo menu text

    When artwork is changed, the text for the Undo menu will be something like "Undo Move" or "Undo Color".  The AIUndo suite has a SetUndoText function that "Specifies the localizable text for Undo and Redo menu items".  However, when I use this functio