Go to the documentation of this file.
3 #include <console_bridge/console.h>
18 return new Box(*
this);
23 float tmin, tmax, tymin, tymax, tzmin, tzmax;
27 tmin = (
bounds[sign[0]].
x - origin.
x) * invDirection.
x;
28 tmax = (
bounds[1-sign[0]].
x - origin.
x) * invDirection.
x;
29 tymin = (
bounds[sign[1]].
y - origin.
y) * invDirection.
y;
30 tymax = (
bounds[1-sign[1]].
y - origin.
y) * invDirection.
y;
32 if ( (tmin > tymax) || (tymin > tmax) )
38 tzmin = (
bounds[sign[2]].
z - origin.
z) * invDirection.
z;
39 tzmax = (
bounds[1-sign[2]].
z - origin.
z) * invDirection.
z;
40 if ( (tmin > tzmax) || (tzmin > tmax) )
48 return t0 < tmax && tmin < t1;
62 if (std::abs(c1.
x - c2.
x) > (r1.
x + r2.
x))
return false;
63 if (std::abs(c1.
y - c2.
y) > (r1.
y + r2.
y))
return false;
64 if (std::abs(c1.
y - c2.
z) > (r1.
z + r2.
z))
return false;
75 for (uint i = 0; i<3; ++i)
83 return radius*radius >= (p-
c).length2();
99 for(
auto it = points.
cbegin(); it != points.
cend(); ++it) {
128 std::string msg =
"Box::setMesh: can not set mesh for Box";
129 CONSOLE_BRIDGE_logError(msg.
c_str());
const std::array< int, 3 > & getSign() const
bool contains(const Vector3 &p) const
Determines whether a point p lies within the shape.
void enclose(const Box &box, const Pose3D &pose)
const Vector3 & getOrigin() const
Box getBoundingBox() const
Returns the smallest box which includes all mesh points. Box is not rotated, but matches the axis of ...
virtual const Mesh & getMesh() const
return the mesh defining the shape
Vector3 getCenter() const
Determine the center of the box with respect to the origin of the box.
const std::vector< geo::Vector3 > & getPoints() const
Mesh getTransformed(const geo::Transform t) const
unsigned int addPoint(double x, double y, double z)
bool intersect(const Ray &r, float t0, float t1, double &distance) const
intersect: currently always throws a logic error
Vector3 getSize() const
get the size of the box along all axes
const Vector3 & getMin() const
get vertex of the box with minimum coordinates
void setMesh(const Mesh &mesh)
set the Mesh Any child classes should throw a std::logic_error in case the mesh should not be changed...
double getMaxRadius() const
Calculate the maximum distance from the origin of the shape to any point of the shape.
void addTriangle(unsigned int i1, unsigned int i2, unsigned int i3)
Box(const Vector3 &min, const Vector3 &max)
void generate_mesh_()
Should be called any time bounds is changed.
const Vector3 & getInvDirection() const
Mesh mesh_
Should not be read or written to directly in general. Use setMesh and getMesh to write respectively r...
const Vector3 & getMax() const
get vertex of the box with maximum coordinates