geolib2
CompositeShape.h
Go to the documentation of this file.
1 #ifndef GEOLIB_COMPOSITE_SHAPE_H_
2 #define GEOLIB_COMPOSITE_SHAPE_H_
3 
4 #include "Shape.h"
5 #include "geolib/Box.h"
6 
7 #include <vector>
8 
9 namespace geo {
10 
11 class Box;
12 
16 class CompositeShape : public Shape {
17 
18 public:
19 
21 
22  virtual ~CompositeShape();
23 
24  CompositeShape* clone() const;
25 
26  bool intersect(const Ray& r, float t0, float t1, double& distance) const;
27 
28  bool intersect(const Vector3& p, const double radius) const;
29 
30  bool contains(const Vector3& p) const;
31 
32  double getMaxRadius() const;
33 
39  void addShape(const Shape& shape, const Pose3D& pose);
40 
41  Box getBoundingBox() const;
42 
48 
49  void setMesh(const Mesh &mesh);
50 
51 protected:
52 
58 
59  double max_radius_;
60 
62 
64 
66 
67 };
68 
69 }
70 
71 
72 #endif
Shape.h
geo::CompositeShape::clone
CompositeShape * clone() const
Definition: CompositeShape.cpp:15
geo
Definition: Box.h:6
vector
geo::Box
Definition: Box.h:15
geo::Transform3T
Definition: math_types.h:19
geo::CompositeShape::addShape
void addShape(const Shape &shape, const Pose3D &pose)
add a shape to the composite
Definition: CompositeShape.cpp:86
geo::CompositeShape::getBoundingBox
Box getBoundingBox() const
Returns the smallest box which includes all mesh points. Box is not rotated, but matches the axis of ...
Definition: CompositeShape.cpp:115
geo::CompositeShape::intersect
bool intersect(const Ray &r, float t0, float t1, double &distance) const
intersect: currently always throws a logic error
Definition: CompositeShape.cpp:19
geo::CompositeShape::~CompositeShape
virtual ~CompositeShape()
Definition: CompositeShape.cpp:12
geo::CompositeShape::CompositeShape
CompositeShape()
Definition: CompositeShape.cpp:9
geo::Ray
Definition: Ray.h:10
geo::CompositeShape::getMaxRadius
double getMaxRadius() const
Calculate the maximum distance from the origin of the shape to any point of the shape.
Definition: CompositeShape.cpp:82
geo::Vector3
Definition: matrix.h:12
geo::CompositeShape::min_
Vector3 min_
Definition: CompositeShape.h:61
geo::CompositeShape::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: CompositeShape.cpp:123
geo::CompositeShape
A geometric description of a shape as a union of other shapes.
Definition: CompositeShape.h:16
geo::CompositeShape::max_
Vector3 max_
Definition: CompositeShape.h:63
geo::CompositeShape::max_radius_
double max_radius_
Definition: CompositeShape.h:59
geo::CompositeShape::getShapes
const std::vector< std::pair< ShapePtr, Transform > > & getShapes() const
Get all the child shapes and their inverse pose relative to the "origin" of the CompositeShape.
Definition: CompositeShape.cpp:119
geo::CompositeShape::contains
bool contains(const Vector3 &p) const
Determines whether a point p lies within the shape.
Definition: CompositeShape.cpp:64
Box.h
geo::CompositeShape::shapes_
std::vector< std::pair< ShapePtr, Transform > > shapes_
Definition: CompositeShape.h:57
geo::CompositeShape::bb_
Box bb_
Definition: CompositeShape.h:65
geo::Mesh
Definition: Mesh.h:25
geo::Shape
A geometric description of a shape.
Definition: Shape.h:19