28 #include <Base/Common/W32Compat.hh>
61 const T act_length = (T) NormL2();
62 if (act_length > std::numeric_limits<T>::epsilon() ){
65 OuterProduct(*
this, tmp);
66 tmp /= (T) (act_length * act_length);
80 BIASERR(
"CoordSphereToEuclidean not implemented for this template type t - but e.g. for double");
96 const double r = (*this)[0];
97 const double phi = (*this)[1];
98 const double theta = (*this)[2];
102 const double xx( r * sin(theta) * cos(phi) );
103 const double yy( r * (sin(theta) * sin(phi)) );
104 const double zz( r * cos(theta) );
115 BIASERR(
"CoordEuclideanToSphere not implemented for this template type T"
116 <<
" - but e.g. for double");
130 const double xx = (*this)[0];
131 const double yy = (*this)[1];
132 const double zz = (*this)[2];
134 const double r( NormL2() );
139 const double phi(M_PI_2- atan2(xx, yy) );
142 const double projLength=sqrt( xx * xx + yy * yy );
144 const double theta(atan2(projLength, zz) );
153 mat[0][0]=data_[0]*v[0]; mat[0][1]= data_[0]*v[1]; mat[0][2]= data_[0]*v[2];
154 mat[1][0]=data_[1]*v[0]; mat[1][1]= data_[1]*v[1]; mat[1][2]= data_[1]*v[2];
155 mat[2][0]=data_[2]*v[0]; mat[2][1]= data_[2]*v[1]; mat[2][2]= data_[2]*v[2];
164 ifstream fs( filename.c_str() );
166 BIASERR(
"could not open file "<<filename);
170 const unsigned int nMax=1024;
176 string::size_type pos=string::npos;
178 vector<string> pattern;
180 pattern.push_back(
"TC_X =");
181 pattern.push_back(
"TC_Y =");
182 pattern.push_back(
"TC_Z =");
183 vector< bool > found;
184 found.resize( pattern.size(),
false);
185 BIASASSERT(found.size()>2);
186 while (!fs.eof() && (fs)
187 && (!found[0] || !found[1] || !found[2] ) )
190 fs.getline(&caLine[0], nMax);
192 for (
unsigned int i=0; i<pattern.size(); i++){
193 pos = strLine.find(pattern[i]);
194 if (pos != string::npos){
198 strLine.substr(pos+pattern[i].size(), strLine.size()-pos-pattern[i].size())
206 BIASASSERT(found.size()==pattern.size());
208 for (
unsigned int j=0; j<found.size(); j++) foundAll=foundAll&&found[j];
209 if (!foundAll)
return -99;
217 std::ifstream fs( filename.c_str() );
232 std::ofstream fs( filename.c_str() );
249 BIASERR(
"not implemented because minus does not make sense for unsigned types");
261 T* pData = result.
GetData() + 1;
262 *pData++ = -data_[2];
266 *pData++ = -data_[0];
267 *pData++ = -data_[1];
277 BIASASSERT(v.
size() == VECTOR3_SIZE);
289 template class BIASMathBase_EXPORT BIAS::Vector3<type>;
int LoadBogTC(const std::string &filename)
reads the TC part of a BOG file which is used by Daimler Chrysler for storing Camera center position...
BIAS::Vector3< T > CoordEuclideanToSphere() const
coordinate transform.
class for column vectors with arbitrary size
void OuterProduct(const Vector3< T > &v, Matrix3x3< T > &res) const
outer product, constructs a matrix.
BIAS::Vector3< T > GetNormalized() const
return a normalized vector of this
Matrix< T > GetSkewSymmetricMatrix() const
constructs a skew symmetric 3x3 matrix from (*this), which can be used instead of the cross product ...
void SetZero()
Sets all values to zero.
T * GetData()
get the pointer to the data array of the matrix (for faster direct memeory access) ...
is a 'fixed size' quadratic matrix of dim.
class Vector3 contains a Vector of fixed dim.
bool Save(const std::string &filename) const
method to save directly to a given filename.
matrix class with arbitrary size, indexing is row major.
BIAS::Vector3< T > CoordSphereToEuclidean() const
coordinate transfrom.
Matrix3x3< T > Transpose() const
returns transposed matrix tested 12.06.2002
bool Load(const std::string &filename)
method to load directly from a given filename.
Vector3< T > & Normalize()
normalize this vector to length 1