MCPcopy Create free account
hub / github.com/davisking/dlib / get_neighbor

Method get_neighbor

dlib/test/graph_cuts.cpp:215–244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

213 }
214
215 unsigned long get_neighbor (
216 long node_id,
217 long idx
218 ) const
219 {
220 ++count;
221 const point& p = get_loc(node_id);
222 if (rect.contains(p + point(1,0)))
223 {
224 if (idx == 0)
225 return node_id+1;
226 --idx;
227 }
228
229 if (rect.contains(p - point(1,0)))
230 {
231 if (idx == 0)
232 return node_id-1;
233 --idx;
234 }
235
236 if (rect.contains(p + point(0,1)))
237 {
238 if (idx == 0)
239 return node_id+nc;
240 --idx;
241 }
242
243 return node_id-nc;
244 }
245
246 void set_label (
247 const unsigned long& idx,

Callers

nothing calls this directly

Calls 2

pointClass · 0.50
containsMethod · 0.45

Tested by

no test coverage detected