Skip to content

Commit

Permalink
fix obb rotate and scale (isl-org#1999)
Browse files Browse the repository at this point in the history
  • Loading branch information
griegler authored and sammo2828 committed Aug 25, 2020
1 parent 2e37c53 commit 6e0d1aa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
6 changes: 3 additions & 3 deletions cpp/open3d/geometry/BoundingVolume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ OrientedBoundingBox& OrientedBoundingBox::Translate(
OrientedBoundingBox& OrientedBoundingBox::Scale(const double scale,
const Eigen::Vector3d& center) {
extent_ *= scale;
center_ = center;
center_ = scale * (center_ - center) + center;
return *this;
}

OrientedBoundingBox& OrientedBoundingBox::Rotate(
const Eigen::Matrix3d& R, const Eigen::Vector3d& center) {
R_ = R;
center_ = center;
R_ = R * R_;
center_ = R * (center_ - center) + center;
return *this;
}

Expand Down
15 changes: 0 additions & 15 deletions cpp/open3d/geometry/BoundingVolume.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,23 +79,8 @@ class OrientedBoundingBox : public Geometry3D {
const Eigen::Matrix4d& transformation) override;
virtual OrientedBoundingBox& Translate(const Eigen::Vector3d& translation,
bool relative = true) override;

/// \brief Scales the oriented bounding boxs.
/// The extent parameter is multiplied by the scale factor and
/// the center is set to the given parameter..
///
/// \param scale The scale parameter that is multiplied to the
/// extent parameter of the oriented bounding box.
/// \param center New center of the oriented bounding box.
virtual OrientedBoundingBox& Scale(const double scale,
const Eigen::Vector3d& center) override;

/// \brief Rotates the oriented bounding boxs.
/// Sets the rotation and center of the oriented bounding box
/// to the given parameters.
///
/// \param R New rotation matrix of the oriented bounding box.
/// \param center New center of the oriented bounding box.
virtual OrientedBoundingBox& Rotate(const Eigen::Matrix3d& R,
const Eigen::Vector3d& center) override;

Expand Down

0 comments on commit 6e0d1aa

Please sign in to comment.