com.ardor3d.math.Transform.invert()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(113)

本文整理了Java中com.ardor3d.math.Transform.invert()方法的一些代码示例,展示了Transform.invert()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Transform.invert()方法的具体详情如下:
包路径:com.ardor3d.math.Transform
类名称:Transform
方法名:invert

Transform.invert介绍

[英]Calculates the inverse of this transform.
[中]计算此变换的逆。

代码示例

代码示例来源:origin: com.ardor3d/ardor3d-math

@Override
public Transform invert(final Transform store) {
  final Transform transform = super.invert(store);
  if (!Transform.isValid(transform)) {
    throw new InvalidTransformException("Transform is invalid");
  }
  return transform;
}

代码示例来源:origin: Renanse/Ardor3D

@Override
public Transform invert(final Transform store) {
  final Transform transform = super.invert(store);
  if (!Transform.isValid(transform)) {
    throw new InvalidTransformException("Transform is invalid");
  }
  return transform;
}

代码示例来源:origin: Renanse/Ardor3D

@Test
public void testInvert() {
  final Transform trans1 = new Transform();
  trans1.setRotation(new Matrix3().applyRotationZ(3 * MathUtils.QUARTER_PI));
  final Transform trans2 = trans1.invert(null);
  assertEquals(Transform.IDENTITY, trans1.multiply(trans2, null));
  trans1.setIdentity().invert(trans1);
  assertEquals(Transform.IDENTITY, trans1);
}

代码示例来源:origin: com.ardor3d/ardor3d-animation

/**
 * Update our local joint transforms so that they reflect the skeleton in bind pose.
 */
public void setToBindPose() {
  final Transform temp = Transform.fetchTempInstance();
  // go through our local transforms
  for (int i = 0; i < _localTransforms.length; i++) {
    // Set us to the bind pose
    _localTransforms[i].set(_skeleton.getJoints()[i].getInverseBindPose());
    // then invert.
    _localTransforms[i].invert(_localTransforms[i]);
    // At this point we are in model space, so we need to remove our parent's transform (if we have one.)
    final short parentIndex = _skeleton.getJoints()[i].getParentIndex();
    if (parentIndex != Joint.NO_PARENT) {
      // We remove the parent's transform simply by multiplying by its inverse bind pose. Done! :)
      _skeleton.getJoints()[parentIndex].getInverseBindPose().multiply(_localTransforms[i], temp);
      _localTransforms[i].set(temp);
    }
  }
  Transform.releaseTempInstance(temp);
  updateTransforms();
}

代码示例来源:origin: Renanse/Ardor3D

/**
 * Update our local joint transforms so that they reflect the skeleton in bind pose.
 */
public void setToBindPose() {
  final Transform temp = Transform.fetchTempInstance();
  // go through our local transforms
  for (int i = 0; i < _localTransforms.length; i++) {
    // Set us to the bind pose
    _localTransforms[i].set(_skeleton.getJoints()[i].getInverseBindPose());
    // then invert.
    _localTransforms[i].invert(_localTransforms[i]);
    // At this point we are in model space, so we need to remove our parent's transform (if we have one.)
    final short parentIndex = _skeleton.getJoints()[i].getParentIndex();
    if (parentIndex != Joint.NO_PARENT) {
      // We remove the parent's transform simply by multiplying by its inverse bind pose. Done! :)
      _skeleton.getJoints()[parentIndex].getInverseBindPose().multiply(_localTransforms[i], temp);
      _localTransforms[i].set(temp);
    }
  }
  Transform.releaseTempInstance(temp);
  updateTransforms();
}

相关文章