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

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

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

Transform.setTranslation介绍

[英]Sets the translation portion of this transform to the given values.
[中]将此变换的平移部分设置为给定值。

代码示例

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

/**
 * Sets the world translation vector.
 *
 * @param translation
 *            the new world translation
 */
public void setWorldTranslation(final ReadOnlyVector3 translation) {
  _worldTransform.setTranslation(translation);
}

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

/**
 * Sets the world translation vector.
 * 
 * @param translation
 *            the new world translation
 */
public void setWorldTranslation(final ReadOnlyVector3 translation) {
  _worldTransform.setTranslation(translation);
}

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

/**
 * Sets the world translation.
 * 
 * @param x
 *            the x coordinate
 * @param y
 *            the y coordinate
 * @param z
 *            the z coordinate
 */
public void setWorldTranslation(final double x, final double y, final double z) {
  _worldTransform.setTranslation(x, y, z);
}

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

/**
 * Sets the world translation.
 *
 * @param x
 *            the x coordinate
 * @param y
 *            the y coordinate
 * @param z
 *            the z coordinate
 */
public void setWorldTranslation(final double x, final double y, final double z) {
  _worldTransform.setTranslation(x, y, z);
}

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

@Override
public ValidatingTransform setTranslation(final ReadOnlyVector3 translation) {
  super.setTranslation(translation);
  validate();
  return this;
}

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

@Override
public ValidatingTransform setTranslation(final double x, final double y, final double z) {
  super.setTranslation(x, y, z);
  validate();
  return this;
}

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

/**
 * <code>setTranslation</code> sets the translation of this spatial. This marks the spatial as DirtyType.Transform.
 *
 * @param translation
 *            the new translation of this spatial
 */
public void setTranslation(final ReadOnlyVector3 translation) {
  _localTransform.setTranslation(translation);
  markDirty(DirtyType.Transform);
}

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

/**
 * <code>setTranslation</code> sets the translation of this spatial. This marks the spatial as DirtyType.Transform.
 * 
 * @param translation
 *            the new translation of this spatial
 */
public void setTranslation(final ReadOnlyVector3 translation) {
  _localTransform.setTranslation(translation);
  markDirty(DirtyType.Transform);
}

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

@Override
public ValidatingTransform setTranslation(final double x, final double y, final double z) {
  super.setTranslation(x, y, z);
  validate();
  return this;
}

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

@Override
public ValidatingTransform setTranslation(final ReadOnlyVector3 translation) {
  super.setTranslation(translation);
  validate();
  return this;
}

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

/**
 * sets the translation of this spatial. This marks the spatial as DirtyType.Transform.
 * 
 * @param x
 *            the x coordinate
 * @param y
 *            the y coordinate
 * @param z
 *            the z coordinate
 */
public void setTranslation(final double x, final double y, final double z) {
  _localTransform.setTranslation(x, y, z);
  markDirty(DirtyType.Transform);
}

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

/**
 * sets the translation of this spatial. This marks the spatial as DirtyType.Transform.
 *
 * @param x
 *            the x coordinate
 * @param y
 *            the y coordinate
 * @param z
 *            the z coordinate
 */
public void setTranslation(final double x, final double y, final double z) {
  _localTransform.setTranslation(x, y, z);
  markDirty(DirtyType.Transform);
}

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

public void applyTo(final Transform transform) {
  transform.setIdentity();
  transform.setRotation(getRotation());
  transform.setScale(getScale());
  transform.setTranslation(getTranslation());
}

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

public void applyTo(final Transform transform) {
  transform.setIdentity();
  transform.setRotation(getRotation());
  transform.setScale(getScale());
  transform.setTranslation(getTranslation());
}

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

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

@Override
public void applyFilter(final InteractManager manager) {
  final SpatialState state = manager.getSpatialState();
  _calcVectorA.set(state.getTransform().getTranslation());
  for (final ReadOnlyPlane plane : _planes) {
    final double distance = plane.pseudoDistance(_calcVectorA);
    if (distance < 0) {
      // push us back to the plane.
      _calcVectorB.set(plane.getNormal()).multiplyLocal(-distance);
      _calcVectorA.addLocal(_calcVectorB);
    }
  }
  state.getTransform().setTranslation(_calcVectorA);
}

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

@Override
public void processInput(final Canvas source, final TwoInputStates inputStates, final AtomicBoolean inputConsumed,
    final InteractManager manager) {
  final Camera camera = source.getCanvasRenderer().getCamera();
  final MouseState current = inputStates.getCurrent().getMouseState();
  final MouseState previous = inputStates.getPrevious().getMouseState();
  // first process mouse over state
  checkMouseOver(source, current, manager);
  // Now check drag status
  if (!checkShouldDrag(camera, current, previous, inputConsumed, manager)) {
    return;
  }
  // act on drag
  final Vector2 oldMouse = new Vector2(previous.getX(), previous.getY());
  final Vector3 loc = getNewOffset(oldMouse, current, camera, manager);
  final Transform transform = manager.getSpatialState().getTransform();
  transform.setTranslation(loc.addLocal(transform.getTranslation()));
  // apply our filters, if any, now that we've made updates.
  applyFilters(manager);
}

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

@Test
  public void testRaySphereIntersection() throws Exception {
    final BoundingSphere bs = new BoundingSphere();
    bs.setCenter(Vector3.ZERO);
    bs.setRadius(1);

    final Ray3 ray = new Ray3(new Vector3(2, -3, 0), Vector3.UNIT_Y);
    assertFalse(bs.intersects(ray));
    IntersectionRecord record = bs.intersectsWhere(ray);
    assertEquals(null, record);

    final Transform transform = new Transform();
    transform.setTranslation(2, 0, .5);
    bs.transform(transform, bs);

    assertTrue(bs.intersects(ray));
    record = bs.intersectsWhere(ray);
    assertEquals(2, record.getNumberOfIntersections());
  }
}

相关文章