@box2d/debug-draw
Version:
Debug drawing helper for @box2d
108 lines • 4.12 kB
TypeScript
import { b2Vec2, XY } from "../common/b2_math";
import { b2Joint, b2JointDef, b2JointType, b2IJointDef } from "./b2_joint";
import { b2PrismaticJoint } from "./b2_prismatic_joint";
import { b2RevoluteJoint } from "./b2_revolute_joint";
import { b2SolverData } from "./b2_time_step";
import { b2Body } from "./b2_body";
export interface b2IGearJointDef extends b2IJointDef {
joint1: b2RevoluteJoint | b2PrismaticJoint;
joint2: b2RevoluteJoint | b2PrismaticJoint;
ratio?: number;
}
/**
* Gear joint definition. This definition requires two existing
* revolute or prismatic joints (any combination will work).
*
* @warning bodyB on the input joints must both be dynamic
*/
export declare class b2GearJointDef extends b2JointDef implements b2IGearJointDef {
/** The first revolute/prismatic joint attached to the gear joint. */
joint1: b2RevoluteJoint | b2PrismaticJoint;
/** The second revolute/prismatic joint attached to the gear joint. */
joint2: b2RevoluteJoint | b2PrismaticJoint;
/**
* The gear ratio.
*
* @see b2GearJoint for explanation.
*/
ratio: number;
constructor();
}
/**
* A gear joint is used to connect two joints together. Either joint
* can be a revolute or prismatic joint. You specify a gear ratio
* to bind the motions together:
* coordinate1 + ratio * coordinate2 = constant
* The ratio can be negative or positive. If one joint is a revolute joint
* and the other joint is a prismatic joint, then the ratio will have units
* of length or units of 1/length.
*
* @warning You have to manually destroy the gear joint if joint1 or joint2
* is destroyed.
*/
export declare class b2GearJoint extends b2Joint {
protected m_joint1: b2RevoluteJoint | b2PrismaticJoint;
protected m_joint2: b2RevoluteJoint | b2PrismaticJoint;
protected m_typeA: b2JointType;
protected m_typeB: b2JointType;
/** Body A is connected to body C */
protected m_bodyC: b2Body;
/** Body B is connected to body D */
protected m_bodyD: b2Body;
protected readonly m_localAnchorA: b2Vec2;
protected readonly m_localAnchorB: b2Vec2;
protected readonly m_localAnchorC: b2Vec2;
protected readonly m_localAnchorD: b2Vec2;
protected readonly m_localAxisC: b2Vec2;
protected readonly m_localAxisD: b2Vec2;
protected m_referenceAngleA: number;
protected m_referenceAngleB: number;
protected m_constant: number;
protected m_ratio: number;
protected m_tolerance: number;
protected m_impulse: number;
protected m_indexA: number;
protected m_indexB: number;
protected m_indexC: number;
protected m_indexD: number;
protected readonly m_lcA: b2Vec2;
protected readonly m_lcB: b2Vec2;
protected readonly m_lcC: b2Vec2;
protected readonly m_lcD: b2Vec2;
protected m_mA: number;
protected m_mB: number;
protected m_mC: number;
protected m_mD: number;
protected m_iA: number;
protected m_iB: number;
protected m_iC: number;
protected m_iD: number;
protected readonly m_JvAC: b2Vec2;
protected readonly m_JvBD: b2Vec2;
protected m_JwA: number;
protected m_JwB: number;
protected m_JwC: number;
protected m_JwD: number;
protected m_mass: number;
/** @internal protected */
constructor(def: b2IGearJointDef);
/** @internal protected */
InitVelocityConstraints(data: b2SolverData): void;
/** @internal protected */
SolveVelocityConstraints(data: b2SolverData): void;
/** @internal protected */
SolvePositionConstraints(data: b2SolverData): boolean;
GetAnchorA<T extends XY>(out: T): T;
GetAnchorB<T extends XY>(out: T): T;
GetReactionForce<T extends XY>(inv_dt: number, out: T): T;
GetReactionTorque(inv_dt: number): number;
/** Get the first joint. */
GetJoint1(): b2PrismaticJoint | b2RevoluteJoint;
/** Get the second joint. */
GetJoint2(): b2PrismaticJoint | b2RevoluteJoint;
/** Get the gear ratio. */
GetRatio(): number;
/** Set the gear ratio. */
SetRatio(ratio: number): void;
}
//# sourceMappingURL=b2_gear_joint.d.ts.map