MCPcopy Create free account
hub / github.com/MapServer/MapServer / get_stateful

Method get_stateful

renderers/agg/src/agg_bspline.cpp:235–281  ·  view source on GitHub ↗

------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

233
234 //------------------------------------------------------------------------
235 double bspline::get_stateful(double x) const
236 {
237 if(m_num > 2)
238 {
239 // Extrapolation on the left
240 if(x < m_x[0]) return extrapolation_left(x);
241
242 // Extrapolation on the right
243 if(x >= m_x[m_num - 1]) return extrapolation_right(x);
244
245 if(m_last_idx >= 0)
246 {
247 // Check if x is not in current range
248 if(x < m_x[m_last_idx] || x > m_x[m_last_idx + 1])
249 {
250 // Check if x between next points (most probably)
251 if(m_last_idx < m_num - 2 &&
252 x >= m_x[m_last_idx + 1] &&
253 x <= m_x[m_last_idx + 2])
254 {
255 ++m_last_idx;
256 }
257 else
258 if(m_last_idx > 0 &&
259 x >= m_x[m_last_idx - 1] &&
260 x <= m_x[m_last_idx])
261 {
262 // x is between pevious points
263 --m_last_idx;
264 }
265 else
266 {
267 // Else perform full search
268 bsearch(m_num, m_x, x, &m_last_idx);
269 }
270 }
271 return interpolation(x, m_last_idx);
272 }
273 else
274 {
275 // Interpolation
276 bsearch(m_num, m_x, x, &m_last_idx);
277 return interpolation(x, m_last_idx);
278 }
279 }
280 return 0.0;
281 }
282
283}
284

Callers 1

vertexMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected