Class Equation

Equation base class.

a, b and eps are SPOOK parameters that default to 0.0. See this exchange for more details on Cannon's physics implementation.

Hierarchy (view full)

Constructors

  • Parameters

    • bi: Body
    • bj: Body
    • Optional minForce: number
    • Optional maxForce: number

    Returns Equation

Properties

a: number

SPOOK parameter

b: number

SPOOK parameter

bi: Body
bj: Body
enabled: boolean
eps: number

SPOOK parameter

id: number
jacobianElementA: JacobianElement
jacobianElementB: JacobianElement
maxForce: number

Maximum (read: positive max) force to be applied by the constraint.

minForce: number

Minimum (read: negative max) force to be applied by the constraint.

multiplier: number

A number, proportional to the force added to the bodies.

si: Shape
sj: Shape
idCounter: number

Methods

  • Add constraint velocity to the bodies.

    Parameters

    • deltalambda: number

    Returns void

  • Computes the right hand side of the SPOOK equation

    Parameters

    • a: number
    • b: number
    • h: number

    Returns number

  • Compute the denominator part of the SPOOK equation: C = G*inv(M)*G' + eps

    Returns number

  • Computes G*W, where W are the body velocities

    Returns number

  • Computes G*Wlambda, where W are the body velocities

    Returns number

  • Computes G*inv(M)*G'

    Returns number

  • Computes G*inv(M)*f, where M is the mass matrix with diagonal blocks for each body, and f are the forces on the bodies.

    Returns number

  • Computes G*q, where q are the generalized body coordinates

    Returns number

  • Recalculates a, b, and eps.

    The Equation constructor sets typical SPOOK parameters as such:

    • stiffness = 1e7
    • relaxation = 4
    • timeStep= 1 / 60, note the hardcoded refresh rate.

    Parameters

    • stiffness: number
    • relaxation: number
    • timeStep: number

    Returns void