29 Edge(
int _from,
int _to, std::vector<Node> &_nodes,
42 Edge(
int _from,
int _to, std::vector<Node> &_nodes,
43 float restlength,
float spring_k=1,
int _index=-1)
61 if(&rhs ==
this)
return *
this;
83 if(
from==-1 ||
to==-1)
return 0;
109 os <<
"e " << p.
from+1 <<
" " << p.
to+1;
150 if(!sensor)
return 0;
153 Point xinc(to); xinc -=
from; xinc /= float(ntimes+1);
155 for(dword i=0; i<ntimes; i++, x+=xinc) {
156 sum += sensor->getWeightedValue((
int)x.x, (
int)x.y);
int index
index in the model (Model.edges)
static ParticleParam global
const Node & toNode() const
Implements a Node used by Model and Edge.
const Node & fromNode() const
float adaptRestLength(float ratio)
Edge(int _from, int _to, std::vector< Node > &_nodes, float restlength, float spring_k=1, int _index=-1)
float dampingconstant
damping constant
void setNodesList(std::vector< Node > &nodes)
Implements an Edge with spring functionality.
ParticleParam phys
physical parameter set
int edgesensor
0-none, >0-use from sensor n times, <0 use to sensor
dword getSensorValue(float &sum, dword &nsamples) const
float springconstant
spring constant
friend std::ostream & operator<<(std::ostream &os, const Edge &p)
DMatrix< T > sum(const DMatrix< T > &mat)
float lengthRatio() const
Edge & operator=(const Edge &rhs)
std::vector< Node > * nodes
std::shared_ptr< const Sensor > sensor_cptr
float norm2() const
returns squared 2-norm
Edge(int _from, int _to, std::vector< Node > &_nodes, const ParticleParam *phys=&ParticleParam::global, int _index=-1)
DMatrix< T > & sqrt(DMatrix< T > &mat)