Java examples for javax.media.j3d:Transform3D
create Java 3D Transform Group
/**/*from ww w .j a v a2 s. c o m*/ * Copyright (c) 2014 Sa?l Pi?a <sauljabin@gmail.com>. * * This file is part of WaspsNestBuilding. * * WaspsNestBuilding is licensed under The MIT License. * For full copyright and license information please see the LICENSE file. */ import java.awt.Color; import javax.media.j3d.Appearance; import javax.media.j3d.Background; import javax.media.j3d.BoundingSphere; import javax.media.j3d.Material; import javax.media.j3d.Transform3D; import javax.media.j3d.TransformGroup; import javax.media.j3d.TransparencyAttributes; import javax.vecmath.Color3f; import javax.vecmath.Vector3d; public class Main{ public static TransformGroup createTransformGroup(Vector3d displace, Vector3d scale, double rotationX, double rotationY, double rotationZ) { TransformGroup tg = new TransformGroup(); tg.setTransform(createTransform3D(displace, scale, rotationX, rotationY, rotationZ)); return tg; } public static Transform3D createTransform3D(Vector3d displace, Vector3d scale, double rotationX, double rotationY, double rotationZ) { Transform3D t = new Transform3D(); Transform3D taux = new Transform3D(); if (scale != null) { taux.setScale(scale); t.mul(taux); } if (displace != null) { taux.setTranslation(displace); t.mul(taux); } taux.rotX(rotationX); t.mul(taux); taux.rotY(rotationY); t.mul(taux); taux.rotZ(rotationZ); t.mul(taux); return t; } }