MCPcopy Create free account
hub / github.com/MITK/MITK / GetNearHandle

Method GetNearHandle

Modules/QtWidgetsExt/src/QmitkPiecewiseFunctionCanvas.cpp:132–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130}
131
132int QmitkPiecewiseFunctionCanvas::GetNearHandle(int x, int y, unsigned int maxSquaredDistance)
133{
134 double *dp = m_PiecewiseFunction->GetDataPointer();
135 for (int i = 0; i < m_PiecewiseFunction->GetSize(); i++)
136 {
137 std::pair<int, int> point = this->FunctionToCanvas(std::make_pair(dp[i * 2], dp[i * 2 + 1]));
138 if ((unsigned int)((point.first - x) * (point.first - x) + (point.second - y) * (point.second - y)) <=
139 maxSquaredDistance)
140 {
141 return i;
142 }
143 }
144 return -1;
145}
146
147void QmitkPiecewiseFunctionCanvas::MoveFunctionPoint(int index, std::pair<double, double> pos)
148{

Callers

nothing calls this directly

Calls 2

FunctionToCanvasMethod · 0.80
GetSizeMethod · 0.45

Tested by

no test coverage detected