import { b2Vec2, b2Transform, XY } from "../common/b2_math";
import { b2MassData } from "../collision/b2_shape";
import type { b2ContactEdge } from "./b2_contact";
import { b2JointEdge } from "./b2_joint";
import { b2Fixture, b2FixtureDef } from "./b2_fixture";
import type { b2World } from "./b2_world";
import type { b2BodyUserData } from "..";
import { b2Readonly } from "../common/b2_readonly";
/**
 * The body type.
 * static: zero mass, zero velocity, may be manually moved
 * kinematic: zero mass, non-zero velocity set by user, moved by solver
 * dynamic: positive mass, non-zero velocity determined by forces, moved by solver
 */
export declare enum b2BodyType {
    b2_staticBody = 0,
    b2_kinematicBody = 1,
    b2_dynamicBody = 2
}
/**
 * A body definition holds all the data needed to construct a rigid body.
 * You can safely re-use body definitions. Shapes are added to a body after construction.
 */
export interface b2BodyDef {
    /**
     * The body type: static, kinematic, or dynamic.
     * Note: if a dynamic body would have zero mass, the mass is set to one.
     */
    type?: b2BodyType;
    /**
     * The world position of the body. Avoid creating bodies at the origin
     * since this can lead to many overlapping shapes.
     */
    position?: XY;
    /** The world angle of the body in radians. */
    angle?: number;
    /** The linear velocity of the body's origin in world co-ordinates. */
    linearVelocity?: XY;
    /** The angular velocity of the body. */
    angularVelocity?: number;
    /**
     * Linear damping is use to reduce the linear velocity. The damping parameter
     * can be larger than 1   but the damping effect becomes sensitive to the
     * time step when the damping parameter is large.
     * Units are 1/time
     */
    linearDamping?: number;
    /**
     * Angular damping is use to reduce the angular velocity. The damping parameter
     * can be larger than 1   but the damping effect becomes sensitive to the
     * time step when the damping parameter is large.
     * Units are 1/time
     */
    angularDamping?: number;
    /**
     * Set this flag to false if this body should never fall asleep. Note that
     * this increases CPU usage.
     */
    allowSleep?: boolean;
    /** Is this body initially awake or sleeping? */
    awake?: boolean;
    /** Should this body be prevented from rotating? Useful for characters. */
    fixedRotation?: boolean;
    /**
     * Is this a fast moving body that should be prevented from tunneling through
     * other moving bodies? Note that all bodies are prevented from tunneling through
     * kinematic and static bodies. This setting is only considered on dynamic bodies.
     *
     * @warning You should use this flag sparingly since it increases processing time.
     */
    bullet?: boolean;
    /** Does this body start out enabled? */
    enabled?: boolean;
    /** Use this to store application specific body data. */
    userData?: b2BodyUserData;
    /** Scale the gravity applied to this body. */
    gravityScale?: number;
}
/**
 * A rigid body. These are created via b2World::CreateBody.
 */
