13 #include <Eigen/Eigenvalues>
25 R_ = Eigen::Matrix3d::Identity();
35 Eigen::Vector3d x_axis =
R_ * Eigen::Vector3d(
extent_(0) / 2, 0, 0);
36 Eigen::Vector3d y_axis =
R_ * Eigen::Vector3d(0,
extent_(1) / 2, 0);
37 Eigen::Vector3d z_axis =
R_ * Eigen::Vector3d(0, 0,
extent_(2) / 2);
38 std::vector<Eigen::Vector3d>
points(8);
51 const std::vector<Eigen::Vector3d>&
points)
const {
57 const std::vector<CCVector3>&
points)
const {
58 std::vector<size_t> indices;
59 Eigen::Vector3d dx =
R_ * Eigen::Vector3d(1, 0, 0);
60 Eigen::Vector3d dy =
R_ * Eigen::Vector3d(0, 1, 0);
61 Eigen::Vector3d dz =
R_ * Eigen::Vector3d(0, 0, 1);
63 for (
size_t idx = 0; idx <
points.size(); idx++) {
65 if (
std::abs(d.dot(dx)) <= halfExtent(0) &&
66 std::abs(d.dot(dy)) <= halfExtent(1) &&
67 std::abs(d.dot(dz)) <= halfExtent(2)) {
68 indices.push_back(idx);
79 obox.
R_ = Eigen::Matrix3d::Identity();
static Vector3Tpl fromArray(const int a[3])
Constructor from an int array.
static std::vector< Eigen::Matrix< double, 3, 1 > > fromArrayContainer(const std::vector< Vector3Tpl< PointCoordinateType >> &container)
Vector3Tpl< T > getDiagVec() const
Returns diagonal vector.
Vector3Tpl< T > getCenter() const
Returns center.
A bounding box oriented along an arbitrary frame of reference.
OrientedBoundingBox & Clear()
Eigen::Vector3d color_
The color of the bounding box in RGB.
Eigen::Vector3d GetHalfExtent() const
Returns the half extent of the bounding box in its frame of reference.
Eigen::Vector3d extent_
The extent of the bounding box in its frame of reference.
std::vector< Eigen::Vector3d > GetBoxPoints() const
static OrientedBoundingBox CreateFromAxisAlignedBoundingBox(const BoundingBox &aabox)
double volume() const
Returns the volume of the bounding box.
Eigen::Vector3d center_
The center point of the bounding box.
std::vector< size_t > GetPointIndicesWithinBoundingBox(const std::vector< Eigen::Vector3d > &points) const
Return indices to points that are within the bounding box.
__host__ __device__ int2 abs(int2 v)
Generic file read and write utility for python interface.