Cheetah Software  1.0
CollisionMesh.h
Go to the documentation of this file.
1 
5 #ifndef COLLISION_MESH_H
6 #define COLLISION_MESH_H
7 
8 #include <vector>
9 #include "Collision/Collision.h"
10 #include "Utilities/utilities.h"
11 #include "cppTypes.h"
12 
16 template <typename T>
17 class CollisionMesh : public Collision<T> {
18  public:
19  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
20 
30  CollisionMesh(const T& mu, const T& restitution, const T& grid,
31  const Vec3<T>& left_corner_loc, const DMat<T>& height_map)
32  : Collision<T>(mu, restitution),
33  _left_corner_loc(left_corner_loc),
34  _height_map(height_map),
35  _grid(grid) {
36  _x_max = (_height_map.rows() - 1) * _grid;
37  _y_max = (_height_map.cols() - 1) * _grid;
38  }
39 
40  virtual ~CollisionMesh() {}
41  virtual bool ContactDetection(const Vec3<T>& cp_pos, T& penetration,
42  Mat3<T>& cp_frame);
43 
44  private:
45  T _size[3];
46 
49 
50  T _grid;
51  T _x_max;
52  T _y_max;
53 };
54 
55 #endif // COLLISION_MESH_H
virtual bool ContactDetection(const Vec3< T > &cp_pos, T &penetration, Mat3< T > &cp_frame)
typename Eigen::Matrix< T, 3, 3 > Mat3
Definition: cppTypes.h:54
typename Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > DMat
Definition: cppTypes.h:106
typename Eigen::Matrix< T, 3, 1 > Vec3
Definition: cppTypes.h:26
Virtual class of Collision logic.
Vec3< T > _left_corner_loc
Definition: CollisionMesh.h:47
virtual ~CollisionMesh()
Definition: CollisionMesh.h:40
DMat< T > _height_map
Definition: CollisionMesh.h:48
EIGEN_MAKE_ALIGNED_OPERATOR_NEW CollisionMesh(const T &mu, const T &restitution, const T &grid, const Vec3< T > &left_corner_loc, const DMat< T > &height_map)
Definition: CollisionMesh.h:30