Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-02 08:48:23

0001 #ifndef VECTOR_2D_H
0002 #define VECTOR_2D_H
0003 
0004 /**
0005  * @file Vector2D.h
0006  * @author Bryan BERTHOU (SPhN / CEA Saclay)
0007  * @date 26 November 2014
0008  * @version 1.0
0009  */
0010 
0011 //TODO mathematique function add, sub, ...
0012 //TODO verifier les operations arithmetic
0013 namespace NumA {
0014 
0015 /**
0016  * @class Vector2D
0017  *
0018  * Object representing a two-dimensional vector.
0019  */
0020 class Vector2D {
0021 public:
0022     /**
0023      * Default constructor.
0024      */
0025     Vector2D();
0026     /**
0027      * Constructor.
0028      * @param x x-coordinate.
0029      * @param y y-coordinate.
0030      */
0031     Vector2D(double x, double y);
0032     /**
0033      * Default destructor.
0034      */
0035     ~Vector2D();
0036 
0037     // ##### GETTERS & SETTERS #####
0038 
0039     /**
0040      *
0041      * @return x-coordinate.
0042      */
0043     double getX() const;
0044     /**
0045      *
0046      * @param x x-coordinate.
0047      */
0048     void setX(double x);
0049     /**
0050      *
0051      * @return y-coordinate.
0052      */
0053     double getY() const;
0054     /**
0055      *
0056      * @param y y-coordinate.
0057      */
0058     void setY(double y);
0059 
0060     /**
0061      * Addition of two vectors.
0062      * @param rhs Vector2D.
0063      * @return Sum of two Vector2D.
0064      */
0065     Vector2D operator+(Vector2D const &rhs);
0066     /**
0067      * Addition with a scalar.
0068      * @param rhs Scalar.
0069      */
0070     void operator+=(Vector2D const &rhs);
0071 
0072     /**
0073      * Subtraction of two vectors
0074      * @param rhs Vector2D.
0075      * @return Subtraction of two Vector2D.
0076      */
0077     Vector2D operator-(Vector2D const &rhs);
0078     /**
0079      * Subtraction with a scalar.
0080      * @param rhs Scalar.
0081      */
0082     void operator-=(Vector2D const &rhs);
0083 
0084 private:
0085     double m_x; ///< x-coordinate.
0086     double m_y; ///< y-coordinate.
0087 };
0088 
0089 } /* namespace NumA */
0090 
0091 #endif /* VECTOR_2D_H */