本文整理了Java中com.ardor3d.math.Quaternion.slerpLocal
方法的一些代码示例,展示了Quaternion.slerpLocal
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Quaternion.slerpLocal
方法的具体详情如下:
包路径:com.ardor3d.math.Quaternion
类名称:Quaternion
方法名:slerpLocal
[英]Does a spherical linear interpolation between this quaternion and the given end quaternion by the given change amount. Stores the results locally in this quaternion.
[中]根据给定的变化量,在该四元数和给定的末端四元数之间进行球面线性插值。将结果本地存储在此四元数中。
代码示例来源:origin: com.ardor3d/ardor3d-math
/**
* Does a spherical linear interpolation between this quaternion and the given end quaternion by the given change
* amount. Stores the results locally in this quaternion.
*
* @param endQuat
* @param changeAmnt
* @return this quaternion for chaining.
*/
public Quaternion slerpLocal(final ReadOnlyQuaternion endQuat, final double changeAmnt) {
return slerpLocal(this, endQuat, changeAmnt);
}
代码示例来源:origin: Renanse/Ardor3D
/**
* Does a spherical linear interpolation between this quaternion and the given end quaternion by the given change
* amount. Stores the results locally in this quaternion.
*
* @param endQuat
* @param changeAmnt
* @return this quaternion for chaining.
*/
public Quaternion slerpLocal(final ReadOnlyQuaternion endQuat, final double changeAmnt) {
return slerpLocal(this, endQuat, changeAmnt);
}
代码示例来源:origin: com.ardor3d/ardor3d-math
/**
* Does a spherical linear interpolation between the given start and end quaternions by the given change amount.
* Stores the result locally.
*
* @param startQuat
* @param endQuat
* @param changeAmnt
* @return this quaternion for chaining.
* @throws NullPointerException
* if startQuat or endQuat are null.
*/
public Quaternion slerpLocal(final ReadOnlyQuaternion startQuat, final ReadOnlyQuaternion endQuat,
final double changeAmnt) {
final Quaternion end = Quaternion.fetchTempInstance().set(endQuat);
slerpLocal(startQuat, endQuat, changeAmnt, end);
Quaternion.releaseTempInstance(end);
return this;
}
代码示例来源:origin: Renanse/Ardor3D
/**
* Does a spherical linear interpolation between the given start and end quaternions by the given change amount.
* Stores the result locally.
*
* @param startQuat
* @param endQuat
* @param changeAmnt
* @return this quaternion for chaining.
* @throws NullPointerException
* if startQuat or endQuat are null.
*/
public Quaternion slerpLocal(final ReadOnlyQuaternion startQuat, final ReadOnlyQuaternion endQuat,
final double changeAmnt) {
final Quaternion end = Quaternion.fetchTempInstance().set(endQuat);
slerpLocal(startQuat, endQuat, changeAmnt, end);
Quaternion.releaseTempInstance(end);
return this;
}
代码示例来源:origin: Renanse/Ardor3D
/**
* Interpolates between the given quaternions using the
* {@link Quaternion#slerpLocal(ReadOnlyQuaternion, ReadOnlyQuaternion, double)} method.
*/
@Override
protected void interpolate(final ReadOnlyQuaternion from, final ReadOnlyQuaternion to, final double delta,
final Spatial caller) {
assert (null != from) : "parameter 'from' can not be null";
assert (null != to) : "parameter 'to' can not be null";
assert (null != caller) : "parameter 'caller' can not be null";
final Quaternion tempQuat = Quaternion.fetchTempInstance();
tempQuat.slerpLocal(from, to, delta);
if (isLocalRotation()) {
caller.setRotation(tempQuat);
} else {
caller.setWorldRotation(tempQuat);
}
Quaternion.releaseTempInstance(tempQuat);
}
代码示例来源:origin: com.ardor3d/ardor3d-core
/**
* Interpolates between the given quaternions using the
* {@link Quaternion#slerpLocal(ReadOnlyQuaternion, ReadOnlyQuaternion, double)} method.
*/
@Override
protected void interpolate(final ReadOnlyQuaternion from, final ReadOnlyQuaternion to, final double delta,
final Spatial caller) {
assert (null != from) : "parameter 'from' can not be null";
assert (null != to) : "parameter 'to' can not be null";
assert (null != caller) : "parameter 'caller' can not be null";
final Quaternion tempQuat = Quaternion.fetchTempInstance();
tempQuat.slerpLocal(from, to, delta);
if (isLocalRotation()) {
caller.setRotation(tempQuat);
} else {
caller.setWorldRotation(tempQuat);
}
Quaternion.releaseTempInstance(tempQuat);
}
代码示例来源:origin: com.ardor3d/ardor3d-animation
@Override
public void setCurrentSample(final int sampleIndex, final double progressPercent, final Object applyTo) {
final TransformData transformData = (TransformData) applyTo;
// shortcut if we are fully on one sample or the next
if (progressPercent == 0.0f) {
transformData.setRotation(_rotations[sampleIndex]);
transformData.setTranslation(_translations[sampleIndex]);
transformData.setScale(_scales[sampleIndex]);
return;
} else if (progressPercent == 1.0f) {
transformData.setRotation(_rotations[sampleIndex + 1]);
transformData.setTranslation(_translations[sampleIndex + 1]);
transformData.setScale(_scales[sampleIndex + 1]);
return;
}
// Apply (s)lerp and set in transform
_compQuat1.slerpLocal(_rotations[sampleIndex], _rotations[sampleIndex + 1], progressPercent, _compQuat2);
transformData.setRotation(_compQuat1);
_compVect1.lerpLocal(_translations[sampleIndex], _translations[sampleIndex + 1], progressPercent);
transformData.setTranslation(_compVect1);
_compVect1.lerpLocal(_scales[sampleIndex], _scales[sampleIndex + 1], progressPercent);
transformData.setScale(_compVect1);
}
代码示例来源:origin: Renanse/Ardor3D
@Override
public void setCurrentSample(final int sampleIndex, final double progressPercent, final Object applyTo) {
final TransformData transformData = (TransformData) applyTo;
// shortcut if we are fully on one sample or the next
if (progressPercent == 0.0f) {
transformData.setRotation(_rotations[sampleIndex]);
transformData.setTranslation(_translations[sampleIndex]);
transformData.setScale(_scales[sampleIndex]);
return;
} else if (progressPercent == 1.0f) {
transformData.setRotation(_rotations[sampleIndex + 1]);
transformData.setTranslation(_translations[sampleIndex + 1]);
transformData.setScale(_scales[sampleIndex + 1]);
return;
}
// Apply (s)lerp and set in transform
_compQuat1.slerpLocal(_rotations[sampleIndex], _rotations[sampleIndex + 1], progressPercent, _compQuat2);
transformData.setRotation(_compQuat1);
_compVect1.lerpLocal(_translations[sampleIndex], _translations[sampleIndex + 1], progressPercent);
transformData.setTranslation(_compVect1);
_compVect1.lerpLocal(_scales[sampleIndex], _scales[sampleIndex + 1], progressPercent);
transformData.setScale(_compVect1);
}
代码示例来源:origin: Renanse/Ardor3D
quat.slerpLocal(quat2, 1.0);
assertTrue(Math.abs(new Vector3(0, -1, 0).distance(quat.apply(Vector3.UNIT_Y, null))) <= Quaternion.ALLOWED_DEVIANCE);
quat.slerpLocal(quat2, .5);
assertTrue(Math.abs(new Vector3(0, 0, 1).distance(quat.apply(Vector3.UNIT_Y, null))) <= Quaternion.ALLOWED_DEVIANCE);
quat.slerpLocal(quat2, 0);
assertTrue(Math.abs(new Vector3(0, 1, 0).distance(quat.apply(Vector3.UNIT_Y, null))) <= Quaternion.ALLOWED_DEVIANCE);
quat.slerpLocal(quat2, 0.25);
assertTrue(Math.abs(new Vector3(0, 1, 0).distance(quat.apply(Vector3.UNIT_Y, null))) <= Quaternion.ALLOWED_DEVIANCE);
quat.slerpLocal(quat2, 0.5);
assertTrue(Math.abs(new Vector3(0, -Math.sin(MathUtils.QUARTER_PI), Math.sin(MathUtils.QUARTER_PI))
.distance(quat.apply(Vector3.UNIT_Y, null))) <= Quaternion.ALLOWED_DEVIANCE);
内容来源于网络,如有侵权,请联系作者删除!