Structural deformable models
Macros | Typedefs | Enumerations | Functions
PropVec.h File Reference
#include "VVector.h"
#include "Point.h"
Include dependency graph for PropVec.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define _PROPTF_NORMALIZE_SCALE_
 

Typedefs

typedef VVector< float, 4 > PropVec
 
typedef PropVec PropTF
 

Enumerations

enum  PropVecOffsets {
  PVEC_POS =0, PVEC_POSX =0, PVEC_POSY, PVEC_SCALE,
  PVEC_DIR
}
 

Functions

Point2D getPropPos (const PropVec &prop)
 
PropVecsetPropPos (PropVec &prop, const Point2D &p)
 
float getPropScale (const PropVec &prop)
 
PropVecsetPropScale (PropVec &prop, float pscale)
 
float getPropDir (const PropVec &prop)
 
PropVecsetPropDir (PropVec &prop, float dir)
 
Point2D getPropSDir (const PropVec &prop)
 
PropVecsetPropSDir (PropVec &prop, const Point2D &sdir)
 
PropTF getPropTF (const PropVec &from, const PropVec &to)
 
PropVecfwdPropTF (PropVec &from, const PropTF &tf)
 
PropVecinvPropTF (PropVec &to, const PropTF &tf)
 
PropTF getIdentityPropTF ()
 
PropVecscalePropVec (PropVec &prop, float scale)
 

Macro Definition Documentation

#define _PROPTF_NORMALIZE_SCALE_

Definition at line 6 of file PropVec.h.

Typedef Documentation

typedef PropVec PropTF

Definition at line 9 of file PropVec.h.

typedef VVector<float,4> PropVec

Definition at line 8 of file PropVec.h.

Enumeration Type Documentation

Enumerator
PVEC_POS 
PVEC_POSX 
PVEC_POSY 
PVEC_SCALE 
PVEC_DIR 

Definition at line 11 of file PropVec.h.

Function Documentation

PropVec& fwdPropTF ( PropVec from,
const PropTF tf 
)
inline

Definition at line 51 of file PropVec.h.

References getPropDir(), getPropPos(), getPropScale(), setPropDir(), setPropPos(), and setPropScale().

Referenced by SubStructure::generateEMDist(), SubStructure::getLBUB(), and EMDXformer::getPropVec().

52 {
53 #ifdef _PROPTF_NORMALIZE_SCALE_
54  setPropPos(from, getPropPos(from)+(getPropPos(tf).rotate(getPropDir(from))
55  *getPropScale(from)));
56 #else
57  setPropPos(from, getPropPos(from)+getPropPos(tf).rotate(getPropDir(from)));
58 #endif
59  setPropDir(from, getPropDir(from)+getPropDir(tf));
60  setPropScale(from, getPropScale(from)*getPropScale(tf));
61 // from[0] += tf[0]; from[1] += tf[1];
62 // from[2] *= tf[2]; from[3] += tf[3];
63  return from;
64 }
Point2D getPropPos(const PropVec &prop)
Definition: PropVec.h:13
float getPropScale(const PropVec &prop)
Definition: PropVec.h:19
PropVec & setPropDir(PropVec &prop, float dir)
Definition: PropVec.h:28
PropVec & setPropPos(PropVec &prop, const Point2D &p)
Definition: PropVec.h:16
float getPropDir(const PropVec &prop)
Definition: PropVec.h:25
PropVec & setPropScale(PropVec &prop, float pscale)
Definition: PropVec.h:22
PropTF getIdentityPropTF ( )
inline

Definition at line 81 of file PropVec.h.

References setPropScale().

Referenced by SubStructure::generateEMDist(), ExpectationMap::getPropVec(), and MStructure::showStats().

81  {
82  PropVec ie(0.f); setPropScale(ie, 1); return ie;
83 }
PropVec & setPropScale(PropVec &prop, float pscale)
Definition: PropVec.h:22
float getPropDir ( const PropVec prop)
inline
Point2D getPropPos ( const PropVec prop)
inline
float getPropScale ( const PropVec prop)
inline
Point2D getPropSDir ( const PropVec prop)
inline

Definition at line 31 of file PropVec.h.

References getPropDir(), getPropScale(), and Point2D::rotate().

Referenced by Model::distance().

32 { return Point2D(getPropScale(prop),0).rotate(getPropDir(prop)); }
float getPropScale(const PropVec &prop)
Definition: PropVec.h:19
float getPropDir(const PropVec &prop)
Definition: PropVec.h:25
const Point2D rotate(float angle) const
Definition: Point.h:211
Definition: Point.h:16
PropTF getPropTF ( const PropVec from,
const PropVec to 
)
inline

