com.jme3.math.Quaternion.nlerp()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(155)

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

Quaternion.nlerp介绍

[英]Sets the values of this quaternion to the nlerp from itself to q2 by blend.
[中]通过混合将此四元数的值从其自身设置为nlerp到q2。

代码示例

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

@Override
  public Quaternion interpolate(float t, int currentIndex, TrackDataReader<Quaternion> data, TrackTimeReader times, Quaternion store) {
    data.getEntryClamp(currentIndex, store);
    data.getEntryClamp(currentIndex + 1, next);
    store.nlerp(next, t);
    return store;
  }
};

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
 * Sets this transform to the interpolation between the first transform and the second by delta amount.
 * @param t1 The beginning transform.
 * @param t2 The ending transform.
 * @param delta An amount between 0 and 1 representing how far to interpolate from t1 to t2.
 */
public void interpolateTransforms(Transform t1, Transform t2, float delta) {
  t1.rot.nlerp(t2.rot, delta);
  this.rot.set(t1.rot);
  this.translation.interpolateLocal(t1.translation,t2.translation,delta);
  this.scale.interpolateLocal(t1.scale,t2.scale,delta);
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

public static Quaternion slerpNoInvert(Quaternion q1, Quaternion q2, float t, Quaternion store) {
  float dot = q1.dot(q2);
  if (dot > -0.95f && dot < 0.95f) {
    float angle = FastMath.acos(dot);
    float sin1 = FastMath.sin(angle * (1 - t));
    float sin2 = FastMath.sin(angle * t);
    float sin3 = FastMath.sin(angle);
    store.x = (q1.x * sin1 + q2.x * sin2) / sin3;
    store.y = (q1.y * sin1 + q2.y * sin2) / sin3;
    store.z = (q1.z * sin1 + q2.z * sin2) / sin3;
    store.w = (q1.w * sin1 + q2.w * sin2) / sin3;
    System.err.println("real slerp");
  } else {
    // if the angle is small, use linear interpolation
    store.set(q1).nlerp(q2, t);
    System.err.println("nlerp");
  }
  return store;
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

private void interpolate(Type type, float ratio, KeyFrame lastKeyFrame, KeyFrame nextKeyFrame, int currentIndex) {
  //TODO here we should interpolate differently according to the interpolation given in the gltf file.
  switch (type) {
    case Translation:
      translations[currentIndex] = FastMath.interpolateLinear(ratio, lastKeyFrame.translation, nextKeyFrame.translation);
      break;
    case Rotation:
      Quaternion rot = new Quaternion().set(lastKeyFrame.rotation);
      rot.nlerp(nextKeyFrame.rotation, ratio);
      rotations[currentIndex] = rot;
      break;
    case Scale:
      scales[currentIndex] = FastMath.interpolateLinear(ratio, lastKeyFrame.scale, nextKeyFrame.scale);
      break;
  }
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
 * Rotate the GUI to the given direction.
 * @param dir the direction to rotate to.
 * @param tpf the time per frame.
 */
private void rotateScreenTo(Quaternion dir, float tpf) {
  dir.getRotationColumn(2, look).negateLocal();
  dir.getRotationColumn(0, left).negateLocal();
  orient.fromAxes(left, dir.getRotationColumn(1, up), look);        
  Quaternion rot = tempq.fromRotationMatrix(orient);
  if( posMode == VRGUIPositioningMode.AUTO_CAM_ALL_SKIP_PITCH ){
    VRUtil.stripToYaw(rot);
  }
  if( guiPositioningElastic > 0f && posMode != VRGUIPositioningMode.MANUAL ) {
    // mix pos & dir with current pos & dir            
    EoldDir.nlerp(rot, tpf * guiPositioningElastic);
    guiQuadNode.setLocalRotation(EoldDir);
  } else {
    guiQuadNode.setLocalRotation(rot);
  }
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

tmpRot2.set(tmpRot1).nlerp(link.bone.getModelSpaceRotation(), blendStart / blendTime);
position2.set(position).interpolateLocal(link.bone.getModelSpacePosition(), blendStart / blendTime);
tmpRot1.set(tmpRot2);

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

tmpRot2.set(tmpRot1).nlerp(link.bone.getModelSpaceRotation(), blendStart / blendTime);
position2.set(position).interpolateLocal(link.bone.getModelSpacePosition(), blendStart / blendTime);
tmpRot1.set(tmpRot2);

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

scales.get(endFrame, tempS2);
tempQ.nlerp(tempQ2, blend);
tempV.interpolateLocal(tempV2, blend);
tempS.interpolateLocal(tempS2, blend);

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

} else {
  float invWeightSum = 1f - currentWeightSum;
  localRot.nlerp(bindRot, invWeightSum);
  localPos.interpolateLocal(bindPos, invWeightSum);
  localScale.interpolateLocal(bindScale, invWeightSum);

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

localRot.nlerp(tmpQ, weight);

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

scales.get(endFrame, tempS2);
tempQ.nlerp(tempQ2, blend);
tempV.interpolateLocal(tempV2, blend);
tempS.interpolateLocal(tempS2, blend);

代码示例来源:origin: org.jmonkeyengine/jme3-plugins

private void interpolate(Type type, float ratio, KeyFrame lastKeyFrame, KeyFrame nextKeyFrame, int currentIndex) {
  //TODO here we should interpolate differently according to the interpolation given in the gltf file.
  switch (type) {
    case Translation:
      translations[currentIndex] = FastMath.interpolateLinear(ratio, lastKeyFrame.translation, nextKeyFrame.translation);
      break;
    case Rotation:
      Quaternion rot = new Quaternion().set(lastKeyFrame.rotation);
      rot.nlerp(nextKeyFrame.rotation, ratio);
      rotations[currentIndex] = rot;
      break;
    case Scale:
      scales[currentIndex] = FastMath.interpolateLinear(ratio, lastKeyFrame.scale, nextKeyFrame.scale);
      break;
  }
}

代码示例来源:origin: org.jmonkeyengine/jme3-bullet

tmpRot2.set(tmpRot1).nlerp(link.bone.getModelSpaceRotation(), blendStart / blendTime);
position2.set(position).interpolateLocal(link.bone.getModelSpacePosition(), blendStart / blendTime);
tmpRot1.set(tmpRot2);

代码示例来源:origin: org.jmonkeyengine/jme3-jbullet

tmpRot2.set(tmpRot1).nlerp(link.bone.getModelSpaceRotation(), blendStart / blendTime);
position2.set(position).interpolateLocal(link.bone.getModelSpacePosition(), blendStart / blendTime);
tmpRot1.set(tmpRot2);

代码示例来源:origin: org.jmonkeyengine/jme3-core

scales.get(endFrame, tempS2);
tempQ.nlerp(tempQ2, blend);
tempV.interpolateLocal(tempV2, blend);
tempS.interpolateLocal(tempS2, blend);

代码示例来源:origin: org.jmonkeyengine/jme3-core

} else {
  float invWeightSum = 1f - currentWeightSum;
  localRot.nlerp(bindRot, invWeightSum);
  localPos.interpolateLocal(bindPos, invWeightSum);
  localScale.interpolateLocal(bindScale, invWeightSum);

代码示例来源:origin: info.projectkyoto/mms-engine

} else {
  float invWeightSum = 1f - currentWeightSum;
  localRot.nlerp(initialRot, invWeightSum);
  localPos.interpolate(initialPos, invWeightSum);
  localScale.interpolate(initialScale, invWeightSum);

代码示例来源:origin: org.jmonkeyengine/jme3-core

localRot.nlerp(tmpQ, weight);

代码示例来源:origin: info.projectkyoto/mms-engine

localRot.nlerp(tmpQ, weight);

代码示例来源:origin: info.projectkyoto/mms-engine

scales.get(endFrame, tempS2);
tempQ.nlerp(tempQ2, blend);
tempV.interpolate(tempV2, blend);
tempS.interpolate(tempS2, blend);

相关文章