本文整理汇总了Java中javax.vecmath.AxisAngle4d类的典型用法代码示例。如果您正苦于以下问题:Java AxisAngle4d类的具体用法?Java AxisAngle4d怎么用?Java AxisAngle4d使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AxisAngle4d类属于javax.vecmath包,在下文中一共展示了AxisAngle4d类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: copyData
import javax.vecmath.AxisAngle4d; //导入依赖的package包/类
public void copyData()
{
Quat4d dat = panel.getRender().getRotationAttr().getValue();
// Transform3D rot = new Transform3D();
// rot.setRotation(dat);
AxisAngle4d rot = new AxisAngle4d();
rot.set(dat);
int rotX = (int) (dat.x * steps);
int rotY = (int) (dat.y * steps);
int rotZ = (int) (dat.z * steps);
int rotW = (int) (dat.w * steps);
setAllowUpdate(false);
xSlide.setValue(rotX);
ySlide.setValue(rotY);
zSlide.setValue(rotZ);
wManualSlide.setValue(rotW);
setAllowUpdate(true);
}
示例2: setHeading
import javax.vecmath.AxisAngle4d; //导入依赖的package包/类
/**
* Setzt Heading
* @param headingInWorldCoord Heading in Welt-Koordinaten
*/
public final synchronized void setHeading(Vector3d headingInWorldCoord) {
// Optimierung (Transform-Kram ist teuer)
if (this.headingInWorldCoord.equals(headingInWorldCoord)) {
return;
}
/*
* Sinn der Methode: Transform3D aktualisieren, das von Bot- nach
* Weltkoordinaten transformiert. (Dieses steckt in unserer
* TransformGroup.)
*/
this.headingInWorldCoord = headingInWorldCoord;
// Winkel zwischen Welt pos. y-Achse und Bot pos. y-Achse
double angleInRad = radiansToYAxis(headingInWorldCoord);
Transform3D t = new Transform3D();
transformgrp.getTransform(t);
t.setRotation(new AxisAngle4d(0, 0, 1, angleInRad));
transformgrp.setTransform(t);
}
示例3: rotationForAxis
import javax.vecmath.AxisAngle4d; //导入依赖的package包/类
/**
* Builds the appropriate quaternion to rotate around the given orthogonalAxis.
*/
public static Quat4f rotationForAxis(EnumFacing.Axis axis, double degrees)
{
Quat4f retVal = new Quat4f();
switch (axis) {
case X:
retVal.set(new AxisAngle4d(1, 0, 0, Math.toRadians(degrees)));
break;
case Y:
retVal.set(new AxisAngle4d(0, 1, 0, Math.toRadians(degrees)));
break;
case Z:
retVal.set(new AxisAngle4d(0, 0, 1, Math.toRadians(degrees)));
break;
}
return retVal;
}
示例4: getViewTransform
import javax.vecmath.AxisAngle4d; //导入依赖的package包/类
/**
* Get the mapping from view to world coordinates
* @param trans
*/
public void getViewTransform( Matrix4d matrix, double angle )
{
Point3d eyePoint = new Point3d( mLookAtPoint );
Vector3d dir = new Vector3d( mLookDirection );
if ( angle != 0d ) {
double[] rotMat = new double[16];
AxisAngle4d rotAA = new AxisAngle4d( mUpDirection, angle );
set( rotAA, rotMat );
transform( rotMat, dir );
}
dir .scale( -mDistance );
eyePoint .add( dir );
double[] mat = new double[16];
lookAt( mat, eyePoint, mLookAtPoint, mUpDirection );
matrix .set( mat );
}
示例5: setC1
import javax.vecmath.AxisAngle4d; //导入依赖的package包/类
public void setC1(int n) {
Rotation r = new Rotation();
List<Integer> permutation = new ArrayList<Integer>(n);
for (int i = 0; i < n; i++) {
permutation.add(i);
}
r.setPermutation(permutation);
Matrix4d m = new Matrix4d();
m.setIdentity();
r.setTransformation(m);
r.setAxisAngle(new AxisAngle4d());
r.setFold(1);
r.setScores(new QuatSymmetryScores());
rotations.add(r);
pointGroup = "C1";
}
示例6: visibilityStateChange
import javax.vecmath.AxisAngle4d; //导入依赖的package包/类
/**
* Invoked when the user enters or leaves an area.
*
* @param visible true when the user enters the area
* @param position The position of the user on entry/exit
* @param orientation The orientation of the user there
* @param localPosition The vworld transform object for the class
* that implemented this listener
*/
public void visibilityStateChange(boolean visible,
Point3d position,
AxisAngle4d orientation,
Transform3D localPosition) {
if(visible) {
vfEnterTime = vrmlClock.getTime();
hasChanged[FIELD_ENTER_TIME] = true;
fireFieldChanged(FIELD_ENTER_TIME);
vfIsActive = true;
hasChanged[FIELD_IS_ACTIVE] = true;
} else {
vfExitTime = vrmlClock.getTime();
hasChanged[FIELD_EXIT_TIME] = true;
fireFieldChanged(FIELD_EXIT_TIME);
vfIsActive = false;
hasChanged[FIELD_IS_ACTIVE] = true;
}
fireFieldChanged(FIELD_IS_ACTIVE);
}
示例7: parseAxisRotation
import javax.vecmath.AxisAngle4d; //导入依赖的package包/类
public static Quat4f parseAxisRotation(JsonElement e)
{
if (!e.isJsonObject()) throw new JsonParseException("Axis rotation: object expected, got: " + e);
JsonObject obj = e.getAsJsonObject();
if (obj.entrySet().size() != 1) throw new JsonParseException("Axis rotation: expected single axis object, got: " + e);
Map.Entry<String, JsonElement> entry = obj.entrySet().iterator().next();
Quat4f ret = new Quat4f();
try
{
if (entry.getKey().equals("x"))
{
ret.set(new AxisAngle4d(1, 0, 0, Math.toRadians(entry.getValue().getAsNumber().floatValue())));
}
else if (entry.getKey().equals("y"))
{
ret.set(new AxisAngle4d(0, 1, 0, Math.toRadians(entry.getValue().getAsNumber().floatValue())));
}
else if (entry.getKey().equals("z"))
{
ret.set(new AxisAngle4d(0, 0, 1, Math.toRadians(entry.getValue().getAsNumber().floatValue())));
}
else throw new JsonParseException("Axis rotation: expected single axis key, got: " + entry.getKey());
}
catch(ClassCastException ex)
{
throw new JsonParseException("Axis rotation value: expected number, got: " + entry.getValue());
}
return ret;
}
示例8: getRotationMatrix
import javax.vecmath.AxisAngle4d; //导入依赖的package包/类
/**
* Create a matrix that rotates around the specified axis by the specified angle.
*
* @param axis The axis
* @param radians The angle in radians
* @return The rotation matrix
*/
public static Matrix3d getRotationMatrix(EnumFacing.Axis axis, double radians) {
final Vec3i axisDirectionVector = AXIS_DIRECTION_VECTORS.get(axis);
final AxisAngle4d axisAngle = new AxisAngle4d(axisDirectionVector.getX(), axisDirectionVector.getY(), axisDirectionVector.getZ(), radians);
final Matrix3d rotationMatrix = new Matrix3d();
rotationMatrix.set(axisAngle);
return rotationMatrix;
}
示例9: Matrix
import javax.vecmath.AxisAngle4d; //导入依赖的package包/类
public Matrix(int poolSize) {
Preconditions.checkArgument(poolSize >= 0, "poolSize must be greater or equal to zero");
this.matrixPool = new Pool<>(Matrix4d::new, poolSize);
this.vectorPool = new Pool<>(Vector3d::new, poolSize);
this.axisAnglePool = new Pool<>(AxisAngle4d::new, poolSize);
this.matrixStack = new Stack<>();
Matrix4d mat = new Matrix4d();
mat.setIdentity();
this.matrixStack.push(mat);
}
示例10: rotate
import javax.vecmath.AxisAngle4d; //导入依赖的package包/类
public void rotate(double angle, double x, double y, double z) {
Matrix4d mat = this.matrixStack.peek();
Matrix4d rotation = this.getMatrix();
rotation.setIdentity();
AxisAngle4d axisAngle = this.getAxisAngle(x, y, z, angle);
rotation.setRotation(axisAngle);
this.freeAxisAngle(axisAngle);
mat.mul(rotation);
this.freeMatrix(rotation);
}
示例11: updateRotation
import javax.vecmath.AxisAngle4d; //导入依赖的package包/类
public void updateRotation()
{
double xRot = xSlide.getValue() / (double) (steps);
double yRot = ySlide.getValue() / (double) (steps);
double zRot = zSlide.getValue() / (double) (steps);
double wRot = wManualSlide.getValue() / (double) (steps);
wRot *= 3.14;
// System.out.println(steps);
// System.out.println(xSlide.getValue() + " - " + xRot);
// System.out.println(ySlide.getValue() + " - " + yRot);
// System.out.println(zSlide.getValue() + " - " + zRot);
// System.out.println(wManualSlide.getValue() + " - " + wRot);
Transform3D tra = new Transform3D();
AxisAngle4d rotation = new AxisAngle4d();
rotation.setX(xRot);
rotation.setY(yRot);
rotation.setZ(zRot);
rotation.setAngle(wRot);
tra.set(rotation);
Quat4d dat = new Quat4d();
tra.get(dat);
// System.out.println("\nSetting Values\n" + dat.x);
// System.out.println(dat.y);
// System.out.println(dat.z);
// System.out.println(dat.w);
panel.getRender().getRotationAttr().set(tra);
panel.getRender().restoreXform();
}
示例12: showDebugBox
import javax.vecmath.AxisAngle4d; //导入依赖的package包/类
/**
* Zeichnet eine Box zu Debug-Zwecken, indem sie zu TestBG hinzugefuegt wird
* @param x Groesse in X-Richtung
* @param y Groesse in Y-Richtung
* @param z Groesse in Z-Richtung
* @param transform Transformation, die auf die Box angewendet werden soll
* @param angle Winkel, um den die Box gedreht werden soll
*/
public void showDebugBox(final double x, final double y, final double z, Transform3D transform, double angle) {
final Box box = new Box((float) x, (float) y, (float) z, null);
transform.setRotation(new AxisAngle4d(0, 0, 1, angle));
TransformGroup tg = new TransformGroup();
tg.setTransform(transform);
tg.addChild(box);
BranchGroup bg = new BranchGroup();
bg.setCapability(BranchGroup.ALLOW_DETACH);
bg.addChild(tg);
testBG.addChild(bg);
}
示例13: trackballRolled
import javax.vecmath.AxisAngle4d; //导入依赖的package包/类
private void trackballRolled( MouseEvent e )
{
// get the new coordinates
int newX = e .getX();
int newY = e .getY();
// the angle in degrees is just the pixel differences
int angleX = newX - oldX;
int angleY = newY - oldY;
// set the old values
oldX = newX;
oldY = newY;
double radians = ((double) angleY) * mSpeed;
AxisAngle4d yAngle = new AxisAngle4d( new Vector3d( 1d, 0d, 0d ), radians );
radians = ((double) angleX) * mSpeed;
AxisAngle4d xAngle = new AxisAngle4d( new Vector3d( 0d, 1d, 0d ), radians );
Matrix4d x = new Matrix4d();
x.set( xAngle );
Matrix4d y = new Matrix4d();
y.set( yAngle );
x .mul( y );
Quat4d q = new Quat4d();
x .get( q );
trackballRolled( q );
}
示例14: turn
import javax.vecmath.AxisAngle4d; //导入依赖的package包/类
public void turn(Vector3d axis, int stroke, GFigure figure) {
double angle = stroke * GCameraSpinner.SPIN_ANGLE;
AxisAngle4d axisAngle = new AxisAngle4d(axis, angle);
Matrix3d rotMatrix = new Matrix3d();
rotMatrix.set(axisAngle);
rotMatrix.mulNormalize(attitude);
attitude.set(rotMatrix);
figure.cameraTurned();
}
示例15: defaultAttitude
import javax.vecmath.AxisAngle4d; //导入依赖的package包/类
public static Matrix3d defaultAttitude() {
AxisAngle4d axisAngle1 = new AxisAngle4d(1, 1, 1, -Math.PI * 2 / 3);
Matrix3d m1 = new Matrix3d();
m1.set(axisAngle1);
AxisAngle4d axisAngle2 = new AxisAngle4d(0, 1, 0, Math.PI / 7);
Matrix3d m2 = new Matrix3d();
m2.set(axisAngle2);
AxisAngle4d axisAngle3 = new AxisAngle4d(1, 0, 0, Math.PI / 15);
Matrix3d m3 = new Matrix3d();
m3.set(axisAngle3);
m2.mul(m1);
m3.mul(m2);
return m3;
}