Definition at line 37 of file PropVec.h.

References getPropDir(), getPropPos(), getPropScale(), setPropDir(), setPropPos(), and setPropScale().

Referenced by MStructure::buildAllStats(), EMDXformer::ratePropVec(), and MStructure::showStats().

38 {
39  PropTF tf;
40 #ifdef _PROPTF_NORMALIZE_SCALE_
41  setPropPos(tf,(getPropPos(to)-getPropPos(from)).rotate(-getPropDir(from))
42  /getPropScale(from));
43 #else
44  setPropPos(tf,(getPropPos(to)-getPropPos(from)).rotate(-getPropDir(from)));
45 #endif
47  setPropDir(tf,getPropDir(to)-getPropDir(from));
48  return tf;
49 }
Point2D getPropPos(const PropVec &prop)
Definition: PropVec.h:13
float getPropScale(const PropVec &prop)
Definition: PropVec.h:19
PropVec & setPropDir(PropVec &prop, float dir)
Definition: PropVec.h:28
PropVec & setPropPos(PropVec &prop, const Point2D &p)
Definition: PropVec.h:16
float getPropDir(const PropVec &prop)
Definition: PropVec.h:25
PropVec & setPropScale(PropVec &prop, float pscale)
Definition: PropVec.h:22
PropVec& invPropTF ( PropVec to,
const PropTF tf 
)
inline

Definition at line 66 of file PropVec.h.

References getPropDir(), getPropPos(), getPropScale(), setPropDir(), setPropPos(), and setPropScale().

Referenced by SubStructure::generateEMDist().

67 {
69  setPropDir(to, getPropDir(to)-getPropDir(tf));
70 #ifdef _PROPTF_NORMALIZE_SCALE_
71  setPropPos(to, getPropPos(to)-(getPropPos(tf).rotate(getPropDir(to))
72  *getPropScale(to)));
73 #else
74  setPropPos(to, getPropPos(to)-getPropPos(tf).rotate(getPropDir(to)));
75 #endif
76 // to[0] -= tf[0]; to[1] -= tf[1];
77 // to[2] /= tf[2]; to[3] -= tf[3];
78  return to;
79 }
Point2D getPropPos(const PropVec &prop)
Definition: PropVec.h:13
float getPropScale(const PropVec &prop)
Definition: PropVec.h:19
PropVec & setPropDir(PropVec &prop, float dir)
Definition: PropVec.h:28
PropVec & setPropPos(PropVec &prop, const Point2D &p)
Definition: PropVec.h:16
float getPropDir(const PropVec &prop)
Definition: PropVec.h:25
PropVec & setPropScale(PropVec &prop, float pscale)
Definition: PropVec.h:22
PropVec& scalePropVec ( PropVec prop,
float  scale 
)
inline

Definition at line 85 of file PropVec.h.

References getPropPos(), getPropScale(), setPropPos(), and setPropScale().

Referenced by Dataset::getPropVecMM().

85  {
86  setPropPos(prop, getPropPos(prop)*scale);
87  setPropScale(prop, getPropScale(prop)*scale);
88  return prop;
89 }
Point2D getPropPos(const PropVec &prop)
Definition: PropVec.h:13
float getPropScale(const PropVec &prop)
Definition: PropVec.h:19
PropVec & setPropPos(PropVec &prop, const Point2D &p)
Definition: PropVec.h:16
PropVec & setPropScale(PropVec &prop, float pscale)
Definition: PropVec.h:22
PropVec& setPropDir ( PropVec prop,
float  dir 
)
inline
PropVec& setPropPos ( PropVec prop,
const Point2D p 
)
inline
PropVec& setPropScale ( PropVec prop,
float  pscale 
)
inline
PropVec& setPropSDir ( PropVec prop,
const Point2D sdir 
)
inline

Definition at line 34 of file PropVec.h.

References Point2D::angle(), Point2D::norm(), setPropDir(), and setPropScale().

35 { return setPropScale(setPropDir(prop, sdir.angle()), sdir.norm()); }
float norm() const
returns 2-norm aka length or absolute
Definition: Point.h:170
PropVec & setPropDir(PropVec &prop, float dir)
Definition: PropVec.h:28
float angle(const Point2D &rhs=Point2D(1, 0)) const
Definition: Point.h:93
PropVec & setPropScale(PropVec &prop, float pscale)
Definition: PropVec.h:22