Get screen coordinates from 3d position

Hi,<br />When I use 3d JavaScript camera's getScreenFromPosition method, the screen Y returned is always 0. The following is the test code. Did I miss anything? Is there another way to get screen coordinates from 3d?<br /><br />I'd appreciate any help.<br /><br />Xintai<br /><br />// test code ==========================<br />function v3dToScreen(v,w,h)<br />{<br />   console.println("\n v=" + v + "  w = " + w + "  h ="+ h);<br />   cam = scene.cameras.getByIndex (0);<br />    <br />   screenV = cam.getScreenFromPosition(v, w, h);<br />   console.println( " converted: mx=" + screenV.x + "    my=" + screenV.y);<br />   console.println(screenV.toString());<br />   //console.println( " pdf mouse X=" + host.mouseX + "   pdf mouse Y=" + host.mouseY);<br />}<br /><br />console.println ("Click a 3D object to test getScreenFromPosition()");<br /><br />myMouseHandler = new MouseEventHandler();<br />myMouseHandler.onMouseDown = true;<br />myMouseHandler.onEvent = function(event)<br />{<br />   if(event.isMouseDown) {<br />    console.println("====== MouseDown =======");<br />    console.println("isMouseDown           = " + event.isMouseDown );<br />    <br />    for ( i=0; i<event.hits.length; i++ )<br />    {<br />         console.println ("   hits[" + i + "].position   = " + event.hits[i].position );<br />        <br />        if (event.hits[i].target != undefined)<br />        {<br />                        v3 = vent.hits[i].position;<br />                        v3dToScreen(v3,event.canvasPixelWidth,event.canvasPixelHeight);<br />        }<br />    }<br />   }<br />}<br /><br />runtime.addEventHandler(myMouseHandler);<br /><br />// end of test code ==========================

Hi Xintai,
This is a feature i would also like to use. I've tried using the script that you've provided but i cant get it to work. I assume this is the javascript (.js file) that you embed into the pdf? Is this all that's needed?
If you've managed to get this working, could you let me know how you did it?
Thanks
George

