create Java 3D Translated TransformGroup - Java javax.media.j3d

Java examples for javax.media.j3d:Transform3D

Description

create Java 3D Translated TransformGroup

Demo Code


import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Enumeration;
import javax.media.j3d.Appearance;
import javax.media.j3d.BoundingSphere;
import javax.media.j3d.BranchGroup;
import javax.media.j3d.Material;
import javax.media.j3d.Node;
import javax.media.j3d.PolygonAttributes;
import javax.media.j3d.Shape3D;
import javax.media.j3d.Transform3D;
import javax.media.j3d.TransformGroup;
import javax.vecmath.Color3f;
import javax.vecmath.Point3d;
import javax.vecmath.Point3f;
import javax.vecmath.Quat4f;
import javax.vecmath.Vector3f;

public class Main{
    public static synchronized TransformGroup createTranslatedTG(
            Vector3f translation) {
        TransformGroup TG = new TransformGroup();
        TG.setCapability(Node.ALLOW_LOCAL_TO_VWORLD_READ);
        Transform3D transform = new Transform3D();
        transform.setTranslation(translation);
        TG.setTransform(transform);/*w ww.  j a v  a  2s.  c o  m*/
        return TG;
    }
}

Related Tutorials