NodeCircleConstraint

Represents a circular constraint applied to nodes of a physical body.

The NodeCircleConstraint ensures that nodes of the body remain within or on the boundary of a circle. It uses constraint-solving techniques to enforce this behavior over a set number of iterations with adjustable compliance and strength parameters.

Parameters

body

the Body whose nodes are subject to this circular constraint.

Constructors

Link copied to clipboard
constructor(body: Body)

Creates a new NodeCircleConstraint with a reference to a physical body.

Properties

Link copied to clipboard
val body: Body
Link copied to clipboard
var circle: (Node) -> Circle

a function that determines the circle for a given node. The function outputs a Circle object that specifies the center and radius of the constraint for that node.

Link copied to clipboard

a parameter representing the flexibility of the constraint. A higher value allows nodes to move more freely within the constraint boundary.

Link copied to clipboard

the number of iterations performed during constraint solving. Higher iterations can increase accuracy at the cost of computation time.

Link copied to clipboard

an array used to store lagrange multipliers for constraint force calculations for each node in the body.

Link copied to clipboard

a multiplier controlling the intensity of the constraint application. Values greater than 1 make the constraint effect stronger, while values less than 1 make it weaker.

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.