MeshSolver.add_shape_constraint

MeshSolver.add_shape_constraint(indices, shape_type='regular_polygon', weight=1.0, allow_scaling=True, allow_rotation=True, allow_translation=True, custom_points=None)

Add a unified shape constraint with different shape types.

This consolidates functionality of add_regular_polygon_constraint, add_similarity_constraint, and set_similarity_constraint_shape into a single unified method.

Parameters:
indiceslist or ndarray

List of vertex indices.

shape_typestr, optional

Type of shape: “regular_polygon”, “similarity”, or “custom”, by default “regular_polygon”

weightfloat, optional

Weight of the constraint, by default 1.0

allow_scalingbool, optional

Whether to allow scaling transformations, by default True

allow_rotationbool, optional

Whether to allow rotation transformations, by default True

allow_translationbool, optional

Whether to allow translation transformations, by default True

custom_pointslist, optional

Optional list of 3D points for custom shapes. Required when shape_type=”custom”.

Returns:
int

ID of the constraint if successful, 0 otherwise.