Limiting rotation of Transform to one axis at a time.

I have a situation where I want to force a transform returned from a picking tool to only rotate around or translate along a single axis. To do this, I'm using the transformChanged() function shown below. It works fine for the translation changes, but has problems for the rotation case. If the rotations are about one axis only it's ok, but when rotations are combined (30 degrees on X, then 60 degrees on Y) say, the object flips around in strange ways.
I understand that my approach to the rotation limit was too simplistic, but none of the other approaches I've tried has worked either. I'm very new to Java3D programming and have run out of ideas, can anyone else suggest something to try?
// Callback from Picking tools.
public void transformChanged(int type, TransformGroup tg)
    if((selObj != null) && (tg != null))
        // Get the current Transform3D
        Transform3D current = new Transform3D();
        tg.getTransform(current);
        // Get the current transform vector
        Quat4f currQuat = new Quat4f();
        Vector3f currVect = new Vector3f();
        current.get(currQuat, currVect);
        double currScale = current.getScale();
        System.out.println("transformChanged - scale = "+current.getScale());
        // Set global current variables
        curPosition = currVect;
        curQuat4f = currQuat;
        // Only allow movement on the chosen axis
        if(moveX)
            if(type == PickingCallback.TRANSLATE)
                currVect.setY(oldPosition.getY());
                currVect.setZ(oldPosition.getZ());
            else if(type == PickingCallback.ROTATE)
                currQuat.setY(oldQuat4f.getY());
                currQuat.setZ(oldQuat4f.getZ());
        else if(moveY)
            if(type == PickingCallback.TRANSLATE)
                currVect.setX(oldPosition.getX());
                currVect.setZ(oldPosition.getZ());
            else if(type == PickingCallback.ROTATE)
                currQuat.setX(oldQuat4f.getX());
                currQuat.setZ(oldQuat4f.getZ());
        else if(moveZ)
            if(type == PickingCallback.TRANSLATE)
                currVect.setX(oldPosition.getX());
                currVect.setY(oldPosition.getY());
            else if(type == PickingCallback.ROTATE)
                currQuat.setX(oldQuat4f.getX());
                currQuat.setY(oldQuat4f.getY());
        // Set old global variables.
        oldPosition = currVect;
        oldQuat4f = currQuat;
        // Set the rotation and position back
        // into the transform.
        current.set(currQuat, currVect, (float)currScale);
        // Set the Transform3D back into the TransformGroup
        try
            tg.setTransform(current);
        catch(BadTransformException btex)
            System.out.println(btex);
            System.out.println("current transform = \n"+current);
}Edited by: billphil on Mar 17, 2008 10:56 AM
Edited by: billphil on Mar 17, 2008 11:07 AM
Edited by: billphil on Mar 17, 2008 11:18 AM
Edited by: billphil on Mar 17, 2008 11:21 AM

thanks!
i have tried using a file as a shared resource, and i
can now check whether an instance of my application
is already running. however, i can't make the
currently running application window to be
automatically displayed after the checking. Ar running application could listen on a port so you could tell it to display itself by using TPC/IP. This would require some additinals code in your app, but that shouldn't be a real problem.
If you shared resource is already a port then you could use this port. And if it is a file you could add some additionla information to this file. Like the port number. In this case you could avoid having to use a predefined port (that could be already used by a a completely different app even though it is not very likely) by using an anonymous ServerSocket (by using "new ServerSocker(0)" and "getLocalPort()")

