Skip to content

File bvh.h

File List > geometry > utils > bvh.h

Go to the documentation of this file

#pragma once
#include <uipc/common/dllexport.h>
#include <uipc/common/type_define.h>
#include <uipc/common/span.h>
#include <uipc/common/smart_pointer.h>
#include <Eigen/Geometry>

namespace uipc::geometry
{
class UIPC_GEOMETRY_API BVH
{
  public:
    using AABB = Eigen::AlignedBox<Float, 3>;

    BVH();
    ~BVH();

    void build(span<const AABB> aabbs);

    void clear();

    void query(span<const AABB> aabbs, std::function<void(IndexT, IndexT)>&& QF) const;

  private:
    class Impl;
    U<Impl> m_impl;
};
}  // namespace uipc::geometry