Skip to content

shapeworks::Constraint

More...

#include <Constraint.h>

Inherited by shapeworks::FreeFormConstraint, shapeworks::PlaneConstraint

Public Functions

Name
bool isViolated(const vnl_vector< double > & pt) const
Returns if pt in vnl_vector format is violated by the constraint.
virtual bool isViolated(const Eigen::Vector3d & pt) const =0
Returns if pt in Eigen format is violated by the constraint.
virtual void print() const =0
Prints the constraint neatly.
void setMus(std::vector< double > inmu)
Initializes mu.
std::vector< double > getMus()
Gets mu.
virtual Eigen::Vector3d constraintGradient(const Eigen::Vector3d & pt) const =0
Returns the gradient of the constraint.
virtual double constraintEval(const Eigen::Vector3d & pt) const =0
Returns the evaluation on the constraint, i.e. the signed distance to the constraint boundary.
void updateMu(const Eigen::Vector3d & pt, double C, size_t index)
Updates the value of mu according to the augmented lagrangian update.
Eigen::Vector3d lagragianGradient(const Eigen::Vector3d & pt, double C, size_t index) const
Computes the lagrangian gradient based on lagrangian inequality equations. NOTE: Not actually lagrangian. We are using quadratic penalty and not lagrangian because it works better.

Protected Functions

Name
int sgn(double val)
Returns the sign of the double.

Protected Attributes

Name
std::vector< double > mus_
Mu is the lagrangian momentum term.

Detailed Description

class shapeworks::Constraint;

This class is the general constraint class. Each instance represents a single constraint, either cutting-plane, sphere or free-form. They all inherit from this class. This class containts all the infrastructure to handle gradients and evaluations, which is shared among all constraint types. NOTE: Not actually using the augmented lagrangian. We are using quadratic penalty and not lagrangian because it works better.

Public Functions Documentation

function isViolated

inline bool isViolated(
    const vnl_vector< double > & pt
) const

Returns if pt in vnl_vector format is violated by the constraint.

function isViolated

virtual bool isViolated(
    const Eigen::Vector3d & pt
) const =0

Returns if pt in Eigen format is violated by the constraint.

Reimplemented by: shapeworks::FreeFormConstraint::isViolated, shapeworks::PlaneConstraint::isViolated

function print

virtual void print() const =0

Prints the constraint neatly.

Reimplemented by: shapeworks::FreeFormConstraint::print, shapeworks::PlaneConstraint::print

function setMus

inline void setMus(
    std::vector< double > inmu
)

Initializes mu.

function getMus

inline std::vector< double > getMus()

Gets mu.

function constraintGradient

virtual Eigen::Vector3d constraintGradient(
    const Eigen::Vector3d & pt
) const =0

Returns the gradient of the constraint.

Reimplemented by: shapeworks::FreeFormConstraint::constraintGradient, shapeworks::PlaneConstraint::constraintGradient

function constraintEval

virtual double constraintEval(
    const Eigen::Vector3d & pt
) const =0

Returns the evaluation on the constraint, i.e. the signed distance to the constraint boundary.

Reimplemented by: shapeworks::FreeFormConstraint::constraintEval, shapeworks::PlaneConstraint::constraintEval

function updateMu

void updateMu(
    const Eigen::Vector3d & pt,
    double C,
    size_t index
)

Updates the value of mu according to the augmented lagrangian update.

function lagragianGradient

Eigen::Vector3d lagragianGradient(
    const Eigen::Vector3d & pt,
    double C,
    size_t index
) const

Computes the lagrangian gradient based on lagrangian inequality equations. NOTE: Not actually lagrangian. We are using quadratic penalty and not lagrangian because it works better.

Protected Functions Documentation

function sgn

inline int sgn(
    double val
)

Returns the sign of the double.

Protected Attributes Documentation

variable mus_

std::vector< double > mus_;

Mu is the lagrangian momentum term.


Updated on 2024-03-17 at 12:58:44 -0600