Class ConeEquation

Cone equation. Works to keep the given body world vectors aligned, or tilted within a given angle from each other.

Hierarchy (view full)

Constructors

  • Parameters

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

        Default

        1e6
        

    Returns ConeEquation

Properties

a: number

SPOOK parameter

angle: number

The "cone angle" to keep

axisA: Vec3

Local axis in A

axisB: Vec3

Local axis in B

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

    • 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