14 static void from_matrix(
const X& m, std::vector<SVELOCITY>& w)
16 const unsigned SPATIAL_DIM = 6;
17 assert(m.rows() == SPATIAL_DIM);
18 w.resize(m.columns());
20 for (
unsigned k=0, i=0; i< w.size(); i++, k+= SPATIAL_DIM)
21 w[i] =
SVELOCITY(data[k+0], data[k+1], data[k+2], data[k+3], data[k+4], data[k+5]);
26 static X&
to_matrix(
const std::vector<SVELOCITY>& w, X& m)
28 const unsigned SPATIAL_DIM = 6;
29 m.resize(SPATIAL_DIM, w.size());
31 for (
unsigned k=0, i=0; i< w.size(); i++)
35 data[k++] = f[0]; data[k++] = f[1]; data[k++] = f[2];
36 data[k++] = t[0]; data[k++] = t[1]; data[k++] = t[2];
44 static X&
to_matrix(
const std::vector<SFORCE>& w, X& m)
46 const unsigned SPATIAL_DIM = 6;
47 m.resize(SPATIAL_DIM, w.size());
49 for (
unsigned k=0, i=0; i< w.size(); i++)
53 data[k++] = f[0]; data[k++] = f[1]; data[k++] = f[2];
54 data[k++] = t[0]; data[k++] = t[1]; data[k++] = t[2];
62 static X&
to_matrix(
const std::vector<SMOMENTUM>& w, X& m)
64 const unsigned SPATIAL_DIM = 6;
65 m.resize(SPATIAL_DIM, w.size());
67 for (
unsigned k=0, i=0; i< w.size(); i++)
71 data[k++] = f[0]; data[k++] = f[1]; data[k++] = f[2];
72 data[k++] = t[0]; data[k++] = t[1]; data[k++] = t[2];
82 const unsigned SPATIAL_DIM = 6;
83 m.resize(w.size(), SPATIAL_DIM);
85 for (
unsigned k=0, i=0; i< w.size(); i++)
89 data[k++] = t[0]; data[k++] = t[1]; data[k++] = t[2];
90 data[k++] = f[0]; data[k++] = f[1]; data[k++] = f[2];
100 const unsigned SPATIAL_DIM = 6;
101 m.resize(t.size(), SPATIAL_DIM);
102 for (
unsigned i=0; i< t.size(); i++)
104 COLUMN_ITERATOR data = m.block_column_iterator_begin(i, i+1, 0, SPATIAL_DIM);
105 VECTOR3 lin = t[i].get_linear();
106 VECTOR3 ang = t[i].get_angular();
120 static X&
transpose_mult(
const std::vector<SVELOCITY>& t,
const std::vector<SFORCE>& w, X& result)
122 result.resize(t.size(), w.size());
124 for (
unsigned i=0, k=0; i< t.size(); i++)
125 for (
unsigned j=0; j< w.size(); j++)
126 data[k++] = t[i].dot(w[j]);
135 result.resize(t.size(), 1,
false);
137 for (
unsigned i=0, k=0; i< t.size(); i++)
138 data[k++] = t[i].dot(w);
147 result.resize(t.size(), 1,
false);
149 for (
unsigned i=0, k=0; i< t.size(); i++)
150 data[k++] = t[i].dot(w);
157 static X&
transpose_mult(
const std::vector<SVELOCITY>& t,
const std::vector<SMOMENTUM>& w, X& result)
159 result.resize(t.size(), w.size());
161 for (
unsigned i=0, k=0; i< t.size(); i++)
162 for (
unsigned j=0; j< w.size(); j++)
163 data[k++] = t[i].dot(w[j]);
169 template <
class Y,
class X>
172 const unsigned SPATIAL_DIM = 6;
173 result.resize(t.size(), y.columns(),
false);
175 for (
unsigned i=0, k=0; i< t.size(); i++)
176 for (
unsigned j=0; j< y.columns(); j++)
177 data[k++] = t[i].dot(y.column(j));
186 result.resize(w.size());
188 for (
unsigned i=0; i< w.size(); i++)
189 data[i] = w[i].dot(t);
196 static std::vector<SMOMENTUM>& mult(
const SPATIAL_AB_INERTIA& I,
const std::vector<SVELOCITY>& s, std::vector<SMOMENTUM>& result);
198 static std::vector<SMOMENTUM>& mult(
const SPATIAL_RB_INERTIA& I,
const std::vector<SVELOCITY>& s, std::vector<SMOMENTUM>& result);
204 static std::vector<SACCEL>&
transform_accel(boost::shared_ptr<const POSE3> target,
const std::vector<SACCEL>& asrc, std::vector<SACCEL>& atgt);
static X & transpose_mult(const std::vector< SVELOCITY > &t, const SMOMENTUM &w, X &result)
Computes the "spatial dot product" between a vector of velocities and a momentum and returns the resu...
Definition: SpatialArithmetic.h:145
static X & transpose_mult(const std::vector< SMOMENTUM > &w, const SVELOCITY &t, X &result)
Computes the "spatial dot product" between a vector of momenta and an axis and returns the result in ...
Definition: SpatialArithmetic.h:184
A spatial (six dimensional) momentum.
Definition: SMomentum.h:12
static VECTORN & concat(const VECTORN &v, const SFORCE &w, VECTORN &result)
Concates a vector with a force to make a new vector.
Definition: SpatialArithmetic.cpp:127
static X & transpose_to_matrix(const std::vector< SVELOCITY > &t, X &m)
Converts an STL vector of spatial velocities to a force matrix (type X)
Definition: SpatialArithmetic.h:98
static X & spatial_transpose_to_matrix(const std::vector< SMOMENTUM > &w, X &m)
Converts an STL vector of momenta to a matrix (type X)
Definition: SpatialArithmetic.h:80
static X & transpose_mult(const std::vector< SVELOCITY > &t, const Y &y, X &result)
Computes the "spatial dot product" between a vector of axes and a matrix or vector and returns the re...
Definition: SpatialArithmetic.h:170
A generic, possibly non-square matrix.
Definition: MatrixN.h:18
A spatial velocity (a twist)
Definition: SVelocity.h:15
static X & to_matrix(const std::vector< SVELOCITY > &w, X &m)
Converts an STL vector of axes to a matrix (type X)
Definition: SpatialArithmetic.h:26
static void from_matrix(const X &m, std::vector< SVELOCITY > &w)
Converts a matrix (type X) to a vector of spatial axes.
Definition: SpatialArithmetic.h:14
A 6x6 spatial algebra matrix typically used for dynamics calculations.
Definition: SpatialABInertia.h:20
static X & transpose_mult(const std::vector< SVELOCITY > &t, const SFORCE &w, X &result)
Computes the "spatial dot product" between a vector of velocities and a force and returns the result ...
Definition: SpatialArithmetic.h:133
A 6x6 spatial algebra matrix used for dynamics calculations.
Definition: SpatialRBInertia.h:25
A spatial (six dimensional) acceleration.
Definition: SAccel.h:14
A generic N-dimensional floating point vector.
Definition: VectorN.h:16
static X & to_matrix(const std::vector< SMOMENTUM > &w, X &m)
Converts an STL vector of momenta to a matrix (type X)
Definition: SpatialArithmetic.h:62
A three-dimensional floating point vector used for representing points and vectors in 3D with associa...
Definition: Vector3.h:15
static X & transpose_mult(const std::vector< SVELOCITY > &t, const std::vector< SFORCE > &w, X &result)
Computes the "spatial dot product" between a vector of velocities and a vector of forces and returns ...
Definition: SpatialArithmetic.h:120
A spatial force (a wrench)
Definition: SForce.h:14
A construct for iterating over a rectangular block of a matrix.
Definition: ColumnIterator.h:12
Class for spatial arithmetic.
Definition: SpatialArithmetic.h:8
A construct for iterating over a rectangular block of a matrix.
Definition: ColumnIterator.h:215
A 3x3 matrix that may be used for orientation, inertia tensors, etc.
Definition: Matrix3.h:20
A construct for iterating over a rectangular block of a matrix.
Definition: RowIterator.h:12
static X & transpose_mult(const std::vector< SVELOCITY > &t, const std::vector< SMOMENTUM > &w, X &result)
Computes the "spatial dot product" between a vector of axes and a vector of momenta and returns the r...
Definition: SpatialArithmetic.h:157
static SACCEL transform_accel(boost::shared_ptr< const POSE3 > target, const SACCEL &a)
Special transformation of acceleration when moving aspect of pose accounted for elsewhere.
Definition: SpatialArithmetic.cpp:45
static X & to_matrix(const std::vector< SFORCE > &w, X &m)
Converts an STL vector of forces to a matrix (type X)
Definition: SpatialArithmetic.h:44