本文整理汇总了Java中javax.media.j3d.Transform3D.rotZ方法的典型用法代码示例。如果您正苦于以下问题:Java Transform3D.rotZ方法的具体用法?Java Transform3D.rotZ怎么用?Java Transform3D.rotZ使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.media.j3d.Transform3D
的用法示例。
在下文中一共展示了Transform3D.rotZ方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createBounds
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
* @param newPos
* @param newHeading
* @param dX
* @param dY
* @param radius
* @param t Transformationsmatrix (wird veraendert)
* @return erzeugte Bounds
*/
private Bounds createBounds(Point3d newPos, double newHeading, double dX, double dY, double radius, Transform3D t) {
final double dZ = - CtBotSimTcp.BOT_HEIGHT / 2;
/* Vektor fuer die Verschiebung erstellen */
Vector3d v = new Vector3d(dX, dY, dZ);
/* Transformations-Matrix fuer die Rotation erstellen */
Transform3D r = new Transform3D();
r.rotZ(newHeading);
/* Transformation um Verschiebung ergaenzen */
r.transform(v);
v.add(newPos);
t.setIdentity();
t.setTranslation(v);
/* Bounds erstellen */
Bounds bounds = new BoundingSphere(new Point3d(0, 0, 0), radius);
/* Bounds transformieren */
bounds.transform(t);
return bounds;
}
示例2: 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);
}
示例3: 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);
}
}
示例4: getRotation
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
private TransformGroup getRotation() {
/*
* Create a TransformGroup to rotate the objects in the scene
* and set the capability bits on the TransformGroup so that
* it can be modified at runtime by the rotation behavior.
*/
TransformGroup objTrans = new TransformGroup();
objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
//Create a spherical bounding volume that will define the volume
//within which the rotation behavior is active.
BoundingSphere bounds = new BoundingSphere(
new Point3d(0.0, 0.0, 0.0), 100.0);
//Create a 4 × 4 transformation matrix
Transform3D yAxis = new Transform3D();
double rot = Math.toRadians(90);
yAxis.rotZ(rot);
/*
* Create an Alpha interpolator to automatically generate
* modifications to the rotation component of the transformation
* matrix. This Alpha loops indefinitely and generates numbers
* from 0 to 1 every 4000 milliseconds.
*/
/*
Alpha rotationAlpha = new Alpha(-1, Alpha.INCREASING_ENABLE,
0, 0,
32000, 0, 0,
0, 0, 0);
*
*/
Alpha rotationAlpha = new Alpha(-1, 0);
/*
* Create a RotationInterpolator behavior to effect the
* TransformGroup. Here we will rotate from 0 to 2p degrees about
* the Y-axis based on the output of rotationAlpha.
*/
rotator = new RotationInterpolator(rotationAlpha,
objTrans, yAxis, 0.0f,
(float) Math.PI * 2.0f);
//Set the scheduling bounds on the behavior. This defines the
//volume within which this behavior will be active.
rotator.setSchedulingBounds(bounds);
//Add the behavior to the scenegraph so that Java 3D
//can schedule it for activation.
objTrans.addChild(rotator);
return objTrans;
}
示例5: getRotation
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
private TransformGroup getRotation() {
/*
* Create a TransformGroup to rotate the objects in the scene
* and set the capability bits on the TransformGroup so that
* it can be modified at runtime by the rotation behavior.
*/
TransformGroup objTrans = new TransformGroup();
objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
//Create a spherical bounding volume that will define the volume
//within which the rotation behavior is active.
BoundingSphere bounds = new BoundingSphere(
new Point3d(0.0, 0.0, 0.0), 100.0);
//Create a 4 × 4 transformation matrix
Transform3D yAxis = new Transform3D();
double rot = Math.toRadians(90);
yAxis.rotZ(rot);
/*
* Create an Alpha interpolator to automatically generate
* modifications to the rotation component of the transformation
* matrix. This Alpha loops indefinitely and generates numbers
* from 0 to 1 every 4000 milliseconds.
*/
/*
Alpha rotationAlpha = new Alpha(-1, Alpha.INCREASING_ENABLE,
0, 0,
32000, 0, 0,
0, 0, 0);
*
*/
Alpha rotationAlpha = new Alpha(-1, 0);
/*
* Create a RotationInterpolator behavior to effect the
* TransformGroup. Here we will rotate from 0 to 2p degrees about
* the Y-axis based on the output of rotationAlpha.
*/
rotator = new RotationInterpolator(rotationAlpha,
objTrans, yAxis, 0.0f,
(float) Math.PI * 2.0f);
//Set the scheduling bounds on the behavior. This defines the
//volume within which this behavior will be active.
rotator.setSchedulingBounds(bounds);
//Add the behavior to the scenegraph so that Java 3D
//can schedule it for activation.
objTrans.addChild(rotator);
return objTrans;
}
示例6: z180aboutCenter
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
* @return 180 Grad Drehung um Z
*/
protected static Transform3D z180aboutCenter() {
Transform3D rv = new Transform3D();
rv.rotZ(PI);
return rv;
}
示例7: 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;
}
示例8: sensGroundReflectionCross
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
* Liefert eine Angabe, wie viel Licht vom Boden absorbiert wird und den
* Linien- bzw. Abgrundsensor nicht mehr erreicht. Je mehr Licht reflektiert
* wird, desto niedriger ist der zurueckgegebene Wert. Der Wertebereich
* erstreckt sich von 0 (weiss oder maximale Reflexion) bis 1023 (minimale
* Reflexion, schwarz oder Loch).
*
* Es werden rayCount viele Strahlen gleichmaessig orthogonal zum Heading in
* die Szene geschossen.
*
* Es werden rayCount viele Strahlen gleichmaessig in Form eines "+" in
* die Szene Geschossen.
*
* @param pos
* Die Position, an der der Sensor angebracht ist
* @param heading
* Die Blickrichtung
* @param openingAngle
* Der Oeffnungswinkel des Sensors
* @param rayCount
* Es werden rayCount viele Strahlen vom Sensor ausgewertet.
* @return Die Menge an Licht, die absorbiert wird, von 1023(100%) bis 0(0%)
*/
public short sensGroundReflectionCross(Point3d pos, Vector3d heading, double openingAngle, short rayCount) {
double absorption;
Vector3d xHeading = new Vector3d(heading);
absorption = sensGroundReflectionLine(pos, heading, openingAngle, (short) (rayCount / 2));
Transform3D rotation = new Transform3D();
rotation.rotZ(Math.PI / 2);
rotation.transform(xHeading);
absorption += sensGroundReflectionLine(pos, xHeading, openingAngle, (short) (rayCount / 2));
return (short) (absorption / 2);
}
示例9: setRollTiltPan
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
* Sets up a roll-tilt-pan transform. This is defined as <code>rotZ(pan)*rotY(tilt)*rotX(roll)</code>.
*
* @param rtp
* the (roll, till, pan) angle vector
* @param result
* {@link Transform3D} to store the result in.
* @return <code>result</code>
* @see #getRollTiltPan(Transform3D, Vector3f)
*/
public Transform3D setRollTiltPan( Vector3f rtp , Transform3D result )
{
result.rotZ( rtp.z );
x1.rotY( rtp.y );
result.mul( x1 );
x1.rotX( rtp.x );
result.mul( x1 );
return result;
}
示例10: setRollTiltPan
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
* Sets up a roll-tilt-pan transform. This is defined as <code>rotZ(pan)*rotY(tilt)*rotX(roll)</code>.
*
* @param rtp
* the (roll, till, pan) angle vector
* @param result
* {@link Transform3D} to store the result in.
* @return <code>result</code>
* @see #getRollTiltPan(Transform3D, Vector3f)
*/
public Transform3D setRollTiltPan( Vector3d rtp , Transform3D result )
{
result.rotZ( rtp.z );
x1.rotY( rtp.y );
result.mul( x1 );
x1.rotX( rtp.x );
result.mul( x1 );
return result;
}