UNPKG

@box2d/debug-draw

Version:

Debug drawing helper for @box2d

102 lines 4.32 kB
import { b2Draw } from "../common/b2_draw"; import { b2Vec2, XY } from "../common/b2_math"; import { b2Readonly } from "../common/b2_readonly"; import { b2Body } from "./b2_body"; import { b2Joint, b2JointDef, b2IJointDef } from "./b2_joint"; import { b2SolverData } from "./b2_time_step"; export declare const b2_minPulleyLength = 2; export interface b2IPulleyJointDef extends b2IJointDef { groundAnchorA?: XY; groundAnchorB?: XY; localAnchorA?: XY; localAnchorB?: XY; lengthA?: number; lengthB?: number; ratio?: number; } /** * Pulley joint definition. This requires two ground anchors, * two dynamic body anchor points, and a pulley ratio. */ export declare class b2PulleyJointDef extends b2JointDef implements b2IPulleyJointDef { /** The first ground anchor in world coordinates. This point never moves. */ readonly groundAnchorA: b2Vec2; /** The second ground anchor in world coordinates. This point never moves. */ readonly groundAnchorB: b2Vec2; /** The local anchor point relative to bodyA's origin. */ readonly localAnchorA: b2Vec2; /** The local anchor point relative to bodyB's origin. */ readonly localAnchorB: b2Vec2; /** The a reference length for the segment attached to bodyA. */ lengthA: number; /** The a reference length for the segment attached to bodyB. */ lengthB: number; /** The pulley ratio, used to simulate a block-and-tackle. */ ratio: number; constructor(); /** Initialize the bodies, anchors, lengths, max lengths, and ratio using the world anchors. */ Initialize(bA: b2Body, bB: b2Body, groundA: Readonly<XY>, groundB: Readonly<XY>, anchorA: Readonly<XY>, anchorB: Readonly<XY>, r: number): void; } /** * The pulley joint is connected to two bodies and two fixed ground points. * The pulley supports a ratio such that: * length1 + ratio * length2 <= constant * Yes, the force transmitted is scaled by the ratio. * Warning: the pulley joint can get a bit squirrelly by itself. They often * work better when combined with prismatic joints. You should also cover the * the anchor points with static shapes to prevent one side from going to * zero length. */ export declare class b2PulleyJoint extends b2Joint { protected readonly m_groundAnchorA: b2Vec2; protected readonly m_groundAnchorB: b2Vec2; protected m_lengthA: number; protected m_lengthB: number; protected readonly m_localAnchorA: b2Vec2; protected readonly m_localAnchorB: b2Vec2; protected m_constant: number; protected m_ratio: number; protected m_impulse: number; protected m_indexA: number; protected m_indexB: number; protected readonly m_uA: b2Vec2; protected readonly m_uB: b2Vec2; protected readonly m_rA: b2Vec2; protected readonly m_rB: b2Vec2; protected readonly m_localCenterA: b2Vec2; protected readonly m_localCenterB: b2Vec2; protected m_invMassA: number; protected m_invMassB: number; protected m_invIA: number; protected m_invIB: number; protected m_mass: number; /** @internal protected */ constructor(def: b2IPulleyJointDef); /** @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 ground anchor. */ GetGroundAnchorA(): b2Vec2; /** Get the second ground anchor. */ GetGroundAnchorB(): b2Vec2; /** Get the current length of the segment attached to bodyA. */ GetLengthA(): number; /** Get the current length of the segment attached to bodyB. */ GetLengthB(): number; /** Get the pulley ratio. */ GetRatio(): number; /** Get the current length of the segment attached to bodyA. */ GetCurrentLengthA(): number; /** Get the current length of the segment attached to bodyB. */ GetCurrentLengthB(): number; ShiftOrigin(newOrigin: b2Readonly<b2Vec2>): void; Draw(draw: b2Draw): void; } //# sourceMappingURL=b2_pulley_joint.d.ts.map