xc
SlidingVectorsSystem2d.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 //SlidingVectorsSystem2d.h
22 //Sliding vectors system.
23 
24 #ifndef SLIDINGVECTORSSYSTEM2D_H
25 #define SLIDINGVECTORSSYSTEM2D_H
26 
27 #include "../ProtoGeom.h"
28 #include "SlidingVector2d.h"
29 #include "Pos2d.h"
30 
31 class SlidingVector2d;
32 class Line2d;
33 class Ref2d2d;
34 
36 //
39  {
40  GEOM_FT mom;
41  public:
42  SlidingVectorsSystem2d(const Pos2d &O= Pos2d(),const Vector2d &R= Vector2d(),const GEOM_FT &Mo= 0.0);
43  explicit SlidingVectorsSystem2d(const SlidingVector2d &v);
44 
45  bool operator==(const SlidingVectorsSystem2d &) const;
46 
47  //Resultant and moment.
48  Vector2d getResultant(void) const
49  { return getVector(); }
50  Vector2d getResultant(const Ref2d2d &ref) const;
51  GEOM_FT getMoment(void) const
52  { return mom; }
53  GEOM_FT getMoment(const Pos2d &P) const;
54  bool Nulo(void) const;
55  void Neg(void);
56  SlidingVectorsSystem2d reduceTo(const Pos2d &Q) const;
57  Line2d getZeroMomentLine(void) const;
58  std::vector<SlidingVector2d> distribute(const std::vector<Pos2d> &) const;
59  boost::python::list distributePyNoWeights(const boost::python::list &) const;
60  std::vector<SlidingVector2d> distribute(const std::vector<Pos2d> &, const std::vector<double> &) const;
61  boost::python::list distributePy(const boost::python::list &, const boost::python::list &) const;
62 
63  SlidingVectorsSystem2d &operator+=(const SlidingVector2d &v);
64  SlidingVectorsSystem2d &operator-=(const SlidingVector2d &v);
65  SlidingVectorsSystem2d &operator+=(const SlidingVectorsSystem2d &s);
66  SlidingVectorsSystem2d &operator-=(const SlidingVectorsSystem2d &s);
67  SlidingVectorsSystem2d &operator*=(const GEOM_FT &d);
68  friend SlidingVectorsSystem2d operator+(const SlidingVectorsSystem2d &s1,const SlidingVectorsSystem2d &s2);
69  friend SlidingVectorsSystem2d operator-(const SlidingVectorsSystem2d &s1,const SlidingVectorsSystem2d &s2);
70  friend SlidingVectorsSystem2d operator*(const GEOM_FT &d, const SlidingVectorsSystem2d &s);
71  friend SlidingVectorsSystem2d operator*(const SlidingVectorsSystem2d &s,const GEOM_FT &d);
72  void Print(std::ostream &os) const;
73  void PrintLtx(std::ostream &,const std::string &ud_long= " m",const GEOM_FT &f_long=1.0, const std::string &ud_f= " N",const GEOM_FT &f_f=1.0) const;
74  friend std::ostream &operator<<(std::ostream &os, const SlidingVectorsSystem2d &svd2d);
75 
76  boost::python::dict getPyDict(void) const;
77  void setPyDict(const boost::python::dict &);
78  };
79 
82 SlidingVectorsSystem2d operator*(const GEOM_FT &d, const SlidingVectorsSystem2d &s);
83 SlidingVectorsSystem2d operator*(const SlidingVectorsSystem2d &s,const GEOM_FT &d);
84 SlidingVectorsSystem2d operator+(const SlidingVector2d &v1,const SlidingVector2d &v2);
87 SlidingVectorsSystem2d operator-(const SlidingVectorsSystem2d &svd2d);
88 std::ostream &operator<<(std::ostream &os, const SlidingVectorsSystem2d &svd2d);
89 
90 
91 #endif
bool operator==(const SlidingVectorsSystem2d &) const
Comparison operator.
Definition: SlidingVectorsSystem2d.cc:36
sliding vector en dos dimensiones.
Definition: SlidingVector2d.h:35
const Vector2d & getVector(void) const
Return the vector part of the object.
Definition: SlidingVector2d.cc:44
Posición en dos dimensiones.
Definition: Pos2d.h:41
Line in a two-dimensional space.
Definition: Line2d.h:61
boost::python::list distributePy(const boost::python::list &, const boost::python::list &) const
Assigns a vector to each point to obtain an equivalent sliding vector system.
Definition: SlidingVectorsSystem2d.cc:191
boost::python::dict getPyDict(void) const
Return a Python dictionary with the object members values.
Definition: SlidingVectorsSystem2d.cc:345
std::vector< SlidingVector2d > distribute(const std::vector< Pos2d > &) const
Assigns a vector to each point to obtain an equivalent sliding vector system.
Definition: SlidingVectorsSystem2d.cc:79
Sliding vectors system.
Definition: SlidingVectorsSystem2d.h:38
Vector en dos dimensiones.
Definition: Vector2d.h:41
Two-dimensional reference system defined in a two-dimensional space.
Definition: Ref2d2d.h:39
void setPyDict(const boost::python::dict &)
Set the values of the object members from a Python dictionary.
Definition: SlidingVectorsSystem2d.cc:353
boost::python::list distributePyNoWeights(const boost::python::list &) const
Assigns a vector to each point to obtain an equivalent sliding vector system.
Definition: SlidingVectorsSystem2d.cc:122
Line2d getZeroMomentLine(void) const
Line of points with zero moment.
Definition: SlidingVectorsSystem2d.cc:308