示例#1
0
static const CubicInit CubicInitMirrorY(const CubicInit& init) {
  return CubicInit(-init.start_y, -init.start_derivative, -init.end_y,
                   -init.end_derivative, init.width_x);
}
示例#2
0
static const CubicInit CubicInitScaleX(const CubicInit& init, float scale) {
  return CubicInit(init.start_y, init.start_derivative / scale, init.end_y,
                   init.end_derivative / scale, init.width_x * scale);
}
示例#3
0
static const float kDerivativePrecision = 0.01f;
static const float kSecondDerivativePrecision = 0.26f;
static const float kThirdDerivativePrecision = 6.0f;
static const float kNodeXPrecision = 0.0001f;
static const float kNodeYPrecision = 0.0001f;
static const float kXGranularityScale = 0.01f;
static const Range kAngleRange(-kPi, kPi);

// Use a ridiculous index that will never hit when doing a search.
// We use this to test the binary search algorithm, not the cache.
static const CompactSplineIndex kRidiculousSplineIndex = 10000;

static const CubicInit kSimpleSplines[] = {
    //    start_y         end_y        width_x
    //      start_derivative  end_derivative
    CubicInit(0.0f, 1.0f, 0.1f, 0.0f, 1.0f),
    CubicInit(1.0f, -8.0f, 0.0f, 0.0f, 1.0f),
    CubicInit(1.0f, -8.0f, -1.0f, 0.0f, 1.0f),
};
static const int kNumSimpleSplines =
    static_cast<int>(MOTIVE_ARRAY_SIZE(kSimpleSplines));

static const CubicInit CubicInitMirrorY(const CubicInit& init) {
  return CubicInit(-init.start_y, -init.start_derivative, -init.end_y,
                   -init.end_derivative, init.width_x);
}

static const CubicInit CubicInitScaleX(const CubicInit& init, float scale) {
  return CubicInit(init.start_y, init.start_derivative / scale, init.end_y,
                   init.end_derivative / scale, init.width_x * scale);
}