ShapeOp
0.1.0
|
Base class of any constraints. This class defines the interface of a ShapeOp constraint. More...
#include <Constraint.h>
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< Constraint > | shapeConstraintFactory (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. | |
Base class of any constraints. This class defines the interface of a ShapeOp constraint.
SHAPEOP_INLINE ShapeOp::Constraint::Constraint | ( | const std::vector< int > & | idI, |
Scalar | weight | ||
) |
Constraint constructor.
idI | A vector of indices of the vertices to be constrained. |
weight | The weight of the constraint to be added relative to the other constraints. |
|
pure virtual |
Add the constraint to the linear system.
[out] | triplets | A vector of triplets each representing an entry in a sparse matrix. |
[in,out] | idO | In: The first row index of the constraint in the sparse matrix. Out: The last row index plus one. |
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.
|
pure virtual |
Find the closest, in the least-squre sense, configuration from the input positions that satisfy the constraint.
positions | The positions of all the n vertices stacked in a 3 by n matrix. |
projections | The 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.
|
static |
Creates a constraint from a string type, a number of indices, a weight and the initial point positions.
ConstraintType | One of the following:
|
idI | A vector of indices of the vertices to be constrained. |
weight | The weight of the constraint to be added relative to the other constraints. |
positions | The positions of all the n vertices stacked in a 3 by n matrix. |