本文整理汇总了Java中javax.media.j3d.Transform3D.rotY方法的典型用法代码示例。如果您正苦于以下问题:Java Transform3D.rotY方法的具体用法?Java Transform3D.rotY怎么用?Java Transform3D.rotY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.media.j3d.Transform3D
的用法示例。
在下文中一共展示了Transform3D.rotY方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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);
}
示例3: RangeSensorBelt
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
* Constructs a RangeSensorBelt. The sensor type can be either
* TYPE_BUMPER,TYPE_SONAR,TYPE_IR or TYPE_LASER. Ranges are measured from
* the belt perimeter (not from the belt center).
*
* @param radius
* - the radius of the belt.
* @param minRange
* - the minimal range of each sensor ray. Not used for
* TYPE_BUMPER.
* @param maxRange
* - the maximal range of each sensor ray. Not used for
* TYPE_BUMPER.
* @param nbsensors
* - the number of sensors in the belt (typically 4,6,12,24 or
* 36).
* @param type
* - to specify the sensor behavior
*/
public RangeSensorBelt(float radius, float minRange, float maxRange, int nbsensors, int type, int flags) {
// compute angles ,positions , directions
positions = new Vector3d[nbsensors];
directions = new Vector3d[nbsensors];
Vector3d frontPos = new Vector3d(radius, 0, 0);
Vector3d frontDir = new Vector3d(maxRange, 0, 0);
angles = new double[nbsensors];
Transform3D transform = new Transform3D();
for (int i = 0; i < nbsensors; i++) {
angles[i] = i * 2 * Math.PI / nbsensors;
transform.setIdentity();
transform.rotY(angles[i]);
Vector3d pos = new Vector3d(frontPos);
transform.transform(pos);
positions[i] = pos;
Vector3d dir = new Vector3d(frontDir);
transform.transform(dir);
directions[i] = dir;
}
initialize(radius, maxRange, nbsensors, type, flags);
}
示例4: RangeSensorBelt
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
* Constructs a RangeSensorBelt. The sensor type can be either
* TYPE_BUMPER,TYPE_SONAR,TYPE_IR or TYPE_LASER. Ranges are measured from the
* belt perimeter (not from the belt center).
*
* @param radius
* - the radius of the belt.
* @param minRange
* - the minimal range of each sensor ray. Not used for TYPE_BUMPER.
* @param maxRange
* - the maximal range of each sensor ray. Not used for TYPE_BUMPER.
* @param nbsensors
* - the number of sensors in the belt (typically 4,6,12,24 or 36).
* @param type
* - to specify the sensor behavior
* @param flags additional flags
*/
public RangeSensorBelt(float radius, float minRange, float maxRange, int nbsensors, int type, int flags) {
// compute angles ,positions , directions
positions = new Vector3d[nbsensors];
directions = new Vector3d[nbsensors];
Vector3d frontPos = new Vector3d(radius, 0, 0);
Vector3d frontDir = new Vector3d(maxRange, 0, 0);
angles = new double[nbsensors];
Transform3D transform = new Transform3D();
for (int i = 0; i < nbsensors; i++) {
angles[i] = i * 2 * Math.PI / nbsensors;
transform.setIdentity();
transform.rotY(angles[i]);
Vector3d pos = new Vector3d(frontPos);
transform.transform(pos);
positions[i] = pos;
Vector3d dir = new Vector3d(frontDir);
transform.transform(dir);
directions[i] = dir;
}
initialize(radius, maxRange, nbsensors, type, flags);
}
示例5: getPieceOFFurnitureNormalizedModelTransformation
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
* Returns a transformation able to place in the scene the normalized model
* of the given <code>piece</code>.
*/
Transform3D getPieceOFFurnitureNormalizedModelTransformation(HomePieceOfFurniture piece)
{
// Set piece size
Transform3D scale = new Transform3D();
float pieceWidth = piece.getWidth();
// If piece model is mirrored, inverse its width
if (piece.isModelMirrored())
{
pieceWidth *= -1;
}
scale.setScale(new Vector3d(pieceWidth, piece.getHeight(), piece.getDepth()));
// Change its angle around y axis
Transform3D orientation = new Transform3D();
orientation.rotY(-piece.getAngle());
orientation.mul(scale);
// Translate it to its location
Transform3D pieceTransform = new Transform3D();
float z = piece.getElevation() + piece.getHeight() / 2;
if (piece.getLevel() != null)
{
z += piece.getLevel().getElevation();
}
pieceTransform.setTranslation(new Vector3f(piece.getX(), z, piece.getY()));
pieceTransform.mul(orientation);
return pieceTransform;
}
示例6: addLightSensorLeft
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
* Adds a prebuild light sensor on the left of the agent .
*
* @param agent
* @return the sensor object
*/
static public LightSensor addLightSensorLeft(Agent agent) {
Vector3d front = new Vector3d(agent.getRadius() + 0.5, 0, 0);
Transform3D t3d = new Transform3D();
t3d.rotY(Math.PI / 4);
Vector3d left = new Vector3d(front);
t3d.transform(left);
return RobotFactory.addLightSensor(agent, left, (float) Math.PI / 4, "left");
}
示例7: addLightSensorRight
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
* Adds a prebuild light sensor on the right of the agent .
*
* @param agent
* @return the sensor object
*/
static public LightSensor addLightSensorRight(Agent agent) {
Vector3d front = new Vector3d(agent.getRadius() + 0.5, 0, 0);
Transform3D t3d = new Transform3D();
t3d.rotY(-Math.PI / 4);
Vector3d right = new Vector3d(front);
t3d.transform(right);
return RobotFactory.addLightSensor(agent, right, (float) -Math.PI / 4, "left");
}
示例8: updatePosition
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
* Update the agent's position with instantTranslation and instantRotation
*/
protected void updatePosition() {
Transform3D t3d = t3d1;
if (!collisionDetected) {
// clip vertical deplacement to avoid traversing the floor
translation.get(v1);
double dist = v1.y - height / 2;
if (instantTranslation.y < (-dist)) {
instantTranslation.y = -dist;
}
double delta;
// perform translation
t3d.setIdentity();
t3d.setTranslation(instantTranslation);
translation.mul(t3d);
translationGroup.setTransform(translation);
// perform rotation
t3d.setIdentity();
t3d.rotY(instantRotation.y);
rotation.mul(t3d1);
rotationGroup.setTransform(rotation);
// add tranlation delta to odometer
delta = instantTranslation.length();
odometer += delta;
positionChanged = (delta != 0);
}
}
示例9: rotateY
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/** Rotates (relative to current rotation) the object about Y axis. */
public void rotateY(double angle) {
Transform3D t3d = new Transform3D();
t3d.rotY(angle);
rotation.mul(t3d);
rotationGroup.setTransform(rotation);
}
示例10: 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);
}
示例11: 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();
}
示例12: addLightSensorLeft
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
* Adds a prebuild light sensor on the left of the agent .
* @param agent a
*
* @return the sensor object
*/
static public LightSensor addLightSensorLeft(Agent agent) {
Vector3d front = new Vector3d(agent.getRadius() + 0.5, 0, 0);
Transform3D t3d = new Transform3D();
t3d.rotY(Math.PI / 4);
Vector3d left = new Vector3d(front);
t3d.transform(left);
return RobotFactory.addLightSensor(agent, left, (float) Math.PI / 4, "left");
}
示例13: addLightSensorRight
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
* Adds a prebuild light sensor on the right of the agent .
* @param agent a
*
* @return the sensor object
*/
static public LightSensor addLightSensorRight(Agent agent) {
Vector3d front = new Vector3d(agent.getRadius() + 0.5, 0, 0);
Transform3D t3d = new Transform3D();
t3d.rotY(-Math.PI / 4);
Vector3d right = new Vector3d(front);
t3d.transform(right);
return RobotFactory.addLightSensor(agent, right, (float) -Math.PI / 4, "left");
}
示例14: updatePosition
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
* Update the agent's position with instantTranslation and instantRotation
*/
protected void updatePosition() {
Transform3D t3d = t3d1;
if (!collisionDetected) {
// clip vertical deplacement to avoid traversing the floor
translation.get(v1);
double dist = v1.y - height / 2;
if (instantTranslation.y < (-dist)) {
instantTranslation.y = -dist;
}
double delta;
// perform translation
t3d.setIdentity();
t3d.setTranslation(instantTranslation);
translation.mul(t3d);
translationGroup.setTransform(translation);
// perform rotation
t3d.setIdentity();
t3d.rotY(instantRotation.y);
rotation.mul(t3d1);
rotationGroup.setTransform(rotation);
// add tranlation delta to odometer
delta = instantTranslation.length();
odometer += delta;
positionChanged = (delta != 0);
}
}
示例15: 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;
}