Picking point on object

Hi,
maybe I'm to stupid or I'm looking just in the wrong places.
I got a 3D scene containing 1 object... now I want to change the point which is the center of my rotation. A click in the scene shall define around which point the object shall rotate.
I now want to get the point where a ray casted from the point I've clicked hits the object. So that the choosen point is on the surface of this object.
Maybe someone could point me to any source where I can find info about getting the point on a surface by picking.
Even better would be if someone could give me a brief example.
Thanx!

I have some code that may help:
from J3D.org
public static PickRay createPickRay(Canvas3D canvas, int x, int y)
Point3d eye_pos = new Point3d();
Point3d mouse_pos = new Point3d();
canvas.getCenterEyeInImagePlate(eye_pos);
canvas.getPixelLocationInImagePlate(x, y, mouse_pos);
Transform3D motion = new Transform3D();
canvas.getImagePlateToVworld(motion);
motion.transform(eye_pos);
motion.transform(mouse_pos);
Vector3d direction = new Vector3d(mouse_pos);
direction.sub(eye_pos);
return new PickRay(eye_pos, direction);
Given three points in a plane, a camera point Cp, and a camera vector Cv,
calculate the intersection of the line (defined by passing through the camera point
and parallel to the camera vector) and the plane
(defined by the three points p1, p2, p3)
public static Point3d getIntersection(Point3d p1, Point3d p2, Point3d p3,
Tuple3d Cp, Tuple3d Cv )
// normal vector to plane
// n = (p2-p1)X(p3-p1)
Vector3d v1 = new Vector3d(p1);
Vector3d v2 = new Vector3d(p2);
Vector3d v3 = new Vector3d(p3);
v3.sub(v1);
v2.sub(v1);
Vector3d n = new Vector3d();
n.cross(v2,v3);
     // parameter for the parametric equation of a line
// t = ( n.p1 - n.Cp ) / n.Cv
     double t = ( n.dot(v1) - n.dot(new Vector3d(Cp)) ) / n.dot(new Vector3d(Cv));
     // plug parameter t into parametric equation for camera line of sight
Point3d lineIntersect = new Point3d();
     lineIntersect.x = Cp.x + Cv.x * t;
     lineIntersect.y = Cp.y + Cv.y * t;
     lineIntersect.z = Cp.z + Cv.z * t;
     return lineIntersect;
Then the above two methods are called from my mouseClicked method (when user clicks on canvas3D, given MouseEvent m)
Canvas3D canvas = (Canvas3D)m.getSource();
Point3d cameraPosition = new Point3d();
Vector3d cameraVector = new Vector3d();
PickRay ray = createPickRay(canvas, m.getX(), m.getY());
SceneGraphPath pickedPath = locale.pickClosest(ray);
Node pickedNode = pickedPath.getObject();
ray.get(cameraPosition, cameraVector);
// three arbitrary points from the face you want to intersect
// I wanted to intersect the xy plane
Point3d p1 = new Point3d(0,0,0);
Point3d p2 = new Point3d(1,0,0);
Point3d p3 = new Point3d(0,1,0);
Point3d intersect = getIntersection(p1, p2, p3, cameraPosition, cameraVector);
Let me know if this helps!

