Ignore:
Timestamp:
01/15/10 14:50:32 (15 years ago)
Author:
Mathieu Morlighem
Message:

removed useless code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/Bamgx/R2.h

    r2861 r2862  
    22
    33namespace bamg {
    4 template <class R,class RR> class P2xP2;
     4        template <class R,class RR> class P2xP2;
    55
    6 template <class R,class RR>
    7 class P2 {
     6        template <class R,class RR>
     7          class P2 {
    88
    9 public: 
    10   R x,y;
    11   P2 () :x(0),y(0) {};
    12   P2 (R a,R b)  :x(a),y(b)  {}
    13   P2 (P2 A,P2 B) : x(B.x-A.x),y(B.y-A.y) {}
    14   P2<R,RR>   operator+(const P2<R,RR> & cc) const {return P2<R,RR>(x+cc.x,y+cc.y);}
    15   P2<R,RR>   operator-(const P2<R,RR> & cc) const {return P2<R,RR>(x-cc.x,y-cc.y);}
    16   P2<R,RR>   operator-()  const{return P2<R,RR>(-x,-y);}
    17 //  RR   operator*(const P2<R,RR> & cc) const {return  (RR) x* (RR) cc.x+(RR) y* (RR) cc.y;} // produit scalaire
    18   RR   operator,(const P2<R,RR> & cc) const {return  (RR) x* (RR) cc.x+(RR) y* (RR) cc.y;} // produit scalaire
    19   P2<R,RR>   operator*(R  cc) const {return P2<R,RR>(x*cc,y*cc);}
    20  // P2<R,RR>   operator*(RR  cc) const {return P2<R,RR>((R)(x*cc),(R)(y*cc));}
    21   P2<R,RR>   operator/(R  cc) const {return P2<R,RR>(x/cc,y/cc);}
    22   P2<R,RR>  operator+=(const  P2<R,RR> & cc) {x += cc.x;y += cc.y;return *this;}
    23   P2<R,RR>  operator/=(const  R r) {x /= r;y /= r;return *this;}
    24   P2<R,RR>  operator*=(const  R r) {x *= r;y *= r;return *this;}
    25   P2<R,RR>  operator-=(const  P2<R,RR> & cc) {x -= cc.x;y -= cc.y;return *this;}
    26 //  P2<R,RR> Orthogonal(const   P2<R,RR> r) {return P2<R,RR>(-r.y,r.x);}
    27  };
     9                  public: 
     10                          R x,y;
     11                          P2 () :x(0),y(0) {};
     12                          P2 (R a,R b)  :x(a),y(b)  {}
     13                          P2 (P2 A,P2 B) : x(B.x-A.x),y(B.y-A.y) {}
     14                          P2<R,RR>   operator+(const P2<R,RR> & cc) const {return P2<R,RR>(x+cc.x,y+cc.y);}
     15                          P2<R,RR>   operator-(const P2<R,RR> & cc) const {return P2<R,RR>(x-cc.x,y-cc.y);}
     16                          P2<R,RR>   operator-()  const{return P2<R,RR>(-x,-y);}
     17                          RR   operator,(const P2<R,RR> & cc) const {return  (RR) x* (RR) cc.x+(RR) y* (RR) cc.y;} // produit scalaire
     18                          P2<R,RR>   operator*(R  cc) const {return P2<R,RR>(x*cc,y*cc);}
     19                          P2<R,RR>   operator/(R  cc) const {return P2<R,RR>(x/cc,y/cc);}
     20                          P2<R,RR>  operator+=(const  P2<R,RR> & cc) {x += cc.x;y += cc.y;return *this;}
     21                          P2<R,RR>  operator/=(const  R r) {x /= r;y /= r;return *this;}
     22                          P2<R,RR>  operator*=(const  R r) {x *= r;y *= r;return *this;}
     23                          P2<R,RR>  operator-=(const  P2<R,RR> & cc) {x -= cc.x;y -= cc.y;return *this;}
     24          };
    2825
    29 template <class R,class RR>
    30 class P2xP2 { // x ligne 1 y ligne2
     26        template <class R,class RR>
     27          class P2xP2 { // x ligne 1 y ligne2
    3128
    32   friend std::ostream& operator <<(std::ostream& f, const P2xP2<R,RR> & c)
    33     { f << '[' << c.x << ',' << c.y << ']' <<std::flush ; return f; }
    34      
    35   friend P2<R,RR> operator*(P2<R,RR> c,P2xP2<R,RR> cc)
    36     {return P2<R,RR>(c.x*cc.x.x + c.y*cc.y.x, c.x*cc.x.y + c.y*cc.y.y);}
     29                  friend std::ostream& operator <<(std::ostream& f, const P2xP2<R,RR> & c)
     30                        { f << '[' << c.x << ',' << c.y << ']' <<std::flush ; return f; }
     31
     32                  friend P2<R,RR> operator*(P2<R,RR> c,P2xP2<R,RR> cc)
     33                        {return P2<R,RR>(c.x*cc.x.x + c.y*cc.y.x, c.x*cc.x.y + c.y*cc.y.y);}
    3734
    3835
    39  public:
    40   P2<R,RR> x,y;
    41   P2xP2 (): x(),y()  {}
    42   P2xP2 (P2<R,RR> a,P2<R,RR> b): x(a),y(b) {}
    43   P2xP2 (P2<R,RR> a,P2<R,RR> b,P2<R,RR> c ): x(b-a),y(c-a) {}
    44   P2xP2 (R xx,R xy,R yx,R yy) :x(xx,xy),y(yx,yy) {}
    45   P2<R,RR> operator*(const P2<R,RR> c) const {return P2<R,RR>(x.x*c.x + x.y*c.y, y.x*c.x + y.y*c.y);}
    46   P2xP2<R,RR>  operator*(P2xP2<R,RR> c) const
    47     { return  P2xP2<R,RR>(x.x*c.x.x + x.y*c.y.x,
    48                           x.x*c.x.y + x.y*c.y.y,
    49                           y.x*c.x.x + y.y*c.y.x,
    50                           y.x*c.x.y + y.y*c.y.y);}
    51   RR det() const {return (RR) x.x* (RR) y.y - (RR) x.y * (RR) y.x;}
    52   P2xP2<R,RR> inv()  const
    53     { RR d = (*this).det();
    54        return P2xP2<R,RR>((R)( y.y /d) ,(R)(-x.y/d),(R)( -y.x/d) ,(R)( x.x/d) );
    55     };
    56    P2xP2<R,RR> t() {return P2xP2<R,RR>(x.x,y.x,x.y,y.y);} //transposer
    57    P2<R,RR>tx() {return P2<R,RR>(x.x,y.x);}
    58    P2<R,RR>ty() {return P2<R,RR>(x.y,y.y);}
     36                  public:
     37                  P2<R,RR> x,y;
     38                  P2xP2 (): x(),y()  {}
     39                  P2xP2 (P2<R,RR> a,P2<R,RR> b): x(a),y(b) {}
     40                  P2xP2 (P2<R,RR> a,P2<R,RR> b,P2<R,RR> c ): x(b-a),y(c-a) {}
     41                  P2xP2 (R xx,R xy,R yx,R yy) :x(xx,xy),y(yx,yy) {}
     42                  P2<R,RR> operator*(const P2<R,RR> c) const {return P2<R,RR>(x.x*c.x + x.y*c.y, y.x*c.x + y.y*c.y);}
     43                  P2xP2<R,RR>  operator*(P2xP2<R,RR> c) const
     44                        { return  P2xP2<R,RR>(x.x*c.x.x + x.y*c.y.x,
     45                                                x.x*c.x.y + x.y*c.y.y,
     46                                                y.x*c.x.x + y.y*c.y.x,
     47                                                y.x*c.x.y + y.y*c.y.y);}
     48                  RR det() const {return (RR) x.x* (RR) y.y - (RR) x.y * (RR) y.x;}
     49                  P2xP2<R,RR> inv()  const
     50                        { RR d = (*this).det();
     51                          return P2xP2<R,RR>((R)( y.y /d) ,(R)(-x.y/d),(R)( -y.x/d) ,(R)( x.x/d) );
     52                        };
     53                  P2xP2<R,RR> t() {return P2xP2<R,RR>(x.x,y.x,x.y,y.y);} //transposer
     54                  P2<R,RR>tx() {return P2<R,RR>(x.x,y.x);}
     55                  P2<R,RR>ty() {return P2<R,RR>(x.y,y.y);}
    5956
    60 }; 
     57          }; 
    6158
    62 template  <class R,class RR> 
    63 inline RR Det(const P2<R,RR> x,const P2<R,RR> y) {
    64   return (RR) x.x * (RR) y.y - (RR) x.y * (RR) y.x ;}
     59        template  <class R,class RR> 
     60          inline RR Det(const P2<R,RR> x,const P2<R,RR> y) {
     61                  return (RR) x.x * (RR) y.y - (RR) x.y * (RR) y.x ;}
    6562
    66 template  <class R,class RR> 
    67 inline RR Area2 (const P2<R,RR> a,const P2<R,RR> b,const P2<R,RR> c) {
    68   return Det(b-a,c-a) ;}
     63        template  <class R,class RR> 
     64          inline RR Area2 (const P2<R,RR> a,const P2<R,RR> b,const P2<R,RR> c) {
     65                  return Det(b-a,c-a) ;}
    6966
    70 template  <class R,class RR> 
    71 inline R Norme1 (const P2<R,RR> x) {
    72   return (Abs(x.x)+Abs(x.y)) ;}
     67        template  <class R,class RR> 
     68          inline R Norme1 (const P2<R,RR> x) {
     69                  return (Abs(x.x)+Abs(x.y)) ;}
    7370
    74 template  <class R,class RR> 
    75 inline R NormeInfini (const P2<R,RR> x) {
    76   return Max(Abs(x.x),Abs(x.y)) ;}
     71        template  <class R,class RR> 
     72          inline R NormeInfini (const P2<R,RR> x) {
     73                  return Max(Abs(x.x),Abs(x.y)) ;}
    7774
    78 template  <class R,class RR> 
    79 inline RR Norme2_2 (const P2<R,RR> x) {
    80   return (RR)x.x*(RR)x.x + (RR)x.y*(RR)x.y ;}
     75        template  <class R,class RR> 
     76          inline RR Norme2_2 (const P2<R,RR> x) {
     77                  return (RR)x.x*(RR)x.x + (RR)x.y*(RR)x.y ;}
    8178
    82 template  <class R,class RR> 
    83 inline RR Norme2 (const P2<R,RR> x) {
    84   return sqrt((RR)x.x*(RR)x.x + (RR)x.y*(RR)x.y) ;}
     79        template  <class R,class RR> 
     80          inline RR Norme2 (const P2<R,RR> x) {
     81                  return sqrt((RR)x.x*(RR)x.x + (RR)x.y*(RR)x.y) ;}
    8582
    86 template  <class R,class RR> 
    87 inline P2<R,RR> Orthogonal (const P2<R,RR> x) {
    88   return  P2<R,RR>(-x.y,x.x);}
     83        template  <class R,class RR> 
     84          inline P2<R,RR> Orthogonal (const P2<R,RR> x) {
     85                  return  P2<R,RR>(-x.y,x.x);}
    8986
    90 template <class R,class RR>
    91 inline  std::ostream& operator <<(std::ostream& f, const P2<R,RR> & c)
    92   { f << '[' << c.x << ',' << c.y <<']' <<std::flush ; return f; }
     87        template <class R,class RR>
     88          inline  std::ostream& operator <<(std::ostream& f, const P2<R,RR> & c)
     89                { f << '[' << c.x << ',' << c.y <<']' <<std::flush ; return f; }
    9390}
Note: See TracChangeset for help on using the changeset viewer.