本文整理汇总了Java中javax.vecmath.Matrix4d.mul方法的典型用法代码示例。如果您正苦于以下问题:Java Matrix4d.mul方法的具体用法?Java Matrix4d.mul怎么用?Java Matrix4d.mul使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.vecmath.Matrix4d
的用法示例。
在下文中一共展示了Matrix4d.mul方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: inBounds
import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
private boolean inBounds( Matrix4d mini, List<double[]> bounds ) {
// mini matrix is in mini-mesh format: a translation from a 255^3 cube in the first quadrant
// trans.offset is a transform from that space, into jme rendered space (cartesian in meters, around the origin)
Matrix4d m = new Matrix4d();
m.mul( Jme3z.fromMatrix ( trans.offset ), mini );
for (Point2d p : Arrays.stream( cubeCorners ).map( c -> {
Point3d tmp = new Point3d();
m.transform( c, tmp );
return new Point2d(tmp.x, tmp.z);
}).collect( Collectors.toList() ) ) {
for (double[] bound : bounds) {
if (
bound[0] < p.x && bound[1] > p.x &&
bound[2] < p.y && bound[3] > p.y )
return true;
}
}
return false;
}
示例2: combineTransformation
import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
static Matrix4d combineTransformation(Matrix4d matrix, Vector3d translation, Vector3d rotation) {
Matrix4d gM = new Matrix4d(matrix);
Matrix4d m = new Matrix4d();
m.setIdentity();
m.setTranslation(translation);
gM.mul(m);
m.setIdentity();
m.rotZ(rotation.z);
gM.mul(m);
m.setIdentity();
m.rotY(rotation.y);
gM.mul(m);
m.setIdentity();
m.rotX(rotation.x);
gM.mul(m);
return gM;
}
示例3: mul
import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
/**
* Multiply this transform by t1. This transform will be update
* and the result returned
*
* @param transform
* @return this
*/
public CellTransform mul(CellTransform in) {
// This does not work when scale!=1
// this.scale *= in.scale;
// this.translation.addLocal(rotation.mult(in.translation).multLocal(in.scale));
// this.rotation.multLocal(in.rotation);
// Correctly calculate the multiplication.
Quat4d q = new Quat4d(rotation.x, rotation.y, rotation.z, rotation.w);
Vector3d t = new Vector3d(translation.x, translation.y, translation.z);
Matrix4d m = new Matrix4d(q,t,scale);
Quat4d q1 = new Quat4d(in.rotation.x, in.rotation.y, in.rotation.z, in.rotation.w);
Vector3d t1 = new Vector3d(in.translation.x, in.translation.y, in.translation.z);
Matrix4d m1 = new Matrix4d(q1,t1,in.scale);
m.mul(m1);
m.get(q);
m.get(t);
scale = (float)m.getScale();
rotation.set((float)q.x, (float)q.y, (float)q.z, (float)q.w);
translation.set((float)t.x, (float)t.y, (float)t.z);
return this;
}
示例4: getGlobalRotationMatrix
import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
/**
*
* @param rot_x
* @param rot_y
* @param rot_z
* @return
*/
private static Matrix4d getGlobalRotationMatrix(double rot_x, double rot_y, double rot_z) {
Matrix4d m4d;
// Checked
Matrix4d m4d_x = new Matrix4d(1D, 0D, 0D, 0D, 0D, Math.cos(rot_x), -Math.sin(rot_x), 0D, 0D, Math.sin(rot_x), Math.cos(rot_x), 0D, 0D, 0D, 0D, 1D);
// Checked
Matrix4d m4d_y = new Matrix4d(Math.cos(rot_y), 0D, Math.sin(rot_y), 0D, 0D, 1D, 0D, 0D, -Math.sin(rot_y), 0, Math.cos(rot_y), 0D, 0D, 0D, 0D, 1D);
// Checked
Matrix4d m4d_z = new Matrix4d(Math.cos(rot_z), Math.sin(rot_z), 0D, 0D, -Math.sin(rot_z), Math.cos(rot_z), 0D, 0D, 0D, 0D, 1D, 0D, 0D, 0D, 0D, 1D);
m4d_x = updateMatrix(m4d_x);
m4d_y = updateMatrix(m4d_y);
m4d_z = updateMatrix(m4d_z);
m4d = m4d_x;
m4d.mul(m4d_y);
m4d.mul(m4d_z);
return m4d;
}
示例5: getRepeatTransform
import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
/**
* Return the transformation that needs to be applied to a
* repeat in order to superimpose onto repeat 0.
*
* @param repeat the repeat index
* @return transformation matrix for the repeat
*/
public Matrix4d getRepeatTransform(int repeat){
Matrix4d transform = new Matrix4d();
transform.setIdentity();
int[] counts = getAxisCounts(repeat);
for(int t = counts.length-1; t>=0; t--) {
if( counts[t] == 0 )
continue;
Matrix4d axis = new Matrix4d(axes.get(t).getOperator());
for(int i=0;i<counts[t];i++) {
transform.mul(axis);
}
}
return transform;
}
示例6: translate
import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
public void translate(double x, double y, double z) {
Matrix4d mat = this.matrixStack.peek();
Matrix4d translation = this.getMatrix();
translation.setIdentity();
Vector3d vector = this.getVector(x, y, z);
translation.setTranslation(vector);
this.freeVector(vector);
mat.mul(translation);
this.freeMatrix(translation);
}
示例7: rotate
import javax.vecmath.Matrix4d; //导入方法依赖的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);
}
示例8: trackballRolled
import javax.vecmath.Matrix4d; //导入方法依赖的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 );
}
示例9: combine
import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
/**
* Returns the combination (product) of two biological assembly transformations.
* @param matrix1
* @param matrix2
* @return combined transformation
*/
public static BiologicalAssemblyTransformation combine(BiologicalAssemblyTransformation matrix1, BiologicalAssemblyTransformation matrix2) {
Matrix4d transformation = new Matrix4d(matrix1.transformation);
transformation.mul(matrix2.transformation);
BiologicalAssemblyTransformation combined = new BiologicalAssemblyTransformation();
combined.setTransformationMatrix(transformation);
return combined;
}
示例10: analyze
import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
/**
* This method is the main function call to extract all step parameters, pairing parameters, and sequence
* information from the Structure object provided to the constructor.
* @return This same object with the populated data, convenient for output
* (e.g. <i>log.info(new BasePairParameters(structure).analyze());</i>)
*/
public BasePairParameters analyze() {
if (structure == null) {
pairingParameters = null;
stepParameters = null;
return this;
}
List<Chain> nucleics = this.getNucleicChains(nonredundant);
List<Pair<Group>> pairs = this.findPairs(nucleics);
this.pairingParameters = new double[pairs.size()][6];
this.stepParameters = new double[pairs.size()][6];
Matrix4d lastStep;
Matrix4d currentStep = null;
for (int i = 0; i < pairs.size(); i++) {
lastStep = currentStep;
currentStep = this.basePairReferenceFrame(pairs.get(i));
referenceFrames.add((Matrix4d)currentStep.clone());
for (int j = 0; j < 6; j++) pairingParameters[i][j] = pairParameters[j];
if (i != 0) {
lastStep.invert();
lastStep.mul(currentStep);
double[] sparms = calculateTp(lastStep);
for (int j = 0; j < 6; j++) stepParameters[i][j] = sparms[j];
}
}
return this;
}
示例11: getSymmetryAxes
import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
/**
* Recursive helper
* @param symmAxes output list
* @param prior transformation aligning the first repeat of this axis with the first overall
* @param level current level
*/
private void getSymmetryAxes(List<Axis> symmAxes, Matrix4d prior, int level, int firstRepeat) {
if(level >= getNumLevels() ) {
return;
}
Axis elem = axes.get(level);
Matrix4d elemOp = elem.getOperator();
// Current axis:
// elementary maps B -> A
// prior maps I -> A and J -> B
// want J -> I = J -> B -> A <- I= inv(prior) * elementary * prior
Matrix4d currAxisOp = new Matrix4d(prior);
currAxisOp.invert();
currAxisOp.mul(elemOp);
currAxisOp.mul(prior);
Axis currAxis = new Axis(currAxisOp,elem.getOrder(),elem.getSymmType(),level,firstRepeat);
symmAxes.add(currAxis);
//Remember that all degrees are at least 2
getSymmetryAxes(symmAxes,prior,level+1,firstRepeat);
//New prior is elementary^d*prior
Matrix4d newPrior = new Matrix4d(elemOp);
newPrior.mul(prior);
int childSize = getNumRepeats(level+1);
getSymmetryAxes(symmAxes,newPrior,level+1,firstRepeat+childSize);
for(int d=2;d<elem.getOrder();d++) {
newPrior.mul(elemOp,newPrior);
getSymmetryAxes(symmAxes,newPrior,level+1,firstRepeat+childSize*d);
}
}
示例12: isEquivalent
import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
/**
* Returns true if the given CrystalTransform is equivalent to this one.
* Two crystal transforms are equivalent if one is the inverse of the other, i.e.
* their transformation matrices multiplication is equal to the identity.
* @param other
* @return
*/
public boolean isEquivalent(CrystalTransform other) {
Matrix4d mul = new Matrix4d();
mul.mul(this.matTransform,other.matTransform);
if (mul.epsilonEquals(IDENTITY, 0.0001)) {
return true;
}
return false;
}
示例13: postSet
import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
public void postSet() {
final Matrix4d m = getM();
if (translation != null) {
final Matrix4d t = new Matrix4d();
t.set(translation);
m.mul(t);
}
if (rotation != null) {
final Matrix4d r = new Matrix4d();
r.rotX(Math.toRadians(rotation.x));
m.mul(r);
r.rotY(Math.toRadians(rotation.y));
m.mul(r);
r.rotZ(Math.toRadians(rotation.z));
m.mul(r);
}
if (scale != null) {
final Matrix4d s = new Matrix4d();
s.setIdentity();
s.setElement(0, 0, scale.x);
s.setElement(1, 1, scale.y);
s.setElement(2, 2, scale.z);
m.mul(s);
}
final Matrix4d minv = getMinv();
minv.invert(getM());
}
示例14: concatenate
import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
/** Concatenate transformations
*
* @param second Transformation which is intended to be applied second in the resulting concatenated transformation.
* @return concatentated transformation
*/
public AffineTransform3D concatenate(AffineTransform3D second) {
Matrix4d concatenatedMatrix = new Matrix4d(second.matrix);
concatenatedMatrix.mul(matrix);
return new AffineTransform3D(concatenatedMatrix);
}
示例15: getParentTransformation
import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
private float[][] getParentTransformation(List<QubbleCuboid> parentCuboids)
{
Matrix4d matrix = new Matrix4d();
matrix.setIdentity();
Matrix4d transform = new Matrix4d();
for (QubbleCuboid cuboid : parentCuboids)
{
transform.setIdentity();
transform.setTranslation(new Vector3d(cuboid.getPositionX(), cuboid.getPositionY(), cuboid.getPositionZ()));
matrix.mul(transform);
transform.rotZ(cuboid.getRotationZ() / 180 * Math.PI);
matrix.mul(transform);
transform.rotY(cuboid.getRotationY() / 180 * Math.PI);
matrix.mul(transform);
transform.rotX(cuboid.getRotationX() / 180 * Math.PI);
matrix.mul(transform);
}
double sinRotationAngleY, cosRotationAngleY, sinRotationAngleX, cosRotationAngleX, sinRotationAngleZ, cosRotationAngleZ;
sinRotationAngleY = -matrix.m20;
cosRotationAngleY = Math.sqrt(1 - sinRotationAngleY * sinRotationAngleY);
if (Math.abs(cosRotationAngleY) > 0.0001)
{
sinRotationAngleX = matrix.m21 / cosRotationAngleY;
cosRotationAngleX = matrix.m22 / cosRotationAngleY;
sinRotationAngleZ = matrix.m10 / cosRotationAngleY;
cosRotationAngleZ = matrix.m00 / cosRotationAngleY;
}
else
{
sinRotationAngleX = -matrix.m12;
cosRotationAngleX = matrix.m11;
sinRotationAngleZ = 0;
cosRotationAngleZ = 1;
}
float rotationAngleX = (float) (this.epsilon((float) Math.atan2(sinRotationAngleX, cosRotationAngleX)) / Math.PI * 180);
float rotationAngleY = (float) (this.epsilon((float) Math.atan2(sinRotationAngleY, cosRotationAngleY)) / Math.PI * 180);
float rotationAngleZ = (float) (this.epsilon((float) Math.atan2(sinRotationAngleZ, cosRotationAngleZ)) / Math.PI * 180);
return new float[][] { { this.epsilon((float) matrix.m03), this.epsilon((float) matrix.m13), this.epsilon((float) matrix.m23) }, { rotationAngleX, rotationAngleY, rotationAngleZ } };
}