MCPcopy Create free account
hub / github.com/ImageEngine/cortex / nearestNNeighbours

Method nearestNNeighbours

src/IECorePython/KDTreeBinding.cpp:122–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120 }
121
122 IntVectorDataPtr nearestNNeighbours(const typename T::Point &p, unsigned int numNeighbours)
123 {
124 assert(m_tree);
125
126 typedef std::vector<typename T::Neighbour> NeighbourArray;
127
128 NeighbourArray points;
129
130 unsigned int num = m_tree->nearestNNeighbours(p, numNeighbours, points);
131
132 IntVectorDataPtr indices = new IntVectorData();
133
134 indices->writable().reserve( num );
135
136 for (typename NeighbourArray::const_iterator it = points.begin(); it != points.end(); ++it)
137 {
138 indices->writable().push_back( std::distance( m_points->readable().begin(), it->point ) );
139 }
140
141 return indices;
142
143 }
144
145 IntVectorDataPtr enclosedPoints( const Box &bound )
146 {

Callers 3

doNearestNNeighboursMethod · 0.80

Calls 4

readableMethod · 0.80
writableMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by 2