【发布时间】:2015-09-28 16:59:03
【问题描述】:
比如说:
if(CurrentRotationStage % 2 == 0)
{
if(FMath::CubicInterpDerivative(CubicPoint[CurrentRotationStage], 0.f, CubicPoint[(CurrentRotationStage + 1) % 4], 0.f, MainMenuWidget->TrumpAngle / RotationLimit) < 0.f)
{
CurrentRotationStage = ++CurrentRotationStage % 4;
MainMenuWidget->TrumpAngle -= RotationLimit;
}
}
else
{
if(FMath::CubicInterpDerivative(CubicPoint[CurrentRotationStage], 0.f, CubicPoint[(CurrentRotationStage + 1) % 4], 0.f, MainMenuWidget->TrumpAngle / RotationLimit) > 0.f)
{
CurrentRotationStage = ++CurrentRotationStage % 4;
MainMenuWidget->TrumpAngle -= RotationLimit;
}
}
基本上,如果 CurrentRotationStage 是偶数,我想在我的 if 语句中使用
【问题讨论】:
-
如果
CubicInterpDerivative == 0怎么办? -
没关系,什么都不会发生,值需要在导数从正到负或负到正的符号变化后改变,具体取决于阶段。
-
这些都是很好的答案,解决了我不知道/不知道的不同事情,谢谢。
标签: c++ conditional simplify