How do setRotationAxis and setRotate work in JavaFX 3D?

There is a texture I have to apply to a sphere. It has an arrow along equator.
When I applied a PhongMaterial with that texture to my sphere, an arrow I needed on top, was on the bottom facing direction opposite of what I needed.
I then called
                    final Sphere sphLeaf = new Sphere(R);
                    sphLeaf.setRotationAxis(Rotate.X_AXIS);
                    sphLeaf.setRotate(180.0);
Then the arrow was correctly placed on top of the sphere, but still facing wrong direction.
I thought that calling
                    sphLeaf.setRotationAxis(Rotate.Y_AXIS);
                    sphLeaf.setRotate(180.0);
would point my arrow where I needed, but instead it was now on the side of the sphere, though facing the right direction.
I thought that each call to setRotationAxis must limit rotation to that axis only. Why is there extra rotation occurring on top of what I requested?

There are two distinct ways to implement an API for applying rotations to Nodes:
1. The Node has a "current rotation" property representing the total rotation of the Node relative to the coordinate system of the Scene. The programmer can change the rotation of the Node by updating this property.
2. The Node has a method for concatenating new rotations to other transforms applied to it (i.e. providing incremental rotations).
The API supports both of these. The way it is written is for the Node to have three specific transformations (a translation, a scale, and a rotation) which can be manipulated via a set of properties (translateX, translateY, translateZ, scaleX, scaleY, scaleZ, rotationAxis, and rotate). These are all properties and obey the usual rules of properties; for example
node.setXXX(value);
assert(node.getXXX()==value);
will always succeed, assuming a single-threaded model.
Additionally, the Node supports a list of arbitrary transforms. These transforms are applied in order, before any of the three transforms above.
So to use 1. above, you can do
node.setRotate(newTotalRotationAmount);
node.setRotationAxis(newAxis); // if necessary
This is really convenient in some circumstances. For example, in an animation it's pretty straightforward to compute how much the node should be rotated (in total) based on the elapsed time of the animation. If you only had the incremental rotation, the animation would need to keep track of how long it was since the previous update (which will vary from rendered frame to rendered frame). JavaFX's animation API takes huge advantage of this, and that's why it's so straightforward to animate a rotation in JavaFX.
To use 2. above, you can do
node.getTransformations().add(Transform.rotate(...));
or
node.getTransformations().add(new Rotate(...));
depending on the rotation you need to append. This is also pretty convenient to code against.
This is fine is you have a relatively small set of rotations you're going to apply, and the result would be complex to compute (for example if they are around different axes).
The one potential problem here is that you would cause memory leaks and could potentially cause slow performance (though I suspect the implementation is written so this wouldn't happen) if you're likely to add arbitrarily many transformations this way. JavaFX 8 adds some API to the Transformation class to deal with this use case. In the most bullet-proof version this would look as follows, though you can probably reduce the code based on surrounding logic:
Rotate additionalRotation = new Rotation(...);
int numTransforms = node.getTransforms().size();
if (numTransforms==0) {
     node.getTransforms().add(additionalRotation);
} else {
     Transform updatedTransform = node.getTransforms().get(numTransforms-1).createConcatenation(additionalRotation);
     node.getTransforms().set(numTransforms-1, updatedTransform);
That seems like a pretty decent API that covers all use cases. The last use case is a little more verbose to use, and is only available in JavaFX 8, but is still not too bad. If you initialize the node to have at least one transformation in the list, and always use this idiom (i.e. just replace the transformation rather than adding any new ones), then you can reduce that to one or two lines.

Similar Messages

  • How does mix and match works in ECC6.0?

    How does mix and match works in ECC 6.0?
    Can some shared on this topic?
    Thanks in advance

    It;s a term used in Retail for combination of sales item eg buy 3 get 1 any other  @ xx price.

  • Is it possible to make is so that, immediately after I import a new clip into FCP, the file is automatically selected in the Event Library? (Similar to how After Effects and Premiere work).

    Is it possible to make is so that, immediately after I import a new clip into FCPX, the file is automatically selected in the Event Library? (Similar to how After Effects and Premiere work). Right now, after I import a new file, I have to then go searching for it amid all the other files in my project. It would be extremely helpful if the file I just imported was already highlighted and selected after import, making it instantly "locatable" and ready to go.

    Kryan73 wrote:
    …  after I import a new file, I have to then go searching for it amid all the other files…
    in a perfect world, you do know the recording date, and you simply scroll to that date.
    in a very perfect world, all your other imports are already tagged, so just have to create a smart list 'unrated' ...
    (I know those messy Events… a friend of mine constantly ignores my advice to check the time/date on his camera; on every battery swap, the cam creates a very erratic timestamp ... his actual recordings are listed as made in "2004" or in "2020" .... )

  • Homework help--almost done but don't know how my class and main work?

    hello, i'm doing a project for my intro to java class. i'm almost done but i'm very confused on making my main and class work. the counter for my class slotMachine keeps resetting after 2 increments. also i don't not know how to make my quarters in the main receive a pay out from my class. Please guide me to understand what i have to do to solve this problem...I have listed my question page and my class and main of what i have done so far. Thank you .I will really appreciate the help.
    Objective: Create a class in Java, make instances of that class. Call methods that solve a particular problem Consider the difference between procedural and object-oriented programming for the same problem.
    Program Purpose:
    Find out how long it will take Martha to lose all of her money playing 3 instances of the slot machine class.
    Specification: Martha in Vegas
    Martha takes a jar of quarters to the casino with the intention of becoming rich. She plays three machines in turn. Unknown to her, the machines are entirely predictable. Each play costs one quarter. The first machine pays 30 quarters every 35th time it is played; the second machine pays 60 quarters every 100th time it is played; the third pays 11 quarters every 10th time it is played. (If she played the 3rd machine only she would be a winner.)
    Your program should take as input the number of quarters in Martha's jar (there will be at least one and fewer than 1000), and the number of times each machine has been played since it last paid.
    Your program should output the number of times Martha plays until she goes broke.
    Sample Session. User input is in italics
    How many quarters does Martha have in the jar?
    48
    How many times has the first machine been played since playing out?
    30
    How many times has the second machine been played since paying out?
    10
    How many times has the third machine been played since paying out?
    9
    Martha plays XXX times
    Specific requirements: You must solve this using an object-oriented approach. Create a class called SlotMachine. Think about: What does a SlotMachine Have? What does it do? What information does it maintain? This is the state and behavior of the object. Each instance of this class will represent a single slot machine. Don�t put anything in the class unless it �belongs� to a single machine.
    In the main method, create 3 instances of the slot machine to solve the problem in the spec. Play the machines in a loop.
    ========================================================================
    my class
    ========================================================================
    public class SlotMachine{
    private int payOut;
    private int playLimit;
    private int counter;
    public SlotMachine (int payOut, int playLimit){
    this.payOut = payOut;
    this.playLimit = playLimit;
    public void setPayOut (int payOut){
    this.payOut = payOut;
    public int getPayOut(){
    return payOut;
    public void setPlayLimit (int playLimit){
    this.playLimit = playLimit;
    public int getPlayLimit(){
    return playLimit;
    public void slotCounter(){
    counter = SavitchIn.readLineInt();
    public int game(){
    counter++;
    if (counter == playLimit){
    counter = 0;
    return payOut - 1;
    return -1; // the game method was edited by my professor but i'm still confused to make it work
    =======================================================================
    my main
    =======================================================================     
    public class Gametesting{
    public static void main(String[]args){
    SlotMachine firstSlotMachine = new SlotMachine (2,3);
    SlotMachine secondSlotMachine = new SlotMachine (2,3);
    SlotMachine thirdSlotMachine = new SlotMachine (2,2);     
    int quarters;
    int playerCount = 0;
    System.out.println("How many quarters does Martha have in the jar?");
    quarters = SavitchIn.readLineInt();
    System.out.println("How many times has the first machine been played since paying out?");
    firstSlotMachine.slotCounter();
    System.out.println("How many times has the second machine been played since paying out?");
    secondSlotMachine.slotCounter();
    System.out.println("How many times has the third machine been played since paying out?");
    thirdSlotMachine.slotCounter();
    while (quarters != 0){
    playerCount++;
    quarters--;
    firstSlotMachine.game();
    if (quarters != 0){
    playerCount++;
    quarters--;
    secondSlotMachine.game();
    if (quarters != 0){
    playerCount++;
    quarters--;
    thirdSlotMachine.game();
    System.out.println("Martha plays " + playerCount + " times");

    The main problem is that you made the first and second slot machine to pay out 2 quarters after 3 games and the third machine pay out two quarters after two games. That is not what your assignment specified.
    SlotMachine firstSlotMachine = new SlotMachine (2,3);
    SlotMachine secondSlotMachine = new SlotMachine (2,3);
    SlotMachine thirdSlotMachine = new SlotMachine (2,2);
    The second problem is that you never add the payout of a machine to Martha's number of quarters.
    Look carefully at the way your professor implemented the game() method. If you think about it, what it returns is the net "gain" from playing a game. On jackpot it returns payOut -1 (jackpot less the one quarter Martha had to pay for the game), otherwise it returns -1 (Martha spends one quarter and wins nothing).
    So what you can do is simply add the returned value to the number of quarters in the jar -
    quarters = <machine>.game();
    instead of quarters--.

  • How does decode and case works?

    Hi,
    I want to know how decode and case works? How they process the arguements. Please explain me with some examples.
    Thanks,
    Sarav
    Edited by: 943941 on Jul 3, 2012 1:42 AM

    welcome
    check this link
    https://forums.oracle.com/forums/ann.jspa?annID=1535
    you will find everything you need
    DECODE compares expr to each search value one by one. If expr is equal to a search, then Oracle Database returns the corresponding result. If no match is found, then Oracle returns default. If default is omitted, then Oracle returns null.
    This example decodes the value warehouse_id. If warehouse_id is 1, then the function returns 'Southlake'; if warehouse_id is 2, then it returns 'San Francisco'; and so forth. If warehouse_id is not 1, 2, 3, or 4, then the function returns 'Non domestic'.
    SELECT product_id,
           DECODE (warehouse_id, 1, 'Southlake',
                                 2, 'San Francisco',
                                 3, 'New Jersey',
                                 4, 'Seattle',
                                    'Non domestic')
           "Location of inventory" FROM inventories
           WHERE product_id < 1775;Edited by: user 007 on Jul 3, 2012 2:40 PM

  • How to backup and restore working Mac OS 9 computer ?

    I have a working G4 running OS 9.0, and I would like to backup and restore that hard disk to a second G4 computer that is OS 9 bootable.
    I have a CD backup taken by Toast v4, of the entire disk, but I do not know how to restore the contents to the second computer. My previous attempt hosed the hard disk inside the second computer.
    I'm thinking I can boot up the second computer via cd-rom or external hard disk, but I'm not sure I can copy the contents from the cd-rom correctly. In particular, I'm guessing the boot sector is challenging to restore.
    I probably have some old OS 9 cd-roms around here, if I need to go that route.
    I've thought about removing the working hard disk, and using dd on a linux machine to make a clone of the drive. I'd prefer not to go that route, as I don't want to touch working hardware.
    I've also thought about hooking up a portable USB disk drive to my working OS 9 machine, and doing some sort of cloning. I'm not sure what program I would need to do that, and whether it's part of the OS 9 suite of tools, or a 3rd party tool. I used to own some various disk tools, but it's been so long I'm not sure I can find the cd's.
    So if anybody can point to some instructions on the net for me to follow, or have any suggestions, I'm all ears.
    Thanks
    mark

    If the second computer originally shipped supporting a newer OS 9.x
    system than the first 9.0, the other computer's OS9 version probably
    won't work since it would be too old. In the case of drag and drop,
    you can get away with a lot more than what an installer package may
    allow, since the installer's software can be avoided with Pacifist. So
    another computer's OS9.2.2 basic system could be used as a boot
    volume even if it is sparse and not the fully complemented OS 9.2.2
    that a full retail build would install from a rich full retail install disc.
    Usually the retail path was an OS 9.2.1 retail and the update to 9.2.2;
    but machines requiring OS 9.2.2 won't like a 9.2.1. Sometimes, since
    a drag and drop is not driven by installer software, you can use older.
    But machine specific bits, some critical for graphic card drivers & etc,
    would be likely missing unless the software used offered that support.
    If you can find one of these, it may work = note, out of stock:
    691-3638-A Apple G3/G4 9.2.2 (CD) System Software
    {This is a Mac OS 9.2.2 full installation CD, color Grey.}
    These do not come in retail packaging.
    http://www.welovemacs.com/6913638a.html
    Have fun, even if it isn't exactly as planned.
    Good luck & happy computing!
    { edited }

  • How does QoS and Queueing work?

    Hello,
    I am new to QoS/Networking and I have a few questions so I hope you can help me.
    1. ToS is older than DiffServ so how does the router know that the bits are set by DiffServ and not ToS?
    2. Why should I use L3 prioritization instead of L2? If I have Switches on the way from the frame I have to use L2 priorization right?
    3. Do I need L2 and L3 priorization if I use Router and Switches or is the Router able to interpret  the 802.1p CoS Tags, too?
    4. I don't understand the way how Cisco Switches are queueing traffic. I read about some specification like "1P4Q4T". I know it's about priority- and standart queues and bandwith thresholds but how does they work?
    4.1 How do you define the bandwith thresholds? What does 4 thresholds mean?
    4.2 How are the Queues used if I don't use QoS?
    4.3 How are the queues used if I prioritize 1 VLAN?
    I watched a few tutorials and read a lot in the world wide web but I haven't found the answers, yet. I hope you can help me.
    Best Regards,
    Veit

    Did nobody have an answer for those questions?

  • How do iPhoto and iTunes work with each other

    I am very confused about how iPhoto (which is located in the file structure on my Macair under pictures) interacts with iTunes and Photos on my iPad.  The management (including synching and moving photos) is not very intuitive.  Anyone care to shoot me a link on where to find a good explanation or try their hand at explain this?  Thanks.

    Instructions here >  iTunes: How to share music between different accounts on a single computer
    And here >  iPhoto: Sharing libraries among multiple users

  • How to install  and make work efront LMS system on a mac mini server

    I need everyones help.
    I like to install and make to work efront learning management system. Do anyone knowsthe steps i have to do? The only i did and was unsuccesfuly is to download unzip and put the folder in the libraries-webserver-documents and try from the browser putting the address http://mydomain.com/efront/www/install/install.php
    Brings me to the installation page press continue and then says to me to fix some php settings. After that i do not know what to do. If any knows please help..

    If it has more than one OS installed you use either System Preferences>Startup Disk, or hold the Option/alt key at bootup to select which one.

  • How does "SoftReference" and "WeakReference" work?

    Hello, everybody!
    I want to design a cache with "SoftReference"
    the cache is just like:
    int length = 1024;
    Object[] cacheObjects = new Object[length+1];
    cacheObjects[value.hashCode() & length] = new SoftReference(value);I hope the "value" and soft reference are cleared by gc at some time before throwing "OutOfMemoryError" if there is no directly reference to the "value" object.
    So I wrote a simple test:
    private static void softCache() {
            int i = 400000;
            List<String> list = new ArrayList<String>(i + 1);
            String a = "...."; // a huge string;
            while (i-- > 0) {
                list.add(a + i);
            Reference<Object> ref = new SoftReference<Object>(110);
            try {
                long[] b = new long[20000000];
                System.out.println(b[0]);
            } catch (Exception e) {
            } finally {
                System.out.println(ref.get());
            System.out.println("OK");
        }The test result is:
    the ref and the 110 object are not cleared before throw "OutOfMemoryError".
    Why?

    Well, for a start the result of boxing 110 is a
    reference to a static Integer object - Integer has
    predefined instances for numbers up to 128, I
    believe. So there's a strong reference to it, and it
    can't be cleared. The ref variable won't be cleared,
    because it's a strong reference to a WeekReference
    object.Yes, you are right. If I change 110 to 1000. it was cleared.
    Thanks.
    Your has table stuff is wrong (you need to use %
    length not & length, and allow for synonyms, i.e.
    different objects with the same hashCode), might as
    well stick to HashMap. You need a seperate key anyway
    to find the appropriate object in a cache.why '% length', not '& length'?
    It 's allowed to cover by the object with same hashCode.
    here the cache is for huge number object(may more than 10,000, 000).
    It's more important to save space and improve speed if match probability > 90%. not nedd to find the appropriate object for each key.
    You should also use a cleanup thread. Create a
    reference queue and attach the SoftReferences to it,
    then a cleanup thread deletes the entries from the
    hashtable when their references are cleared. The
    requires extending the SoftReference class to add the
    key information needed to find and clear the hash
    table entry.yes. thank your advice.

  • How does tRFC and JCO3 work?

    Hello.
    I'm building an application that based on JCo 3 and iDoc libraries 3 will be used to execute BAPIs remotely and also send iDocs.
    I'm wondering if it will be a valid scenario to use the same TID in to make multiple calls and if this whole set of calls will be consider to be part of the same transaction. For example:
    JCoFunction function1 = ...;
    JCoFunction function2 = ...;
    IDocDocument idoc1 = ...;
    try {
       String tid = destination.createTID();
       function1.execute(destination, tid);
       JCoIDoc.send(idoc1, ..., destination, tid);
       function2.execute(destination, tid);
       destination.confirmTID(tid);
    } catch(Exception ex) {
    Is this something that makes sense? Or should createTID and confirmTID be called for each execute/send? If this is valid, what will happen if executing function2 fails? Is there any way to notify that the tid was not finished or is not valid?
    Thank you very much.

    Did nobody have an answer for those questions?

  • App Store - How does licensing and transferring work?

    I've just purchased and downloaded Aperture from the Mac App Store and it appears to have installed correctly but I have no notification of a licence number, no dmg file and no information about whether I can load it on other computers that I own. Is this a one computer licence or what? and what happens if I lose the program or have a disk crash or change to another machine?

    There is no license as the apps are already pre-registered for ownership via the MAS. There is no disc image. The applications are simply fully installed on your computer as if you installed from a disc image.
    If you select MAS Help from its Help menu, open the section "Purchase applications" then select "Use applications on multiple Macs." The information should answer the question.

  • How SDA and DDA works in Java Card?

    Hi Friends,
    I want to know how exactly SDA and DDA works in Java Card technology..
    Yes, i know that SDA (Static Data Authentication) is valid for every transactions, but the key used is always same for every transaction made..
    and DDA (Dynamic Data Authentication) uses dynamic key for every transactions, it means that one key is valid for one transaction..
    But, i'm a little bit confused how this is implemented in Java Card..
    Is it related with SCP01 and SCP02?..
    Please help me regarding this..
    Thanks in advance

    Hi,
    I want to know how exactly SDA and DDA works in Java Card technology..This is an EMV concept and as such is not implemented in Java Card as such. You would have to create an implementation to be able to use SDA and DDA.
    But, i'm a little bit confused how this is implemented in Java Card..
    Is it related with SCP01 and SCP02?..It is not implemented natively in Java Card and are not related to SCP. SDA and DDA are for the EMV card application (card application data updates) and SCP is for the card manager (card content updates). While they could be considered similar concepts, they are not related in a Java Card sense.
    Cheers,
    Shane

  • What are condition variables? how do condition variables and monitors work?

    What are condition variables? how do condition variables and monitors work? Isn't condition variables the same as semaphore? After reading their implementaion over and over again..I still don't know how condition variables and monitors work together to provide good synchroniztion.
    Thanks

    I can tell you they have nothing to do with Serialization.
    Are you refering to the Condition class in Java 5+
    Usually you would use either a Condition or use synchronization, so you shouldn't need to use them together.

  • How the downconversion and sampling

    Dear Sir/Madam,
    I am working on the NI card Pxi-5660 (NI Pxi-5600 & NI Pxi-5620) and I
    would need to understand better how the downconversion and sampling
    works:
    1) When we configure the card, we set the carrier frequency fc and
    bandwidth B to control downconversion. I understand that the band that
    we consider is between fc-B/2 and fc+B/2. How is this band
    downconverted? (i.e. how do you choose the frequency of local
    oscillator? Is it fc-B/2?)
    2) Concerning the digitizer. How is the sampling frequency chosen as a
    function of fc and B? Does it work at a fixed sampling frequency of
    64Ms/s or do you change the sampling frequency as a function of B?
    I would appreciate if you can help me on these issues. Thank you very
    much in advance.
    Best regards,

    Hi Babu,
    Campaign Type controles the Objective and Tactics in Marketing Planner.
    Based on Type we define Objectives and Tactics in Marketing Planner/Campaign.
    Thanks,
    Srini.

Maybe you are looking for

  • How to get selected  row index  of a Table ?

    hi gurus,I'm new  to Webdynpro for abap I'm displaying    just Flight details in a Table  so how to get selected  row index  of a  Table  and need  to be display in Message manager.

  • Why do multiple Download windows pop up when I download a PDF or other file?

    Everytime I try to download a file (PDF, JPG, DOC) that was attached to an email (I am using Outlook WebMail) the document will download fine HOWEVER eight (8!!!) or more Download windows pop up as if I tried to download that file eight (or more) tim

  • How can I see what is on my cloud?

    How can I see what is on my cloud? Also, I keep getting asked to manage storage when I am watching videos that I have bought through the store. I have bought lots of cloud space only half of which is used. Is my device too full of pictures or videos

  • How do you cancel BT Sports?

    I'm currently on Sky HD but I'm cancelling it as the majority of programmes I watch are on freeview. I signed up online for BT Sports back in May but I've changed my mind & don't wish to go ahead with it anymore. How do you cancel this before the sea

  • 500 internal error in one WFE

    I have SharePoint farm with 3 WFE. Site gives 500 error wheneve it hits one of the WFEs. Strange part is same site will load with Newsfeed, skydrive and sites at top once and again will not have those features if you open up from the other browser an