Klamp't  0.9.0
Hold.h
Go to the documentation of this file.
1 #ifndef HOLD_H
2 #define HOLD_H
3
4 #include <KrisLibrary/robotics/Contact.h>
5 #include <KrisLibrary/robotics/IK.h>
6
7 namespace Klampt {
8  using namespace std;
9
28 struct Hold
29 {
31  void Transform(const RigidTransform& T);
33  inline void GetCentroid(Vector3& c) const
34  {
35  c.setZero();
36  for(size_t i=0;i<contacts.size();i++)
37  c += contacts[i].x;
38  c/=(Real)contacts.size();
39  }
40
41  //Returns the average normal of the contacts
42  inline void GetNormal(Vector3& n) const
43  {
44  n.setZero();
45  for(size_t j=0;j<contacts.size();j++)
46  n += contacts[j].n;
47  n.inplaceNormalize();
48  }
49
51  inline Vector3 GetCentroid() const { Vector3 c; GetCentroid(c); return c; }
52  inline Vector3 GetNormal() const { Vector3 n; GetNormal(n); return n; }
53
66  void SetupIKConstraint(const Vector3& localPos0, const Vector3& rot);
75  void SetupFixedIKConstraint( const Vector3& localPos0, const Matrix3& rot);
82  void SetupPointIKConstraint(const Vector3& localPos0);
93  void SetupAxisIKConstraint( const Vector3& localPos0, const Vector3& axis, const Vector3& axis_w);
94
96  vector<ContactPoint> contacts;
97  IKGoal ikConstraint;
98 };
99
100 bool operator == (const Hold& a,const Hold& b);
101 bool operator < (const Hold& a,const Hold& b);
102 bool operator > (const Hold& a,const Hold& b);
103 ostream& operator << (ostream&, const Hold&);
104 istream& operator >> (istream&, Hold&);
105
108 } //namespace Klampt
109
110 #endif
Vector3 GetCentroid() const
Same as above.
Definition: Hold.h:51
void GetCentroid(Vector3 &c) const
Returns the centroid of the contacts.
Definition: Hold.h:33
A single contact between the robot and the environment.
Definition: Hold.h:28
Definition: ContactDistance.h:6