Getting current coordinates

Hi,
I'm very new to J3d, I'm creating a solar system simulator for a uni project and I've got most of it working. The issue I have is that when I stop the animation and want to adjust the view point to look at another planet say mars I can't seem to figure out how to get the current coordinates of the planet as they wil have changed from their current position code for creating mars
      * this private method creates the planet mars
     private BranchGroup createMars(){
          BranchGroup marsBG = new BranchGroup();
          TransformGroup mars = new TransformGroup();
          mars.setCapability(TransformGroup.ALLOW_LOCAL_TO_VWORLD_READ);
          mars.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
          mars.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
          TransformGroup marsRot = new TransformGroup();
          marsRot.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
          TransformGroup rotMarsSun = new TransformGroup();
          rotMarsSun.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
          rotMarsSun.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
          rotMarsSun.setCapability(TransformGroup.ALLOW_LOCAL_TO_VWORLD_READ);
          //perform rotations
          rotation(5000, marsRot);
          rotation(75000, rotMarsSun);
          //get textures
          TextureLoader marsTex = new TextureLoader(MARS, null);
          //set position
          Transform3D marsX = new Transform3D();
          marsX.setTranslation(new Vector3f(20.0f, 0.0f, 0.0f));
          mars.setTransform(marsX);
          //set Apperance
          Appearance marsApp = new Appearance();
          marsApp.setTexture(marsTex.getTexture());
          //set Material
          Material material = new Material();
          material.setDiffuseColor(white);
          material.setAmbientColor(white);
          material.setSpecularColor(white);
          marsApp.setMaterial(material);
          //create planets
          Sphere venusS = new Sphere(0.4f, Sphere.GENERATE_TEXTURE_COORDS
                    | Sphere.GENERATE_NORMALS, 40, marsApp);
          marsRot.addChild(venusS);
          mars.addChild(marsRot);
          rotMarsSun.addChild(mars);
          marsBG.addChild(rotMarsSun);
          return marsBG;
     }//end of create marscode for rotate
     private void rotation( int v, TransformGroup target  ) {
          Alpha a = new Alpha( -1, v );
          rotInter = new RotationInterpolator( a, target );
          rotBehaviours.add( rotInter );
          rotInter.setSchedulingBounds( BIGBOUNDS );
          rotInter.setTarget( target );
          alphaVector.add( rotInter );
          target.addChild( rotInter );
     } // end rotationnow when I call the marsBG.toString method it shows me all the current coordinates but am unable to get them out unless I use some elaborate regex. Their must be an easier way to do it just can't put my finger on it.
Thanks in advance

Hi,
I'm very new to J3d, I'm creating a solar system simulator for a uni project and I've got most of it working. The issue I have is that when I stop the animation and want to adjust the view point to look at another planet say mars I can't seem to figure out how to get the current coordinates of the planet as they wil have changed from their current position code for creating mars
      * this private method creates the planet mars
     private BranchGroup createMars(){
          BranchGroup marsBG = new BranchGroup();
          TransformGroup mars = new TransformGroup();
          mars.setCapability(TransformGroup.ALLOW_LOCAL_TO_VWORLD_READ);
          mars.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
          mars.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
          TransformGroup marsRot = new TransformGroup();
          marsRot.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
          TransformGroup rotMarsSun = new TransformGroup();
          rotMarsSun.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
          rotMarsSun.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
          rotMarsSun.setCapability(TransformGroup.ALLOW_LOCAL_TO_VWORLD_READ);
          //perform rotations
          rotation(5000, marsRot);
          rotation(75000, rotMarsSun);
          //get textures
          TextureLoader marsTex = new TextureLoader(MARS, null);
          //set position
          Transform3D marsX = new Transform3D();
          marsX.setTranslation(new Vector3f(20.0f, 0.0f, 0.0f));
          mars.setTransform(marsX);
          //set Apperance
          Appearance marsApp = new Appearance();
          marsApp.setTexture(marsTex.getTexture());
          //set Material
          Material material = new Material();
          material.setDiffuseColor(white);
          material.setAmbientColor(white);
          material.setSpecularColor(white);
          marsApp.setMaterial(material);
          //create planets
          Sphere venusS = new Sphere(0.4f, Sphere.GENERATE_TEXTURE_COORDS
                    | Sphere.GENERATE_NORMALS, 40, marsApp);
          marsRot.addChild(venusS);
          mars.addChild(marsRot);
          rotMarsSun.addChild(mars);
          marsBG.addChild(rotMarsSun);
          return marsBG;
     }//end of create marscode for rotate
     private void rotation( int v, TransformGroup target  ) {
          Alpha a = new Alpha( -1, v );
          rotInter = new RotationInterpolator( a, target );
          rotBehaviours.add( rotInter );
          rotInter.setSchedulingBounds( BIGBOUNDS );
          rotInter.setTarget( target );
          alphaVector.add( rotInter );
          target.addChild( rotInter );
     } // end rotationnow when I call the marsBG.toString method it shows me all the current coordinates but am unable to get them out unless I use some elaborate regex. Their must be an easier way to do it just can't put my finger on it.
