forked from cleroy8/PositionBasedDynamics
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcollider.h
More file actions
51 lines (40 loc) · 1.22 KB
/
Copy pathcollider.h
File metadata and controls
51 lines (40 loc) · 1.22 KB
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
#ifndef COLLIDER_H
#define COLLIDER_H
#include "StaticConstraint.h"
#include "particle.h"
#include <optional>
// Abstract class that defines collider objects
class Collider
{
public:
/**
* @brief Collider
* default role is 0 (neutral collider)
* default color is black
*/
Collider();
/**
* @brief Collider
* color is defined based on the role
* @param role_ whether the collider can destroy or heal the particles
*/
Collider(const int role_);
/// Destructor for Collider class.
virtual ~Collider() {}
/**
* @brief check if collider is in contact with the collider.
* If so, returns the corresponding StaticConstraint.
* @param collider Particle to check
* @return StaticConstraint corresponding to the collider and the particle if in contact.
*/
virtual const std::optional<StaticConstraint> checkContact(Particle& collider) =0;
virtual const Vec2 getPoint() const = 0;
const int getRole() const;
const QColor getColor() const;
protected:
/// Role of the collider
/// 0 if the collider does nothing, 1 if it can destroy the particles, 2 if it can heal them
const int role;
QColor color;
};
#endif // COLLIDER_H