Example usage for javax.media.j3d Transform3D equals

List of usage examples for javax.media.j3d Transform3D equals

Introduction

In this page you can find the example usage for javax.media.j3d Transform3D equals.

Prototype

@Override
public boolean equals(Object o1) 

Source Link

Document

Returns true if the Object o1 is of type Transform3D and all of the data members of o1 are equal to the corresponding data members in this Transform3D.

Usage

From source file:TreePrinter.java

private void printNode(Object o, int indent, Set sharedGroups) {
    for (int i = 0; i < indent; i++)
        printStream.print(">");
    printStream.print(nodeString(o) + ": ");
    if (o instanceof SceneGraphObject) {
        SceneGraphObject sgo = (SceneGraphObject) o;
        int capBits = 0;
        // TODO: how to make sure we always check all the valid bits?
        for (int i = 0; i < 64; i++) {
            if (sgo.getCapability(i)) {
                capBits |= 1 << i;
            }/*from  w w  w  . j  ava2  s.  c  o m*/
        }
        printStream.print("capBits:Ox" + Integer.toHexString(capBits));
        if (o instanceof javax.media.j3d.Group) {
            javax.media.j3d.Group g = (javax.media.j3d.Group) o;
            int numChildren = 0;
            try {
                numChildren = g.numChildren();
            } catch (CapabilityNotSetException e) {
                //anyone who is using treePrinter, is debugging, so it is
                //alright to blindly allow read. you should first detach
                //browser.curScene, print the tree, then add it back to
                //browser.locale when finished.
                g.setCapability(javax.media.j3d.Group.ALLOW_CHILDREN_READ);
                numChildren = g.numChildren();
                //System.out.println("Can't read children on group");
                //return;
            }
            printStream.print(" children:" + numChildren);
            if (o instanceof TransformGroup) {
                Transform3D transform = new Transform3D();
                Transform3D identity = new Transform3D();
                TransformGroup t = (TransformGroup) o;
                t.getTransform(transform);
                // TODO: use getBestType() when implemented
                if (transform.equals(identity)) {
                    printStream.print(" xform:IDENTITY ");
                } else {
                    printStream.print(" xform:NON-IDENTITY ");
                }
            }
        } else if (o instanceof Link) {
            Link l = (Link) o;
            SharedGroup sg = l.getSharedGroup();
            printStream.print(" sg:" + nodeString(sg));
            sharedGroups.add(sg);
        } else {
            printStream.print(": leaf");
        }
    }
    printStream.println();
}