How to rotate camera around origin?

Hello!
I managed to create a view like:
TransformGroup cameraTransformGroup;
Transform3D cameraTransform3D = new Transform3D();
//Camera 10f from center at z-axis
          cameraTransform3D.set(new Vector3f(0.0f, 0.0f, 10.0f));
          cameraTransformGroup = simpleUniverse.getViewingPlatform().getViewPlatformTransform();
          cameraTransformGroup.setTransform(cameraTransform3D);
I mange to rotate the camera around it's own y-axis like:
rotY(cameraTransformGroup, Math.PI/32);
     public TransformGroup rotY(TransformGroup transformGroup, double angle)
          Transform3D oldTransform3D = new Transform3D();
          Transform3D rotationTransform3D = new Transform3D();
          transformGroup.getTransform(oldTransform3D);
          rotationTransform3D.rotY(angle);
          oldTransform3D.mul(rotationTransform3D);
          transformGroup.setTransform( oldTransform3D );
          return transformGroup;
Now I need something like:
public TransformGroup rotY(TransformGroup transformGroup, double angle, float anchor_x, float anchor_y, float anchor_z )
I really need some help with this code so if you guys got any nice solution please let me know!
Best regards
Fredrik

import javax.vecmath.*;
import java.awt.*;
import java.awt.event.*;
import javax.media.j3d.*;
import com.sun.j3d.utils.universe.*;
import com.sun.j3d.utils.geometry.*;
import com.sun.j3d.utils.picking.*;
import com.sun.j3d.utils.behaviors.mouse.*;
import java.applet.*;
import com.sun.j3d.utils.applet.MainFrame;
public class DataViewer extends Applet
     public static void main( String args[] )
          new MainFrame( new DataViewer(), 640, 480 );
     PointArray geom;
     PickCanvas pc;
     TextField text;
     public void init()
          setLayout( new BorderLayout() );
          GraphicsConfiguration gc = SimpleUniverse.getPreferredConfiguration();
          Canvas3D cv = new Canvas3D( gc );
          add( cv, BorderLayout.CENTER );
          cv.addMouseListener( new MouseAdapter()
               public void mouseClicked( MouseEvent event )
                    pick( event );
          text = new TextField();
          add( text, BorderLayout.SOUTH );
          BranchGroup bg = createSceneGraph( cv );
          bg.compile();
          SimpleUniverse su = new SimpleUniverse( cv );
          su.getViewingPlatform().setNominalViewingTransform();
          su.addBranchGraph( bg );
     private BranchGroup createSceneGraph( Canvas3D cv )
          BranchGroup root = new BranchGroup();
          TransformGroup spin = new TransformGroup();
          spin.setCapability( TransformGroup.ALLOW_TRANSFORM_READ );
          spin.setCapability( TransformGroup.ALLOW_TRANSFORM_WRITE );
          root.addChild( spin );
          // axes
          Transform3D tr = new Transform3D();
          tr.setScale( 0.3 );
          TransformGroup tg = new TransformGroup( tr );
          spin.addChild( tg );
          Axes axes = new Axes();
          tg.addChild( axes );
          // appearance
          Appearance ap = new Appearance();
          ap.setPointAttributes( new PointAttributes( 10f, true ) );
          // objects
          int n = 20;
          geom = new PointArray( n, PointArray.COORDINATES | PointArray.COLOR_4 );
          geom.setCapability( PointArray.ALLOW_COORDINATE_READ );
          geom.setCapability( PointArray.ALLOW_FORMAT_READ );
          geom.setCapability( PointArray.ALLOW_COLOR_READ );
          geom.setCapability( PointArray.ALLOW_COLOR_WRITE );
          geom.setCapability( PointArray.ALLOW_COUNT_READ );
          Point3f[] coords = new Point3f[n];
          Color4f[] colors = new Color4f[n];
          for ( int i = 0; i < n; i++ )
               coords[i] = new Point3f( (float)(Math.random()-0.5), (float)(Math.random()-0.5), (float)(Math.random()-0.5) );
               colors[i] = new Color4f( (float)(Math.random()), (float)(Math.random()), (float)(Math.random()), 1.0f );
          geom.setCoordinates( 0, coords );
          geom.setColors( 0, colors );
          BranchGroup bg = new BranchGroup();
          spin.addChild( bg );
          pc = new PickCanvas( cv, bg );
          pc.setTolerance( 5 );
          pc.setMode( PickTool.GEOMETRY_INTERSECT_INFO );
          Shape3D shape = new Shape3D( geom, ap );
          bg.addChild( shape );
          PickTool.setCapabilities( shape, PickTool.INTERSECT_TEST );
          shape.setCapability( Shape3D.ALLOW_GEOMETRY_READ );
          // rotation
          MouseRotate rotator = new MouseRotate( spin );
          BoundingSphere bounds = new BoundingSphere();
          rotator.setSchedulingBounds( bounds );
          spin.addChild( rotator );
          // translation
          MouseTranslate translator = new MouseTranslate( spin );
          translator.setSchedulingBounds( bounds );
          spin.addChild( translator );
          // zoom
          MouseZoom zoom = new MouseZoom( spin );
          zoom.setSchedulingBounds( bounds );
          spin.addChild( zoom );
          // background and light
          Background background = new Background( 1.0f, 1.0f, 1.0f );
          background.setApplicationBounds( bounds );
          root.addChild( background );
          AmbientLight light = new AmbientLight( true, new Color3f( Color.red ) );
          light.setInfluencingBounds( bounds );
          root.addChild( light );
          PointLight ptlight = new PointLight( new Color3f( Color.green ), new Point3f( 3.0f, 3.0f, 3.0f ), new Point3f( 1.0f, 0.0f, 0.0f ) );
          ptlight.setInfluencingBounds( bounds );
          root.addChild( ptlight );
          PointLight ptlight2 = new PointLight( new Color3f( Color.orange ), new Point3f( -2.0f, 2.0f, 2.0f ), new Point3f( 1.0f, 0.0f, 0.0f ) );
          ptlight2.setInfluencingBounds( bounds );
          root.addChild( ptlight2 );
          return root;
     private void pick( MouseEvent event )
          Color4f color = new Color4f();
          pc.setShapeLocation( event );
          PickResult[] results = pc.pickAll();
          for ( int i = 0; (results != null) && (i < results.length); i++ )
               PickIntersection inter = results.getIntersection( 0 );
               Point3d pt = inter.getClosestVertexCoordinates();
               int[] ind = inter.getPrimitiveCoordinateIndices();
               text.setText( "vertex " + ind[0] + ": (" + pt.x + ", " + pt.y + ", " + pt.z + ")" );
               geom.getColor( ind[0], color );
               color.x = 1.0f - color.x;
               color.y = 1.0f - color.y;
               color.z = 1.0f - color.z;
               if ( color.w > 0.8 )
                    color.w = 0.5f;
               else
                    color.w = 1.0f;
               geom.setColor( ind[0], color );

Similar Messages

  • Settlers 7; I don't know how to rotate camera on macbook pro. Please Help!

    Can anyone tell me how to rotate the camera in settlers 7 on my mac book pro 15" track pad or keyboard? The game wont let me play until I've done this first test.
    Also is it worth buying Sims 3 or will I have just as much trouble as I've had with Settlers 7?

    Thanks for your reply Kappy but I did not mean the camera that is in the lap top lid that is used to take photos of yourself with photo booth. I mean rotating the camera view in the game of Settlers 7. I can zoom in and out and move horizontally and vertically but don't know how to rotate the view.

  • How to Rotate Camera HP ENVY Windows 10

    First, I do not know if I have Windows 64 or 32 bit but I just downloaded it a couple of days ago. Question: I still have the issue with the camera FACING ME. In other words, I am taking a selfie. How can I change the camera view so I am taking a picture of someone else? Thanks.  Also, wonder why it doesn't give you this option when you are in the camera? Thanks everyone for your help! Would also like to know how to KEEP Google Chrome and not have it revert back to BING search all the time if you have that answer! Thanks again.

    Had you considered installing the free version of Virtualbox? Create a VHD of Windows 95 to satisfy the requirement of Windows 95 for the program.
    It  seems to me that dual booting with Windows 95 may be going a tad overboard just for one program.
    Does the MUSICAL INSTRUMENTS/ ENCARTA/ MYTHOLOGY software you reference run under Windows XP?
    There is actually an app in the Microsoft store called Musical instruments that runs under Windows 8.1. It may be worth taking a look at for you.
    ****Please click on Accept As Solution if a suggestion solves your problem. It helps others facing the same problem to find a solution easily****
    2015 Microsoft MVP - Windows Experience Consumer

  • How to always rotate objects around the same point, even using the right-click menu?

    I need some of my objects to always rotate around the same point. How can I select a point which will stay that way?
    Using the rotate tool resets after deselecting.
    Also, I'd like to rotate objects around a certain point even when using the right click > Transform > Rotate.
    Is it possible?

    Right, so this is where Illustrator falls short with respect you your need, but only in the sense that the reference point can't be made to stick. You can, however, use Smart Guides to make it so the point is easy to set at exactly the same location, (especially since your object has an anchor point there), manually before each rotation.

  • MacBook won't let me let me install mountain lion because i don't have the previous owner's password how do i get around that

    MacBook won't let me let me install mountain lion because i don't have the previous owner's password how do i get around that

    What model year it the Mac you have? If it is a Late 2011 or newer model then you can first reinstall the Original version of OS X that came on it by using the Online Internet Recovery system. Hold down the Command+Option/Alt+r key at startup and hold them down until you see a Spinning Globe in the center of the screen. From the screen that comes up use Disk Utility to Repartition the drive as one partition aand when that is done close DU and Select Reinstall Mac OS X.
    If it is older then a late 2011 model then you will need the Original System disks for that Mac. These can be order from Apple for a small charge.

  • How to rotate an ellipse

    How would I change this code (shamelessly taken from one of DrLaszloJamf's posts) to rotate the ellipse around its center, I need an image with several ellipses at several different angles.
    import java.awt.*;
    import java.awt.image.*;
    import javax.swing.*;
    import java.io.*;
    import javax.imageio.ImageIO;
    public class BW
    public static void main(String[] args) throws IOException
    byte[] two = {0, (byte)0xff};
    ColorModel cm = new IndexColorModel(1, 2, two, two, two);
    WritableRaster raster = cm.createCompatibleWritableRaster(650, 100);
    BufferedImage image = new BufferedImage(cm, raster, false, null);
    Graphics2D g = image.createGraphics();
    g.setColor(Color.WHITE);
    g.fillArc(200, 10, 60, 30, 45, 360);
    g.dispose();
    ImageIO.write(image,"png",(new File("output.png")));

    You need to use java.awt.geom.AffineTransform, either directly or through the transform that the Graphics2D
    object has.
    Here is a simple example that animates using rotation.
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import javax.swing.*;
    public class RotatingShape extends JPanel {
         private Shape shape;
         private double angle;
         private Timer timer = new Timer(500, new ActionListener(){
              public void actionPerformed(ActionEvent evt) {
                   angle += Math.PI/50;
                   repaint();
         //rotates shape around its origin, which is placed in center of component
         public RotatingShape(Shape shape) {
              this.shape = shape;
              timer.start();
         protected void paintComponent(Graphics g) {
              super.paintComponent(g);
              Insets insets = getInsets();
              int w = getWidth() - insets.left - insets.right;
              int h = getHeight() -insets.top  - insets.bottom;
              Graphics2D g2 = (Graphics2D) g.create(insets.left, insets.top, w, h);
              g2.setColor(getForeground());
              g2.translate(w/2.0, h/2.0);
              g2.rotate(angle);
              g2.setStroke(new BasicStroke(3));
              g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
              g2.draw(shape);
         public static void main(String[] args) {
              Shape shape = new Ellipse2D.Float(-100, -200, 200, 400);
              JComponent comp = new RotatingShape(shape);
              comp.setBackground(Color.BLACK);
              comp.setForeground(Color.GREEN);
              comp.setPreferredSize(new Dimension(450, 450));
              JFrame f = new JFrame("RotatingShape");
              f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              f.getContentPane().add(comp);
              f.pack();
              f.setLocationRelativeTo(null);
              f.setVisible(true);
    }

  • Each time i try to share my movie to media browser it sais'The project could not be prepared for publishing because an error occurred. (-50)'' how do i get around this

    Each time i try to share my movie to media browser it sais'The project could not be prepared for publishing because an error occurred. (-50)'' how do i get around this

    Hi
    Error -43
    -43
    fnfErr
    File not found; Folder not found; Edition container not found; Target not found
    So Your original is still there ? or did You move or trash anything ?
    Yours Bengt W

  • How to access Camera Raw when invoking CS5 from Lightroom 3?

    When I invoke CS5 from Lightroom, my NEF files seem to load directly without giving me an opportunity to make adjustments in Camera Raw. If I open the same NEF file from windows Explorer, CS5 presents the Camera Raw adjustment page and I can make adjustments before proceeding.
    How can I work around this?
    BTW I know I can make camera raw adjustments in Lightroom and then open in CS5, however for an image that I know I will be using CS5 on anyway, I don't want to do anything at all in LR just go direct to CS5 but I can't do this if this bypasses my ability to make adjustments in camera raw!
    I must be missing something here, can anyone point me in the right direction?
    [I'm using Camera Raw 6.1, LR3, CS5 12.0.1 x64; Invoking CS5 from LR3 by right-click on image, Edit In > Edit in Adobe Photoshop CS5]

    That workaround did work for me so thanks for the helpful reply!
    If anyone else has other ways of making this work I'd like to hear about it.
    Thanks,
    Eric

  • How do I stop my original photo from changing after I edit then save it in Raw 7

    How do I stop my original image from changing after I save the edited version in Camera Raw 7. I want to be able to keep the original intact and
    also have the edited version. Also, if I want to work the new edited version in the future I would want to also keep that old version.
    Thanks for your help

    Thanks for this great solution NoelHave a great day and weekend
    Re: How do I stop my original photo from changing after I edit then save it in Raw 7created by Noel Carboni in Photoshop General Discussion - View the full discussion Another way to revert all the saved metadata changes back to defaults is to select the Camera Raw Defaults entry in the Camera Raw fly-out menu... http://forums.adobe.com/servlet/JiveServlet/downloadImage/2-6070597-543394/362-482/RevertS ettings.png  -Noel

  • HT201401 how to rotate a video after recording on my iphone

    how to rotate a video after recording on my iphone?

    Import the video with your computer as with any other digital camera and you can use a video viewing/editing app on your computer to rotate the video.
    For what purpose?

  • How to set CAM Mode background wallpaper

    Hi forum users,
    Where can i download or find the "xv" application ?
    Thanks.
    # Yours Sincerely,
    # Mohamed Ali Bin Abdullah.
    Anthony Worrall wrote:
    In chapter 10 "Control Access Mode" of the "Sun Ray Server Software 3.1
    Administrator's Guide for the Solaris Operating System"
    http://docs.sun.com/source/819-2384/cam.html
    To Change the Backdrop
    1. Run xv (version 3.10 or later) on any desired image.
    2. Save the file as "XPM". Rename the file from <>.xpm to <>.pm.
    3. Edit the file /opt/SUNWut/kiosk/prototypes/dtsession/Dtwm and change
    the two backdrop lines to the full pathname of the <>.pm file.
    You can also place the <>.pm file in /usr/dt/share/backdrops and then
    refer to it by <> in the Dtwm file.
    -----Original Message-----
    From: [email protected]
    [mailto:[email protected]] On Behalf Of Mohamed Ali Bin
    Abdullah
    Sent: 16 August 2006 13:14
    To: [email protected]
    Subject: [SunRay-Users] How to set CAM Mode background wallpaper
    Importance: High
    Dear SunRay Fourm Users,
    I need help regarding Sun Ray CAM mode background wallpaper settings.
    My objective is that, non-card users( DTUs ) will start the Controlled
    Access Mode. In CAM mode i don't want any application to be launch. I
    want CAM mode background shows only my wallpaper( jpg format ). Users
    with card can access the system( dtlogin ). I have set those policy in
    SunRay Web Administration Console and restart the services.
    My question is, how can i set or configure the CAM mode background to
    show my wallpaper( jpg fornat ) ?
    These are my setup environment information:
    - Sun E220( Sparc )
    - Installed Solaris 10 06/06 OS.
    - Installed latest Solaris 10 recommended patches
    - SunRay Server Software 3.1
    - Installed patch 120879-04
    - 2x SunRay 1
    - 2x SunRay 150
    - 2x SunRay 170
    I would be thankful if anyone can offer me help and guidance.
    Please let me know if you need any more information.
    # Yours Sincerely,
    # Mohamed Ali Bin Abdullah.

    Hi forum users,
    Where can i download or find the "xv" application ?blastwave.org has it for example

  • How do I keep the original pre-RAW preview exposure ?

    IF I understand it when I imort a RAW "NEF file from my Nikon, LIghtroom shows a preview that is a jpeg exposre, something equivalent to a point and shoot photo. Then after processing the info from the RAW file, it shows the unprocessed image. Typically, this image for me becomes unsaturated and less colorful. Although I want to process "some" of my photos, I like some of the point and shoot images, and I'm wondering how do you keep the original exposiure that LIghtroom shows before showing the RAW unprocessed image?
    When I'm taking photos just to archive a thing, I like the advanced point and shoot saturated image. When I want to be artistic, I prefer to process them myself. Is there a setting that will allow me to keep the preview look?

    natekon wrote:
    Is there a setting that will allow me to keep the preview look?
    Aside from what Lee Jay said (which is technically accurate) the best thing you can do is to learn how to quickly make image adjustments and if you find you are making the same adjustments all the time, create a preset or consider making a new Default tone/color adjustment for your images. The fact is that the EFIX JPEG is the camera maker's interpretation of the raw image. It's neither accurate nor sacrosanct. It's simply a different rendering of your raw data. You can look at using different DNG profiles (in the Camera Calibrate panel) to alter the color rendering and adjust your tone controls to taste and make a preset or a new Default.
    But in answer to your main question can you use those JPEG previews as a basis for LR, no other than you make the manual adjustments yourself...

  • How do you set the original outbound message from MSG_WAIT_ACK to MSG_COMPLETE ?

    We are using B2B & OSB to send out messages via eBMS protocol
    So basically this are the two use cases
    1) EBusiness Suite => B2B => OSB=> Customer for the outbound Shipment Notices
    2) EBusiness Suite <= B2B <= OSB<= Customer for the Inbound acknowledgement
    We are able to use standard B2B functionality to send out the messages using eBMS with https and client certificates
    On the way back from the customer, we are using OSB that gets the raw data and the body gets sent to B2B
    On the outgoing part a message gets created in B2B and is at MSG_WAIT_ACK
    When the acknowledgement comes in, it comes as a seperate messgae in B2B and is at MSG_COMPLETE
    How do you set the original outbound message from MSG_WAIT_ACK to MSG_COMPLETE?
    We use JMS and have played around with jca.jms.JMSProperty.INREPLYTO_MSG_ID but that is not propagating to REFER_TO_MESSAGE_ID in B2B_BUSINESS_MESSAGE table
    I tried using jca.jms.JMSProperty.CONVERSATION_ID as well but no luck
    Any response is highly appreciated!

    Are you asking about your own JavaMail code or about somebody else's web-based mail agent?
    If it's the latter (which is what it sounds like) then you find the checkbox in the preferences configuration, or whatever they call it, which says "Include original message in reply", or something like that. If such a thing exists, that is. If you're thinking that the e-mail message controls how their code formats replies to it, that's not how it works.
    Even Outlook lets you configure how replies are formatted, the only difference is that the Outlook default is to include the original message and your web-based agent's default is to not include it.

  • I'm using Photoshop Elements 12 on Windows 8.1.  When I go into the Expert Edit Mode the toolbar available appears in one single column and misses off several tools including foreground and background colour.  How can I restore the original toolbar?

    I'm using Photoshop Elements 12 on Windows 8.1.  When I go into the Expert Edit Mode the toolbar available appears in one single column and misses off several tools including foreground and background colour.  How can I restore the original toolbar?

    Thanks for your help - your suggestion worked beautifully.Dennis Hood
          From: 99jon <[email protected]>
    To: Dennis Hood <[email protected]>
    Sent: Thursday, 15 January 2015, 15:20
    Subject:  I'm using Photoshop Elements 12 on Windows 8.1.  When I go into the Expert Edit Mode the toolbar available appears in one single column and misses off several tools including foreground and background colour.  How can I restore the original toolbar?
    I'm using Photoshop Elements 12 on Windows 8.1.  When I go into the Expert Edit Mode the toolbar available appears in one single column and misses off several tools including foreground and background colour.  How can I restore the original toolbar?
    created by 99jon in Photoshop Elements - View the full discussionTry re-setting the prefs.Go to: Edit >> Preferences >> General (Photoshop Elements menu on Mac)Click the button Reset Preferences on next Launch If the reply above answers your question, please take a moment to mark this answer as correct by visiting: https://forums.adobe.com/message/7099161#7099161 and clicking ‘Correct’ below the answer Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: Please note that the Adobe Forums do not accept email attachments. If you want to embed an image in your message please visit the thread in the forum and click the camera icon: https://forums.adobe.com/message/7099161#7099161 To unsubscribe from this thread, please visit the message page at , click "Following" at the top right, & "Stop Following"  Start a new discussion in Photoshop Elements by email or at Adobe Community For more information about maintaining your forum email notifications please go to https://forums.adobe.com/thread/1516624.

  • How to rotate at any angle?

    So I see normally for the rotation it's based on X, Y, and Z, by choosing one of them.. I also saw somewhere where you can specify the angle for the cam, but that's about it.. I want to be able to manipulate a 3d object at any angle :)

    For that you need to rotate the camera rather than the object.
    You will need to use a recent build of Java8 (b77+) for that and a machine that can run the 3D stuff in it (currently only a Windows machine).
    From: https://wikis.oracle.com/display/OpenJDK/3D+Features
    There is some code for specifying a movable camera:
    // Create a camera and add it to the Scene
    Camera camera = new PerspectiveCamera();
    scene.setCamera(camera);
    // Add camera to scene graph (so it can move)
    Group cameraGroup = new Group();
    cameraGroup.getChildren().add(camera);
    root.getChildren().add(cameraGroup);
    // Rotate the camera
    camera.rotate(45);
    // Move the cameraGroup (camera moves with it)
    cameraGroup.setTranslateZ(-75);I haven't tried it, but in JavaFX 8 the camera is just another node.
    I think if you apply a RotateTransition to the camera you could animate rotating it around (like turning your head to see change your field of view).
    Similarly, if you instead applied a PathTransition to the group containing the camera, then that would simulate you walking in a circle, but looking in a constant direction.
    If you applied an appropriate RotateTransition to both the camera and a PathTransition to the group containing the camera and you did it at the right proportional values, then you could ensure that the as the camera was rotating around the object, it was always facing inward tangentally to the path the group is following so that it is always looking at the object being walked around.
    http://docs.oracle.com/javafx/2/api/javafx/animation/RotateTransition.html
    For some inspiration look at Uluk's answer here which demonstrate animation around a circular path.
    http://stackoverflow.com/questions/14171856/javafx-2-circle-path-for-animation
    http://stackoverflow.com/questions/14182704/javafx-2-animation-scale-node-depending-pathtransition-duration/14182917#14182917
    But in the second example, you put it in 3D and rotate the camera instead of scaling the node.

Maybe you are looking for