Skip to content

shapeworks::FreeFormConstraint

More...

#include <FreeFormConstraint.h>

Inherits from shapeworks::Constraint

Public Functions

Name
FreeFormConstraint()
void setMesh(std::shared_ptr< shapeworks::Mesh > mesh)
Sets the mesh that defines the FFC.
std::shared_ptr< shapeworks::Mesh > getMesh()
Returns the mesh that defines the FFC.
bool readyForOptimize() const
Prepares for optimize.
virtual bool isViolated(const Eigen::Vector3d & pt) const override
Returns if pt in Eigen format is violated by the constraint.
virtual void print() const override
Prints the constraint neatly.
virtual Eigen::Vector3d constraintGradient(const Eigen::Vector3d & pt) const override
Returns the gradient of the constraint.
virtual double constraintEval(const Eigen::Vector3d & pt) const override
Returns the evaluation on the constraint, i.e. the signed distance to the constraint boundary.
void setDefinition(vtkSmartPointer< vtkPolyData > polyData)
Set polydata where per-vertex free form constraint definition exists.
vtkSmartPointer< vtkPolyData > getDefinition()
Get polydata where per-vertex free form constraint definition exists.
void applyToPolyData(vtkSmartPointer< vtkPolyData > polyData)
Apply the free form constraint to a polydata.
std::vector< std::vector< Eigen::Vector3d > > & boundaries()
Eigen::Vector3d getQueryPoint()
void setQueryPoint(Eigen::Vector3d queryPoint)
void computeBoundaries()
void setInoutPolyData(vtkSmartPointer< vtkPolyData > polyData)
Set the in/out polydata.
vtkSmartPointer< vtkPolyData > getInoutPolyData()
Get the in/out polydata.
void createInoutPolyData()
Create the in/out poly data from the definition poly data.
bool isSet()
Return if this FFC is set or not.
void setPainted(bool painted)
Set if this FFC has paint on it or not.
void reset()
Reset to initial state.
void computeGradientFields(std::shared_ptr< Mesh > mesh)
Compute gradient fields for a mesh.
void convertLegacyFFC(vtkSmartPointer< vtkPolyData > polyData)
Convert legacy FFC to new format.

Additional inherited members

Public Functions inherited from shapeworks::Constraint

Name
void setMus(std::vector< double > inmu)
Initializes mu.
std::vector< double > getMus()
Gets mu.
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 inherited from shapeworks::Constraint

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

Protected Attributes inherited from shapeworks::Constraint

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

Detailed Description

cpp class shapeworks::FreeFormConstraint;

Encapsulate functionality related to free-form constraints (FFC). Inherits from Constraint. See [Constraint.h] for more information

Public Functions Documentation

function FreeFormConstraint

cpp inline FreeFormConstraint()

function setMesh

cpp inline void setMesh( std::shared_ptr< shapeworks::Mesh > mesh )

Sets the mesh that defines the FFC.

function getMesh

cpp inline std::shared_ptr< shapeworks::Mesh > getMesh()

Returns the mesh that defines the FFC.

function readyForOptimize

cpp bool readyForOptimize() const

Prepares for optimize.

function isViolated

cpp virtual bool isViolated( const Eigen::Vector3d & pt ) const override

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

Reimplements: shapeworks::Constraint::isViolated

function print

cpp inline virtual void print() const override

Prints the constraint neatly.

Reimplements: shapeworks::Constraint::print

function constraintGradient

cpp inline virtual Eigen::Vector3d constraintGradient( const Eigen::Vector3d & pt ) const override

Returns the gradient of the constraint.

Reimplements: shapeworks::Constraint::constraintGradient

function constraintEval

cpp inline virtual double constraintEval( const Eigen::Vector3d & pt ) const override

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

Reimplements: shapeworks::Constraint::constraintEval

function setDefinition

cpp void setDefinition( vtkSmartPointer< vtkPolyData > polyData )

Set polydata where per-vertex free form constraint definition exists.

function getDefinition

cpp inline vtkSmartPointer< vtkPolyData > getDefinition()

Get polydata where per-vertex free form constraint definition exists.

function applyToPolyData

cpp void applyToPolyData( vtkSmartPointer< vtkPolyData > polyData )

Apply the free form constraint to a polydata.

function boundaries

cpp std::vector< std::vector< Eigen::Vector3d > > & boundaries()

Deprecated:

Access the set of boundaries

function getQueryPoint

cpp inline Eigen::Vector3d getQueryPoint()

Deprecated:

Get query (inside) point

function setQueryPoint

cpp inline void setQueryPoint( Eigen::Vector3d queryPoint )

Deprecated:

Set query (inside) point

function computeBoundaries

cpp void computeBoundaries()

Deprecated:

Compute boundaries from definition polydata with ffc_paint scalars

function setInoutPolyData

cpp inline void setInoutPolyData( vtkSmartPointer< vtkPolyData > polyData )

Set the in/out polydata.

function getInoutPolyData

cpp inline vtkSmartPointer< vtkPolyData > getInoutPolyData()

Get the in/out polydata.

function createInoutPolyData

cpp void createInoutPolyData()

Create the in/out poly data from the definition poly data.

function isSet

cpp bool isSet()

Return if this FFC is set or not.

function setPainted

cpp void setPainted( bool painted )

Set if this FFC has paint on it or not.

function reset

cpp void reset()

Reset to initial state.

function computeGradientFields

cpp void computeGradientFields( std::shared_ptr< Mesh > mesh )

Compute gradient fields for a mesh.

function convertLegacyFFC

cpp void convertLegacyFFC( vtkSmartPointer< vtkPolyData > polyData )

Convert legacy FFC to new format.


Updated on 2026-03-31 at 16:02:10 +0000