16 #define __SHAPEWEIGHT 0.1 30 class CAMgraphicsProcess;
55 operator bool()
const {
return !
nodes.empty(); }
69 int addEdge(
int ifrom,
int ito);
80 void setName(
const std::string &name);
87 void draw(
bool drawPoints=
false)
const;
89 void drawPS(CAMgraphicsProcess& gp,
dword mode=0)
const;
112 bool readFile(
const char* filename,
bool fullread=
true);
114 bool writeFile(
const char* filename)
const;
138 void scale(
float factor,
bool movepoints=
false);
float getLiveliness() const
std::vector< Edge > EdgeArray
bool writeFile(const char *filename) const
PropVec & convertPropFromMM(PropVec &prop) const
float getQualityOfFit() const
PropVec & convertPropToMM(PropVec &prop) const
void attachDataset(dataset_cptr dataset)
void rotate(float angle, const Point &c)
Implements a Node used by Model and Edge.
void calculateForces(float dt)
float getEdgeSensorFit(dword *npts=NULL) const
get average fit of sensors along edges
int getHLNode() const
Returns ID of highlighted node. Value is -1 if none is selected.
void mergeSensorCollection(SensorCollection *sensors)
friend ParseFile & operator>>(ParseFile &is, Model &g)
PropVec getPropertiesMM() const
return property vector using millimeter scale
const PropVec & getProperties() const
void pushRotate(const Point &c, float angle)
void setWinner(bool iswin=true, float ts=0.)
bool readSensor(ParseFile &is)
read sensor from stream
void adaptDataScale(dword ppmm=0)
std::vector< Node > NodeArray
void setHLNode(int hlnode)
void adaptProportion(float ratio)
overall rest lengths sum is adapted to overall edge lengths by ratio
void setShapeWeight(float weight)
const Node & getDirNode() const
void calculateDerivatives(std::vector< NodeDerivative > &deriv)
dword createEdgeSensors(float dist=0.1)
auto-create appropriate edge sensors (dist*stdRadius is distance)
void rebuildIndexTables()
rebuild cross indexing between nodes and edges
void drawPS(CAMgraphicsProcess &gp, dword mode=0) const
Draw to postscrip output.
float getDirection() const
Implements an Edge with spring functionality.
dword createByAdjMat(const DMatrixf &adjm)
create edges mentioned in adjacency matrix
ParticleParam phys
physical parameter set
std::shared_ptr< const Dataset > dataset_cptr
Model(dataset_cptr _dataset=NULL, SensorCollection *sensors=NULL)
Default constructor.
void scale(float factor, bool movepoints=false)
multiply all rest lengths by factor
dword connectNodes()
Connect selected nodes.
int nearestNode(const Point &pos, float &dist=*(float *)(NULL)) const
void adaptRestLength(float ratio)
adapt restlengths towards current lengths by ratio
void attachSensorColl(SensorCollection *sc)
set reference to and from sensor collection for correct updates
SensorCollection * m_Sensors
dword getInstCount() const
const Point getCenter() const
float getSensorFit(dword *npts=NULL) const
get average sensor value
float getFullLength() const
Returns overall sum of edge lengths.
void reattachSensors()
get sensors from sensor collection
void attract(const Point &c, float factor)
dword mergeModel(Model &mergemod)
float getStdRadius() const
EdgeArray edges
indexed list of edges
dword removeEdges()
Remove edges between selected nodes.
int addNode(const Node &node)
void setLooser(bool isloose=true, float ts=0.)
Point2D & convertPointToMM(Point2D &pt) const
const Node & getNode(int index) const
dword & unsetFlags(dword flags)
float getNodeAngle(const Node &n) const
NodeArray nodes
indexed list of nodes
void setName(const std::string &name)
void reset()
reset all model information (including geometry)
float getLengthRatio() const
relation of overall edge length by overall rest length sum
float addImageForces(float dt)
friend std::ostream & operator<<(std::ostream &is, const Model &g)
dword getSelectedNodesN(dword state=Node::ST_SELECT) const
get number of selected nodes
Edge & getEdge(int index)
void adaptRestLengthSel(float ratio, const DMatrixf &selm)
adapt restlengths of selected edges towards current lengths by ratio
void adaptProperties(const PropVec &prop)
SensorCollection * getSensorCollection()
dword & switchFlags(dword flags)
void adaptPropertiesMM(PropVec prop)
adapt to a property vector using millimeter scale
void translate(const Point &t)
void draw(bool drawPoints=false) const
Draw using OpenGL.
bool readNode(ParseFile &is)
read node from stream
bool readParameter(ParseFile &is)
read model parameters
const Edge & getEdge(int index) const
int addEdge(const Edge &edge)
void removeNode(int nid)
Removes a node and its adjacent edges.
DMatrixf adjMat() const
compute undirected adjacency matrix
void setOldState(bool isoldstate=true, float ts=0.)
float distance(const Model &rhs, enum Model::DistType kind=DIST_POINTS) const
void updateParticles(float dt, int method=0)
bool hasFlags(dword flags) const
const std::string & getFilename() const
float getLengthVariation() const
mean squared difference from restlength normalized by restlength sum
Model & operator=(const Model &rhs)
void invalidatePC(dword pcflags=PC_ALL)
float getMaxRadius() const
bool readFile(const char *filename, bool fullread=true)
void setInstCount(dword ic)
dword & setFlags(dword flags)
void clear()
remove and destroy all geometry information (nodes and edges)
DMatrixf selMaskMat() const
compute mask matrix of selected nodes
void scaleSel(float factor, const DMatrixf &selm)
multiply all rest lengths of selected edges by factor
bool readEdge(ParseFile &is)
read edge from stream
const std::string & getName() const
Point2D & convertPointFromMM(Point2D &pt) const
float getDeformation() const
normalized length variation to compensate for different sizes
dword m_InstCount
number of merged instances
dword getDataScale() const
dword removeByAdjMat(DMatrixf &adjm)
remove edged not mentioned in (non-directional) adjacency matrix
float m_TimeStamp
time stamps (see. TTimeStamp)
Node & getNode(int index)
void push(const Point &t)