20 #ifndef MIRTK_NegJacobianConstraint_H 21 #define MIRTK_NegJacobianConstraint_H 23 #include "mirtk/JacobianConstraint.h" 65 mirtkPublicAttributeMacro(
double, Epsilon);
73 mirtkPublicAttributeMacro(
double, Gamma);
76 mirtkPublicAttributeMacro(
int, Power);
110 if (det >= _Gamma)
return 0.;
111 double a = pow(_Gamma, _Power);
112 if (det < _Epsilon) {
113 double b = pow(_Epsilon, _Power);
114 double m = _Power * ((pow(_Epsilon, _Power - 1) / a) - (a / pow(_Epsilon, _Power + 1)));
115 double t = a / b + b / a - 2. - m * _Epsilon;
118 double b = pow(det, _Power);
119 return a / b + b / a - 2.;
126 if (det >= _Gamma)
return 0.;
127 if (det < _Epsilon) det = _Epsilon;
128 double a = pow(_Gamma, _Power);
129 return _Power * ((pow(det, _Power - 1) / a) - (a / pow(det, _Power + 1)));
137 #endif // MIRTK_NegJacobianConstraint_H Array< Pair< string, string > > ParameterList
Ordered list of parameter name/value pairs.
NegJacobianConstraint(const char *="", bool=true)
Constructor.
Penalise negative Jacobian determinant.
virtual ParameterList Parameter() const
Get parameter key/value as string map.
virtual ParameterList Parameter() const
Get parameter key/value as string map.
virtual double Penalty(double det) const
Evaluate penalty at control point location given Jacobian determinant value.
virtual bool SetWithPrefix(const char *, const char *)
Set parameter value from string.
virtual bool SetWithoutPrefix(const char *, const char *)
Set parameter value from string.
virtual double DerivativeWrtJacobianDet(double det) const
Evaluate derivative of penalty w.r.t. Jacobian determinant value.
virtual ~NegJacobianConstraint()
Destructor.