Class Box
Defined in File bodies.h
Inheritance Relationships
Base Type
public bodies::Body
(Class Body)
Class Documentation
-
class Box : public bodies::Body
Definition of a box.
Public Functions
-
inline Box()
-
~Box() override = default
-
virtual std::vector<double> getDimensions() const override
Get the length & width & height (x, y, z) of the box.
-
virtual std::vector<double> getScaledDimensions() const override
Get the dimensions associated to this body (scaled and padded)
-
virtual bool containsPoint(const Eigen::Vector3d &p, bool verbose = false) const override
Check if a point is inside the body. Surface points are included.
-
virtual double computeVolume() const override
Compute the volume of the body. This method includes changes induced by scaling and padding.
-
virtual bool samplePointInside(random_numbers::RandomNumberGenerator &rng, unsigned int max_attempts, Eigen::Vector3d &result) const override
Sample a point that is included in the body using a given random number generator.
Sometimes multiple attempts need to be generated. The function terminates with failure (returns false) after max_attempts attempts. If the call is successful (returns true) the point is written to result
-
virtual void computeBoundingSphere(BoundingSphere &sphere) const override
Compute the bounding radius for the body, in its current pose. Scaling and padding are accounted for.
-
virtual void computeBoundingCylinder(BoundingCylinder &cylinder) const override
Compute the bounding cylinder for the body, in its current pose. Scaling and padding are accounted for.
-
virtual void computeBoundingBox(AABB &bbox) const override
Compute the axis-aligned bounding box for the body, in its current pose. Scaling and padding are accounted for.
-
virtual void computeBoundingBox(OBB &bbox) const override
Compute the oriented bounding box for the body, in its current pose. Scaling and padding are accounted for.
-
virtual bool intersectsRay(const Eigen::Vector3d &origin, const Eigen::Vector3d &dir, EigenSTL::vector_Vector3d *intersections = nullptr, unsigned int count = 0) const override
Check if a ray intersects the body, and find the set of intersections, in order, along the ray. A maximum number of intersections can be specified as well. If that number is 0, all intersections are returned. Passing dir as a unit vector will result in faster computation.
-
virtual BodyPtr cloneAt(const Eigen::Isometry3d &pose, double padding, double scale) const override
Get a clone of this body, but one that is located at the pose pose and has possibly different passing and scaling: padding and scaling. This function is useful to implement thread safety, when bodies need to be moved around.
-
virtual void updateInternalData() override
This function is called every time a change to the body is made, so that intermediate values stored for efficiency reasons are kept up to date.
Protected Functions
Protected Attributes
-
double length_
-
double width_
-
double height_
-
Eigen::Vector3d center_
-
Eigen::Matrix3d invRot_
-
Eigen::Vector3d minCorner_
The translated, but not rotated min corner.
-
Eigen::Vector3d maxCorner_
The translated, but not rotated max corner.
-
double length2_
-
double width2_
-
double height2_
-
double radiusB_
-
double radius2_
-
inline Box()