ShapeOp  0.1.0
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
ShapeOp::Constraint Class Referenceabstract

Base class of any constraints. This class defines the interface of a ShapeOp constraint. More...

#include <Constraint.h>

Inheritance diagram for ShapeOp::Constraint:
ShapeOp::AngleConstraint ShapeOp::AreaConstraint ShapeOp::BendingConstraint ShapeOp::CircleConstraint ShapeOp::ClosenessConstraint ShapeOp::EdgeStrainConstraint ShapeOp::LineConstraint ShapeOp::ParallelogramConstraint ShapeOp::PlaneConstraint ShapeOp::RectangleConstraint ShapeOp::SimilarityConstraint ShapeOp::SphereConstraint ShapeOp::TetrahedronStrainConstraint ShapeOp::TriangleStrainConstraint ShapeOp::UniformLaplacianConstraint ShapeOp::VolumeConstraint

Public Member Functions

 Constraint (const std::vector< int > &idI, Scalar weight)
 Constraint constructor. More...
 
virtual void project (const Matrix3X &positions, Matrix3X &projections) const =0
 Find the closest, in the least-squre sense, configuration from the input positions that satisfy the constraint. More...
 
virtual void addConstraint (std::vector< Triplet > &triplets, int &idO) const =0
 Add the constraint to the linear system. More...
 
std::size_t nIndices () const
 Number of indices of vertices involved in the constraint.
 

Static Public Member Functions

static std::shared_ptr< ConstraintshapeConstraintFactory (const std::string &ConstraintType, const std::vector< int > &idI, Scalar weight, const Matrix3X &positions)
 Creates a constraint from a string type, a number of indices, a weight and the initial point positions. More...
 

Protected Attributes

std::vector< int > idI_
 ids of the vertices involved in this constraint.
 
Scalar weight_
 weight for the constraint.
 
int idO_
 location of this constraint in the linear system.
 

Detailed Description

Base class of any constraints. This class defines the interface of a ShapeOp constraint.

Constructor & Destructor Documentation

SHAPEOP_INLINE ShapeOp::Constraint::Constraint ( const std::vector< int > &  idI,
Scalar  weight 
)

Constraint constructor.

Parameters
idIA vector of indices of the vertices to be constrained.
weightThe weight of the constraint to be added relative to the other constraints.

Member Function Documentation

virtual void ShapeOp::Constraint::addConstraint ( std::vector< Triplet > &  triplets,
int &  idO 
) const
pure virtual
virtual void ShapeOp::Constraint::project ( const Matrix3X positions,
Matrix3X projections 
) const
pure virtual

Find the closest, in the least-squre sense, configuration from the input positions that satisfy the constraint.

Parameters
positionsThe positions of all the n vertices stacked in a 3 by n matrix.
projectionsThe projections of the vertices involved in the constraint.

Implemented in ShapeOp::AngleConstraint, ShapeOp::UniformLaplacianConstraint, ShapeOp::ParallelogramConstraint, ShapeOp::RectangleConstraint, ShapeOp::SimilarityConstraint, ShapeOp::SphereConstraint, ShapeOp::CircleConstraint, ShapeOp::PlaneConstraint, ShapeOp::LineConstraint, ShapeOp::ClosenessConstraint, ShapeOp::BendingConstraint, ShapeOp::VolumeConstraint, ShapeOp::AreaConstraint, ShapeOp::TetrahedronStrainConstraint, ShapeOp::TriangleStrainConstraint, and ShapeOp::EdgeStrainConstraint.

SHAPEOP_INLINE std::shared_ptr< Constraint > ShapeOp::Constraint::shapeConstraintFactory ( const std::string &  ConstraintType,
const std::vector< int > &  idI,
Scalar  weight,
const Matrix3X positions 
)
static

Creates a constraint from a string type, a number of indices, a weight and the initial point positions.

Parameters
ConstraintTypeOne of the following:
idIA vector of indices of the vertices to be constrained.
weightThe weight of the constraint to be added relative to the other constraints.
positionsThe positions of all the n vertices stacked in a 3 by n matrix.
Returns
A std::shared pointer to the Constraint, which is empty/null if failed.

The documentation for this class was generated from the following files: