Class RotationalEquation

Rotational constraint. Works to keep the local vectors orthogonal to each other in world space.

Hierarchy (view full)

Constructors

  • Parameters

    • bodyA: Body
    • bodyB: Body
    • Optional options: {
          axisA?: Vec3;
          axisB?: Vec3;
          maxAngle?: number;
          maxForce?: number;
      }
      • Optional axisA?: Vec3

        World oriented rotational axis.

      • Optional axisB?: Vec3

        World oriented rotational axis.

      • Optional maxAngle?: number

        maxAngle

      • Optional maxForce?: number

        Default

        1e6
        

    Returns RotationalEquation

Properties

a: number

SPOOK parameter

axisA: Vec3

World oriented rotational axis.

axisB: Vec3

World oriented rotational axis.

b: number

SPOOK parameter

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

SPOOK parameter

id: number
jacobianElementA: JacobianElement
jacobianElementB: JacobianElement
maxAngle: number

maxAngle

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

    • 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)*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