VclipLinkPair.cpp
Go to the documentation of this file.
1 #include "VclipLinkPair.h"
2 
3 VclipLinkPair::VclipLinkPair(hrp::Link* link0, Vclip::Polyhedron* vclip_model0, hrp::Link* link1, Vclip::Polyhedron* vclip_model1, double tolerance)
4 {
5  links_[0] = link0;
6  links_[1] = link1;
7  Vclip_Model1 = vclip_model0;
8  Vclip_Model2 = vclip_model1;
9  tolerance_ = tolerance;
12 }
14 {
15 }
16 
18 {
19  double p1[3], p2[3];
20  double len = computeDistance(p1,p2);
21  if ( len < tolerance_ ) {
22  return true;
23  }
24  return false;
25 }
26 
27 double VclipLinkPair::computeDistance(double *q1, double *q2)
28 {
29  Vclip::Mat3 R1, R2;
30  Vclip::Vect3 T1, T2;
31  Vclip::VclipPose P1, P2;
32  const hrp::Vector3& p1 = links_[0]->p;
33  hrp::Matrix33 r1 = links_[0]->attitude();
34  const hrp::Vector3& p2 = links_[1]->p;
35  hrp::Matrix33 r2 = links_[1]->attitude();
36  R1.xrow().set(r1(0,0), r1(0,1), r1(0,2));
37  R1.yrow().set(r1(1,0), r1(1,1), r1(1,2));
38  R1.zrow().set(r1(2,0), r1(2,1), r1(2,2));
39  R2.xrow().set(r2(0,0), r2(0,1), r2(0,2));
40  R2.yrow().set(r2(1,0), r2(1,1), r2(1,2));
41  R2.zrow().set(r2(2,0), r2(2,1), r2(2,2));
42  T1.set(p1(0), p1(1), p1(2));
43  T2.set(p2(0), p2(1), p2(2));
44  P1.set(R1, T1);
45  P2.set(R2, T2);
46  Vclip::VclipPose X12, X21;
47  X12.invert(P2);
48  X12.postmult(P1);
49  X21.invert(X12);
50  Vclip::Vect3 cp1, cp2;
52  Vclip::Vect3 cp1g, cp2g;
53  P1.xformPoint(cp1, cp1g);
54  P2.xformPoint(cp2, cp2g);
55  q1[0] = cp1g.x; q1[1] = cp1g.y; q1[2] = cp1g.z;
56  q2[0] = cp2g.x; q2[1] = cp2g.y; q2[2] = cp2g.z;
57 
58  return len;
59 }
60 
61 
Real x
Definition: mv.h:190
const Vect3 & xrow() const
Definition: mv.h:339
void set(Real x_, Real y_, Real z_)
Definition: mv.h:199
hrp::Link * links_[2]
Definition: VclipLinkPair.h:15
const list< Vertex > & verts() const
Definition: vclip.h:416
Definition: mv.h:600
Real z
Definition: mv.h:190
Vclip::Polyhedron * Vclip_Model2
Definition: VclipLinkPair.h:16
double computeDistance(double *q1, double *q2)
Eigen::Vector3d Vector3
const Feature * second
Definition: vclip.h:261
void xformPoint(const Vect3 &p, Vect3 &xp) const
Definition: mv.h:1530
VclipLinkPair(hrp::Link *link0, Vclip::Polyhedron *pqp_model0, hrp::Link *link1, Vclip::Polyhedron *pqp_model1, double tolerance=0)
Eigen::Matrix3d Matrix33
const Feature * first
Definition: vclip.h:261
Real y
Definition: mv.h:190
const Vect3 & zrow() const
Definition: mv.h:341
void invert(const Se3 &T)
Definition: mv.h:1499
void postmult(const Se3 &T)
Definition: mv.h:1489
Vclip::FeaturePair Feature_Pair
Definition: VclipLinkPair.h:17
Vclip::Polyhedron * Vclip_Model1
Definition: VclipLinkPair.h:16
double tolerance_
Definition: VclipLinkPair.h:18
const Vect3 & yrow() const
Definition: mv.h:340
void set(const Quat &q_, const Vect3 &d_)
Definition: mv.h:620
bool checkCollision()
static Real vclip(const Polyhedron *const poly1, const Polyhedron *const poly2, const VclipPose &X12, const VclipPose &X21, const Feature *&feat1, const Feature *&feat2, Vect3 &cp1, Vect3 &cp2, int oneStep=0)


hrpsys
Author(s): AIST, Fumio Kanehiro
autogenerated on Thu May 6 2021 02:41:51