LinkLengthConstraint

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

A constraint that enforces the lengths of links between nodes within a Body.

The LinkLengthConstraint ensures that links connecting nodes in the Body adhere to their defined rest lengths. It computes corrections over a number of iterations to resolve any deviations in length while considering compliance, which introduces flexibility into the system.

Constructors

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

Properties

Link copied to clipboard
val body: Body

the Body that this constraint operates on.

Link copied to clipboard

a parameter controlling the flexibility of the links. Higher compliance allows greater deviation from the rest lengths.

Link copied to clipboard

the number of iterations to refine the resolution of the constraint for each time step.

Link copied to clipboard

Functions

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.