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

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

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

Transform.<init>介绍

[英]Constructs a new Transform object.
[中]构造一个新的变换对象。

代码示例

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

/**
 * @return An instance of Transform that is intended for temporary use in calculations and so forth. Multiple calls
 *         to the method should return instances of this class that are not currently in use.
 */
public final static Transform fetchTempInstance() {
  if (MathConstants.useMathPools) {
    return Transform.TRANS_POOL.fetch();
  } else {
    return new Transform();
  }
}

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

/**
 * @return An instance of Transform that is intended for temporary use in calculations and so forth. Multiple calls
 *         to the method should return instances of this class that are not currently in use.
 */
public final static Transform fetchTempInstance() {
  if (MathConstants.useMathPools) {
    return Transform.TRANS_POOL.fetch();
  } else {
    return new Transform();
  }
}

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

/**
 * Constructs a new Spatial. Initializes the transform fields.
 */
public Spatial() {
  _localTransform = Constants.useValidatingTransform ? new ValidatingTransform() : new Transform();
  _worldTransform = Constants.useValidatingTransform ? new ValidatingTransform() : new Transform();
  _sceneHints = new SceneHints(this);
}

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

/**
 * Constructs a new Spatial. Initializes the transform fields.
 */
public Spatial() {
  _localTransform = Constants.useValidatingTransform ? new ValidatingTransform() : new Transform();
  _worldTransform = Constants.useValidatingTransform ? new ValidatingTransform() : new Transform();
  _sceneHints = new SceneHints(this);
}

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

@Test(expected = NullPointerException.class)
public void testApplyFail4() {
  final Transform trans = new Transform();
  trans.applyInverseVector(null);
}

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

@Test(expected = IllegalArgumentException.class)
public void testFailScale1B() {
  final Transform trans = new Transform();
  trans.setScale(Vector3.ZERO);
}

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

@Test(expected = NullPointerException.class)
public void testApplyFail3() {
  final Transform trans = new Transform();
  trans.applyInverse(null);
}

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

@Test(expected = IllegalArgumentException.class)
public void testFailScale2B() {
  final Transform trans = new Transform();
  trans.setScale(0, 0, 0);
}

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

@Test(expected = NullPointerException.class)
public void testApplyFail1() {
  final Transform trans = new Transform();
  trans.applyForward(null);
}

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

@Test(expected = NullPointerException.class)
public void testApplyFail2() {
  final Transform trans = new Transform();
  trans.applyForwardVector(null);
}

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

@Test(expected = IllegalArgumentException.class)
public void testFailScale3B() {
  final Transform trans = new Transform();
  trans.setScale(0);
}

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

@Test
public void testSimpleHash() {
  // Just a simple sanity check.
  final Transform trans1 = new Transform().setTranslation(1, 2, 3);
  final Transform trans2 = new Transform().setTranslation(1, 2, 3);
  final Transform trans3 = new Transform().setTranslation(1, 2, 0);
  assertTrue(trans1.hashCode() == trans2.hashCode());
  assertTrue(trans1.hashCode() != trans3.hashCode());
}

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

@Test(expected = InvalidTransformException.class)
public void failConstructor() {
  final Transform bad = new Transform();
  bad.translate(Double.NaN, 1, 2);
  new ValidatingTransform(Transform.IDENTITY); // good
  new ValidatingTransform(bad); // bad
}

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

public ReadOnlyTransform getValue() {
  final Transform t = new Transform();
  t.setTranslation(_translationX.getDoubleValue(), _translationY.getDoubleValue(), 0);
  final double val = _rotation.getDoubleValue() * MathUtils.DEG_TO_RAD;
  final Matrix3 mat = Matrix3.fetchTempInstance().fromAngles(0, 0, val);
  t.setRotation(mat);
  Matrix3.releaseTempInstance(mat);
  t.setScale(_scale.getDoubleValue());
  return t;
}

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

@Test(expected = InvalidTransformException.class)
public void testSet() {
  final Transform bad = new Transform();
  bad.translate(Double.NaN, 1, 2);
  final ValidatingTransform vt1 = new ValidatingTransform();
  vt1.set(Transform.IDENTITY); // good
  vt1.set(bad); // bad
}

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

public ReadOnlyTransform getValue() {
  final Transform t = new Transform();
  t.setTranslation(_translation.getValue());
  final Vector3 val = _rotation.getValue().multiplyLocal(MathUtils.DEG_TO_RAD);
  final Matrix3 mat = Matrix3.fetchTempInstance().fromAngles(val.getX(), val.getY(), val.getZ());
  t.setRotation(mat);
  Matrix3.releaseTempInstance(mat);
  t.setScale(_scale.getValue());
  return t;
}

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

@Test(expected = TransformException.class)
public void testFailScale1A() {
  final Transform trans = new Transform(new Matrix3(), new Vector3(), new Vector3(), false, false, false);
  trans.setScale(Vector3.ONE);
}

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

@Test(expected = TransformException.class)
public void testFailScale2A() {
  final Transform trans = new Transform(new Matrix3(), new Vector3(), new Vector3(), false, false, false);
  trans.setScale(1, 1, 1);
}

代码示例来源: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: Renanse/Ardor3D

@Test
public void testTranslate() {
  final Transform trans = new Transform();
  trans.translate(1, 3, 5);
  assertEquals(new Vector3(1, 3, 5), trans.getTranslation());
  trans.translate(trans.getTranslation().negate(null));
  assertEquals(Vector3.ZERO, trans.getTranslation());
  trans.translate(new Vector3(1, 3, 5));
  assertEquals(new Vector3(1, 3, 5), trans.getTranslation());
  trans.translate(-1, -3, -5);
  assertEquals(Vector3.ZERO, trans.getTranslation());
}

相关文章