Similar Messages

  • Can only move object one axis at a time in PageMake 5

    I must have hit some sort of short cut. I can only move an object one way at a time. Also rectangle tool only draws squares. Any help is appreciated. TIA

    Thank you for the reply. Yes it is a old version and using an old Op system, Win98. Doesn't make it useless but will add a lot of extra time. Won't let me move object freely, only one direction at a time. Also won't draw rectangles or ovals. Not sure if I put some constraint on by accident. Thanks again for the help.

  • Can Cover Flow view be limited to playback of only one album at a time?

    Hi all,
    I've been using the Cover Flow view in my iTunes Library more and more lately (after years of suffering owning a slow machine). But there has been a question regarding playback that has been slightly nagging me for a little while. I couldn't come up with effective search results, so I'll pose the question to the masses.
    Cover Flow playback (by default) seems limited to playing through one album and jumping straight into the next album in the Library without stopping. Scroll through the track listing in the lower screen and you'll notice that iTunes lists every track from every album in your Library.
    (picture one of those digital bar jukeboxes and an unlimited bankroll...)
    Conversely, when clicking the album's title in the default List view, iTunes will only play the tracks in that particular album's playlist, and stop playback once this is finished. I have grown used to this option when desiring to fall asleep to one particular album only... and not the 476 albums which follow it.
    Is there a workaround in place to emulate this "List View" playback behavior for Cover Flow playback?
    Just curious... if not, it isn't the end of the world - List View will still continue to serve its specific purpose for my needs.
    I just have a thirst for knowledge.
    Thanks,
    Steve

    Hi Jeremy,
    Conversely, when clicking the album's title in the default List view, iTunes will only play the tracks in that particular album's playlist, and stop playback once this is finished.
    I'm not sure I follow you here — if I click a track in list view, iTunes always goes on to the next track when it's over (assuming Shuffle is off). If that's the next track on an album, great, but when I come to the end of an album it moves on to the next one.
    Or are you talking about the Browser? Selecting an album in the Album browser pane will indeed produce the results you're describing, since the rest of your library will be excluded.
    Yes that's correct - my apologies, I was at work at the time and was working from memory. I've had the Browser enabled since day one that it almost becomes second nature.
    My iTunes interface, while displaying in List mode with the Browser active, limits the upper display fields to only Artist and Album panes.
    And exactly as you said, once the album finishes playing, iTunes ceases playback.
    Is there a workaround in place to emulate this "List View" playback behavior for Cover Flow playback?
    Yes, but it's a bit clunky: use the Search box to narrow down your library until only one album is displayed.
    Yes you are correct - it is a bit clunky. But it does work for the most part, provided that the album title is unique from a song title on another album.
    Thanks for the info Jeremy!
    Steve

  • Problem: Orbit Camera Tool Only Rotates One Axis

    Hey forum, please forgive the newbee question. I just upgraded to motion 4 and noticed that in a 3D project the orbit tool only swivels the view in one axis (I cannot tilt the view).
    I just opened a new project. Inserted an object. Created a camera. Switched to 3D. Choose the top view from the compass. Clicked and held on the 'orbit camera' in the top right... no 3D axis rotation (same protocol works perfectly in motion 3 with full 3D perspective rotation).
    Guessing I am missing something really simple... Any thoughts?

    That's how it works now. If you want to orbit on multiple axes, you need to be in an Active Camera or Perspective view.

  • Javascript function to rotate an object around its axis

    Hello,
    I wonder if it is possible to rotate an object around its axis (eg 45 ° rotation)?
    I want to make this rotation with a button and a Javascript code!
    Is it possible? if so, have a track for me to start?
    thank you

    Possible, yes - but you will need some basic knowledge of how 3D matrix transformations work if you want to do anything complex.
    The code to rotate a node in a 3D scene by 45 degrees on the X axis is
    myNode.transform.rotateAboutXInPlace(Math.PI/4)

  • How to set a keyframe with setValueAtTime for only one axis?

    Hi,
    I´d like to set a keyframe for the layer´s scale, anchor point values but separately. Let´s say I want to add the following keyframes to a layer:
    time: 0, value: 100, axis: X
    time: 0.3, value: 10, axis: Y
    time: 1, value: 110, axis: X
    If I use setValueAtTime(time ,[x, y]) it always places a keyframe for both axis.
    How can I set a keyframe with setValueAtTime for only one axis?
    Regards,
    Thomas

    Dan, thanks for your fast reply. But the problem is a bit difficult to describe for a german like me
    I´m try to convert given keyframes from another application. Let me visually show how it handles keyframes that are set on different axis at different times:
    X: O---O---O
    Y: ---O--O-O
    You see when the user sets a keyframe and both axis were modified, both have a keyframe (see the last key). But if only one axis is transformed and the other not, there is only one keyframe. The problem that I try to solve is that AE is only able to set a keyframe for both axis at a given time. So if I set the 3 keyframes of the X axis first, the AE script will set keys on the Y axis simultaneously. That´s bad because it adds keyframe to the other axis where there is no value "cache". So if I would set all keyframes it would look like this:
    X: O--•O-•-O
    Y: •--O•-O-O
    The small dots indicate those "forced" in-between keys.
    So is there a "native" scripting way to separate the dimensions (like the position prop) for other props and add independent keyframes?

  • How do you rotate one page at a time?

    When I choose Rotate View - Clockwise, it rotates the whole document. I want to rotate one page at a time.
    Thanks
    Ray
    Adobe Reader for Mac, 8.12

    Can't do that with Reader.

  • Problem: XYGraph with units in one axis in LV7.0

    When I bundle one array with units (length) and another without units
    together into a cluster and wire it to an XY Graph, the unit label
    shows up correctly at the lower-right corner of the X axis.
    But when I rescale the unit by changing the unit label (from nm to
    uin), the Y axis rescales as well! Furthermore, if I change the unit
    label back to nm, the Y axis values to not revert back!
    It seems that there is a problem when units are in only one axis of an
    XY Graph. (I tried with units on both axis and that seems to work
    fine).
    Any solution/workaround?
    Thanks,
    germ Remove "nospam" to reply

    In article <[email protected]>,
    Philip C. wrote:
    > Hi Germ,
    >
    > Please post the VI that shows this behaviour. Then it will be easier
    > for me to troubleshoot.
    >
    > Thanks!
    >
    > Philip C.
    Philip, I tried to post one, but there's something wrong with my ISP or
    some other problem, so I cannot post.
    But it's very easy to create: Make two array controls, one for the X
    values and one for the Y values. Assign the unit nm to the X axis, and
    leave the Y array without units. Make a new XY Graph control.
    On the block diagram, bundle the two arrays and connect them to the XY
    graph. Go back to the front panel and make "unit" visible in the
    graph. A unit label will appear near the lower-right corner. Change m
    to nm
    Enter a couple of values in each to the two arrays.
    Execute the VI. The points will plot on the graph. Now change the unit
    lablel from nm to uin on the graph and then change it back. Watch the Y
    axis go berserk.
    germ Remove "nospam" to reply

  • Multiple transformation between one data source & Target

    Hi ,
    Is Multiple transformation between one data source & one Target possible.
    If possible in which way?
    Thanks,
    Erick

    hello,
    No it is not possible,
    you can have different gorups
    or
    in case of Flat File datasource you can copy the datasource give it a different name and then create a new transformation.
    not sure how this works on R/3
    Regards
    Nitin Bhatia

  • Stabilizing only one axis in CS5.5?

    Hey there! I am attempting to stabilize a clip in after effects and attempting to stabilize only one axis of motion to avoid having to resize the frame. Any suggestions?

    The expression solution assumed that you were using the legacy point-tracker for stabilization, not the Warp Stabilizer.
    You say that you're needing to do this to "avoid having to resize the frame". But you don't need to resize the frame if your using Warp Stabilizer. Just use the Synthesize Edges option. It's very important that you use these basic learning resources before trying to us the Warp Stabilizer:
    http://blogs.adobe.com/toddkopriva/2011/04/warp-stabilizer-in-after-effects-cs5-5.html

  • Linear movement with 2 motors attached to one axis

    Hello,
    I have a PCI NI 7356 board to control the movement of two motors attached to one axis. This configuration is intended to have more power.  Each motor has its own encoder. I need the axis to turn to a specified position and return back to the initial position, it is a straight line move. There is no problem to do this with each of the motors separated, but if I try to make the two motors work together, the result is a clattering noise. It looks like the two motors are trying to do a slightly different movement.
    I tried two ways to program this: Master/slave (gearing one axis to the other axis) and sending the same position command to both the axis and starting them sychronised. In both cases the result is similar. I get this clattering noise for slow speeds and it dissapears once the axis gets to high speeds. 
    What can I try to get rid of this clattering noise?
    I plan to test how does it work if I put the same encoder signal for both the motors, intead of having one encoder at each motor? Should this improve behaviour?
    I think that the best solution would be to control one motor in position and send to the other its DAC output.  It this possible ? I am using the flexmotion library programing in C.
    Thank you

    The best option was to command the two motors separately. We could get
    rid of the clattering with the help of some mechanical adjustments.
    We are doing some tests with the device. Some straight line movements
    moving different loads.  It works OK until 20KN at 300rpm and
    acceleration of 1rpss but when we try a stright line movement with 22KN
    the device stops giving a following error. We wanted to test if it
    could move the the load, so we took the following error check off. We
    found the behaviour to be similar, but this time the following error
    bit is not set to 1.  I copy the axis state data of one test:
    t            Pos1    V        DAC1    DAC2    STATUS1            STATUS2
    (seg)    (mm)   (rpm)    (volt)    (volt)
    0.17    -0.03    0.00      1.92    1.14      :0100010000000000    :0100000000000000
    0.34    -0.02    13.46      3.77    2.84    :0100010000000000    :0100000000000000
    0.47    0.17    40.39      3.20    2.77      :0100010000000000    :0100000000000000
    0.61    0.37    53.85      3.27    2.84      :0100010000000000    :0100000000000000
    0.80    0.67    81.43      2.92    2.42      :0100010000000000    :0100000000000000
    0.94    1.20    114.43      3.34    2.70    :0100010000000000    :0100000000000000
    1.11    1.66    122.23      1.99    2.70    :0100010000000000    :0100000000000000
    1.25    2.34    158.97      2.42    2.92    :0100010000000000    :0100000000000000
    1.38    2.96    164.08      1.99    2.21    :0100010000000000    :0100000000000000
    1.55    3.62    184.93      2.63    2.70    :0100010000000000    :0100000000000000
    1.69    4.53    212.79      2.92    2.56    :0100010000000000    :0100000000000000
    1.83    5.42    226.74      2.28    2.56    :0100010000000000    :0100000000000000
    2.00    6.57    255.35      2.70    3.55    :0100010000000000    :0100000000000001
    2.13    -1.21    -2512.54  7.00    7.00    :0100010000000001    :0100000000000001
    2.25    -9.83    -2558.19  7.00    7.00    :1100010000100011    :0100000000000001
    2.45    -22.64    -1691.88  7.00    7.00  :1100010000010010    :1100000000010010
    2.58    -22.18    -33.69      7.00    7.00  :1100010000010010    :1100000000010010
    2.75    -22.19    13.46      7.00    7.00   :1100010000010010    :1100000000010010
    The tests start OK, but after getting to 5.42 mm on the position (when
    the command was 200mm) the motor 2 goes to Off (pin 0) and then the
    motor 1. We don't understand why could this happen. The following error
    check has been dissabled and we see that the pin for it stays in 0, but
    why is the pin 0 set suddenly to 1?
    Thank you,

  • [iPhone] Enable paging for only one axis?

    Hi! Basically what I am looking to do is exactly like the AIM application where I want to have a paging effect horizontally, but I want to scroll vertically.
    Unfortunately, the best I can come up with is a scrollview inside another scrollview. This doesn't seem to work as the inner scrollview (that controls vertical scrolling) doesn't pick up any touches when it's inside the paging scrollview.
    I was wondering whether it really is two scrollviews or whether I can enable paging for only one axis.
    How would I go about programming this?
    Thanks!

    {quote}You need to have only one scrollview that handles the vertical scrolling. Then add code to the touchesBegan:withEvent: method to detect a horizontal swipe. When you detect one, programmatically animate the page change.{quote}
    I had the same question as this topic and this answer was what I ended up doing.

  • Importing a velocity vector when blending moves on one axis

    I have altered the template of 'Sequence of Blended One-Axis Moves' such that it imports a vector of moves, but am trying to also import a vector of varying velocity values to accompany each position value that is input into the program. I have tried moving the velocity input into the loop as well with no success. Any suggestions?

    Dear Iaf3g,
    Have you tried creating an array of Velocities corresponding to the Target Position Array and then auto-indexing it into the while loop much the same way as the Target position array? Then you could input a different velocity to the Load Velocity VI each iteration of the loop. You also need to make sure that both the Load Position and Load Velocity VIs execute before the Start Motion VI, and you can ensure this by the way you route the error wires. It sounds like you tried something similar to this. Why didn't it work? What errors were you getting when trying to load velocities in this way?
    Best Regards,
    ~Nate

  • OBIEE Pre-Builts Loading one year at a time

    Hi,
    We are in a situation where we need to load one year at a time into the BAW (warehouse). I have seen this done before where the initial load was a full load and only went forward one year. Each subsequent load was for a complete year until we were current. After that, it was simply incremental loads with the standard prune days of 30.
    Does anyone have any detail as to how to do this?
    Regards

    Is the issue a performance issue (ETLs running for too long)? The problem is that if you do Year by year..and you want to do a "incremental" load for each year, that would be even more of a load..since you are not allowing for BULK load (where the tables get truncated). Either you can truncate and do BULK or incrmental..which may be an even heavier load. I think you are assuming that this approach will somehow help you from a hardware limitation standpoint..do you know for sure that it will?
    If you really do want to do it, as I mentioned, you can edit the INITIAL and END parameters. It would help if you clarify the Hardware limitation...I think there are better ways to handle this than to do what you are doing.

  • Loading data one year at a time

    Hi,
    We have a situation where we need to load data one year at a time. I saw this done a few years ago but do not remember the details.
    What I am thinking is that we could initially run a full load with the following parameters:
    $$ANALYSIS_START: 1/1/2006
    $$ANALYSIS_START_WID: 1/1/2006
    $$INITIAL_EXTRACT_DATE: 1/1/2006
    $$ANALYSIS_END_WID: 1/1/2006
    And this should give us one year. What I am not sure about is how to load each subsequent year???
    Regards

    Is the issue a performance issue (ETLs running for too long)? The problem is that if you do Year by year..and you want to do a "incremental" load for each year, that would be even more of a load..since you are not allowing for BULK load (where the tables get truncated). Either you can truncate and do BULK or incrmental..which may be an even heavier load. I think you are assuming that this approach will somehow help you from a hardware limitation standpoint..do you know for sure that it will?
    If you really do want to do it, as I mentioned, you can edit the INITIAL and END parameters. It would help if you clarify the Hardware limitation...I think there are better ways to handle this than to do what you are doing.

