geolib2
Box.h
Go to the documentation of this file.
1 #ifndef GEOLIB_BOX_H_
2 #define GEOLIB_BOX_H_
3 
4 #include "Shape.h"
5 
6 namespace geo {
7 
15 class Box : public Shape {
16 
17 public:
18 
19  Box(const Vector3 &min, const Vector3 &max);
20 
21  Box* clone() const;
22 
23  bool intersect(const Ray& r, float t0, float t1, double& distance) const;
24 
32  bool intersect(const Box& other) const;
33 
34  bool intersect(const Vector3& p, const double radius) const;
35 
36  bool contains(const Vector3& p) const;
37 
38  double getMaxRadius() const;
39 
45  Box getBoundingBox() const;
46 
47  void enclose(const Box& box, const Pose3D& pose);
48 
53  Vector3 getSize() const;
54 
59  Vector3 getCenter() const;
60 
65  const Vector3& getMin() const;
66 
71  const Vector3& getMax() const;
72 
73  void setMesh(const Mesh& mesh);
74 
75 protected:
76 
78 
79  double max_radius_;
80 
84  void generate_mesh_();
85 
86 };
87 
88 }
89 
90 #endif
Shape.h
geo::Box::contains
bool contains(const Vector3 &p) const
Determines whether a point p lies within the shape.
Definition: Box.cpp:86
geo::Box::enclose
void enclose(const Box &box, const Pose3D &pose)
Definition: Box.cpp:96
geo
Definition: Box.h:6
geo::Box
Definition: Box.h:15
geo::Box::getBoundingBox
Box getBoundingBox() const
Returns the smallest box which includes all mesh points. Box is not rotated, but matches the axis of ...
Definition: Box.cpp:92
geo::Transform3T
Definition: math_types.h:19
geo::Box::getCenter
Vector3 getCenter() const
Determine the center of the box with respect to the origin of the box.
Definition: Box.cpp:115
geo::Box::bounds
Vector3 bounds[2]
Definition: Box.h:77
geo::Box::max_radius_
double max_radius_
Definition: Box.h:79
geo::Box::intersect
bool intersect(const Ray &r, float t0, float t1, double &distance) const
intersect: currently always throws a logic error
Definition: Box.cpp:21
geo::Ray
Definition: Ray.h:10
geo::Vector3
Definition: matrix.h:12
geo::Box::getSize
Vector3 getSize() const
get the size of the box along all axes
Definition: Box.cpp:111
geo::Box::getMin
const Vector3 & getMin() const
get vertex of the box with minimum coordinates
Definition: Box.cpp:119
geo::Box::setMesh
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...
Definition: Box.cpp:127
geo::Box::getMaxRadius
double getMaxRadius() const
Calculate the maximum distance from the origin of the shape to any point of the shape.
Definition: Box.cpp:51
geo::Box::Box
Box(const Vector3 &min, const Vector3 &max)
Definition: Box.cpp:11
geo::Box::generate_mesh_
void generate_mesh_()
Should be called any time bounds is changed.
Definition: Box.cpp:133
geo::Box::clone
Box * clone() const
Definition: Box.cpp:17
geo::Mesh
Definition: Mesh.h:25
geo::Box::getMax
const Vector3 & getMax() const
get vertex of the box with maximum coordinates
Definition: Box.cpp:123
geo::Shape
A geometric description of a shape.
Definition: Shape.h:19