xc
CooSys.h
1 // -*-c++-*-
2 //----------------------------------------------------------------------------
3 // xc utils library; general purpose classes and functions.
4 //
5 // Copyright (C) Luis C. PĂ©rez Tato
6 //
7 // XC utils is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // This software is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program.
19 // If not, see <http://www.gnu.org/licenses/>.
20 //----------------------------------------------------------------------------
21 //CooSys.h
22 //Coordinate systems base class.
23 
24 #ifndef SIS_COO_H
25 #define SIS_COO_H
26 
27 #include "../ProtoGeom.h"
28 #include "utility/geom/FT_matrix.h"
29 
31 //
33 //
38 class CooSys: public ProtoGeom
39  {
40  FT_matrix rot;
41  protected:
42  void identity(void);
43  void put(const size_t &i,const size_t &j,const GEOM_FT &);
44  void normalize(void);
45  void ortogonaliza(void);
46  void orthonormalize(void);
47  CooSys(const size_t &,const size_t &);
48  CooSys(const CooSys &other)
49  : ProtoGeom(other), rot(other.rot) {}
50  CooSys &operator=(const CooSys &other)
51  {
52  ProtoGeom::operator=(other);
53  rot= other.rot;
54  return *this;
55  }
56  virtual CooSys *Copia(void) const= 0;
57  public:
58  inline virtual bool operator==(const CooSys &other) const
59  { return (rot==other.rot); }
60  inline bool operator!=(const CooSys &other)
61  { return !(*this==other); }
62 
63  virtual size_t numberOfAxis(void) const
64  { return rot.getNumberOfRows(); }
65  bool EsNormal(void) const;
66  bool EsOrtogonal(void) const;
67  bool EsOrtonormal(void) const;
68  bool EsDextrogiro(void) const;
69  FT_matrix getRow(const size_t &i) const;
70  void putRow(const size_t &axis,const FT_matrix &v);
71 
72  virtual FT_matrix TransAGlobal(void) const;
73  //Return the matrix que transforma un vector expresado
74  // en locales al mismo vector expresado en globales.
75  virtual FT_matrix TransDeGlobal(void) const;
76  //Return the matrix que transforma un vector expresado
77  // en globales al mismo vector expresado en locales.
78  FT_matrix GetTransA(const CooSys &dest) const;
79  //Return the transformation matrix of this coordinates system to dest.
81  FT_matrix getLocalCoordinates(const FT_matrix &v) const;
82  FT_matrix getLocalMatrix(const FT_matrix &) const;
83  FT_matrix getGlobalMatrix(const FT_matrix &) const;
84  boost::python::list getLocalMatrixPy(const boost::python::list &) const;
85  boost::python::list getGlobalMatrixPy(const boost::python::list &) const;
86 
87  boost::python::dict getPyDict(void) const;
88  void setPyDict(const boost::python::dict &);
89  virtual void Print(std::ostream &os) const;
90  friend std::ostream &operator<<(std::ostream &os,const CooSys &sc);
91  };
92 
93 #endif
CooSys(const size_t &, const size_t &)
Constructor.
Definition: CooSys.cc:31
void putRow(const size_t &axis, const FT_matrix &v)
Set the i row of the matrix.
Definition: CooSys.cc:163
EntityWithOwner & operator=(const EntityWithOwner &)
Assignment operator.
Definition: EntityWithOwner.cc:53
bool EsNormal(void) const
Return true if the vectors are normalized.
Definition: CooSys.cc:106
virtual FT_matrix TransAGlobal(void) const
Return the matrix que transforma un vector expresado en locales al mismo vector expresado en globales...
Definition: CooSys.cc:167
FT_matrix getRow(const size_t &i) const
Return the matrix i row.
Definition: CooSys.cc:100
void put(const size_t &i, const size_t &j, const GEOM_FT &)
Assigns the (i,j) component of the matrix.
Definition: CooSys.cc:96
void identity(void)
Aligns the coordinate system with the global one.
Definition: CooSys.cc:89
bool EsOrtonormal(void) const
Return verdadero si los vectores son unitarios y ortogonales.
Definition: CooSys.cc:159
ProtoGeom(void)
False when solution is not possible: intersection of parallel planes.
Definition: ProtoGeom.cc:33
bool EsDextrogiro(void) const
Return true if it&#39;s a dextrorotatory coordinate system.
Definition: CooSys.cc:119
virtual FT_matrix TransDeGlobal(void) const
Return the matrix que transforma un vector expresado en globales al mismo vector expresado en locales...
Definition: CooSys.cc:172
FT_matrix getLocalCoordinates(const FT_matrix &v) const
Return the local coordinates of the vector.
Definition: CooSys.cc:189
Base class for geometry objects.
Definition: ProtoGeom.h:33
void orthonormalize(void)
Makes the base orthonormal.
Definition: CooSys.cc:76
void ortogonaliza(void)
Make the base orthogonal.
Definition: CooSys.cc:45
virtual void Print(std::ostream &os) const
Prints the matrix.
Definition: CooSys.cc:223
FT_matrix GetTransA(const CooSys &dest) const
Return the transformation matrix from this system to the argument one.
Definition: CooSys.cc:177
boost::python::list getGlobalMatrixPy(const boost::python::list &) const
Return the given matrix expressed in global coordinates.
Definition: CooSys.cc:216
boost::python::dict getPyDict(void) const
Return a Python dictionary with the object members values.
Definition: CooSys.cc:227
void normalize(void)
Row-normalize matrix.
Definition: CooSys.cc:36
FT_matrix getLocalMatrix(const FT_matrix &) const
Return the given matrix expressed in local coordinates.
Definition: CooSys.cc:193
Matrix which components are GEOM_FT numbers.
Definition: FT_matrix.h:40
void setPyDict(const boost::python::dict &)
Set the values of the object members from a Python dictionary.
Definition: CooSys.cc:240
Coordinate systems base class.
Definition: CooSys.h:38
FT_matrix getGlobalMatrix(const FT_matrix &) const
Return the given matrix expressed in global coordinates.
Definition: CooSys.cc:201
bool EsOrtogonal(void) const
Return verdadero si los vectores son ortogonales.
Definition: CooSys.cc:138
FT_matrix getGlobalCoordinates(const FT_matrix &v) const
Return the global coordinates of the vector.
Definition: CooSys.cc:183
boost::python::list getLocalMatrixPy(const boost::python::list &) const
Return the given matrix expressed in local coordinates.
Definition: CooSys.cc:209