Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/xdg/vec3da.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ __forceinline double dot( const Vec3da& a, const Vec3da& b ) { return a.dot(b);
__forceinline Vec3da cross( const Vec3da& a, const Vec3da& b ) { return a.cross(b); }

__forceinline std::ostream& operator <<(std::ostream &os, Vec3da const& v) {
return os << '[' << v[0] << ' ' << v[1] << ' ' << v[2] << ' ' << v.a << ']';
return os << '[' << v[0] << ' ' << v[1] << ' ' << v[2] << ']';
}

//! Determine if a position is lexicographically higher or lower than another
Expand Down
22 changes: 21 additions & 1 deletion tools/find_volume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ int main(int argc, char** argv) {
const auto& mm = xdg->mesh_manager();
mm->load_file(args.get<std::string>("filename"));
mm->init();
mm->parse_metadata();
xdg->prepare_raytracer();

if (args.get<bool>("--list")) {
Expand All @@ -63,11 +62,32 @@ int main(int argc, char** argv) {

MeshID volume = xdg->find_volume(position, direction);

std::cout << "Find Volume" << std::endl;
std::cout << "-----------" << std::endl;
if (volume == ID_NONE) {
std::cout << "No volume found for position " << position << std::endl;
} else {
std::cout << "Point " << position << " is in Volume " << volume << std::endl;
}
std::cout << "-----------" << std::endl;

// perform the same check using a point in volume loop
MeshID piv_volume = ID_NONE;
for (auto volume_id : mm->volumes()) {
if (xdg->point_in_volume(volume_id, position, &direction)) {
piv_volume = volume_id;
break;
}
}

std::cout << "Point in Volume" << std::endl;
std::cout << "---------------" << std::endl;
if (piv_volume == ID_NONE) {
std::cout << "No volume found for position " << position << std::endl;
} else {
std::cout << "Point " << position << " is in Volume " << piv_volume << std::endl;
}
std::cout << "---------------" << std::endl;

return 0;
}