31 o <<
"*********" << std::endl;
32 o <<
"a_wrench:" << std::endl;
33 o <<
"*********" << std::endl;
34 o <<
"This class is used to model a wrench: force + moment" << std::endl;
35 o <<
"Commands:" << std::endl;
36 o <<
"--------" << std::endl;
37 o <<
"a_wrench W 'p' 'f' ('m'): create a wrench by applying force 'f' at point 'p', possibly with a moment having the same direction of 'f'" << std::endl;
38 o <<
"a_wrench W 'x' 'y' 'z' 'fx' 'fy' 'fz' ('m'): idem above" << std::endl;
39 o <<
"a_wrench W 'p1' 'p2' 'p3' 'w1' 'w2': create a wrench at p1 such that m=0 at p1, torque//normal plane (p1,p2,p3)=0 at p2 & p3, w1 applied between p1 and p2, w2 between p2 and p3" << std::endl;
41 o <<
"set 'p' 'f' ('m'): apply force 'f' at point 'p', possibly with a moment having the same direction of 'f'" << std::endl;
42 o <<
"set 'x' 'y' 'z' 'fx' 'fy' 'fz' ('m'): idem above" << std::endl;
43 o <<
"print: print the six values of the force and moment" << std::endl;
44 o <<
"F: returns the force (vector)" << std::endl;
45 o <<
"fx: returns x component of the force" << std::endl;
46 o <<
"fy: returns y component of the force" << std::endl;
47 o <<
"fz: returns z component of the force" << std::endl;
48 o <<
"f: returns norm of the force" << std::endl;
49 o <<
"M: returns the moment (vector)" << std::endl;
50 o <<
"mx: returns x component of the moment" << std::endl;
51 o <<
"my: returns y component of the moment" << std::endl;
52 o <<
"mz: returns z component of the moment" << std::endl;
53 o <<
"m: returns norm of the moment" << std::endl;
54 o <<
"clear: clear the wrench" << std::endl;
55 o <<
"origin 'a_point': change the origin of the coordinate system" << std::endl;
56 o <<
"d0: point where wrench reduces to a pure force, return origin if f=0" << std::endl;
57 o <<
"torque 'p': gets torque at point 'p' (a_point)" << std::endl;
58 o <<
"torque 'p' 'n': gets torque at 'p', in direction 'n'" << std::endl;
59 o <<
"pierce 'a_plane': find the point of interesction of the wrench with the plane" << std::endl;
61 o <<
"If 'w1' and 'w2' are two wrenches" << std::endl;
62 o <<
"w1 + w1: returns the sum of the two wrenches" << std::endl;
63 o <<
"w1 - w1: returns the difference of the two wrenches" << std::endl;
64 o <<
"-w1: sreturns the inverse of 'w1'" << std::endl;
71 a_point m0 =
f.normalise()*
m;
75 void a_wrench::set(
double x,
double y,
double z,
double fx,
double fy,
double fz,
double m)
100 a_point u = d3.normalise();
102 a_point n = cross(u,d2).normalise();
103 a_point v = cross(n,u).normalise();
111 double t3n = ft.
torque(p3,n);
115 double du = dist(
p1,p3);
122 double fu = -(t2n-u2*fv)/v2;
137 a_point x1 = this->
d0();
140 a_point x = p.intersect(s);
149 return a_point(0.,0.,0.);
151 double m = this->
m();
155 a_point fl = (dm*
f)*dm;
158 double fps = fp.norm();
161 return a_point(0.,0.,0.);
163 return cross(fp,dm)*(
m/fps);
175 return (this->
torque(p))*n2;
void set(const a_point &p, a_point f, double m=0)
apply a force f at p, possibly with a moment having same direction
double fx() const
force at the origin (x component)
double fz() const
force at the origin (z component)
double f() const
force at the origin
static const std::string help()
get information about the class
a_point torque(const a_point &p) const
torque at p
double fy() const
force at the origin (y component)
void origin(a_point p)
change origin
a_point d0() const
point where wrench reduces to a pure force, return origin if f=0
a_point pierce(const a_plane &p) const
intersection with a plane
double m() const
torque at the origin