本文整理汇总了Java中javax.media.j3d.Transform3D.rotX方法的典型用法代码示例。如果您正苦于以下问题:Java Transform3D.rotX方法的具体用法?Java Transform3D.rotX怎么用?Java Transform3D.rotX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.media.j3d.Transform3D
的用法示例。
在下文中一共展示了Transform3D.rotX方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCompass
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
public static Group createCompass() {
Appearance ap = Compass.generateAppearance(Color.pink, 0.5, true);
Cone c = new Cone(1f, 5f, ap);
Transform3D tf = new Transform3D();
tf.rotX(Math.PI / 2);
Transform3D tf1 = new Transform3D();
tf1.setTranslation(new Vector3d(10, 15, -40));
TransformGroup tg = new TransformGroup(tf);
tg.addChild(c);
TransformGroup tg2 = new TransformGroup(tf1);
tg2.addChild(tg);
return tg2;
}
示例2: updateViewPlatformTransform
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
* Updates <code>viewPlatformTransform</code> transform from camera angles and location.
*/
private void updateViewPlatformTransform(Transform3D transform, float cameraX, float cameraY, float cameraZ,
float cameraYaw, float cameraPitch)
{
Transform3D yawRotation = new Transform3D();
yawRotation.rotY(-cameraYaw + Math.PI);
Transform3D pitchRotation = new Transform3D();
pitchRotation.rotX(-cameraPitch);
yawRotation.mul(pitchRotation);
transform.setIdentity();
transform.setTranslation(new Vector3f(cameraX, cameraZ, cameraY));
transform.mul(yawRotation);
this.camera = new Camera(cameraX, cameraY, cameraZ, cameraYaw, cameraPitch, 0);
}
示例3: updateViewPlatformTransform
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
* Updates the given view platform transformation from yaw angle, pitch angle and scale.
*/
private void updateViewPlatformTransform(TransformGroup viewPlatformTransform, float viewYaw, float viewPitch,
float viewScale)
{
// Default distance used to view a 2 unit wide scene
double nominalDistanceToCenter = 1.4 / Math.tan(Math.PI / 8);
// We don't use a TransformGroup in scene tree to be able to share the same scene
// in the different views displayed by OrientationPreviewComponent class
Transform3D translation = new Transform3D();
translation.setTranslation(new Vector3d(0, 0, nominalDistanceToCenter));
Transform3D pitchRotation = new Transform3D();
pitchRotation.rotX(viewPitch);
Transform3D yawRotation = new Transform3D();
yawRotation.rotY(viewYaw);
Transform3D scale = new Transform3D();
scale.setScale(viewScale);
pitchRotation.mul(translation);
yawRotation.mul(pitchRotation);
scale.mul(yawRotation);
viewPlatformTransform.setTransform(scale);
}
示例4: makeSpin
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
private RotationInterpolator makeSpin(TransformGroup spinner) {
//Alpha alpha = new Alpha(1, Alpha.DECREASING_ENABLE, 0, 10000, 5000, 0, 1000, 5000, 0, 1000);
Alpha alpha = new Alpha(1, 3000);//new Alpha(-1, 10000) set speed here
alpha.setAlphaAtOneDuration(3000);
alpha.setIncreasingAlphaRampDuration(500);
alpha.setMode(Alpha.INCREASING_ENABLE);
rotator = new RotationInterpolator(alpha, spinner);
double rot = Math.toRadians(90);
Transform3D rotate1 = new Transform3D();
rotate1.rotX(rot);
rotate1.setTranslation(new Vector3f(0.3f, 0.3f, 0.0f));
rotator.setTransformAxis(rotate1);
rotator.setSchedulingBounds(bounds);
return rotator;
}
示例5: addScaleBarToSceneGraph
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
* add a 100 µm scale bar to the BranchGroup
*
* @param scene
* the BranchGroup
*/
public static void addScaleBarToSceneGraph(TransformGroup scene, Point3f scaleBarPos, float scale) {
if (scaleBarPos == null) {
scaleBarPos = new Point3f();
}
float barPos = -150.0f * scale;
float hight = 100.0f * scale;
//logger.info("scaleBarPos: " + scaleBarPos.toString());
LineArray la = new LineArray(2, LineArray.COORDINATES | LineArray.COLOR_3);
//la.setCoordinate(0, new Point3f(scaleBarPos.x + 0.7f, scaleBarPos.y + 0.0f, scaleBarPos.z + 0.9f));
//la.setCoordinate(1, new Point3f(scaleBarPos.x + 0.7f, scaleBarPos.y + 0.0f, scaleBarPos.z + 1.0f));
la.setCoordinate(0, new Point3f(barPos, scaleBarPos.y, scaleBarPos.z));
la.setCoordinate(1, new Point3f(barPos, scaleBarPos.y, scaleBarPos.z + hight));
for (int i = 0; i < 2; ++i) {
la.setColor(i, grey);
}
scene.addChild(new Shape3D(la));
Text3D text3d = new Text3D(new Font3D(new Font("plain", java.awt.Font.PLAIN, 1), new FontExtrusion()), "100 µm");
text3d.setAlignment(Text3D.ALIGN_LAST);
Shape3D text3dShape3d = new Shape3D(text3d);
Appearance appearance = new Appearance();
ColoringAttributes ca = new ColoringAttributes();
ca.setColor(grey);
appearance.setColoringAttributes(ca);
text3dShape3d.setAppearance(appearance);
TransformGroup tg = new TransformGroup();
Transform3D t3d = new Transform3D();
t3d.rotX(Math.PI / 2);
float textScale = 30f * scale;
//t3d.setScale(0.025);
t3d.setScale(textScale);
t3d.setTranslation(new Vector3f((barPos + (barPos/10.0f)), scaleBarPos.y, scaleBarPos.z + hight/2.0f));
tg.setTransform(t3d);
tg.addChild(text3dShape3d);
scene.addChild(tg);
// scene.addChild(text3dShape3d);
}
示例6: addText3D
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
public static void addText3D(TransformGroup bg, String text, Vector3f vPos, float scale, Color3f color) {
Text3D text3d = new Text3D(new Font3D(new Font("plain", java.awt.Font.PLAIN, 1), new FontExtrusion()), text);
Shape3D text3dShape3d = new Shape3D(text3d);
Appearance appearance = new Appearance();
ColoringAttributes ca = new ColoringAttributes();
ca.setColor(color);
appearance.setColoringAttributes(ca);
TransparencyAttributes myTA = new TransparencyAttributes();
myTA.setTransparency(0.3f);
myTA.setTransparencyMode(TransparencyAttributes.NICEST);
appearance.setTransparencyAttributes(myTA);
text3dShape3d.setAppearance(appearance);
TransformGroup tg = new TransformGroup();
Transform3D t3d = new Transform3D();
t3d.rotX(Math.PI / 2);
t3d.setTranslation(vPos);
t3d.setScale(scale * 15.0f);
tg.setTransform(t3d);
tg.addChild(text3dShape3d);
bg.addChild(tg);
}
示例7: rotate
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
private void rotate(float x, float y, float z)
{
Transform3D tr = new Transform3D();
if (x != 0) tr.rotX(x);
if (y != 0) tr.rotY(y);
if (z != 0) tr.rotZ(z);
tg.getTransform(tgr);
tgr.mul(tr);
tg.setTransform(tgr);
}
示例8: createPillar
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
* Erzeugt eine Saeule, auch mit Lichtquelle obendrauf moeglich
*
* @param x X-Koordinate (bewegliches Objekt) oder X-Achse im Parcours (unbewegliches Objekt)
* @param y Y-Koordinate (bewegliches Objekt) oder Y-Achse im Parcours (unbewegliches Objekt)
* @param diameter Durchmesser der Saeule
* @param height Hoehe der Saeule
* @param bodyAppearance Saeulen-Appearance
* @param lightAppearance Licht-Appearance oder null
* @param moveable Soll das Objekt bewegbar sein?
*/
private void createPillar(float x, float y, float diameter, float height, Appearance bodyAppearance, Appearance lightAppearance, boolean moveable) {
Cylinder pillar = new Cylinder(diameter / 2.0f, height, bodyAppearance);
// pillar.setName("Object");
pillar.setCapability(javax.media.j3d.Node.ALLOW_PICKABLE_WRITE);
TransformGroup tg = new TransformGroup();
tg.addChild(pillar);
Transform3D translate = new Transform3D();
/* Drehen auf vertikal */
Transform3D rot = new Transform3D();
rot.rotX(0.5 * Math.PI);
translate.mul(rot);
/* unteres Ende auf Fussboden "hochschieben" */
translate.setTranslation(new Vector3f(0, 0, + height / 2.0f - 0.2f));
tg.setTransform(translate);
if (moveable) {
parcours.addMoveableObstacle(tg, x, y);
} else {
parcours.addObstacle(tg, x + 0.5f, y + 0.5f);
}
if (lightAppearance != null) {
createLight(new BoundingSphere(new Point3d(0d, 0d, 0d), 10d), new Color3f(1.0f, 1.0f, 0.9f), (int) x, (int) y, lightAppearance);
}
}
示例9: callbackRender
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
* Calculate the angles and call them back to the app
* @param inFunction function to call (either pov or svg)
*/
private void callbackRender(Export3dFunction inFunction)
{
Transform3D trans3d = new Transform3D();
_orbit.getViewingPlatform().getViewPlatformTransform().getTransform(trans3d);
Matrix3d matrix = new Matrix3d();
trans3d.get(matrix);
Point3d point = new Point3d(0.0, 0.0, 1.0);
matrix.transform(point);
// Set up initial rotations
Transform3D firstTran = new Transform3D();
firstTran.rotY(Math.toRadians(-INITIAL_Y_ROTATION));
Transform3D secondTran = new Transform3D();
secondTran.rotX(Math.toRadians(-INITIAL_X_ROTATION));
// Apply inverse rotations in reverse order to the test point
Point3d result = new Point3d();
secondTran.transform(point, result);
firstTran.transform(result);
// Give the settings to the rendering function
inFunction.setCameraCoordinates(result.x, result.y, result.z);
inFunction.setAltitudeExaggeration(_altFactor);
inFunction.setTerrainDefinition(_terrainDefinition); // ignored by svg, used by pov
inFunction.setImageDefinition(_imageDefinition); // ignored by svg, used by pov
inFunction.begin();
}
示例10: createSceneGraph
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
public BranchGroup createSceneGraph() {
BranchGroup bg = new BranchGroup();
// �L���[�u���X����
Transform3D rotate = new Transform3D();
Transform3D tempRotate = new Transform3D();
rotate.rotX(Math.PI / 4.0);
tempRotate.rotY(Math.PI / 4.0);
rotate.mul(tempRotate);
TransformGroup rotateTG = new TransformGroup(rotate);
// �L���[�u����]����
TransformGroup spinTG = new TransformGroup();
spinTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
// �J���[�L���[�u���쐬����spinTG�ɒlj�
ColorCube cube = new ColorCube(0.4);
spinTG.addChild(cube);
// ��]�^��
Alpha rotationAlpha = new Alpha(-1, 4000);
RotationInterpolator rotator = new RotationInterpolator(rotationAlpha, spinTG);
// �͈͂��w��
BoundingSphere bounds = new BoundingSphere();
rotator.setSchedulingBounds(bounds);
spinTG.addChild(rotator);
rotateTG.addChild(spinTG);
bg.addChild(rotateTG);
return bg;
}
示例11: endDocument
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
@Override
public void endDocument() throws SAXException
{
for (Runnable runnable : this.postProcessingBinders)
{
runnable.run();
}
if (this.visualScene != null)
{
Transform3D rootTransform = new Transform3D();
this.visualScene.getTransform(rootTransform);
BoundingBox bounds = new BoundingBox(
new Point3d(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY),
new Point3d(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY));
computeBounds(this.visualScene, bounds, new Transform3D());
// Translate model to its center
Point3d lower = new Point3d();
bounds.getLower(lower);
if (lower.x != Double.POSITIVE_INFINITY)
{
Point3d upper = new Point3d();
bounds.getUpper(upper);
Transform3D translation = new Transform3D();
translation.setTranslation(new Vector3d(-lower.x - (upper.x - lower.x) / 2,
-lower.y - (upper.y - lower.y) / 2, -lower.z - (upper.z - lower.z) / 2));
translation.mul(rootTransform);
rootTransform = translation;
}
// Scale model to cm
Transform3D scaleTransform = new Transform3D();
scaleTransform.setScale(this.meterScale * 100);
scaleTransform.mul(rootTransform);
// Set orientation to Y_UP
Transform3D axisTransform = new Transform3D();
if ("Z_UP".equals(axis))
{
axisTransform.rotX(-Math.PI / 2);
}
else if ("X_UP".equals(axis))
{
axisTransform.rotZ(Math.PI / 2);
}
axisTransform.mul(scaleTransform);
this.visualScene.setTransform(axisTransform);
BranchGroup sceneRoot = new BranchGroup();
this.scene.setSceneGroup(sceneRoot);
sceneRoot.addChild(this.visualScene);
}
}
示例12: createSceneGraph
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
private BranchGroup createSceneGraph() {
BranchGroup objRoot = new BranchGroup();
//Set up node for rotating the surface based on mouse drags
TransformGroup objTransform = new TransformGroup();
objTransform.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
objTransform.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
//Set up node for translating and scaling the surface
TransformGroup surfaceTranslate = new TransformGroup();
TransformGroup surfaceScale = new TransformGroup();
surfaceTranslate.setBoundsAutoCompute(true);
surfaceScale.setBoundsAutoCompute(true);
surfaceTranslate.addChild(new Surface(_organism, 32, 32));
BoundingSphere bSphere = new BoundingSphere(surfaceTranslate.getBounds());
Point3d center = new Point3d();
bSphere.getCenter(center);
double radius = bSphere.getRadius();
Matrix3d rotate = new Matrix3d();
rotate.setIdentity();
Vector3d translate = new Vector3d(center);
translate.negate();
double scale = 1/radius;
surfaceTranslate.setTransform(new Transform3D(rotate,translate,1.0));
surfaceScale.setTransform(new Transform3D(rotate,new Vector3d(),scale));
surfaceScale.addChild(surfaceTranslate);
//random rotation
Transform3D rotX = new Transform3D();
Transform3D rotY = new Transform3D();
Transform3D rotZ = new Transform3D();
rotX.rotX(2*Math.PI*Math.random());
rotY.rotY(2*Math.PI*Math.random());
rotZ.rotZ(2*Math.PI*Math.random());
rotX.mul(rotY);
rotX.mul(rotZ);
TransformGroup randRot = new TransformGroup(rotX);
randRot.addChild(surfaceScale);
//Add nodes to root tree
objTransform.addChild(randRot);
objRoot.addChild(objTransform);
//Set up lights
DirectionalLight dirLight =
new DirectionalLight(new Color3f(.9f,.9f,.9f),new Vector3f(0,0,-1));
dirLight.setInfluencingBounds(surfaceScale.getBounds());
objRoot.addChild(dirLight);
AmbientLight ambLight = new AmbientLight(new Color3f(.3f,.3f,.3f));
ambLight.setInfluencingBounds(surfaceScale.getBounds());
objRoot.addChild(ambLight);
//Set up mouse interactions
MouseRotate myMouseRotate = new MouseRotate();
myMouseRotate.setTransformGroup(objTransform);
myMouseRotate.setSchedulingBounds(surfaceScale.getBounds());
objRoot.addChild(myMouseRotate);
MouseZoom myMouseZoom = new MouseZoom();
myMouseZoom.setTransformGroup(objTransform);
myMouseZoom.setSchedulingBounds(surfaceScale.getBounds());
objRoot.addChild(myMouseZoom);
MouseTranslate myMouseTranslate = new MouseTranslate();
myMouseTranslate.setTransformGroup(objTransform);
myMouseTranslate.setSchedulingBounds(surfaceScale.getBounds());
objRoot.addChild(myMouseTranslate);
objRoot.compile();
return objRoot;
}