PatchTestMovementProjectiveConstraint
Impose a motion to all the boundary points of a mesh. Impose a motion to all the boundary points of a mesh. The motion of the 4 corners are given in the data d_cornerMovements and the movements of the edge points are computed by linear interpolation.
Imposes motion to all boundary points of a mesh by linearly interpolating between initial and final positions over a specified time interval based on the movements of the corners.
- module
- Sofa.Component.Constraint.Projective
- namespace
- sofa::component::constraint::projective
- include
- sofa/component/constraint/projective/PatchTestMovementProjectiveConstraint.h
- inherits
-
- ProjectiveConstraintSet
- templates
-
- sofa::defaulttype::Rigid3Types
- sofa::defaulttype::Vec3Types
- description
The PatchTestMovementProjectiveConstraint is a constraint that imposes motion on the boundary points of a mesh. It linearly interpolates between initial and final positions for specified mesh points over a given time interval, \$t \in [beginTime, endTime]\$. This component operates by defining movements for the 4 corners of the grid (or 8 in 3D), and computing displacements for all other boundary points via linear interpolation based on these corner movements.
Governing Equations and Operators
- Initial Position Initialization: \$x_0 = x(t_{init})\$
- Final Position Initialization: The final positions, \$xf_i\$, are computed by linearly interpolating the displacements from the 4 corner points. For a point \$i\$ with barycentric coordinates \$ (\alpha, \beta, \gamma) \$:
egin{align}
displacement_i &= C_0(1-\alpha)(1-\beta)(1-\gamma) + C_1\alpha(1-\beta)(1-\gamma) + C_2\alpha\beta(1-\gamma) \ &+ C_3(1-\alpha)\beta(1-\gamma) + C_4(1-\alpha)(1-\beta)\gamma + C_5\alpha(1-\beta)\gamma \ &+ C_6\alpha\beta\gamma + C_7(1-\alpha)\beta\gamma,
\end{align}
where \$C_i = d_{cornerMovements}[i]\$.
- Position Update: The new position of point \$i\$ at time \$t\$, within the constraint interval, is computed as:
egin{align}
x(t) &= x_0 + \frac{(xf - x_0)}{endTime - beginTime} (t - beginTime).
\end{align}
Constitutive or Kinematic Laws Involved
- Linear Interpolation: The movement is computed by linear interpolation between the initial and final positions of the boundary points. This ensures that the motion is smooth and continuous within the specified time interval.
Role in the Global FEM Pipeline
- Initialization: During initialization, the component computes the initial positions \$x_0\$ and calculates the final positions \$xf\$ based on the corner movements and linear interpolation for edge points.
- Time Integration: The constraint operates at each time step by projecting new positions for constrained boundary points using the computed displacements. It applies these changes within the specified time interval, ensuring that the motion is applied smoothly over this period.
- Constraint Handling: This component imposes constraints on the motion of specific mesh points (boundary points). These constraints are handled through projection methods (
projectPosition,projectVelocity,projectResponse) to ensure consistency with the overall simulation. - Draw Functionality: The draw method visualizes constrained boundary points for debugging and visualization purposes, aiding in verifying that the constraints have been applied correctly.
Numerical Methods or Discretization Choices
- Linear Interpolation: The displacements are computed using linear interpolation based on corner movements, ensuring smooth and consistent movement over time.
- Time Integration: Implicit integration is used to project new positions at each time step within the specified interval. This ensures stability and accuracy in the motion of constrained points.
Fit into Variational/Lagrangian Mechanics Framework
This constraint component fits into a broader variational or Lagrangian mechanics framework by enforcing specific kinematic constraints on boundary points. By imposing these constraints, it modifies the system's degrees of freedom (DOFs) to ensure that certain parts of the mesh move in prescribed ways over time. This approach is consistent with both variational principles and explicit kinematic enforcement within a larger simulation pipeline.
Data Fields
| Name | Type | Default | Help |
|---|---|---|---|
d_beginConstraintTime |
double | |
Begin time of the bilinear constraint |
d_endConstraintTime |
double | |
End time of the bilinear constraint |
d_constrainedPoints |
VecCoord | |
Coordinates of the constrained points |
d_cornerMovements |
VecDeriv | |
movements of the corners of the grid |
d_cornerPoints |
VecCoord | |
corner points for computing constraint |
d_drawConstrainedPoints |
bool | |
draw constrained points |
Links
| Name | Type | Help |
|---|---|---|
l_topology |
link to the topology container |
Methods
void
projectPosition
()
void
draw
()
{
"name": "PatchTestMovementProjectiveConstraint",
"namespace": "sofa::component::constraint::projective",
"module": "Sofa.Component.Constraint.Projective",
"include": "sofa/component/constraint/projective/PatchTestMovementProjectiveConstraint.h",
"doc": "Impose a motion to all the boundary points of a mesh.\n\nImpose a motion to all the boundary points of a mesh. The motion of the 4 corners are given in the data d_cornerMovements and the movements of the edge points are computed by linear interpolation.",
"inherits": [
"ProjectiveConstraintSet"
],
"templates": [
"sofa::defaulttype::Rigid3Types",
"sofa::defaulttype::Vec3Types"
],
"data_fields": [
{
"name": "d_beginConstraintTime",
"type": "double",
"xmlname": "beginConstraintTime",
"help": "Begin time of the bilinear constraint"
},
{
"name": "d_endConstraintTime",
"type": "double",
"xmlname": "endConstraintTime",
"help": "End time of the bilinear constraint"
},
{
"name": "d_constrainedPoints",
"type": "VecCoord",
"xmlname": "constrainedPoints",
"help": "Coordinates of the constrained points"
},
{
"name": "d_cornerMovements",
"type": "VecDeriv",
"xmlname": "cornerMovements",
"help": "movements of the corners of the grid"
},
{
"name": "d_cornerPoints",
"type": "VecCoord",
"xmlname": "cornerPoints",
"help": "corner points for computing constraint"
},
{
"name": "d_drawConstrainedPoints",
"type": "bool",
"xmlname": "drawConstrainedPoints",
"help": "draw constrained points"
}
],
"links": [
{
"name": "l_topology",
"target": "BaseMeshTopology",
"kind": "single",
"xmlname": "topology",
"help": "link to the topology container"
}
],
"methods": [
{
"name": "projectPosition",
"parameters": [
"core::MechanicalParams*",
"DataVecCoord&"
],
"description": "Project position by interpolating between initial and final positions based on time."
},
{
"name": "draw",
"parameters": [
"const core::visual::VisualParams*"
],
"description": "Draw the constrained points if drawConstrainedPoints is enabled."
}
],
"description": "A constraint that linearly interpolates between initial and final positions for specified mesh points over a given time interval.",
"parameters": [
{
"name": "beginTime",
"type": "float",
"description": "The starting time of the interpolation."
},
{
"name": "endTime",
"type": "float",
"description": "The end time of the interpolation. The constraint will remain at the final position after this time."
},
{
"name": "drawConstrainedPoints",
"type": "bool",
"default": false,
"description": "A flag to enable drawing of constrained points during visualization."
},
{
"name": "cornerMovements",
"type": "list of vectors",
"description": "The displacements for the corner points used in linear interpolation."
},
{
"name": "meshIndices",
"type": "list of integers",
"description": "Indices of mesh points to be constrained."
},
{
"name": "indices",
"type": "list of integers",
"description": "Indices of the dofs that are constrained."
}
],
"usage_example": [
"This component can be used to apply a linear transformation (e.g., translation, scaling) to parts of a mesh over time. It is useful for simulating simple deformations or movements in a controlled manner.",
"The cornerMovements parameter defines the displacement at the corners of the mesh area being constrained. The interpolation between these points determines the movement of all other points within this area."
],
"notes": [
"The component initializes the initial and final positions of the specified indices during its setup phase. If these are not provided, it uses the current positions as the starting point.",
"This constraint is particularly useful in scenarios where a gradual deformation or movement needs to be simulated for specific parts of a mesh over a defined period."
],
"maths": "The PatchTestMovementProjectiveConstraint is a constraint that imposes motion on the boundary points of a mesh. It linearly interpolates between initial and final positions for specified mesh points over a given time interval, \\\\(t \\in [beginTime, endTime]\\\\). This component operates by defining movements for the 4 corners of the grid (or 8 in 3D), and computing displacements for all other boundary points via linear interpolation based on these corner movements.\n\n### Governing Equations and Operators\n- **Initial Position Initialization**: \\\\(x_0 = x(t_{init})\\\\)\n- **Final Position Initialization**: The final positions, \\\\(xf_i\\\\), are computed by linearly interpolating the displacements from the 4 corner points. For a point \\\\(i\\\\) with barycentric coordinates \\\\( (\\alpha, \\beta, \\gamma) \\\\):\n\n\begin{align*}\ndisplacement_i &= C_0(1-\\alpha)(1-\\beta)(1-\\gamma) + C_1\\alpha(1-\\beta)(1-\\gamma) + C_2\\alpha\\beta(1-\\gamma) \\\\ &+ C_3(1-\\alpha)\\beta(1-\\gamma) + C_4(1-\\alpha)(1-\\beta)\\gamma + C_5\\alpha(1-\\beta)\\gamma \\\\ &+ C_6\\alpha\\beta\\gamma + C_7(1-\\alpha)\\beta\\gamma,\n\\end{align*}\nwhere \\\\(C_i = d_{cornerMovements}[i]\\\\).\n\n- **Position Update**: The new position of point \\\\(i\\\\) at time \\\\(t\\\\), within the constraint interval, is computed as:\n\begin{align*}\nx(t) &= x_0 + \\frac{(xf - x_0)}{endTime - beginTime} (t - beginTime).\n\\end{align*}\n\n### Constitutive or Kinematic Laws Involved\n- **Linear Interpolation**: The movement is computed by linear interpolation between the initial and final positions of the boundary points. This ensures that the motion is smooth and continuous within the specified time interval.\n\n### Role in the Global FEM Pipeline\n1. **Initialization**: During initialization, the component computes the initial positions \\\\(x_0\\\\) and calculates the final positions \\\\(xf\\\\) based on the corner movements and linear interpolation for edge points.\n2. **Time Integration**: The constraint operates at each time step by projecting new positions for constrained boundary points using the computed displacements. It applies these changes within the specified time interval, ensuring that the motion is applied smoothly over this period.\n3. **Constraint Handling**: This component imposes constraints on the motion of specific mesh points (boundary points). These constraints are handled through projection methods (`projectPosition`, `projectVelocity`, `projectResponse`) to ensure consistency with the overall simulation.\n4. **Draw Functionality**: The draw method visualizes constrained boundary points for debugging and visualization purposes, aiding in verifying that the constraints have been applied correctly.\n\n### Numerical Methods or Discretization Choices\n- **Linear Interpolation**: The displacements are computed using linear interpolation based on corner movements, ensuring smooth and consistent movement over time.\n- **Time Integration**: Implicit integration is used to project new positions at each time step within the specified interval. This ensures stability and accuracy in the motion of constrained points.\n\n### Fit into Variational/Lagrangian Mechanics Framework\nThis constraint component fits into a broader variational or Lagrangian mechanics framework by enforcing specific kinematic constraints on boundary points. By imposing these constraints, it modifies the system's degrees of freedom (DOFs) to ensure that certain parts of the mesh move in prescribed ways over time. This approach is consistent with both variational principles and explicit kinematic enforcement within a larger simulation pipeline.",
"abstract": "Imposes motion to all boundary points of a mesh by linearly interpolating between initial and final positions over a specified time interval based on the movements of the corners.",
"sheet": "# PatchTestMovementProjectiveConstraint\n\n## Overview\nImpose a motion to all the boundary points of a mesh. The motion of the 4 corners are given in the data `d_cornerMovements` and the movements of the edge points are computed by linear interpolation.\n\n## Mathematical Model\nThe component computes displacements for each point based on corner movements using linear interpolation, then applies these changes over time within the specified interval \\(t \\\\[beginTime, endTime]\\). The new position at time \\(t\\) is given by:\n\begin{align*}\n x(t) &= x_0 + \\frac{(xf - x_0)}{endTime - beginTime} (t - beginTime),\n\ndisplacement_i &= C_0(1-\\alpha)(1-\\beta)(1-\\gamma) + C_1\\alpha(1-\\beta)(1-\\gamma) \\\\ &+ C_2\\alpha\\beta(1-\\gamma) + C_3(1-\\alpha)\\beta(1-\\gamma) + C_4(1-\\alpha)(1-\\beta)\\gamma \\\\ &+ C_5\\alpha(1-\\beta)\\gamma + C_6\\alpha\\beta\\gamma + C_7(1-\\alpha)\\beta\\gamma,\n\text{where } C_i = d_{cornerMovements}[i].\n\ndisplacement_i \\text{ is the displacement for point } i.\n\text{The final position } xf_i \\text{ is computed by adding this displacement to the initial position.}\n\text{The motion is applied smoothly over time within the specified interval.}\n\text{The component operates at each time step, projecting new positions using these displacements.}\n\n## Parameters and Data\n- **beginConstraintTime**: Begin time of the bilinear constraint (default: 0).\n- **endConstraintTime**: End time of the bilinear constraint.\n- **constrainedPoints**: Coordinates of the constrained points.\n- **cornerMovements**: Movements of the corners of the grid.\n- **cornerPoints**: Corner points for computing constraints.\n- **drawConstrainedPoints**: Draw constrained points (default: false).\n\n## Dependencies and Connections\nThe component requires a link to the topology container (`l_topology`). It fits into the scene graph by projecting new positions, velocities, and responses at each time step within the specified interval."
}