BodyAreaConstraint

class BodyAreaConstraint(val body: Body, var compliance: Double = 0.0, var iterations: Int = 1) : Constraint(source)

Represents a constraint that maintains a specified area for a deformable body.

This class ensures that the area defined by the body's boundary remains close to a target rest area during simulation. The constraint is solved iteratively and includes compliance to allow some flexibility in maintaining the target area.

Parameters

body

The deformable body whose area is constrained.

compliance

The compliance factor that governs the flexibility of the constraint. Higher values allow more deviation from the rest area.

iterations

The number of iterations for solving the constraint in each simulation step.

Constructors

Link copied to clipboard
constructor(body: Body, compliance: Double = 0.0, iterations: Int = 1)

Creates a BodyAreaConstraint for the specified body.

Properties

Link copied to clipboard
val body: Body
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun area(): Double
Link copied to clipboard
open suspend override fun initialize()
Link copied to clipboard
open suspend override fun solve(body: Body, dt: Double)

Resolves constraints and updates the state of nodes within the given physical body over a time step.