42 return ::basegfx::B2DPoint(
52 const double nS (1-nT);
59 const double nV01 (nS*nV0 + nT*nV1);
60 const double nV12 (nS*nV1 + nT*nV2);
61 const double nV23 (nS*nV2 + nT*nV3);
63 const double nV012 (nS*nV01 + nT*nV12);
64 const double nV123 (nS*nV12 + nT*nV23);
66 const double nV0123 (nS*nV012 + nT*nV123);
75 const sal_Int32 nSampleCount (64);
78 ::std::vector<basegfx::B2DPoint> aPoints;
79 aPoints.reserve(nSampleCount);
82 const double nT (
nIndex/
double(nSampleCount-1));
83 aPoints.emplace_back(rFunction(nT));
88 maY.reserve(nSampleCount);
89 double nX0 (aPoints[0].getX());
90 double nY0 (aPoints[0].getY());
91 double nX1 (aPoints[1].getX());
92 double nY1 (aPoints[1].getY());
94 for (sal_Int32 nIndex2=0; nIndex2<nSampleCount; ++nIndex2)
96 const double nX (nIndex2 /
double(nSampleCount-1));
97 while (nX > nX1 &&
nIndex<nSampleCount)
101 nX1 = aPoints[
nIndex].getX();
102 nY1 = aPoints[
nIndex].getY();
105 const double nU ((nX-nX1) / (nX0 - nX1));
106 const double nY (nY0*nU + nY1*(1-nU));
113 const sal_Int32 nIndex0 (
static_cast<sal_Int32
>(nX *
maY.size()));
114 const double nX0 (nIndex0 /
double(
maY.size()-1));
115 const sal_uInt32 nIndex1 (nIndex0 + 1);
116 const double nX1 (nIndex1 /
double(
maY.size()-1));
123 const double nU ((nX-nX1) / (nX0 - nX1));
124 return maY[nIndex0]*nU +
maY[nIndex1]*(1-nU);
AnimationBezierFunction(const double nX1, const double nY1)
Create a cubic bezier curve whose start and end points are given implicitly as P0=(0,...
static double EvaluateComponent(const double nT, const double nV1, const double nV2)
::basegfx::B2DPoint operator()(const double nT)
::std::function< basegfx::B2DPoint(double)> ParametricFunction
::std::vector< double > maY
y-Values of the parametric function given to the constructor evaluated (and interpolated) for evenly ...
AnimationParametricFunction(const ParametricFunction &rFunction)
double operator()(const double nX)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)