export declare class b2Body {
    private m_type;
    private m_islandFlag;
    private m_awakeFlag;
    private m_autoSleepFlag;
    private m_bulletFlag;
    private m_fixedRotationFlag;
    private m_enabledFlag;
    private m_toiFlag;
    private m_islandIndex;
    private readonly m_xf;
    private readonly m_sweep;
    private readonly m_linearVelocity;
    private m_angularVelocity;
    private readonly m_force;
    private m_torque;
    private readonly m_world;
    private m_prev;
    private m_next;
    private m_fixtureList;
    private m_fixtureCount;
    private m_jointList;
    private m_contactList;
    private m_mass;
    private m_invMass;
    private m_I;
    private m_invI;
    private m_linearDamping;
    private m_angularDamping;
    private m_gravityScale;
    private m_sleepTime;
    private readonly m_userData;
    private constructor();
    /**
     * Creates a fixture and attach it to this body. Use this function if you need
     * to set some fixture parameters, like friction. Otherwise you can create the
     * fixture directly from a shape.
     * If the density is non-zero, this function automatically updates the mass of the body.
     * Contacts are not created until the next time step.
     *
     * @param def The fixture definition.
     * @warning This function is locked during callbacks.
     */
    CreateFixture(def: b2FixtureDef): b2Fixture;
    /**
     * Destroy a fixture. This removes the fixture from the broad-phase and
     * destroys all contacts associated with this fixture. This will
     * automatically adjust the mass of the body if the body is dynamic and the
     * fixture has positive density.
     * All fixtures attached to a body are implicitly destroyed when the body is destroyed.
     *
     * @param fixture The fixture to be removed.
     * @warning This function is locked during callbacks.
     */
    DestroyFixture(fixture: b2Fixture): void;
    /**
     * Set the position of the body's origin and rotation.
     * This breaks any contacts and wakes the other bodies.
     * Manipulating a body's transform may cause non-physical behavior.
     *
     * @param position The world position of the body's local origin.
     * @param angle The world rotation in radians.
     */
    SetTransformVec(position: XY, angle: number): void;
    SetTransformXY(x: number, y: number, angle: number): void;
    SetTransform(xf: b2Readonly<b2Transform>): void;
    /**
     * Get the body transform for the body's origin.
     *
     * @returns The world transform of the body's origin.
     */
    GetTransform(): b2Readonly<b2Transform>;
    /**
     * Get the world body origin position.
     *
     * @returns The world position of the body's origin.
     */
    GetPosition(): b2Readonly<b2Vec2>;
    /**
     * Get the angle in radians.
     *
     * @returns The current world rotation angle in radians.
     */
    GetAngle(): number;
    SetAngle(angle: number): void;
    /**
     * Get the world position of the center of mass.
     */
    GetWorldCenter(): b2Readonly<b2Vec2>;
    /**
     * Get the local position of the center of mass.
     */
    GetLocalCenter(): b2Readonly<b2Vec2>;
    /**
     * Set the linear velocity of the center of mass.
     *
     * @param v The new linear velocity of the center of mass.
     */
    SetLinearVelocity(v: XY): void;
    /**
     * Get the linear velocity of the center of mass.
     *
     * @returns The linear velocity of the center of mass.
     */
    GetLinearVelocity(): b2Readonly<b2Vec2>;
    /**
     * Set the angular velocity.
     *
     * @param omega The new angular velocity in radians/second.
     */
    SetAngularVelocity(w: number): void;
    /**
     * Get the angular velocity.
     *
     * @returns The angular velocity in radians/second.
     */
    GetAngularVelocity(): number;
    /**
     * Apply a force at a world point. If the force is not
     * applied at the center of mass, it will generate a torque and
     * affect the angular velocity. This wakes up the body.
     *
     * @param force The world force vector, usually in Newtons (N).
     * @param point The world position of the point of application.
     * @param wake Also wake up the body
     */
    ApplyForce(force: XY, point: XY, wake?: boolean): void;
    /**
     * Apply a force to the center of mass. This wakes up the body.
     *
     * @param force The world force vector, usually in Newtons (N).
     * @param wake Also wake up the body
     */
    ApplyForceToCenter(force: XY, wake?: boolean): void;
    /**
     * Apply a torque. This affects the angular velocity
     * without affecting the linear velocity of the center of mass.
     *
     * @param torque About the z-axis (out of the screen), usually in N-m.
     * @param wake Also wake up the body
     */
    ApplyTorque(torque: number, wake?: boolean): void;
    /**
     * Apply an impulse at a point. This immediately modifies the velocity.
     * It also modifies the angular velocity if the point of application
     * is not at the center of mass. This wakes up the body.
     *
     * @param impulse The world impulse vector, usually in N-seconds or kg-m/s.
     * @param point The world position of the point of application.
     * @param wake Also wake up the body
     */
    ApplyLinearImpulse(impulse: XY, point: XY, wake?: boolean): void;
    /**
     * Apply an impulse to the center of mass. This immediately modifies the velocity.
     *
     * @param impulse The world impulse vector, usually in N-seconds or kg-m/s.
     * @param wake Also wake up the body
     */
    ApplyLinearImpulseToCenter(impulse: XY, wake?: boolean): void;
    /**
     * Apply an angular impulse.
     *
     * @param impulse The angular impulse in units of kg*m*m/s
     * @param wake Also wake up the body
     */
    ApplyAngularImpulse(impulse: number, wake?: boolean): void;
    /**
     * Get the total mass of the body.
     *
     * @returns The mass, usually in kilograms (kg).
     */
    GetMass(): number;
    /**
     * Get the rotational inertia of the body about the local origin.
     *
     * @returns The rotational inertia, usually in kg-m^2.
     */
    GetInertia(): number;
    /**
     * Get the mass data of the body.
     *
     * @returns A struct containing the mass, inertia and center of the body.
     */
    GetMassData(data: b2MassData): b2MassData;
    private static SetMassData_s_oldCenter;
    /**
     * Set the mass properties to override the mass properties of the fixtures.
     * Note that this changes the center of mass position.
     * Note that creating or destroying fixtures can also alter the mass.
     * This function has no effect if the body isn't dynamic.
     *
     * @param massData The mass properties.
     */
    SetMassData(massData: b2MassData): void;
    private static ResetMassData_s_localCenter;
    private static ResetMassData_s_oldCenter;
    private static ResetMassData_s_massData;
    /**
     * This resets the mass properties to the sum of the mass properties of the fixtures.
     * This normally does not need to be called unless you called SetMassData to override
     * the mass and you later want to reset the mass.
     */
    ResetMassData(): void;
    /**
     * Get the world coordinates of a point given the local coordinates.
     *
     * @param localPoint A point on the body measured relative the the body's origin.
     * @returns The same point expressed in world coordinates.
     */
    GetWorldPoint<T extends XY>(localPoint: Readonly<XY>, out: T): T;
    /**
     * Get the world coordinates of a vector given the local coordinates.
     *
     * @param localVector A vector fixed in the body.
     * @returns The same vector expressed in world coordinates.
     */
    GetWorldVector<T extends XY>(localVector: Readonly<XY>, out: T): T;
    /**
     * Gets a local point relative to the body's origin given a world point.
     *
     * @param a Point in world coordinates.
     * @returns The corresponding local point relative to the body's origin.
     */
    GetLocalPoint<T extends XY>(worldPoint: Readonly<XY>, out: T): T;
    /**
     * Gets a local vector given a world vector.
     *
     * @param a Vector in world coordinates.
     * @returns The corresponding local vector.
     */
    GetLocalVector<T extends XY>(worldVector: Readonly<XY>, out: T): T;
    /**
     * Get the world linear velocity of a world point attached to this body.
     *
     * @param a Point in world coordinates.
     * @returns The world velocity of a point.
     */
    GetLinearVelocityFromWorldPoint<T extends XY>(worldPoint: Readonly<XY>, out: T): T;
    /**
     * Get the world velocity of a local point.
     *
     * @param a Point in local coordinates.
     * @returns The world velocity of a point.
     */
    GetLinearVelocityFromLocalPoint<T extends XY>(localPoint: Readonly<XY>, out: T): T;
    /**
     * Get the linear damping of the body.
     */
    GetLinearDamping(): number;
    /**
     * Set the linear damping of the body.
     */
    SetLinearDamping(linearDamping: number): void;
    /**
     * Get the angular damping of the body.
     */
    GetAngularDamping(): number;
    /**
     * Set the angular damping of the body.
     */
    SetAngularDamping(angularDamping: number): void;
    /**
     * Get the gravity scale of the body.
     */
    GetGravityScale(): number;
    /**
     * Set the gravity scale of the body.
     */
    SetGravityScale(scale: number): void;
    /**
     * Set the type of this body. This may alter the mass and velocity.
     */
    SetType(type: b2BodyType): void;
    /**
     * Get the type of this body.
     */
    GetType(): b2BodyType;
    /**
     * Should this body be treated like a bullet for continuous collision detection?
     */
    SetBullet(flag: boolean): void;
    /**
     * Is this body treated like a bullet for continuous collision detection?
     */
    IsBullet(): boolean;
    /**
     * You can disable sleeping on this body. If you disable sleeping, the
     * body will be woken.
     */
    SetSleepingAllowed(flag: boolean): void;
    /**
     * Is this body allowed to sleep
     */
    IsSleepingAllowed(): boolean;
    /**
     * Set the sleep state of the body. A sleeping body has very
     * low CPU cost.
     *
     * @param flag Set to true to wake the body, false to put it to sleep.
     */
    SetAwake(flag: boolean): void;
    /**
     * Get the sleeping state of this body.
     *
     * @returns true if the body is awake.
     */
    IsAwake(): boolean;
    /**
     * Allow a body to be disabled. A disabled body is not simulated and cannot
     * be collided with or woken up.
     * If you pass a flag of true, all fixtures will be added to the broad-phase.
     * If you pass a flag of false, all fixtures will be removed from the
     * broad-phase and all contacts will be destroyed.
     * Fixtures and joints are otherwise unaffected. You may continue
     * to create/destroy fixtures and joints on disabled bodies.
     * Fixtures on a disabled body are implicitly disabled and will
     * not participate in collisions, ray-casts, or queries.
     * Joints connected to a disabled body are implicitly disabled.
     * An disabled body is still owned by a b2World object and remains
     * in the body list.
     */
    SetEnabled(flag: boolean): void;
    /**
     * Get the active state of the body.
     */
    IsEnabled(): boolean;
    /**
     * Set this body to have fixed rotation. This causes the mass
     * to be reset.
     */
    SetFixedRotation(flag: boolean): void;
    /**
     * Does this body have fixed rotation?
     */
    IsFixedRotation(): boolean;
    /**
     * Get the list of all fixtures attached to this body.
     */
    GetFixtureList(): b2Fixture | null;
    /**
     * Get the list of all joints attached to this body.
     */
    GetJointList(): b2JointEdge | null;
    /**
     * Get the list of all contacts attached to this body.
     *
     * @warning this list changes during the time step and you may
     * miss some collisions if you don't use b2ContactListener.
     */
    GetContactList(): b2ContactEdge | null;
    /**
     * Get the next body in the world's body list.
     */
    GetNext(): b2Body | null;
    /**
     * Get the user data reference that was provided in the body definition.
     */
    GetUserData(): b2BodyUserData;
    /**
     * Set the user data. Use this to store your application specific data.
     * This is a merge operation. Only specified keys will be overridden.
     */
    SetUserData(data: b2BodyUserData): void;
    /**
     * Get the parent world of this body.
     */
    GetWorld(): b2World;
    private static SynchronizeFixtures_s_xf1;
    private SynchronizeFixtures;
    private SynchronizeTransform;
    private ShouldCollide;
    private ShouldCollideConnected;
    private Advance;
}
//# sourceMappingURL=b2_body.d.ts.map