-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathParticle.h
69 lines (60 loc) · 1.91 KB
/
Particle.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef PARTICLE_H
#define PARTICLE_H
#include <iostream>
#include <cmath>
using namespace std;
#define EPSILON 0.01
class Particle {
private: float x,y;
public: // Do NOT make any modifications below!
/*********************************************************************
* Constructor
*
* The first @param is the x-coordinate of the point
* The second @param is the y-coordinate of the point
*/
Particle(float, float);
/*********************************************************************
* Copy constructor
*
*/
Particle(const Particle&);
/*********************************************************************
* X()
*
* @return x-coordinate of the point
*/
float X() const;
/*********************************************************************
* Y()
*
* @return y-coordinate of the point
*/
float Y() const;
/*********************************************************************
* FindDistance
*
* Computes the Eucledean distance of this 2D Particle object to another
particle given in the @param
* @return the distance
*/
float FindDistance(const Particle&) const;
/*********************************************************************
* Operator Overload
*
* Checks whether the x and y coordinates of this 2D Particle object is
equal to those of the particle given in the @param
* @return true if they are equal, @return false if not
* Use EPSILON given in the macros to compare the float values.
*/
bool operator== (const Particle&) const;
/*********************************************************************
* Stream Operator
* Prints particle coordinates
* The format is: (p.x,p.y) where p is the particle in the @param
* Do NOT add new line character "\n" to the end of the stream.
*/
friend ostream& operator<<(ostream&, const Particle&);
/********************************************************************/
};
#endif