Skip to content

Commit

Permalink
Homework jgoppert#7
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderJChapa committed Oct 30, 2019
1 parent 86f07d6 commit eb0e90e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Binary file added homework/hw7/a.out
Binary file not shown.
Binary file added homework/hw7/quad
Binary file not shown.
11 changes: 10 additions & 1 deletion homework/hw7/quadtree.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,16 @@ class QuadTree
std::list<Landmark> search(const Position &position, double radius)
{
std::list<Landmark> close_landmarks;
// just fill in your logic here
if (m_size < m_resolution) close_landmarks.splice(close_landmarks.end(), std::list<Landmark>(m_landmarks));
auto loc = sqrt((m_center.x-position.x)*(m_center.x-position.x) + (m_center.y-position.y)*(m_center.y-position.y));
auto dist = radius + m_size*sqrt(2);
if(loc<dist){
if (m_NE.get()) close_landmarks.splice(close_landmarks.end(), m_NE->search(position, radius));
if (m_NW.get()) close_landmarks.splice(close_landmarks.end(), m_NW->search(position, radius));
if (m_SE.get()) close_landmarks.splice(close_landmarks.end(), m_SE->search(position, radius));
if (m_SW.get()) close_landmarks.splice(close_landmarks.end(), m_SW->search(position, radius));
}

return close_landmarks;
}

Expand Down

0 comments on commit eb0e90e

Please sign in to comment.