UNPKG

@box2d/debug-draw

Version:

Debug drawing helper for @box2d

78 lines 2.94 kB
import { b2Color, b2Draw } from "../common/b2_draw"; import { b2Vec2, b2Transform, XY } from "../common/b2_math"; import { b2Readonly } from "../common/b2_readonly"; import { b2AABB, b2Hull, b2RayCastInput, b2RayCastOutput } from "./b2_collision"; import { b2DistanceProxy } from "./b2_distance"; import { b2MassData, b2Shape } from "./b2_shape"; /** * A solid convex polygon. It is assumed that the interior of the polygon is to * the left of each edge. * Polygons have a maximum number of vertices equal to b2_maxPolygonVertices. * In most cases you should not need many vertices for a convex polygon. */ export declare class b2PolygonShape extends b2Shape { readonly m_centroid: b2Vec2; m_vertices: b2Vec2[]; m_normals: b2Vec2[]; m_count: number; constructor(); /** * Implement b2Shape. */ Clone(): b2PolygonShape; Copy(other: b2PolygonShape): b2PolygonShape; /** * @see b2Shape::GetChildCount */ GetChildCount(): number; /** * Create a convex hull from the given array of local points. * The count must be in the range [3, b2_maxPolygonVertices]. * * @warning the points may be re-ordered, even if they form a convex polygon * @warning if this fails then the polygon is invalid * @returns true if valid */ Set(vertices: XY[], count?: number): boolean; /** * Create a polygon from a given convex hull (see b2ComputeHull). * @warning the hull must be valid or this will crash or have unexpected behavior */ SetHull(hull: Readonly<b2Hull>, count: number): b2PolygonShape; /** * Build vertices to represent an axis-aligned box centered on the local origin. * * @param hx The half-width. * @param hy The half-height. * @param center The center of the box in local coordinates. * @param angle The rotation of the box in local coordinates. */ SetAsBox(hx: number, hy: number, center?: XY, angle?: number): b2PolygonShape; /** * @see b2Shape::TestPoint */ TestPoint(xf: b2Readonly<b2Transform>, p: XY): boolean; /** * Implement b2Shape. * * @note because the polygon is solid, rays that start inside do not hit because the normal is * not defined. */ RayCast(output: b2RayCastOutput, input: b2RayCastInput, xf: b2Readonly<b2Transform>, _childIndex: number): boolean; /** * @see b2Shape::ComputeAABB */ ComputeAABB(aabb: b2AABB, xf: b2Readonly<b2Transform>, _childIndex: number): void; /** * @see b2Shape::ComputeMass */ ComputeMass(massData: b2MassData, density: number): void; /** * Validate convexity. This is a very time consuming operation. * @returns true if valid */ Validate(): boolean; SetupDistanceProxy(proxy: b2DistanceProxy, _index: number): void; Draw(draw: b2Draw, color: b2Color): void; } //# sourceMappingURL=b2_polygon_shape.d.ts.map