MCPcopy Create free account
hub / github.com/beefytech/Beef / GetVal

Method GetVal

BeefySysLib/img/ImgEffects.cpp:121–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119}
120
121float ImageCurve::GetVal(float x)
122{
123 ImageCurvePoint* prevPt = NULL;
124 for (int i = 0; i < (int) mPoints.size(); i++)
125 {
126 ImageCurvePoint* nextPt = &mPoints[i];
127
128 if (x == nextPt->mX)
129 return nextPt->mY;
130
131 if ((x <= nextPt->mX) && (prevPt != NULL))
132 {
133 if (prevPt->mSpline != NULL)
134 return prevPt->mSpline->Evaluate(x);
135 //return BFClamp(prevPt->mSpline->Evaluate(x), 0.0f, 255.0f);
136
137 return prevPt->mY +
138 ((x - prevPt->mX) / (nextPt->mX - prevPt->mX)) * (nextPt->mY - prevPt->mY);
139 }
140
141 prevPt = nextPt;
142 }
143
144 return mPoints.back().mY;
145}
146
147bool ImageCurve::IsDefault()
148{

Callers 4

CreateContourDataTableFunction · 0.45
CreateGradientDataTableFunction · 0.45
ApplyMethod · 0.45
InitMethod · 0.45

Calls 5

BFClampFunction · 0.85
sizeMethod · 0.45
EvaluateMethod · 0.45
backMethod · 0.45
AddPtMethod · 0.45

Tested by

no test coverage detected