Skip to content
This repository has been archived by the owner on Feb 3, 2025. It is now read-only.

Box::GetCenter() returns wrong value #1327

Closed
osrf-migration opened this issue Nov 10, 2014 · 4 comments
Closed

Box::GetCenter() returns wrong value #1327

osrf-migration opened this issue Nov 10, 2014 · 4 comments
Labels
all bug Something isn't working major

Comments

@osrf-migration
Copy link

Original report (archived issue) by Andrei Haidu (Bitbucket: ahaidu).


Hi,

i noticed a bug in the BB code, namely at the Box::GetCenter()

#!c++

math::Vector3 Box::GetCenter() const
{
  Vector3 size = this->GetSize();
  size /= 2.0;
  return this->min + size;
}

because GetSize(); returns only positive values this will give false values for BB in the negative areas.

a correct version would be:

#!c++

math::Vector3 Box::GetCenter() const
{
  return  this->min + (this->max - this->min) / 2;
}

Cheers,
Andrei

UPDATE:

Created a pull request and also changed the Box_TEST to have an example with negative valued BB

@osrf-migration
Copy link
Author

Original comment by Andrei Haidu (Bitbucket: ahaidu).


  • Edited issue description

@osrf-migration
Copy link
Author

Original comment by Nate Koenig (Bitbucket: Nathan Koenig).


  • changed state from "new" to "resolved"

Resolved in pull request #1278

@osrf-migration
Copy link
Author

Original comment by Nate Koenig (Bitbucket: Nathan Koenig).


  • set version to "all"

@osrf-migration
Copy link
Author

Original comment by Nate Koenig (Bitbucket: Nathan Koenig).


  • changed state from "resolved" to "closed"

@osrf-migration osrf-migration added major bug Something isn't working all labels Apr 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
all bug Something isn't working major
Projects
None yet
Development

No branches or pull requests

1 participant