PositionInterpolator - change axis

Hello,
A question concerning PositionInterpolator:
I�m trying to use setTransformAxis(Transform3D axisOfTransform) method to change axis from X (default) to Y. The question is how to construct Transform3D object that is passed as a parameter.
Thanks in advance!

Well kiddies, it's getting late and my head hurts. I'm still trying to get the new Interpolator working...
Anyway, here's what I got so far (if it helps you, etc etc). Everything works except the Interpolator. I'll have to run some tests to make sure I'm using it right. Keep in mind this code is incomplete (it doesn't do exactly what's it's supposed to yet):
// Allows an object or group of objects to be moved around SMOOTHLY by the
// keyboard in the X x Z plane.
public class KeyboardControlBehavior extends Behavior {
// USER DEFINED VARIABLES (SET ONCE, REQUIRED TO SET THINGS UP)
// The time is takes to move once.
private long time = 0;
// The distance travelled in one move.
private float distance = 0.0f;
// The TransformGroup to move around.
private TransformGroup target = null;
// SYSTEM DEFINED VARIABLES (SET ONCE, REQUIRED FOR FUTURE MOVEMENTS
private Vector3d rotationAxis = null;
// BEHAVIOR DEFINED VARIABLES (CONSTANTLY CHANGED TO KEEP MOVING FORWARD)
// The last keyboard key code that was pressed.
int lastKeyCode = KeyEvent.VK_RIGHT;
// The Interpolator used to make the smooth movement animation.
private RotPosScalePathInterpolator posInt = null;
// The Alpha object used by the Interpolator.
private Alpha alpha = null;
// The Knots used by the Interpolator (Alpha time of each key frame).
private float[] knots = null;
// The Quaternions used by the Interpolator (rotation of TransformGroup at
// each key frame).
private Quat4f[] quats = null;
// The Scales used by the Interpolator (scale of TransformGroup at each
// key frame).
private float[] scales = null;
// The Positions used by the Interpolator (position of TransformGroup at
// each key frame).
private Point3f[] positions = null;
// Create the KeyboardControlBehavior.
KeyboardControlBehavior(long time, float distance, TransformGroup target){
super();
// Set the target TransformGroup to move around.
this.target = target;
// Set the time it takes to move the TransformGroup around.
this.time = time;
// Set the Alpha object to the specified time for the Interpolator to use.
this.alpha = new Alpha(1, time);
// Set the distance to move the TransformGroup around.
this.distance = distance;
// Set the rotation axis of the Interpolator to be the Y axis.
Transform3D yAxis = new Transform3D();
yAxis.rotZ(-Math.PI/2.0f);
this.rotationAxis = new Vector3d();
yAxis.get(this.rotationAxis);
// Set the Alpha time of each key frame:
// - Initial frame is at 0.0
// - Rotation frame is at 0.3
// - Translation frame is at 1.0
this.knots = new float[3];
this.knots[0] = 0.0f;
this.knots[1] = 0.3f;
this.knots[2] = 1.0f;
// Set the Scales of each key frame to 100% (1.0f).
this.scales = new float[3];
this.scales[0] = 1.0f;
this.scales[1] = 1.0f;
this.scales[2] = 1.0f;
// Initialize all the positions to be the current TransformGroup's
// position.
Transform3D curPos = new Transform3D();
target.getTransform(curPos);
Vector3f curPosVec = new Vector3f();
curPos.get(curPosVec);
float[] curPos3f = new float[3];
curPosVec.get(curPos3f);
this.positions = new Point3f[3];
this.positions[0] = new Point3f(curPos3f);
this.positions[1] = new Point3f(curPos3f);
this.positions[2] = new Point3f(curPos3f);
// Initialize all the rotations to be the current TransformGroup's
// rotation (none).
this.quats = new Quat4f[3];
this.quats[0] = this.createQuaternionFromAxisAndAngle(this.rotationAxis, 0.0f);
this.quats[1] = this.createQuaternionFromAxisAndAngle(this.rotationAxis, 0.0f);
this.quats[2] = this.createQuaternionFromAxisAndAngle(this.rotationAxis, 0.0f);
// Create the new Interpolator, disable it and add it to the target
// TransformGroup.
this.posInt = new RotPosScalePathInterpolator(alpha, target, new Transform3D(), knots, quats, positions, scales);
this.posInt.setEnable(false);
target.addChild(posInt);
// Initialize the KeyboardControlBehavior.
public void initialize(){
// Set the initial wakeup condition to a key pressed.
this.wakeupOn(new WakeupOnAWTEvent(KeyEvent.KEY_PRESSED));
// KeyboardControlBehavior behavior (tasks to execute after a key is
// pressed).
public void processStimulus(Enumeration criteria){
// Extract the KeyEvent.
KeyEvent event = (KeyEvent) ((WakeupOnAWTEvent) criteria.nextElement()).getAWTEvent()[0];
// Read the key code that was pressed.
int currentKeyCode = event.getKeyCode();
// Execute the desired movement according to which arrow key was pressed
// as well as the previous arrow key (previous direction).
if(alpha.finished()) {
if(currentKeyCode == KeyEvent.VK_UP
|| currentKeyCode == KeyEvent.VK_DOWN
|| currentKeyCode == KeyEvent.VK_LEFT
|| currentKeyCode == KeyEvent.VK_RIGHT) {
// Set the position of the first key frame to the last key frame's
// position.
positions[0] = (Point3f)positions[2].clone();
// Set the rotation of the first key frame to the last key frame's
// rotation.
quats[0] = (Quat4f)quats[2].clone();
switch(currentKeyCode) {
case KeyEvent.VK_UP:
System.out.println("UP KEY");
// If the current direction is different than the last direction,
// a rotation into the new direction is required.
switch(lastKeyCode) {
case KeyEvent.VK_DOWN:
break;
case KeyEvent.VK_LEFT:
break;
case KeyEvent.VK_RIGHT:
break;
case KeyEvent.VK_UP:
// If we're going in the same direction, do not rotate.
positions[1] = (Point3f)positions[0].clone();
quats[1] = (Quat4f)quats[0].clone();
break;
// Set the last key frame farther away on the Z axis.
positions[2].z += distance;
break;
case KeyEvent.VK_DOWN:
System.out.println("DOWN KEY");
break;
case KeyEvent.VK_LEFT:
System.out.println("LEFT KEY");
break;
case KeyEvent.VK_RIGHT:
System.out.println("RIGHT KEY");
// If the current direction is different than the last direction,
// a rotation into the new direction is required.
switch(lastKeyCode) {
case KeyEvent.VK_DOWN:
break;
case KeyEvent.VK_LEFT:
break;
case KeyEvent.VK_RIGHT:
// If we're going in the same direction, do not rotate.
positions[1] = (Point3f)positions[0].clone();
quats[1] = (Quat4f)quats[0].clone();
break;
case KeyEvent.VK_UP:
break;
// Set the last key frame farther away on the X axis.
positions[2].x += distance;
break;
// Enable the Interpolator.
posInt.setEnable(true);
// Activate the Interpolator to move the TransformGroup.
posInt.getAlpha().setStartTime(System.currentTimeMillis());
// Save the last key code.
lastKeyCode = currentKeyCode;
else {
System.out.println("NOT AN ARROW KEY");
// Don't move the TransformGroup.
else {
System.out.println("Waiting for animation to complete...");
// Wait till animation is finished to process next key.
// Consume the key pressed event.
event.consume();
// Reset the wakeup condition to await the next key pressed event.
this.wakeupOn(new WakeupOnAWTEvent(KeyEvent.KEY_PRESSED));
// A very practical method to convert Radian angles into Quaternions.
// (Taken from page 207 of Daniel Selman's Java 3D Programming book.)
private Quat4f createQuaternionFromAxisAndAngle( Vector3d axis, double angle ) {
double sin_a = Math.sin( angle / 2 );
double cos_a = Math.cos( angle / 2 );
// Use a Vector so we can call normalize.
Vector4f q = new Vector4f();
q.x = (float) (axis.x + sin_a);
q.y = (float) (axis.y + sin_a);
q.z = (float) (axis.z + sin_a);
q.w = (float) cos_a;
// It is best to normalize the Quaternion so that only rotation
// information is used.
q.normalize();
// Convert to a Quat4f and return.
return new Quat4f( q );
} // end of class KeyboardNavigationBehavior

Similar Messages

  • How to change axis values in Numbers

    In v1.7 I have tried to change the axis values on existing charts but can't find how to do it...
    So I tried to create bar charts from scratch in order to rebuild the old ones with the new axis data but I can't find out how to set any of the axis values on chart creation now!!
    Has something changed - or am I just thick/blind?!!

    Is it so difficult to read given answers ?
    Barry described the correct scheme.
    In the table "to_chart", the cell A1 contains :
    =ROUNDUP(ABS(MIN(Tableau 1 :: B:E))/10,0)*10
    The cell B2 embed the formula :
    =$A$1+Tableau 1 :: B2
    Apply fill down and fill to the right.
    On the left edge, the colored rectangle is a text block in which I inserted the label values.
    Of course if you dislike this scheme, you are perfectly free to use an other application.
    Yvan KOENIG (VALLAURIS, France) lundi 4 juillet 2011 14:37:56 iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8
    Please : Search for questions similar to your own before submitting them to the community
    To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !

  • Bubble Chart with legend changes axis dimensions according to labels length

    I have a Bubble Chart with legend on the right. Data are by series and  the series are set  dynamically with a  drop down combo which replace the content of each series from time to time.  Every time the series changes, also the name of the series changes and the legend on the right  shows the new series names. The problem is that also the x axis dimension changes according to the new labels size, so the bubble chart changes its axis width in relation to the labels length in the legend. Is its possible to make somehow the bubble chart axis of a fixed lenght?
    Xcelsius 2008, SP4, Windows XP
    Thanks in advance

    Hi Matt,
    I just got a chance to try out your suggestions, and the
    chart that is right in the main application renders the labels
    fine, but the exact same code loaded in as a module doesn't. And it
    never does, not even if the scale changes. Do you know why that
    would be?
    Mukul

  • Graph control causes general protection fault when changing axis range (64bit)

    Hello,
    i wrote a 32bit application which i'm porting to 64bit now and stumbled across a problem with the graph control.
    The Graph axsis are set to editable so that the user can change the axis range manually at runtime. The 32bit version has no problem here, but the 64bit  version is crashing  with a general protection fault at the source line with RunUserInterface().
    Is there a compiler option/value or something i should be aware of when swithing to 64bit that should be set?
    Or is this just a problem with the code of the control?
    I tried it with LabWindows v13.0.2 (278)  and v13.0.1, running under Windows 7 64bit.
    Thanks.

    Hello, danouj!
    Thank you for reporting this issue to us!
    However, information you provided is still unsufficient for us to determine the background of this bug.
    Please also provide the following details, so that we can identify the issue and investigate whether a workaround for this problem exists:
    From my understanding, when porting the application to 64-bit, you also performed some code changes to your CVI application. What are these code changes?
    If you run the 64-bit version of your application without these code changes, does the application also crash?
    What is the address of this crash?
    It would also be very useful, if you can send us a copy of a minimal snapshot of your project application, in which the problem still occurs, for us to investigate the issue.
    You can upload the sources at ftp://ftp.natinst.com/incoming
    Best regards,
    - Johannes

  • Changing Axis data values in OBIEE 11g Graph

    Hi ,
    I have a graph with three dimensions and a single measure . So , on x axis I am getting the values with two dimensions like
    Customer1 2013
    Customer1 2012
    Customer1 2011
    I want to change it to Customer1 only . Can anybody suggest how can we change this.

    Why don't you just remove the Year dimension from the "Group By (Horizontal Axis)" section?

  • Changing axis in waveform chart

    How can I set the x-axis to be something other than time. I want to measure all of my inputs vs. a cycle count. Is there a way to change the axis?
    Attachments:
    boolean count.vi ‏12 KB

    Sorry, I posted the one from yesterday. If I change the name in the property node, will it just change the name? I need it to not be time, and instead be another input, the cycle count. Now that the correct vi is posted, you can see what I'm talking about. Thanks
    Attachments:
    boolean count.vi ‏66 KB

  • Changing axis labels on Excel XY Graph

    Hello,
    I'm trying to generate a report using the Report Generation Tollkit, i was following the steps indicated in the NI report tutorial that helped me a lot.
    The problem is that i could not change the scaling of the X axis which is giving me always numbers from 1 to 11 then zeros after while these numbers need to be under date format (ex 10/04/2013), i'll appreciate the help if someone knows how to fix this.
    Thank you,
    MGarry
    Attachments:
    Graph.PNG ‏8 KB
    diagram.PNG ‏13 KB

    Hi MGarry,
    It seems that excel has a special way of representing the date/time format. See this: http://digital.ni.com/public.nsf/allkb/7AAFFD177BBB33CC86256E91000B1E32
    So we know how it is represented in Excel, but the issue is telling excel that those numbers are meant to be interpreted as date/time format not regular decimal numbers. Have you managed to do this in excel manually? (without using the report generation toolkit). If so you might be able to make a skeleton of the graph and then update it using the following excel update graph VI (http://zone.ni.com/reference/en-XX/help/370274E-01/lvoffice/excel_update_graph/). You can also add row headers and column headers. I would check to see if its possible manually first and we can go from there.
    Regards,
    Basil
    Applications Engineering
    National Instruments

  • Changing Axis Labels

    Hi,
    Is there any way to change the Axis labels on runtime? Becuase we have designed a chart page where SQL statements can be created dynamically. Therefore Axis labels should also be changed. But i couldnt figure it out how to do...
    Thanks,
    Osman...

    Hi,
    You can create hidden item that value you set dynamically.
    Then use item like below on Chart attributes Axes Settings
    &Px_MY_ITEM.Hope this helps and was what you looking for
    Br, Jari

  • How do i change axis label object type from label to text? (to allow wrapping)

    In the example of a barChart, how does one change the LABEL type from "Label" to "Text"?
    I am trying to allow for long labels to wrap (ie. multi-line labels), but the default object type of labels is "Label" (which are single-line only).
    I have been researching this issue all day, and have enountered a similar situation for changing the Legend component labels where a method override is implemented in a custom itemRenderer.
    But I have not been able to figure out how to do this for an Axis label.
    Any help would be greatly appreciated!  
    J

    Yes, thank you.  I am aware of the AxisRenderer.... but I'm not sure how to implement it to change the label type from "Label" to "Text" to allow for wrapping.
    I guess what I'm looking for is a good example....  

  • Changing axis data(other than time in x-aix)

    requirement is to plot a graph with voltage in x-axis and counts in y-axis. I have formed a 2-d array and fed as input to graph.
    Could you please guide me in changing the axes accordingly.
    Krithika
    Attachments:
    Block dia.JPG ‏40 KB

    Thanks for the response
    Ok, let me be more clear in my requirement.
    sample data i want to plot:
    Vol         Counts
    16           16.25
    22           63.25
    I have attached the vi now and the graph displays 2 plots ( red and white). The white plot is the 1st col in the aray built ( vol value) and i am not sure what is the red plot and i want to change the graph properties in such a way that vol values are on X-axis and counts values are on Y-axis.
    i am beginner in using labview, kindly bear with me...
    Krithika
    Attachments:
    Plot - Counts.vi ‏47 KB

  • Unable to change Axis y location from right side to left

    Hi All,
    I am working with OBIEE 11.1.1.1.7.
    I am tring to change the location of AXIS Y (in chart) from right side to left.
    please help :-)

    Hi Tyson,
    I did exactly what you have mentioned and it worked fine.
    But when I am putting the same thing in my custom.css file as mentioned below, IT's NOT WORKING.
    uploaded custom.css at
    Application XXX>Shared Components>Cascading Style Sheets
    custom.css
    .TabHolder,.TabHolderC {text-align:left;}calling custom.css in the Page Template (one level tab)
    <head>
    <title>#TITLE#</title>
    <link rel="stylesheet" href="#IMAGE_PREFIX#themes/theme_16/theme_3_1.css" type="text/css" />
    <!--[if IE]><link rel="stylesheet" href="#IMAGE_PREFIX#themes/theme_16/ie.css" type="text/css" /><![endif]-->
    <!-- added custom css file -->
    <link rel="stylesheet" href="#WORKSPACE_IMAGES#custom.css" type="text/css"/>
    #HEAD#
    </head>Any idea why it is not picking up???...
    Thanks,
    Deepak

  • Changing axis of rotation in timeline animation.

    Hi guys I am working on creating a logo with animation, and I am struggling to make a layer rotate without wobbling off of axis. I doing a transform in the timeline, and moving the anchors to the direct center of the screen when I am rotating the layer in transform mode in the timeline to save the animation. Although the layer rotates perfectly when I do it manually to before adding a point on the timeline, when I hit play, the layer wobbles out of axis. Do you guys know how to change the axis of rotation on a layer animation in the timeline?

    What I would try to sove the problem would be to create rasterize layer version of your odd shape layer and add a couple of very transparent pixels so that the retangle layer's bounds would be centered over the center of the round circle part of your shape layer.

  • Any way to change axis?

    Hello,
    I am currently developing a 3d robotic arm simulator in java3d and have hit a problem caused by the axes.
    I worked out my kinematic chain matrix, which was calculated looking down the Y-axis, with the Z axis pointing upward, all rotations performed around the Z-axis.
    However, Java automatically looks down the Z-axis and points the Y-axis upward. I tried rotating the whole scene around the X-axis, and set up to look down the Y-axis using the following code:
    Point3d eye    = new Point3d(0, 10, 0);
              Point3d center = new Point3d(0, 0, 0);
              Vector3d up    = new Vector3d(0, 0, -1);
              Transform3D t3d = new Transform3D();
              t3d.lookAt(eye, center, up);
              t3d.invert();
              ViewingPlatform viewingPlatform = u.getViewingPlatform();
              TransformGroup vpTrans = viewingPlatform.getViewPlatformTransform();
              vpTrans.setTransform(t3d);However, whenever I input x, y and z coordinates to my program, it still uses the old axes, i.e Y upward, X to the side and Z into the screen.
    I was wondering if anyone can tell me why what I've done here is wrong, and if anyone knows of a way to fix this?
    Any help would be greatly appreciated.

    function(){return A.apply(null,[this].concat($A(arguments)))}
    For many years, Illustrator has been the only design application that uses the 1st Quadrant (origin at lower left, y-values increasing as you move up the page).
    Nonsense. FreeHand, Draw, Designer, Canvas, Xtreme are all illustration programs in Illustrator's same product category, and all use the normal Cartesian coordinate system. Same goes for almost all drawing programs in more exacting disciplines, such as CAD.
    function(){return A.apply(null,[this].concat($A(arguments)))}
    If AI allowed you to set the direction of the Y axis...[various ostensible problems cited]
    David,
    Why do you consider it inherently less possible or more problematic to provide the Y-axis orientation as a user setting in Illustrator than it is for other programs that already do so?
    For example:
    Xtreme 5 document with rulers set to normal Y-up orientation:
    Object copied, pasted (Paste In Place) into a separate Different document with Y-down orientation:
    Both documents saved and open at the same time. No problem copying/pasting between them.
    function(){return A.apply(null,[this].concat($A(arguments)))}
    Adding additional controls adds complexity, and many already feel that Illustrator is a complex product and needs to be simpler.
    I quite agree that Illustrator is unnecessarily confused, cluttered, and poorly organized, making it nearly indecipherable to new users. But making a program approachable is an issue of interface design elegance, not a matter of limiting needed functionality. Between Illustrator and Xtreme, which do you consider--on the obvious face of it--more approachable to beginners?
    JET

  • Change axis step pulse width - NI 7340

    Hi,
    I'm controlling a stepper motors with a NI-7340 and UMI 7774 without feedback.  With MAX I've configured the interface and I can see the step & dir waveform on the scope.
    But, the step pulse is only 20us wide and my motor driver does not see it.
    How to increase the pulse width?   I have tried using Set u32.flx in LabVIEW, but the pulse width has not changed.  I have attached the VI and MAX configuration (zip file).
    Please help me.
    Thanks.
    Attachments:
    Straight Line Move.vi ‏80 KB
    configData.nce.zip ‏838 KB

    duplicate post

  • Repeatedly Changing AXI BAR 0 Address Register but Microblaze Keeps Reading from the Same Address

    Hello,
    I work on a project based on AXI PCIe Bridge.
    What I am trying to do is access a userspace memory block directly from a Microblaze (or DMA).
    So far, I use posix_memalign() to allocate a block of memory in the userspace which has the size of the page (4K).
    Once I allocate this block of memory I fill it with data.
    Then I pass its pointer to my kernel driver where I use get_user_pages() and a few other functions to create a scatter/gather list in order to get the physical addresses of my userspace pages (so far I get one physical address since I have allocated one page).
    The next step is to write that physical address to the AXI BAR 0 address register.
    I validate that the correct address is written at this register.
    Then I ask the Microblaze to read the data from this physical address but I get different data.
    After reading the data I ask the Microblaze to write new ones at this address.
    I repeat all that procedure by allocating new memory block filled with different data in my userspace.
    Then I pass the new physical address again at the AXI BAR 0 address register.
    This time the Microblaze reads the last data it wrote itself.
    It seems like the Microblaze always reads/writes from/to an unknown address even if I repeatedly give different physical address at the AXI BAR 0 address register.
    Are there any suggestions?
    Could this be a cache coherency issue?
    Trying the "cache coherency issue" approach, though, did not solve the problem either.
    I have, also, tried a different case which worked.
    I used pci_alloc_consistent() in my kernel driver and I gave its physical address to the AXI BAR 0 address register.
    Then the MIcroblaze writes and reads data from/to this block of memory correctly.
    The kernel driver verified that the transfers are correct since it read the same data that the Microblaze previously wrote.
    This approach always worked for every new allocated block of memory.
     

    Hello,
    I work on a project based on AXI PCIe Bridge.
    What I am trying to do is access a userspace memory block directly from a Microblaze (or DMA).
    So far, I use posix_memalign() to allocate a block of memory in the userspace which has the size of the page (4K).
    Once I allocate this block of memory I fill it with data.
    Then I pass its pointer to my kernel driver where I use get_user_pages() and a few other functions to create a scatter/gather list in order to get the physical addresses of my userspace pages (so far I get one physical address since I have allocated one page).
    The next step is to write that physical address to the AXI BAR 0 address register.
    I validate that the correct address is written at this register.
    Then I ask the Microblaze to read the data from this physical address but I get different data.
    After reading the data I ask the Microblaze to write new ones at this address.
    I repeat all that procedure by allocating new memory block filled with different data in my userspace.
    Then I pass the new physical address again at the AXI BAR 0 address register.
    This time the Microblaze reads the last data it wrote itself.
    It seems like the Microblaze always reads/writes from/to an unknown address even if I repeatedly give different physical address at the AXI BAR 0 address register.
    Are there any suggestions?
    Could this be a cache coherency issue?
    Trying the "cache coherency issue" approach, though, did not solve the problem either.
    I have, also, tried a different case which worked.
    I used pci_alloc_consistent() in my kernel driver and I gave its physical address to the AXI BAR 0 address register.
    Then the MIcroblaze writes and reads data from/to this block of memory correctly.
    The kernel driver verified that the transfers are correct since it read the same data that the Microblaze previously wrote.
    This approach always worked for every new allocated block of memory.
     

Maybe you are looking for

  • Development and Production

    Hi All, I had to append a field in development.  I appended in dev. already there is init and delta happening.  Every half an hour delta is uploading.  so after I append the field, do i do a full upload or init again or do a delta again?  so what hap

  • How do I set up the printer default so that it prints black only, with all my devices and iMac

    Have an Officejet 8600 Plus, used with an iMac. Also using wireless feature to print from iPads and iPhones. The printer has been setup from the iMac to print using the black ink cartridge, only. The problem is with my devices. I am unable to figure

  • Sreaming at the top of my lungs for HELP with Java Script problem!

    Hello, I have this strange problem that no one seems to know why or how to fix it.Whenever I encounter a web site that has java scripting for anything pop ups or redirects to url's anything that says java script when I mouse over the link my browsers

  • I want to move a channel

    I have returned from holiday to find that my BT Vision + box channels have all been altered by BT. My previous signals were from the Winter Hill transmitter, north west, but then altered to BBC Wales,(1) ITV Wales (3) and SC4 (Welsh language) (4) I h

  • Trigger with sequence question

    figured it out Edited by: Jay on Apr 24, 2012 9:49 AM