@box2d/debug-draw
Version:
Debug drawing helper for @box2d
88 lines • 3.29 kB
TypeScript
import { b2Color, b2Draw } from "../common/b2_draw";
import { b2Vec2, b2Transform, XY } from "../common/b2_math";
import { b2Readonly } from "../common/b2_readonly";
import { b2AABB, b2RayCastInput, b2RayCastOutput } from "./b2_collision";
import { b2DistanceProxy } from "./b2_distance";
/**
* This holds the mass data computed for a shape.
*/
export declare class b2MassData {
/** The mass of the shape, usually in kilograms. */
mass: number;
/** The position of the shape's centroid relative to the shape's origin. */
readonly center: b2Vec2;
/** The rotational inertia of the shape about the local origin. */
I: number;
}
export declare enum b2ShapeType {
e_unknown = -1,
e_circle = 0,
e_edge = 1,
e_polygon = 2,
e_chain = 3,
e_typeCount = 4
}
/**
* A shape is used for collision detection. You can create a shape however you like.
* Shapes used for simulation in b2World are created automatically when a b2Fixture
* is created. Shapes may encapsulate a one or more child shapes.
*/
export declare abstract class b2Shape {
readonly m_type: b2ShapeType;
/**
* Radius of a shape. For polygonal shapes this must be b2_polygonRadius. There is no support for
* making rounded polygons.
*/
m_radius: number;
constructor(type: b2ShapeType, radius: number);
/**
* Clone the concrete shape.
*/
abstract Clone(): b2Shape;
Copy(other: b2Shape): b2Shape;
/**
* Get the type of this shape. You can use this to down cast to the concrete shape.
*
* @returns The shape type.
*/
GetType(): b2ShapeType;
/**
* Get the number of child primitives.
*/
abstract GetChildCount(): number;
/**
* Test a point for containment in this shape. This only works for convex shapes.
*
* @param xf The shape world transform.
* @param p A point in world coordinates.
*/
abstract TestPoint(xf: b2Readonly<b2Transform>, p: XY): boolean;
/**
* Cast a ray against a child shape.
*
* @param output The ray-cast results.
* @param input The ray-cast input parameters.
* @param transform The transform to be applied to the shape.
* @param childIndex The child shape index
*/
abstract RayCast(output: b2RayCastOutput, input: b2RayCastInput, transform: b2Readonly<b2Transform>, childIndex: number): boolean;
/**
* Given a transform, compute the associated axis aligned bounding box for a child shape.
*
* @param aabb Returns the axis aligned box.
* @param xf The world transform of the shape.
* @param childIndex The child shape
*/
abstract ComputeAABB(aabb: b2AABB, xf: b2Readonly<b2Transform>, childIndex: number): void;
/**
* Compute the mass properties of this shape using its dimensions and density.
* The inertia tensor is computed about the local origin.
*
* @param massData Returns the mass data for this shape.
* @param density The density in kilograms per meter squared.
*/
abstract ComputeMass(massData: b2MassData, density: number): void;
abstract SetupDistanceProxy(proxy: b2DistanceProxy, index: number): void;
abstract Draw(draw: b2Draw, color: b2Color): void;
}
//# sourceMappingURL=b2_shape.d.ts.map