Changeset 68fbb5


Ignore:
Timestamp:
Jun 10, 2008, 11:15:52 AM (17 years ago)
Author:
Frederik Heber <heber@…>
Children:
b9a995
Parents:
c4a0a2
Message:

Revert "some new functions: vector::vector(), vector::ProjectOntoPlane(), vector::One(), vector::Init()"

This reverts commit d11f22c4a97b28e748e8ef9cb37f315ad278ac27.

Files:
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/vector.cpp

    rc4a0a2 r68fbb5  
    1313 */
    1414vector::vector() { x[0] = x[1] = x[2] = 0.; };
    15 
    16 /** Constructor of class vector.
    17  */
    18 vector::vector(double x1, double x2, double x3) { x[0] = x1; x[1] = x2; x[2] = x3; };
    1915
    2016/** Desctructor of class vector.
     
    115111};
    116112
    117 /** projects this vector onto plane defined by \a *y.
    118  * \param *y array to normal vector of plane
    119  * \return \f$\langle x, y \rangle\f$
    120  */
    121 void vector::ProjectOntoPlane(const vector *y)
    122 {
    123   vector tmp;
    124   tmp.CopyVector(y);
    125   tmp.Scale(Projection(y));
    126   this->SubtractVector(&tmp);
    127 };
    128 
    129113/** Calculates the projection of a vector onto another \a *y.
    130114 * \param *y array to second vector
     
    133117double vector::Projection(const vector *y) const
    134118{
    135   return (ScalarProduct(y));
     119  return (ScalarProduct(y)/Norm()/y->Norm());
    136120};
    137121
     
    166150};
    167151
    168 /** Zeros all components of this vector.
    169  */
    170 void vector::One(double one)
    171 {
    172   for (int i=NDIM;i--;)
    173     this->x[i] = one;
    174 };
    175 
    176 /** Initialises all components of this vector.
    177  */
    178 void vector::Init(double x1, double x2, double x3)
    179 {
    180   x[0] = x1;
    181   x[1] = x2;
    182   x[2] = x3;
    183 };
    184 
    185152/** Calculates the angle between this and another vector.
    186153 * \param *y array to second vector
    187  * \return \f$\acos\bigl(frac{\langle x, y \rangle}{|x||y|}\bigr)\f$
     154 * \return \f$\frac{\langle x, y \rangle}{|x||y|}\f$
    188155 */
    189156double vector::Angle(vector *y) const
    190157{
    191   return acos(this->ScalarProduct(y)/Norm()/y->Norm());
     158  return (this->ScalarProduct(y)/(this->Norm()*y->Norm()));
    192159};
    193160
  • molecuilder/src/vector.hpp

    rc4a0a2 r68fbb5  
    1010
    1111  vector();
    12   vector(double x1, double x2, double x3);
    1312  ~vector();
    1413
     
    2423  void CopyVector(const vector *y);
    2524  void RotateVector(const vector *y, const double alpha);
    26   void Zero();
    27   void One(double one = 1.);
    28   void Init(double x1, double x2, double x3);
     25  void Zero();
    2926  void Normalize();
    3027  void Translate(const vector *x);
    3128  void Mirror(const vector *x);
    32   void ProjectOntoPlane(const vector *y);
    3329  void Scale(double **factor);
    3430  void Scale(double *factor);
Note: See TracChangeset for help on using the changeset viewer.