Similar Messages

  • Pick Point Method

    I'm using the 3D picture control for my application, and I want to be able to select objects I have created, by clicking on them with the mouse.
    I have tried using the  Pick Point Method of the 3D Picture control with no luck.
    Has anyone managed to do this yet
    Thanks

    Thanks for the feedback
    The subtract was left over from debugging, decrement is defiantly the better option!
    I also agree it would make more sense to return a "No Object" message.
    I have updated the example to reflect these changes.
    The timeout case is actually to hide a little bug in the code
    When the code first starts up two of the blocks do not appear....... and I can not work out why!  They only appear after the event structure has executed at least once so the timeout case was to force this execution.  As you rightly say there is no other purpose for it when using the event structure in this manor.
    Again, thanks for the feedback
    John.P | Certified LabVIEW Architect | NI Alliance Member

  • Stock Removal using Pick Point

    Hi all,
    I have configure Storage Type 100 with SU managed and a pick point ST 001.
    Once the TO is generated from delivery, the TO information will be from source ST100 to destination ST916.
    So I would like to know, how to identify the SU is arrived pick point? If there any status or information can help me to know the status of TO.
    Since i need to identify,
    1.SU still in the Source Storage Type (TO open)
    2.Worker starts transfer to SU to pick point with liftfork
    3.SU arrived Pick point
    4.Picker picked the material from pick point (TO picked)
    5.Picker transferred the material to GI area (TO transferred and completed)
    I dun know how to let user know the status of 2 and 3
    Thanks in advance.
    David Tai

    Hi David,
    If the pick point / ID point is defined for SType 100 then during transfer order creation system will automatically stamps the destination storage type as Pick point when it is taking out the stock from Stype  100
    I have simulated one scenario where for my storage type 010 the ID point / Pick Point is defined as 011
    Stock removal / putaway defined in material master & Stock in Storage bin are as below
    & the Putaway / Picking storage type search is defined as
    Now for the Transfer order creation i am using the T-Code  LT09 (enter the SU number & MvT and system automatically propose 011 as destination storage type in the transfer order
    Upon confirmation of the transfer order 0168, use LT09 again to transfer the SU from Pick point to final destination bin and system automatically propose 010 as the final destination storage type
    Hope this helps

  • How do You See Anchor Points When Object is Unselected

    Hi, In Adobe Illustrator is there any way of viewing the anchor points of objects permanently even when an object is unselected? So you can see where the points are when you are making shapes with the pen tool. If there was, this would make it a lot easer to place the points on existing points of other shapes without having to guess where they are. Thanks for you help Gareth.

    Oh no! I just noticed when using it, that it is not as useful as I thought, because if you want to put a point anywhere near the 90º or 45º line from the last one it forces you to put in on that line, it's great that it lets you see the points on the other shapes but too bad it makes you do that. and you can't turn off smart guides while making a shape because it stops that shape and starts a new one. That's a bit annoying, so it's still easier to do it without smart guides guessing where the points are and correct them later with the white arrow if you missed any. Thanks for you help though. Gareth.

  • Set reference point in objects and measure distance

    1) How can I set the reference point in objects?
      for example:  
            a) exactly in the center of a pad or a via
            b) exactly in any corner of the board outline
    2) How can I measure the distance of two points with the maximum accuracy?
      for example:
            a) measure the distance between two pads or via
            b) measure the lenght of a line

    dear Semaphore, thanx for your response.
    I already use the ways that you refer me, but like this I can't measure with accuracy, or setting the zero reference is not guarantee that I set it exactly in the center of via or pad.
    With grid seted in smallest option is difficult to target the center of a pad, and also is difficult to target the point in the edje of a line with accuracy. With ruler I also have the same problem, I cant be sure that the ruler is pointing exactly to the center of a via or pad.
    That I need is a kind of a snap option to attach the mouse-cursor exactly in the center of an object, that can help me to target exactly in the center and have an accurate measurement or accurate set the zero reference without mistake.
    Any other suggestion for accurate measurements?

  • Storage section check indicator --   ID & Pick point

    Dear Gurus ,
    1.  I have defined new storage type with  NO storage section check. then maintained material with storage type indicaor.with storage type search strategy only.
      in this case the system does not suggest the bin  or even storage type.
    But if i maintain the storage section indicator & section search strategy then the system proposing Bin while creating TO.
        Then what is the use of deactivating the storage section check while defining the storage type??
    2. Can anybody explain me what is the ID point storage type & Pick point storage Type.
    Is it mean that the perticular material from storage type can be only  picked or putaway  from  the
    storage type that is assighned ID or pick point?
      If yes in which scenario it will be utilised or how it works?

    What are the other influencing factors you have set for your storage type search? For example stock status, WPC? Activity - E or A or 2-step?
    2. Can anybody explain me what is the ID point storage type & Pick point storage Type.
    See here for ID point:
    http://help.sap.com/saphelp_erp2005/helpdata/en/c6/f846b74afa11d182b90000e829fbfe/frameset.htm
    and here for Pick Point:
    http://help.sap.com/saphelp_erp2005/helpdata/en/c6/f847124afa11d182b90000e829fbfe/frameset.htm

  • HU SU and Pick Point Partial Picking

    Hi,
    I have an scenario where I dont want to make partial picking of an Handling unit in storage type with bulk strategy, I was trying to use the pick point however is there a form that first make the transfer order for the complete HU to the pick point and then it ask me for the pick HU to 916, because it seems that the standar behavior is to create the pick HU during the confirmation of the transfer order to 916 and leave the rest of the HU in the pick point, is it correct?
    Thx.

    Hi Mariana,
    You are experiencing standard SAP.
    As I understand you want some kind of two-step picking but it doesn't work trhough pick point. As I understand you would like to do this:
    1. TO from nromal storage type to pick point
    2. TO from pick point to interim storage type
    However, system executes the WM goods movement via one TO:
    1. TO from normal storage type to interim storage type
    It doesn't matter you use a pick point or not.
    Please read SAP online help how the process goes:
    http://help.sap.com/erp2005_ehp_04/helpdata/EN/c6/f8471f4afa11d182b90000e829fbfe/frameset.htm
    Regards,
    Csaba

  • POSC setting to create WTs automatically to putaway remaining qty from pick point to original bin

    Hello,
    In Layout oriented storage control for out bound process, I removed the HU at intermediate storage type as pick point and removed partial qty as per the OBD and completed whole process. This is OK as per the POSC setting. Now my original HU iwith remaining qty is still at pick point. I need to place it at original storage bin. I can easily do it with manually with WPT 9999. But if I want that, system should create  warehouse task automatically from ID point  remaining qty in original HU to original storage type-BIn. Is there any setting for this?  In other word, how can I configure the system to create 3rd  task automatically to put away remaining qty from pick point area to original storage bin of product? 
    Thanks,
    Milind.

    Hi  MILIND
    In this case you can use exception handling and achieve. Create exception code in which WpT will be create WT to original bin. Fixed bin transfer from ID point to the mat available.
    Regards
    Suraj

  • WM Pick point

    Hi,
    for picking from a storage type that is managed by a sub-system I would like to set up a pick point storage type similar to the identification storage type for inbound movements.
    I checked the pick point functionality, but that is not what we are looking as it is restricted to handling partial picks in SU managed storage types.
    Basically we want any outbound movement from our externally managed storage type to move through a storage type / area / bin.
    Any ideas?
    Regards
    Andreas

    Hi,
    It was not clear to me why the pick point doesn't fulfill your requirement. Both full and partial SUs go trough it when you do the picking.
    Of course, if you don't want to restrict the process only to SU-managed storage types, you cannot use it. But you wrote:
    I was rather looking for something analogous to the identfication point for inbound processes:
    ID point is used only in case of SU management...
    http://help.sap.com/saphelp_47x200/helpdata/en/c6/f8471f4afa11d182b90000e829fbfe/frameset.htm
    Other solution might be VAS:
    http://help.sap.com/saphelp_47x200/helpdata/en/17/e8d63790630c4fbd27b0dea62d89b7/frameset.htm
    Just my ideas I don't know what is the best solution.
    Regards,
    csaba

  • Picking a Primitive object!

    Hi!
    I have a problem with picking objects in my Scene that are instances of class Primitive. If I try picking I get this Exception:
    "javax.media.j3d.CapabilityNotSetException: Shape3D: no capability to get geometry"
    I tried every possible combination of capabilities for my Primitive-object, but the Exception stays... :-(
    Picking with Geometry-Nodes for example seems to work, but not with Primitive-Nodes.
    It's also confusing me, that he misses any capability of a Shape3D-Node. But I don't have one in relation to my Primitive... Or is there any way to access a Shape3D-Node related to my Primitive?
    Does anybody know how to solve this problem?? It's very important for me!!
    Greetz!

    to pick using geometry you have to set the ALLOW_INTERSECT capability on the object's geometry. Get the geometry from the shape3D and set the capability - adding some example code:
    Primitive primitive = new Primitive();  // note you'll have to edit this specific line to create the primitive as you're using it - creating just a primitive isn't going to give you any specific object
    Shape3D shape3D = primitive.getShape();
    Geometry geometry = shape3D.getGeometry();
    geometry.setCapability(geometry.ALLOW_INTERSECT); //now when you pick the object you should get no errors.

  • Note correction Instructions point towards object type FUGR / REPS

    Folks
    While looking at Correction Instructions for a note, its pointing to changes in Object Type FUGR, REPS
    I am familiar with Object Type Class and methods and how to navigate to them but am unfamiliar on how to check the Object Type FUGR, REPS and the corrections made to them.
    Is there any standard T-code or process to check the Object Type FUGR, REPS ?
    Thanks

    Further to above ;
    SAP systems record all changes made in the system in transport requests. There are different types of transport objects, depending on the type of change. Each transport object consists of three pieces of information:
    ·        Program ID
    ·        Object type
    ·        Object name
    Program ID can be R3TR, LIMU, or LANG. R3TR is a group of objects, and LIMU is a subobject of a larger object. This means, for example, that R3TR PROG RSPFPAR is the transport of the program RSPFPAR with all its information (source code, text elements, properties, ...), while LIMU REPT RSPFPAR describes the text elements of this program.
    The complete object R3TR PROG includes the following subobjects, among others:
    LIMU REPS
    LIMU REPT
    LIMU DYNP.
    Also REPS stands for Report Source Code
    Manish

  • Pick up metal objects with zen micro headphones? battery life with firmware 1.02

    hey all
    just purchased my zen micro couple days ago.
    the package we got here in downunder is satifying. included were the wired remote and also the stand/case with belt clip. these were the only reasons that made me choose this over the ipod mini.
    this has not occurred to me until tonight, but the headphones seems to act as magnets and were stuck to each other as the phones were dangling
    i never noticed this happening with other phones
    also the battery life of my zen was horrendous. its lasted 5 hrs with eq and smart volume on. the zen was on hold the whole time as the actions were controlled by the wired remote.
    this was with the firmware that was shipped with the player .0.03 i believe
    have just updated the firmware now, and will be testing the battery life to see if the problem is rectified.
    if not, then an exhange for an ipod is inevitable.

    Yep, SV is a battery killer, around a 50% drop in life has been meaured and the effect is known to be pretty negligible.
    And as others have said, them headphones have magnets in, like pretty much any speaker

  • [How-to] Find the middle point between sides of two distant objects.

    [In reference to my attachment]
    I would like to find the middle point between object A's right-most segment (in green) and object B's left-most segment (in blue), quickly, effectively and reliably.
    Ideally, there's a function i'm not familiar with that exists . I would rather not resort to having to create more objects to "figure out" the middle point manually, so-to speak.

    Dandreu,
    In a more general case than assumed in the first post, if you wish to have an actual key point, you may:
    1) Direct Select each of the path segments in question and Ctrl/Cmd+C+F+X+F,
    2) Select either and rotate it by 180 degrees,
    3) Object>Blend>Blend Options, with 1 Step, then Object>Blend>Make, then Object>Blend>Expand,
    4) Select the line in the middle and Object>Path>Add Anchor Point.
    You may also do a similar way where you add an Anchor Point at the middle of the segments and ClickDrag with the Line Segment Tool between them, but that is a bit destructive.

  • BI Content collecting objects from wrong/old source system??

    Hi Gurus! Lovely day here on the westcoast of Sweden - springtime is coming!
    I have selected an infosource for installation in trx RSOR. I also want to pick up some objects in the dataflow before and after that specific infosource. So I guess the system keeps trying to collect metadata from diffrerent source systems that we have assigned.
    I don't know the complete history of the systems - other than it's a bloody mess. We have right now a ECC 6 system connected to BI - but before that we had an older version connected (I guess 4.x something) on a diffrerent server.
    Somehow the collection process picks up some data from the ECC 6 system - but sometimes it asks for a login to the old system as well.
    This is my problem. I don't have an issue with logging on to the old system - because I have all the necessary rights to do that. But I don't want BI trying to collect metadata from our old system. So somewhere there's a pointer of some sort to the old system that I need to delete....
    The old system is not visible in the "source system assignment" view so I can't really find out where to change this settings....
    Any ideas??

    It's probably so. Would I still carry out the instructions Andreas gave me for checking this? Or should I just delete everything and do it all over again, just to get the connections straightened out?
    I'm more or less the only one at  this point using the system - as it is a kind of sandbox environment. So extreme measures is not a problem

  • Picking question.

    I have been beating my head on this for days and can't see what the problem is. All I want to do is to pick a point on a sphere and then at that point project a cylinder into the sphere.
    I can get the thing to place the pont in the sphere, but not at the point I pick. If I keep picking other points, the cylinder will move slightly one way or the other, but not to the extent it needs to.
    Any help is REALLY appreciated.
    Here is the code:
    import java.awt.BorderLayout;
    import java.awt.Dimension;
    import javax.media.j3d.AmbientLight;
    import javax.media.j3d.Appearance;
    import javax.media.j3d.BoundingSphere;
    import javax.media.j3d.BranchGroup;
    import javax.media.j3d.Canvas3D;
    import javax.media.j3d.ColoringAttributes;
    import javax.media.j3d.DirectionalLight;
    import javax.media.j3d.GeometryArray;
    import javax.media.j3d.HiResCoord;
    import javax.media.j3d.Locale;
    import javax.media.j3d.PhysicalBody;
    import javax.media.j3d.PhysicalEnvironment;
    import javax.media.j3d.Shape3D;
    import javax.media.j3d.Transform3D;
    import javax.media.j3d.TransformGroup;
    import javax.media.j3d.View;
    import javax.media.j3d.ViewPlatform;
    import javax.media.j3d.VirtualUniverse;
    import javax.swing.JFrame;
    import javax.vecmath.AxisAngle4d;
    import javax.vecmath.Color3f;
    import javax.vecmath.Point3d;
    import javax.vecmath.Vector3d;
    import javax.vecmath.Vector3f;
    import com.sun.j3d.utils.behaviors.mouse.MouseRotate;
    import com.sun.j3d.utils.behaviors.mouse.MouseTranslate;
    import com.sun.j3d.utils.geometry.Cylinder;
    import com.sun.j3d.utils.geometry.Sphere;
    import com.sun.j3d.utils.universe.SimpleUniverse;
    //import com.tornadolabs.j3dtree.Java3dTree;
    public class DisplayFrame extends JFrame implements PointSelectedReceiver
        private Transform3D     pointT3D = new Transform3D();
        private TransformGroup  pointTG;
        private VirtualUniverse universe;
        //private Java3dTree      j3dTree;
        private Canvas3D        canvas3D;
        private Vector3d        pointCurrTrans = new Vector3d();
        private Transform3D     pointRotT3D    = new Transform3D();
        private static final Vector3d ORIGIN = new Vector3d(0, 0, 0);
         * @param args
        public static void main(String[] args)
            DisplayFrame mainframe = new DisplayFrame();
            mainframe.init();
            mainframe.setPreferredSize(new Dimension(1280, 1024));
            mainframe.setMinimumSize(new Dimension(1024, 768));
            mainframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            mainframe.pack();
            mainframe.setVisible(true);
        private void init()
             universe = new VirtualUniverse();
             canvas3D = new Canvas3D(SimpleUniverse.getPreferredConfiguration());
             int[] xPos = {0,0,0,0,0,0,0,0};
             int[] yPos = {0,0,0,0,0,0,0,0};
             int[] zPos = {0,0,1,5,0,0,0,0};
             HiResCoord hiResCoord = new HiResCoord(xPos, yPos, zPos);
             //j3dTree  = new Java3dTree();
             Locale locale = new Locale(universe, hiResCoord);
             BranchGroup scene = createSceneGraph();
             //j3dTree.recursiveApplyCapability(scene);
             scene.compile();
             locale.addBranchGraph(scene);
             BranchGroup vpBranchGroup = new BranchGroup();
             TransformGroup tg = new TransformGroup();
             ViewPlatform vp = new ViewPlatform();
             vp.setViewAttachPolicy(View.RELATIVE_TO_FIELD_OF_VIEW);
             tg.addChild(vp);
             vpBranchGroup.addChild(tg);
             locale.addBranchGraph(vpBranchGroup);
             View view = new View();
             view.setProjectionPolicy(View.PARALLEL_PROJECTION);
             PhysicalBody        pb = new PhysicalBody();
             PhysicalEnvironment pe = new PhysicalEnvironment();
             view.setPhysicalEnvironment(pe);
             view.setPhysicalBody(pb);
             view.attachViewPlatform(vp);
             view.setBackClipDistance(110);
             view.setFrontClipPolicy(View.VIRTUAL_EYE);
             view.addCanvas3D(canvas3D);
             this.setLayout( new BorderLayout() );
             this.setSize(new Dimension(1024,768));
             this.setMinimumSize(new Dimension(1024, 768));
             this.add("Center", canvas3D);  
             //j3dTree.updateNodes(universe);
        private BranchGroup createSceneGraph()
            BranchGroup objRoot = new BranchGroup();
            double scale = 0.02d;
            Transform3D myTransform3D = new Transform3D();
            myTransform3D.setScale(scale);
            TransformGroup mainTG = new TransformGroup(myTransform3D);
            mainTG.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
            mainTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
            mainTG.setCapability(TransformGroup.ALLOW_CHILDREN_EXTEND);
            mainTG.setCapability(TransformGroup.ALLOW_CHILDREN_WRITE);
            //Test a color cube
            Sphere sphere = new Sphere(10.0f);
            sphere.setPickable(true);
            sphere.getShape().setCapability(Shape3D.ENABLE_PICK_REPORTING);
            sphere.getShape().setCapability(Shape3D.ALLOW_GEOMETRY_READ);
            sphere.getShape().getGeometry().setCapability(GeometryArray.ALLOW_COUNT_READ);
            sphere.getShape().getGeometry().setCapability(GeometryArray.ALLOW_FORMAT_READ);
            sphere.getShape().getGeometry().setCapability(GeometryArray.ALLOW_COORDINATE_READ);
            sphere.getShape().getGeometry().setCapability(GeometryArray.ALLOW_REF_DATA_READ);
            sphere.setCapability(Sphere.ALLOW_PICKABLE_READ);
            Transform3D sphereT3D = new Transform3D();
            sphereT3D.setTranslation(new Vector3d(0.0f, 0.0f, 0.0f));
            TransformGroup sphereTG = new TransformGroup(sphereT3D);
            sphereTG.addChild(sphere);
            mainTG.addChild(sphereTG);
            //Add lighting
            BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);
            Color3f ambientColor          = new Color3f(0.9f, 0.9f, 0.9f);
            Color3f directionalLightColor = new Color3f(0.6f, 0.6f, 0.6f);
            AmbientLight ambientLightNode = new AmbientLight(ambientColor);
            ambientLightNode.setInfluencingBounds(bounds);
            mainTG.addChild(ambientLightNode);
            DirectionalLight directionalLight = new DirectionalLight(directionalLightColor, new Vector3f(+0.0f, +0.10f, +0.00f) );
            directionalLight.setInfluencingBounds(bounds);
            mainTG.addChild(directionalLight);
            //Add an object to indicate the point picked
            pointTG = new TransformGroup();
            pointTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
            pointTG.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
            pointT3D.setTranslation(new Vector3d(-20.0f, 0.0f, 0.0f));
            pointTG.setTransform(pointT3D);
            Appearance         pickAp    = new Appearance();
            ColoringAttributes colorAtt  = new ColoringAttributes();
            Color3f            pickColor = new Color3f(0.0f, 0.5f, 0.8f);
            colorAtt.setColor( pickColor );
            pickAp.setColoringAttributes( colorAtt );
            Cylinder pointIndicator = new Cylinder(0.25f, 25.0f, pickAp); 
            pointIndicator.setPickable(false);
            pointTG.addChild(pointIndicator);
            mainTG.addChild(pointTG);  
            //Add the picking behavior next
            PointPickBehaviour picking = new PointPickBehaviour(canvas3D,
                                                                objRoot,
                                                                bounds,
                                                                DisplayFrame.this);
            mainTG.addChild(picking);
            MouseRotate behavior = new MouseRotate();
            behavior.setTransformGroup(mainTG);
            mainTG.addChild(behavior);
            behavior.setSchedulingBounds(bounds);
            MouseTranslate behavior2 = new MouseTranslate();
            behavior2.setTransformGroup(mainTG);
            mainTG.addChild(behavior2);
            behavior2.setSchedulingBounds(bounds);
            objRoot.addChild(mainTG);
            objRoot.setCapability(BranchGroup.ENABLE_PICK_REPORTING);
            return objRoot;
        public void receiveSelectedPoint(Point3d point)
            pointT3D.setTranslation(new Vector3d(point.x, point.y, point.z));
            pointTG.setTransform(pointT3D);
        public void receivePickRotation(AxisAngle4d rotAxis)
            pointTG.getTransform( pointT3D );
            pointT3D.get( pointCurrTrans ); 
            pointT3D.setTranslation( ORIGIN );
            pointT3D.setRotation( rotAxis ); 
            pointT3D.mul(pointRotT3D);
            pointT3D.setTranslation( pointCurrTrans );
            pointTG.setTransform( pointT3D );
    }Now the code to the pick itself:
    import javax.vecmath.*;
    import javax.media.j3d.*;
    import com.sun.j3d.utils.picking.*;
    import com.sun.j3d.utils.picking.behaviors.PickMouseBehavior;
    public class PointPickBehaviour extends PickMouseBehavior
      private PointSelectedReceiver receiver;
      private boolean               firstRotation;
      private AxisAngle4d           rotAxisAngle   = new AxisAngle4d();
      private Vector3d              clickVec       = new Vector3d();
      private Vector3d              axisVec        = new Vector3d();
      private double                pickAngle;
      private Point3d               startPt;
      // initial orientation of pick pointer: straight up
      private static final Vector3d UPVEC = new Vector3d(0.0, 1.0, 0.0);
      // for repeated calculations
      public PointPickBehaviour(Canvas3D    canvas,
                                BranchGroup root,
                                Bounds      bounds,
                                PointSelectedReceiver receiver)
        super(canvas, root, bounds);
        setSchedulingBounds(bounds);
        pickCanvas.setMode(PickCanvas.GEOMETRY_INTERSECT_INFO);
        this.receiver = receiver;
      public void updateScene(int xpos, int ypos)
      /* This method is called when something is picked.
           pickCanvas.setShapeLocation(xpos, ypos);
           Point3d eyePos = pickCanvas.getStartPosition();
          startPt = eyePos;
           PickResult pickResult = null;
           pickResult = pickCanvas.pickClosest();
           if (pickResult != null)
               PickIntersection pi = pickResult.getClosestIntersection(eyePos); 
              System.out.println("Picked coordinates: " + pi.getClosestVertexCoordinates());
              Point3d intercept = pi.getPointCoordinatesVW();
              rotateToPoint(intercept);
              receiver.receiveSelectedPoint(intercept);
      } // end of updateScene()
      private void rotateToPoint(Point3d intercept)
      /* Turn the picked point to point at the point where the
         mouse was clicked.
            if (!firstRotation)
            {   // undo previous rotations to gun and beam
                axisVec.negate();
                rotAxisAngle.set( axisVec, pickAngle );
                receiver.receivePickRotation(rotAxisAngle);
            clickVec.set( intercept.x - startPt.x,
                          intercept.y - startPt.y,
                          intercept.z - startPt.z);
            clickVec.normalize();
            axisVec.cross( UPVEC, clickVec);
            pickAngle = UPVEC.angle(clickVec);
            rotAxisAngle.set(axisVec, pickAngle);     // build rotation
            receiver.receivePickRotation(rotAxisAngle);
            firstRotation = false;
      } // end of rotateToPoint()
    } Fianlly the interface to tie the two:
    import javax.vecmath.AxisAngle4d;
    import javax.vecmath.Point3d;
    public interface PointSelectedReceiver
        public void receiveSelectedPoint(Point3d point);
        public void receivePickRotation(AxisAngle4d rotation);
    }

    Well I have it sort of working (the pick indicator cylinder gets placed at the right point, but if you rotate the sphere and then select another point the cylinder isn't drawn toward the user).
    The fix was to change getPointCoordinatesVW to getClosestVertexCoordinates.

Maybe you are looking for

  • Problem with XSU when trying to execute pl/sql package returning ref cursor

    Hi, I'm exploring xsu with 8i database. I tried running sample program which I took from oracle documentation. Here is the details of these. ------create package returning ref cursor--- CREATE OR REPLACE package testRef is      Type empRef IS REF CUR

  • Process one set of primary and secondary records at a time

    Need to read and analyze all service lines for every claim I wrote these Statements but they are in a never ending state despite of the fact of setting the claims range to one day. Thank you for any suggestions. Harry set serveroutput on declare v_cl

  • How to determine the # of instances one needs?

    Hi, Our current Oracle environment (1 physical instance) houses a data warehouse, 1 data mart, oracle BI and Oracle Spend Analytics. What is a good approach to investigate if my current instance is powerful enough to sustain the various applications?

  • Several forecast models

    Hi, I need to see the result of several forecast models. how to do it ? Do I need to create n number of forecast profie to see the result of n number of forecast models or in one profile I can see the result of n number of forecast models. Thanks a l

  • Is NewerTech Wireless Adaptor known to fail on iMac G5, ISO 10.4.11?

    I have a G5 iMac PPC with a Newer Tech Wireless Adaptor which is showing that my LAN is acitve (but vacilating off and on).  Is there a way to test to see if the stick is faullty?  At one time, last week, it was changing from my LAN to that of my nei