Maybe you are looking for

  • ITunes refuses to import Amazon MP3 album, claims permissions won't allow me. What?

    I download through Amazon MP3. I downloaded Muse's album and imported that into iTunes just fine, but for whatever reason, when I downloaded the Black Keys album El Camino it refuses to play ball. I get "Attempting to copy to the disk "Macintosh HD"

  • Is this video too much for my G4 Powerbook?

    Hi, I have downloaded a video from Vimeo and it won't play. At best it gets very choppy, even the audio, to the point where it just stalls. I have a G4 powerbook, 15" 1.6GHz 2GB RAM 250GB hardrive (165GB free) OSX 10.5.6 Quicktime Pro 7.6 The video i

  • The page parameters are not showing in the URL .

    I my appliaction all the pages have textboxes with some values . But the URL for none of the page shows the parameters like every page has url : http://127.0.0.1:8080/apex/f?p=105:8:598450314306501::NO::: but none of the page parameters are being sho

  • Date formats, language

    we are using jdeveloper 10.1.3.4 and rolled out an application to the oc4j server in jdeveoper we specified the dat format in formatinfo.xml, in the oc4j server we get an error because the date format does not match: ....AND ( ( (Dinehmer.DI_GEBDAT =

  • How to display the height, width and resolution of an EPS file

    Hi friends, I have to do a small module.. in that I have to display height, width and resolution of a given EPS file.. please help.. Thank you very much.. Regards, krishna.