本文整理汇总了Java中javax.vecmath.Matrix4f.mul方法的典型用法代码示例。如果您正苦于以下问题:Java Matrix4f.mul方法的具体用法?Java Matrix4f.mul怎么用?Java Matrix4f.mul使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.vecmath.Matrix4f
的用法示例。
在下文中一共展示了Matrix4f.mul方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isInteger
import javax.vecmath.Matrix4f; //导入方法依赖的package包/类
public static boolean isInteger(Matrix4f matrix)
{
Matrix4f m = new Matrix4f();
m.setIdentity();
m.m30 = m.m31 = m.m32 = 1;
m.m33 = 0;
m.mul(matrix, m);
for(int i = 0; i < 3; i++)
{
for(int j = 0; j < 3; j++)
{
float v = m.getElement(i, j) / m.getElement(3, j);
if(Math.abs(v - Math.round(v)) > 1e-5) return false;
}
}
return true;
}
示例2: getBlockTransforms
import javax.vecmath.Matrix4f; //导入方法依赖的package包/类
/** Get the default transformations for inside inventories and third person */
protected static ImmutableMap<TransformType, TRSRTransformation> getBlockTransforms() {
ImmutableMap.Builder<TransformType, TRSRTransformation> builder = ImmutableMap.builder();
// Copied from ForgeBlockStateV1
/*builder.put(TransformType.THIRD_PERSON, TRSRTransformation.blockCenterToCorner(new TRSRTransformation(new Vector3f(0, 1.5f / 16, -2.75f / 16),
TRSRTransformation.quatFromYXZDegrees(new Vector3f(10, -45, 170)), new Vector3f(0.375f, 0.375f, 0.375f), null)));
*/
// Gui
{
Matrix4f rotationMatrix = new Matrix4f();
rotationMatrix.setIdentity();
rotationMatrix = rotateTowardsFace(EnumFacing.SOUTH, EnumFacing.EAST);
Matrix4f result = new Matrix4f();
result.setIdentity();
// Multiply by the last matrix transformation FIRST
result.mul(rotationMatrix);
TRSRTransformation trsr = new TRSRTransformation(result);
builder.put(TransformType.GUI, trsr);
}
return builder.build();
}
示例3: handleCameraTransforms
import javax.vecmath.Matrix4f; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public static IBakedModel handleCameraTransforms(IBakedModel model, ItemCameraTransforms.TransformType cameraTransformType, boolean leftHandHackery)
{
if(model instanceof IPerspectiveAwareModel)
{
Pair<? extends IBakedModel, Matrix4f> pair = ((IPerspectiveAwareModel)model).handlePerspective(cameraTransformType);
if(pair.getRight() != null)
{
Matrix4f matrix = new Matrix4f(pair.getRight());
if(leftHandHackery)
{
matrix.mul(flipX, matrix);
matrix.mul(matrix, flipX);
}
multiplyCurrentGlMatrix(matrix);
}
return pair.getLeft();
}
else
{
//if(leftHandHackery) GlStateManager.scale(-1, 1, 1);
ItemCameraTransforms.applyTransformSide(model.getItemCameraTransforms().getTransform(cameraTransformType), leftHandHackery);
//if(leftHandHackery) GlStateManager.scale(-1, 1, 1);
}
return model;
}
示例4: toAffine
import javax.vecmath.Matrix4f; //导入方法依赖的package包/类
public static Pair<Matrix3f, Vector3f> toAffine(Matrix4f m)
{
m.mul(1.f / m.m33);
Vector3f trans = new Vector3f(m.m03, m.m13, m.m23);
Matrix3f linear = new Matrix3f(m.m00, m.m01, m.m02, m.m10, m.m11, m.m12, m.m20, m.m21, m.m22);
return Pair.of(linear, trans);
}
示例5: rotateTowardsFace
import javax.vecmath.Matrix4f; //导入方法依赖的package包/类
/** Rotates towards the given face, from the specified face */
public static Matrix4f rotateTowardsFace(EnumFacing from, EnumFacing to) {
Matrix4f fromMatrix = new Matrix4f(rotateTowardsFace(from));
// Because we want to do the opposite of what this does
fromMatrix.invert();
Matrix4f toMatrix = rotateTowardsFace(to);
Matrix4f result = new Matrix4f(toMatrix);
result.mul(fromMatrix);
return result;
}
示例6: generateAllOperators
import javax.vecmath.Matrix4f; //导入方法依赖的package包/类
private void generateAllOperators(HallInfo h) {
if (h == null) {
h = hallInfo;
if (operationCount > 0)
return;
operations = new SymmetryOperation[4];
operationCount = 0;
if (hallInfo == null || hallInfo.nRotations == 0)
h = hallInfo = new HallInfo(hallSymbol);
setLattice(hallInfo.latticeCode, hallInfo.isCentrosymmetric);
addOperation(null, 0);
addSymmetry("x,y,z", 0);
}
Matrix4f mat1 = new Matrix4f();
Matrix4f operation = new Matrix4f();
Matrix4f[] newOps = new Matrix4f[7];
for (int i = 0; i < 7; i++)
newOps[i] = new Matrix4f();
// prior to Jmol 11.7.36/11.6.23 this was setting nOps within the loop
// and setIdentity() outside the loop. That caused a multiplication of
// operations, not a resetting of them each time.
for (int i = 0; i < h.nRotations; i++) {
mat1.set(h.rotationTerms[i].seitzMatrix12ths);
int nRot = h.rotationTerms[i].order;
// this would iterate int nOps = operationCount;
newOps[0].setIdentity();
int nOps = operationCount;
for (int j = 1; j <= nRot; j++) {
newOps[j].mul(mat1, newOps[0]);
newOps[0].set(newOps[j]);
for (int k = 0; k < nOps; k++) {
operation.mul(newOps[j], operations[k]);
SymmetryOperation.normalizeTranslation(operation);
String xyz = SymmetryOperation.getXYZFromMatrix(operation, true, true, true);
addSymmetry(xyz, operation);
}
}
}
}
示例7: getUnscaledTransformMatrix
import javax.vecmath.Matrix4f; //导入方法依赖的package包/类
Matrix4f getUnscaledTransformMatrix() {
//for povray only
Matrix4f unscaled = new Matrix4f();
unscaled.setIdentity();
vectorTemp.set(fixedRotationCenter);
matrixTemp.setZero();
matrixTemp.setTranslation(vectorTemp);
unscaled.sub(matrixTemp);
matrixTemp.set(matrixRotate);
unscaled.mul(matrixTemp, unscaled);
return unscaled;
}
示例8: getMatrix
import javax.vecmath.Matrix4f; //导入方法依赖的package包/类
public void getMatrix(Matrix4f matrix, float time) {
matrix.setIdentity();
Matrix4f rot = new Matrix4f();
for(SkyLayerRotation roti : rotation) {
roti.getMatrix(rot, time);
matrix.mul(rot);
}
matrix.setTranslation(new Vector3f(offset[0], offset[1], offset[2]));
matrix.setScale(scale);
}
示例9: compose
import javax.vecmath.Matrix4f; //导入方法依赖的package包/类
public TRSRTransformation compose(TRSRTransformation b)
{
Matrix4f m = getMatrix();
m.mul(b.getMatrix());
return new TRSRTransformation(m);
}