Thanks in advance

Similar Messages

  • Get current event in iCal

    I'm trying to create a script that would run as a trigger to set my away message in Adium to currentEventName - eventLocation
    Theoretically, my code works, and it does... sometimes. I figure there is some bug in it I'm just missing. Any help would be appreciated. Note that this has to work for for repeated items. I have cut the date off at the minute since the date and time has to be exact - unless of course you know of a way to fix this. Thanks. Below is the code.
    set myEvent to "Unknown Event"
    --gets the current date minus the time
    set curDate to (weekday of (current date)) & ", " & month of (current date) & ¬
    " " & day of (current date) & ", " & year of (current date) as string
    set curTime to round ((time of (current date)) / 60) rounding down
    set curHour to round (curTime / 60) rounding down
    set curMin to curTime mod 60
    --fixes the 0 problem
    if curMin < 10 then
    set curMin to "0" & curMin as string
    end if
    if curHour > 12 then
    set today to curDate & " " & curHour - 12 & ":" & curMin & ":00 PM" as string
    else
    set today to curDate & " " & curHour & ":" & curMin & ":00 AM" as string
    end if
    --today should now be the correct time without the seconds
    set today to date today
    tell application "iCal"
    repeat with i from 1 to count of every calendar
    if myEvent is "Unknown Event" or myEvent is {} then
    set myEvent to (summary of every event of calendar i whose start date is today)
    set myPlace to (location of every event of calendar i whose start date is today)
    end if
    end repeat
    end tell
    if myEvent is {} then
    set myEvent to "Unknown Event"
    --display dialog "No event on " & today
    end if
    if myPlace is {} then set myPlace to "Unknown location"
    set myAway to myEvent & " - " & myPlace as string
    tell application "Adium"
    set my status type to away
    set my status message to myAway
    end tell
    PowerMac G5 DP 2.0Ghz   Mac OS X (10.4.6)   1.5GB RAM, 160GB SATA HD, 160GB ATA HD (enclosure)

    Apparently, it works even faster if executed from iCal (as opposed to running with the events tab closed).
    There were a couple of minor bug fixes, but I've tested it on a fake repeated event, and will see if it really works tomorrow.
    Known bugs:
    does not work for daily
    does not work for monthly (ie, things on the third sunday)
    For now though, this is fine as almost all my things are custom weekly events.
    Here's the code:
    --Get current time, current time without seconds, and day abbreviation
    set current_date to (current date)
    set today to current_date - (seconds of current_date)
    set now to (time of (current date)) - (seconds of (current date))
    log now
    log today
    set thisYear to year of (current date) as number
    set thisMonth to month of (current date) as number
    set thisDay to day of (current date) as number
    set thisDate to characters 1 thru 2 of (weekday of (current date) as string) as string
    log thisDate
    --Init vars
    set freq to ""
    set interval to ""
    set endDate to ""
    set myEvent to ""
    set myPlace to ""
    set setBool to false
    tell application "iCal"
    repeat with i from 1 to count of calendars
    if setBool is true then exit repeat
    repeat with j from 1 to count of events of calendar i
    set rec to recurrence of event j of calendar i as string
    set curDays to my getDays(rec, j, i)
    if thisDate is in curDays then --Check if the event ocurrs today
    set endDate to my getEnd(rec, j, i)
    --If the end date is equal or greater to the current date (minus seconds)
    if item 3 of endDate ≥ thisYear and (item 2 of endDate > thisMonth or (item 2 of endDate = thisMonth and item 1 of endDate ≥ thisDay)) then
    set eventStartTime to (start date of event j of calendar i)
    set eventStartTime to (time of eventStartTime) - (seconds of eventStartTime)
    if eventStartTime is now then
    set myEvent to summary of event j of calendar i
    set myPlace to location of event j of calendar i
    set setBool to true
    exit repeat
    end if
    end if
    end if
    end repeat
    end repeat
    end tell
    try
    if myEvent is "" then set myEvent to "Unknown Event"
    on error
    set myEvent to "Unknown Event"
    end try
    try
    if myPlace is "" then set myPlace to "Unknown Location"
    on error
    set myPlace to "Unknown Location"
    end try
    set myAway to myEvent & " - " & myPlace as string
    if myAway is "Unknown Event - Unknown Location" then set myAway to "Out. Call the cell."
    tell application "Adium"
    set my status type to away
    set my status message to myAway
    end tell
    --display dialog myAway
    (* Parse Recurrence *)
    on getFreq(str)
    try
    return word 3 of str
    on error
    return ""
    end try
    end getFreq
    --Not used right now, but I feel it should be...
    on getInterval(str)
    try
    return word 6 of str
    on error
    return ""
    end try
    end getInterval
    on getStartDay(eventNum, calNum)
    tell application "iCal"
    set startDay to items 1 thru 2 of (start date of event eventNum of calendar calNum as string) as string
    end tell
    return startDay
    end getStartDay
    on getEnd(str, eventNum, calNum)
    try
    set endDate to items 1 thru 8 of word 9 of str as string
    set endYear to items 1 thru 4 of endDate as string
    set endMonth to items 5 thru 6 of endDate as string
    set endDay to items 7 thru 8 of endDate as string
    set endYear to endYear as number
    set endMonth to endMonth as number
    set endDay to endDay as number
    log {endDay, endMonth, endYear}
    on error --It isn't a recurring event
    tell application "iCal"
    set endDate to end date of event eventNum of calendar calNum
    set endYear to year of endDate as number
    set endMonth to (month of endDate) as number
    set endDay to (day of endDate) as number
    log {endDay, endMonth, endYear}
    end tell
    end try
    return {endDay, endMonth, endYear}
    end getEnd
    on getDays(str, eventNum, calNum)
    set dayList to {"MO", "TU", "WE", "TH", "FR", "SA", "SU"}
    set recDays to {getStartDay(eventNum, calNum) of me}
    log recDays
    try
    repeat with i from 12 to length of str
    if word i of str is in dayList then
    set recDays to recDays & word i of str
    else
    exit repeat
    end if
    end repeat
    return recDays
    on error
    return recDays
    end try
    end getDays

  • PhotoShop Automation PlugIn: How do I get the coordinates of a polygonal selection?

    Hi.
    I try to get the coordinates out of a selection, but I can't find out how to do that.
    I tried to convert the selection into a path and get the coordinates from the path. That doesn't work either.
    Can somebody give me a list of parameters inside the action descriptor of keyPathContent in classPath? I assume that the point infos are located there...
    Thanx in advance,
    Christian

    found the answer myself. It might be helpfull to others.
    btn.addMouseListener(new MouseAdapter(){
    public void mouseClicked(MouseEvent e) {
    Rectangle ret = btn.getBounds();
    double y = ret.y + ret.getHeight();
    pop.show((Component) e.getSource(), ret.x, (int)y);
    }

  • Get current playlist in iTunes

    I'm pretty sure this worked at one time, but I don't know what was changed.
    I need to get the name of the currently selected playlist.The following command doesn't work on 2 different computers (10.4 & 10.3).
    tell application "iTunes" to get current playlist
    Looking at the dictionary from both machines, this should work. I'm totally confused, hopfully I'm just missing something stupid.
    Oh ya, the "current track" property has the same problem.
    Both properties only return "unknown object" error
    iBookG4/eMac/iMacx2/G3300/G4400   Mac OS X (10.4.2)  

    Current track & playlist only return info about what's playing. If nothing is playing, you'll get an error. What you want is the visible selection, which is obtained thusly:
    click here to open this script in your editor<pre style="font-family: 'Monaco', 'Courier New', Courier, monospace; overflow:auto; color: #222; background: #DDD; padding: 0.2em; font-size: 10px; width:400px">tell application "iTunes" to get view of front browser window</pre>You can also get the playlist from a visible track selection:
    click here to open this script in your editor<pre style="font-family: 'Monaco', 'Courier New', Courier, monospace; overflow:auto; color: #222; background: #DDD; padding: 0.2em; font-size: 10px; width:400px">tell application "iTunes"
    set selected_tracks to selection
    set selected_playlist to container of first item of selected_tracks
    end tell</pre>

  • Get Current row in Editable ALV

    Hi,
    I have editable alv, when i press "insert row" or "Append row" i need to get current inserted/appended row element reference or index.
    How can i get this??
    Please suggest.

    Hi kranthi ,
    While inserting row you must be selecting a row, you can get the index of the selected row by this following code
    get Index of selected table item
    CALL METHOD NODE_NAME->GET_LEAD_SELECTION_INDEX
    RECEIVING INDEX = Lv_Indx.
    ( DATA: Lv_Indx Type i )
    or while you are appending a row you can use Describe int_table LINES lv_line and use the value of 'lv_line' as the index.
    Regards

  • Get Current year in Query Designer

    Dear all
    I don't know how to determine current year in Query Designer.
    I have a report, i want to see some indexs in bance sheet and income statement in current year and previous year. but, I can only assign with the fixed year (ex, 2010), this is not flexible. I want to get current year on system and calculate previous year.
    Please help me solve this problem
    Thanks

    Hi,
    You can use the SAP Exit variable 0CALYEAR for current year. For Previous year you can offset this by -1.
    You can refer this link for more Information,
    http://help.sap.com/saphelp_bw33/helpdata/en/3f/89533e5ff4d064e10000000a114084/content.htm
    Regards,
    Hari.
    Edited by: Hari Krishnan K on Jul 20, 2010 10:36 AM

  • Get current LOCATION in ProcessFlow (PF) or Mapping

    How can I get current LOCATION from running PF or Mapping?
    I need to run PF.
    Name of PF passing via parameter of PF.
    I know about wb_rt_api_exec.run_task, but first parameter is LOCATION.

    It is possible to get location from ALL_RT_AUDIT_EXECUTIONS OWB public view (column OBJECT_LOCATION_NAME),
    if I understand your requirements properly.
    Filter rows from ALL_RT_AUDIT_EXECUTIONS via execution_audit_id, in processflow you can use predefined variable AUDIT_ID for currently running processflow audit id
    Regards,
    Oleg

  • How to get current tab name or tab id or related info?

    Hi ,
    I would like to hide/show tabs according to users' page privileges list. So I need get current tab ID or tab Name in runtime environment to know if show/hide it for current user. :APP_USER
    Could you please provide any info about this requirement? Or do you have alternative method to control tabs' hide/show?
    thanks
    Ruiping

    最爱用中文 wrote:
    Hi Jari,
    Thanks for your info. Even if set authorize schema to tabs, I still need to get the relationship between "current tab" and "privilege&users". So I think evrm's hard-code method above is avaliable.I agree with Jari: APEX provides Authorization schemes specifically for this purpose. You need to reverse your thinking on how to implement this.
    For more information consult the documentation on APEX security, specifically using authorization schemes to restrict access to pages and control rendering of components.
    Tutorial: Adding Security to your Database Application (APEX 4.0)
    Use Authorization Schemes to control access/rendering for security ("only managers see/access this page and it's associated tab"); and Conditions to control rendering for functional reasons ("region only displayed if account is in arrears").
    Authorization Schemes have the benefits of being reusable, performing better, and allowing central maintenance of security-related code. This makes it easier to change the implementation&mdash;say moving from role information held in database tables to groups defined in LDAP.
    I worked for a number of years with an application where authorization schemes are not properly used (decisions made before my involvement) and all security and business logic relating to rendering and processing is wrapped up in spaghetti code in conditions. It's impossible to maintain.
    It is of course advisable to make both authorization scheme and business logic condition code more reusable and maintainable by locating it in API packages.

  • How to get current view name on clicking device back button?

    Hi,
    iam wriing a function for handling device back button(in android) press in my app.controller.js .How to get current viewname when clicking device back button.
    code samples will be helpful.
    my app.controller.js looks like below
    sap.ui.controller("com.opensap.App", {
      onInit : function() {
      document.addEventListener("deviceready", onDeviceReady, false);
      onBeforeShow : function(evt) {
      navButtonTap : function(evt) { 
    function onBackKeyDown(){
      //alert("hai");
      //sap.ui.getCore().byId("SalesDetail").app.backToPage("ProductList");
      //sap.ui.getCore().byId("ProductList").app.backToPage("Dashboard");
      //sap.ui.getCore().byId("SupplierDetail").app.backToPage("Dashboard");
    function onDeviceReady(){
       document.addEventListener("backbutton", onBackKeyDown, false);

    I somehow managed to find the solution
    function onBackKeyDown(){
      var app = sap.ui.getCore().byId("LoginDetail").app;
      app.back();

  • How to get current row data in table control

    Hi , expert ,
       I am professional in oracle ,  but  now I am a new guy in SAP ABAP .
    I  have a question in UI
    How to get current row data and click pushbutton  in table control  to open next screen ?
    I want to get the current data and open next screen to carry out detail detail .
    Thansk for all your suggestion .

    GET CURSOR LINE SY-CUROW .
      READ TABLE internal_table index SY-CUROW.

  • How to get current PopUp Window

    Dear All,
    I am using NetWeaver 7.1 sp1 and facing a problem. Actually I want to show a view in popup window. The popup window works fine but i want to get currently popup window. How can i get it in View and controller ??
    I found a solution : wdContext.currentPopupElement().getWindowInstacnce();
    but in wdContext there is no method like .currentPopupElement(). plz help.

    Hi
    wdContext.currentPopupElement().getWindowInstacnce();
      Here PopupElement is a attribute of IWDWindow type where u have to put the window instances (say For close or life control of that popup)
    For further plz go through these doc
    1. [Dialog|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/903fed0d-7be4-2a10-cd96-9136707374e1&overridelayout=true]
    2. [Popup Window|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/a04870c5-749b-2b10-06ba-d25515ef39e3&overridelayout=true]
    Best Regards
    Satish Kumar

  • How to get current layer type (text, art, group layer, etc.)

    Hi,
    I am traversing over all layers using layerIndex.
    I can get current later name in following way.
    char* layerName = new char[100];
    int32 len = 100;
    PIUGetInfoByIndex(layerIndex,classLayer, keyName, layerName , &len) ;
    I need to get layer type using the someway. There exists a key called keyType.
    But I am not able access layer type that way. Why?
    If there is a better way, I wold like to know that too.

    Photoshop Scripting

  • How to get current layer type (text, art, group layer, etc.)r discussion here

    Hi,
    I am traversing over all layers using layerIndex.
    I can get current later name in following way.
    char* layerName = new char[100];
    int32 len = 100;
    PIUGetInfoByIndex(layerIndex,classLayer, keyName, layerName , &len) ;
    I tried  using the keys keyType and keyGroup in the same way but I am not able to directly get type of the layer. Why?
    Also, I found similar discussion, which is check the layer is SectionStart, SectionEnd or SectionContent.
    Get Layer Groups from C++ plugin
    If the layer is a "SectionContent", how to I further check its type (artlayer, textlater, adjustmentlayer, ect) ?

    apologize !
    I post the question in relevant forum. But I would like to ask extra explanation here.
    var ref = new ActionReference();                                                                                                               // create action reference
    ref.putProperty(stringIDToTypeID ("property"), stringIDToTypeID("layerKind"));                                            // add "layerKind" property to the reference
    ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );                   // what putEnumerated actually do ?
    var layerDesc = executeActionGet(ref);                                                                                                      // get the corresponding layer descriptor
    alert (layerDesc.getInteger(stringIDToTypeID("layerKind")));                                                                        / get its layerKind
    1. what putEnumerated actually do ?
    2. I am traversing each layer so that I have the layer object in JavaScript.
        How current layer object is refereed to above code segment ?

  • How to get current displayed position of an item in listcontrol ?

    Hi,
    can anyone please help me to get current displayed position of an item in a listbox control in vc++ mfc. I am using CListCtrl class to manipulate.
    Thanks,
    saffiuddin 

    On 4/11/2015 3:45 AM, "David Lowndes [MVP]" wrote:
    can anyone please help me to get current displayed position of an item in a listbox control in vc++ mfc. I am using CListCtrl class to manipulate.
    Have you tried GetItemPosition?
    ... or GetItemRect (a bit more information).
    Igor Tandetnik

  • How to get Current Row values in Af:ForEach

    Hi,
    We have a requirement to conditionally Display/Hide CommandLink item in af:forEach Loop.
    <af:forEach items="#{bindings.RegionalAreaPVO.rangeSet}" var="parent">
    <af:spacer height="10" id="s1"/>
    <af:commandLink inlineStyle="font-weight:bold;" text="#{parent.ItemName}" partialSubmit="true" actionListener="#{backingBeanScope.RegionalAreaBean.launchTaskflow}" id="cl1" rendered="*#{backingBeanScope.XXWFCRegionalAreaBean.modelEligibleflag eq true}*">
    <af:setActionListener from="#{parent.Code}" to="#{parentNode}"/>
    </af:commandLink>
    </af:forEach>
    I have added a Cutom Managed Bean Class and Returning boolean value to Control Render property which is working. But now i want to add business Logic based on 'parent.ItemName' or 'parentNode' Values in the bean method to return proper Boolean value.
    But i am unable to get the Current Iteration values in the bean method.
    I am using below EL expressions to get the values. But no luck.
    String nameel = (String)ADFUtil.evaluateEL("#{bindings.parent.ItemName}");
    String codeel = (String)ADFUtil.evaluateEL("#{parent.Code}");
    String nodeEl = (String)ADFUtil.evaluateEL("#{parentNode}");
    Also, i have tried getting the Row object like below but i am getting the First row details always. My intention is to get Current row values and use them for Business logic.
    ViewRowImpl row =
    (ViewRowImpl)ADFUtil.evaluateEL("#{bindings." + VoName +
    "Iterator.currentRow}");
    String code = (String)row.getAttribute("Code");
    Any help is highly appreciated.
    Thanks
    Kaja

    Hi Sascha,
    I have tried that. But in my case the functional logic behind the Rendering is based on more complex logic. Hence i am trying to add a method to return a boolean in Render property of the Link.
    But the real problem for me is, in the Managed bean method i am not finding a way to get the Current Iteration index. If i can get the Current iteration index, i can get the Corresponding Component ID of Command link (In the forEach Loop Component Id's are getting generated Dynamically based on Iteration Index), i can use that and add additional logic and derive true/false to return.
    Any inputs?
    Thanks
    Kaja

Maybe you are looking for