Structural deformable models
Node.h
Go to the documentation of this file.
1 /* -*- C++ -*- */
2 #ifndef _NODE_H_
3 #define _NODE_H_
4 
5 #include <iostream>
6 #include <vector>
7 #include "Point.h"
8 #include "PartParam.h"
9 
10 #include "types_fwd.h"
11 
13 class Node : public Point {
14  friend class Model;
15 public:
17 
21  Node(const Node & rhs) { operator=(rhs); }
23  Node(float _x, float _y, const ParticleParam *phys=&ParticleParam::global);
25  virtual ~Node() {};
27  Node& operator=(const Node &rhs);
28  Node& setPos(const Point& p) {
30  return *this;
31  }
33  int getIndex() const { return index; }
35  friend std::ostream& operator<<(std::ostream &os, const Node &n);
36  void attachSensor(sensor_cptr _sensor);
37  void addSensorForce();
38  void enableState(dword nstate) { state |= nstate; }
39  void disableState(dword nstate=0xffffffff) { state &= ~nstate; }
40  void toggleState(dword nstate) { state ^= nstate; }
41  bool hasState(dword nstate=0xffffffff) const { return state & nstate; }
42  void draw() const;
44  std::string sensorID;
45 
46 public:
48  float mass;
49 
50 protected:
52  Point v, f;
56  int index;
57  float oangle;
58  float cangle;
59  float nedges;
60  std::vector<int> edges;
62 };
63 
64 #endif
float cangle
Definition: Node.h:58
static ParticleParam global
Definition: PartParam.h:72
void attachSensor(sensor_cptr _sensor)
Definition: Node.cpp:50
Implements a Node used by Model and Edge.
Definition: Node.h:13
void toggleState(dword nstate)
Definition: Node.h:40
std::vector< int > edges
Definition: Node.h:60
float nedges
Definition: Node.h:59
Point f
Definition: Node.h:52
float mass
Mass.
Definition: Node.h:48
int getIndex() const
Definition: Node.h:33
ParticleParam phys
physical parameter set
Definition: Model.h:257
void disableState(dword nstate=0xffffffff)
Definition: Node.h:39
Node & setPos(const Point &p)
Definition: Node.h:28
Point ef
extern force
Definition: Node.h:54
void draw() const
Definition: Node.cpp:69
Point2D & operator=(const Point2D &rhs)
Definition: Point.h:27
Node(const ParticleParam *phys=&ParticleParam::global)
Default constructor.
Definition: Node.cpp:7
int index
Index in the list (Model.nodes)
Definition: Node.h:56
sensor_cptr sensor
Definition: Node.h:43
void addSensorForce()
Definition: Node.cpp:62
Node(const Node &rhs)
Assignment constructor.
Definition: Node.h:21
Definition: Model.h:33
Point v
Velocity and Force.
Definition: Node.h:52
unsigned long dword
Definition: simpletypes.h:6
bool hasState(dword nstate=0xffffffff) const
Definition: Node.h:41
virtual ~Node()
Destructor.
Definition: Node.h:25
Node & operator=(const Node &rhs)
Assignment operator.
Definition: Node.cpp:21
friend std::ostream & operator<<(std::ostream &os, const Node &n)
output operator
Definition: Node.cpp:38
dword state
Definition: Node.h:61
std::string sensorID
Definition: Node.h:44
std::shared_ptr< const Sensor > sensor_cptr
Definition: types_fwd.h:17
Definition: Point.h:16
NodeState
Definition: Node.h:16
void enableState(dword nstate)
Definition: Node.h:38
float oangle
Definition: Node.h:57