Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Index

Constructors

constructor

  • new Equation(bi: Body, bj: Body, minForce?: number, maxForce?: number): Equation

Properties

a

a: number

SPOOK parameter

b

b: number

SPOOK parameter

eps

eps: number

SPOOK parameter

maxForce

maxForce: number

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

minForce

minForce: number

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

multiplier

multiplier: number

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

Methods

addToWlambda

  • addToWlambda(deltalambda: number): void

computeB

  • computeB(a: number, b: number, h: number): number
  • Computes the right hand side of the SPOOK equation

    Parameters

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

    Returns number

computeC

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

    Returns number

computeGW

  • computeGW(): number

computeGWlambda

  • computeGWlambda(): number

computeGiMGt

  • computeGiMGt(): number

computeGiMf

  • computeGiMf(): 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

computeGq

  • computeGq(): number

setSpookParams

  • setSpookParams(stiffness: number, relaxation: number, timeStep: number): void
  • 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