Skip to content

Commit

Permalink
Factor out the query primitive
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonCampolattaro committed Aug 20, 2020
1 parent 142cf3b commit e22430c
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions Octree/test/Octree/test_octree_intersecting.cpp
Expand Up @@ -43,10 +43,12 @@ int main(void) {
// Intersection with a point (not particularly useful)
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{
// Set the search point
auto query = Point{1, 1, 1};

// Get a list of nodes intersected
std::vector<const Octree::Node *> nodes{};
octree.intersecting_nodes(Point{1, 1, 1},
std::back_inserter(nodes));
octree.intersecting_nodes(query, std::back_inserter(nodes));

// A point should only intersect one node
assert(1 == nodes.size());
Expand All @@ -58,20 +60,24 @@ int main(void) {
// Intersection with a sphere
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{
// Set the search point
auto query = Kernel::Sphere_3(Point{1, 1, 1}, 4.0);

// Get a list of nodes intersected
std::vector<const Octree::Node *> nodes{};
octree.intersecting_nodes(Kernel::Sphere_3(Point{1, 1, 1}, 4.0),
std::back_inserter(nodes));
octree.intersecting_nodes(query, std::back_inserter(nodes));

}

// Intersection with a ray
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{
// Set the search point
auto query = Kernel::Ray_3(Point{1, 1, 1}, Point{0, 0, 0});

// Get a list of nodes intersected
std::vector<const Octree::Node *> nodes{};
octree.intersecting_nodes(Kernel::Ray_3(Point{1, 1, 1}, Point{0, 0, 0}),
std::back_inserter(nodes));
octree.intersecting_nodes(query, std::back_inserter(nodes));

}

Expand Down

0 comments on commit e22430c

Please sign in to comment.