Similar Messages

  • How to center loaded swf & get screen coordinates of its component?

    I made an swf using Flash CS4, it has a movieclip named 'mc' & and a vertical bar centered horizontally. I then load it using swfloaded & put it inside a canvas & set it's windows & height to 100%.
    The codes:
    <mx:Canvas id="cv" verticalScrollPolicy="off" horizontalScrollPolicy="off" width="{screen.width}" height="{screen.height}">
      <mx:SWFLoader id="template" source="assets/sample.swf" width="100%" height="100%"  complete="dump(event);"/>
      <mx:HBox id="bb" />
    </mx:Canvas>
    <mx:Script>
    private function dump(event:Event): void {
         var panel:MovieClip = MovieClip(template.content);
         var pt:Point = panel.localToGlobal(new Point(panel.mc.x, panel.mc.y));
         bb.x = pt.x; bb.y = pt.y; bb.width=10; bb.height = 10;
         panel.x = (cv.width - panel.conentWidth) / 2;
         Alert.show(
              "scaleratio x,y = " + panel.scaleX + "," + panel.scaleY +"\n"
              + "panel x,y = " + panel.x + "," + panel.y + "\n"
              + "local x,y = " + panel.mc.x + "," + panel.mc.y + "\n"
              + "global x,y = " + pt.x + "," + pt.y + "\n"
    </mx:Script>
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The dump result is:
    scaleratio x,y = 1,1
    panel x,y = 100,800
    local x,y = 775, 800
    gloval x,y = 875, 800
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Q1. I draw an bound box according to the content object of this swf & saw this bound box is indeed centered. However, the bar object is some offset left from the center of screen. Why it's not aligned center as I saw it in Flash CS4?
    Q2. I try to get the screen coordinates of component 'mc' by using localToGlobal to convert it to screen coordinates & draw a box to overlap their top-left point. However the topleft point of box is far left of mc's on screen. I think it's due to the swf is scaled, so I dump scaleX and scaleY of this swf but they are both 1? How can I get correct screen coordinates of mc?
    Thanks in advance!
    Scott

    Because of margins and padding, the Canvas probably won't be positioned at
    0,0, so setting its width to screen.width will make it hang over the right
    edge.  Use width="100%" instead.  Same for height.
    I believe there is a horizontalAlign property on the SWFLoader.

  • Get Screen Resolution from Custom Reports

    I was wondering if it was possible to get the screen resolution of a workstation from the Custom Reports in ZCC ??
    Seb

    Originally Posted by sebastien
    I was wondering if it was possible to get the screen resolution of a workstation from the Custom Reports in ZCC ??
    Seb
    Hi Seb
    I'm out of the network so I can't double check this but I don't think Zen captures that information. If my memory serves it captures some PNP info from the screen like the manufacturer and product ID's.
    It looks like you could pull the data from the registry.
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Hardwa re Profiles\UnitedVideo\CONTROL\VIDEO\{EE167610-A476-4BE2-9CD6-C24D55DFF3B9}\0000
    I think the challenge will be that this key will vary from system to system. And if you have multiple monitor setups you would want to collect both sets of data.
    One way you could do this would be to deploy a bundle containing a small easily available executable called DumpEDID.exe (google it) This little command line utility does exactly what it says on the box. It reads the EDID data from the display and dumps the data back to the command shell.
    Then all you need to do is to run a script to retrieve this output and load it into a custom made registry key. From there you can then pull the registry data into Zen and even create an ADF field for the info.
    Hope this helps

  • Getting Z coordinates from Body Basics in SDK2.0

    Hi! I need to write a code for a project to detect the distance of a person's stride. I am using visual studio 2013 in WPF. How can i modify BodyBasics-WPF from the SDK to display the Z coordinates of the left and right foot in maybe a textbox?

    you might want to search on the forums for similar topics. The Kinect SDK doesn't provide any UI helpers and will only provide you the data of the joint. How you visualize or represent that on screen would be up to you.
    From the sample, you will note that every joint is in CameraSpace which provides an X/Y/Z value.
    Carmine Sirignano - MSFT

  • Is there an easy way to get GPS coordinates from Maps.app in Mavericks?

    My DSLR doesn't have a GPS built in, but I like to Geo-tag some of my photos. I usually just take a pic with my iPhone and then copy the geo data (GPS coordinates) and paste into the photos (in Adobe Lightroom). Unfortunately, I didn't have my phone with me. I have the location stored as a bookmark in Maps, but I don't see any easy way to just pull coordinates.

    Hi,
    I am doing the same thing too. I have to call my reports thru menu. I tried web.show_document in my menu and it works. I also added paramform=yes and it gives the report parameters, but I want to give the user the choice of format for the reports. eg. pdf, html, excel, etc. instead of hardcoding it.
    Could you please give me some idea on how can I do that??
    Thanks.

  • How can I get a baseline coordinate from a font

    Hi everybody.
    Does anybody know how to get the coordinates from the baselane of the font in a textfield?

    If a second-hand iOS device has been 'Activation locked' then only the previous owner can unlock it, either by providing you with the account ID and password, or by removing it from his list of devices (as he should have done before selling it) - please see http://support.apple.com/kb/ts4515
    If you are unable to contact him to do this then I'm afraid you will not be able to use the device - there is no other way of unlocking it at all. Apple cannot unlock it for you.
    You should if possible return it to the vendor and ask for a refund as in this event the device is completely useless.

  • How do I obtain the coordinates from an active X IMAQ container from use in another part of a vi?

    Is their a simple way to read the screen coordinates from the IMAQ Active X container produced by the example NI code IMAQ_vi.llb so I can use them in another part of a program?
    Many thanks
    Nick

    What is confusing me is the ActiveX reference. Are you using a non-standard display, or are you assuming it is ActiveX? The standard display (WindDraw) is not ActiveX as far as I know.
    To get a cursor coordinate within the WindDraw window, use IMAQ WindLastEvent. You can input that you are looking for mouse clicks. The output will tell you where the last mouse click was.
    Bruce
    Bruce Ammons
    Ammons Engineering

  • 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 pixel coordinates in image with mouseclick

    Hey there
    Im a beginner at labview, so i walked into a little problem.
    I want to know if there is a way to get pixel coordinates from an imagefile with a mouseclick in labview, this is to use the coordinates in order to calibrate the image without using the vision assistent.
    THx with regards
    jens dassen

    I'm not sure if this is something new with newer versions of LabVIEW, but I just solved this problem using a property node for the image indicator. See images below. Super easy!
    Cheers!
    James
    LabVIEW Professional 2014
    Attachments:
    Capture.PNG ‏8 KB
    Capture1.PNG ‏5 KB

  • Mapping component location from screen coordinates

    hello ...
    I have to display popup menu on click of jtable's cell. When my popup appears, it get displayed too far away from table. My table is on a jinternalframe within desktoppane. I have used the following code to map screen coordinates to component coordinates.
    public void mouseClicked(MouseEvent mev)      
            int tabcol = parentTable.columnAtPoint(mev.getPoint());     
         Point p = mev.getPoint();
         int c = parentTable.columnAtPoint(p);
         int r = parentTable.rowAtPoint(p);     
         Rectangle a = parentTable.getCellRect(r, c, true);
            displayAt((int)a.getX(),(int)a.getY()+parentTable.getRowHeight(0), r);
    after applying above strategy, i succeeded in positioning the popup horizontally, but it is still above the cell where i want it to be.
    so, thats the problem basically.
    any professional comments/solutions will be hightly appreciated.
    cheers,
    Raheel.

    Well, i have used those swingutilities methods too, but no luck. I think i am using some wrong ones like "convertPointToScreen" OR "convertPointFromScreen". If you plz specify the correct methods with proper usage then it might solve my problem.
    thanks...
    Raheel.

  • Looking to extract position/coordinates from Simulated Starter Kit 2.0

    I am new to the Robotics Module of LabView so I wanted to clarify is either of things exist. The simulated DaNI (starter kit 2.0) moves depending on the speeds sent to the DC motors, but how/where is this translated into movement for the simulated DaNI? OR is there any way to put a marker or otherwise monitor the current position of the simulated DaNI in the simulated environment. (hopefully using coordinates or something similar?)
    I am only using the basic, nothing complex. Some code has been written to make inputs to the Write Dc Motor Setpoints VI and that is where the motor speed is inputted, but I cannot see where it actually translates into movement for the simulated DaNI.
    I don't need anything solved or fixed, would just appreciate a point in the right direction or a clarification.

    You may want to take a look at the "Starter Kit 2.0 Dead Reckoning" example to see how to directly access the position of the robot from the simulation environment. (If you don't have LabVIEW 2012 or later you can get the example here.)  In this case, you get a reference to the robot's "Body" object, then call the "Position" property to get the coordinates of the robot's center point within the simulation environment.  As for how the API controls the motors, the robot host interface contains references to the simulated motors, and it is sending position setpoints to the simulator through those references  This comminication is handled within Write DC Motor Setpoints.vi.  Meanwhile the simulator is calculating the friction and collisions between the wheels and the ground to make the robot move.
    Chris M

  • How we can get the values  from one screen to another screen?

    hi guru's.
         how we can get the values  from one screen to another screen?
              we get values where cusor is placed but in my requirement i want to get to field values from one screen to another screen.
    regards.
      satheesh.

    Just think of dynpros as windows into the global memory of your program... so if you want the value of a field on dynpro 1234 to appear on dynpro 2345, then just pop the value into a global variable (i.e. one defined in your top include), and you will be able to see it in your second dynpro (assuming you make the field formats etc the same on both screens!).

  • I have a 60 inch Sony XBR TV that has DVI input but not HDMI. I am using an adapter to get the video from my Apple TV, but the screen flashes a lot. Do I have any other choices other than buying a new TV?

    I have a 60 inch Sony XBR TV that has DVI input but not HDMI. I am using an adapter to get the video from my Apple TV to the Sony, but the screen flashes a lot. Do I have any other choices other than buying a new TV?

    Is this an iphone question?
    You have posted in the iphone forum.

  • Is it possible to get the image from the i pad when mirroring via Apple TV to fill the screen instead of appearing as a screen within a screen?

    When mirroring, is it possible to get the image from the ipad to fill the screen on the TV instead of appearing as a screen within a screen?

    Welcome to the Apple Community.
    No, the iPad has an aspect ratio of 4:3, a TV has an aspect ratio of 16:9, to fit one into the other is impossible without distorting the picture. If your TV has a zoom feature, you may be able to use this to fill the screen a little more to your liking, but this will result in cropping top and bottom.

  • Problem in getting parameter value from selection screen in web dynpro abap

    Hi,
    I am facing problem in getting parameter value from selection screen.
    Please find my code below:
    DATA LT_PAR_ITEM TYPE IF_WD_SELECT_OPTIONS=>TT_SELECTION_SCREEN_ITEM.
    FIELD-SYMBOLS:<FS_PAR_ITEM> LIKE LINE OF LT_PAR_ITEM,
                                 <FS_OBJ_USAGE>    TYPE REF TO data.
      WD_THIS->M_HANDLER->GET_PARAMETER_FIELDS( IMPORTING ET_FIELDS = LT_PAR_ITEM ).
      LOOP AT LT_PAR_ITEM ASSIGNING <FS_PAR_ITEM>.
        CASE <FS_PAR_ITEM>-M_ID.
          WHEN `OBJ_USAGE`.
             ASSIGN <FS_PAR_ITEM>-M_VALUE->* TO <FS_OBJ_USAGE>.      
    [ Here, sy-subrc is 4,  <FS_OBJ_USAGE> is not assigning.]
        ENDCASE.
      ENDLOOP. 
    So, can any one solve this problem.
    Thanks in advance,
    Radhika

    Hi Radhika,
    Try using GET_RANGE_TABLE_OF_SEL_FIELD...
    Please Refer below code..
       DATA: NODE_FLIGHTS TYPE REF TO IF_WD_CONTEXT_NODE.
      DATA: RT_CARRID TYPE REF TO DATA.
      DATA: ISFLIGHT TYPE TABLE OF SFLIGHT.
      DATA: WSFLIGHT TYPE SFLIGHT.
      FIELD-SYMBOLS: <FS_CARRID> TYPE TABLE.
    Retrieve the data from the select option
      RT_CARRID = WD_THIS->M_HANDLER->GET_RANGE_TABLE_OF_SEL_FIELD( I_ID = 'S_CARR_ID' ).
    Assign it to a field symbol
      ASSIGN RT_CARRID->* TO <FS_CARRID>.
      CLEAR ISFLIGHT. REFRESH ISFLIGHT.
      SELECT * INTO CORRESPONDING FIELDS OF TABLE ISFLIGHT FROM SFLIGHT
                           WHERE CARRID IN <FS_CARRID>.
      NODE_FLIGHTS = WD_CONTEXT->GET_CHILD_NODE( NAME = `FLIGHTS` ).
      NODE_FLIGHTS->BIND_ELEMENTS( ISFLIGHT ).
    Thanks,
    Regards,
    Kiran

Maybe you are looking for