Box2D
3.0.0
A Real-Time-Oriented 2-D Physics Engine
|
Classes | |
class | AABB |
Axis Aligned Bounding Box. More... | |
class | AllocatedArray |
Allocated Array. More... | |
class | ArrayList |
Array list. More... | |
class | BlockAllocator |
Block allocator. More... | |
struct | BlockDeallocator |
Blockl Deallocator. More... | |
class | Body |
A physical entity that exists within a World. More... | |
class | BodyAtty |
An "attorney" through which a World can get special access to a Body "client". More... | |
class | BodyConstraint |
Body Constraint. More... | |
struct | BodyDef |
Body Definition. More... | |
class | BroadPhase |
Broad phase assistant. More... | |
class | ChainShape |
Chain shape. More... | |
class | CircleShape |
Circle shape. More... | |
struct | ClipVertex |
Used for computing contact manifolds. More... | |
struct | ConstraintSolverConf |
Constraint solver configuration data. More... | |
class | Contact |
A potential contact between the chidren of two Fixture objects. More... | |
class | ContactAtty |
An "attorney" through which a World can get special access to a Contact "client". More... | |
struct | ContactFeature |
Contact Feature. More... | |
class | ContactFilter |
Implement this class to provide collision filtering. In other words, you can implement this class if you want finer control over contact creation. More... | |
struct | ContactImpulses |
class | ContactImpulsesList |
Contact Impulse. More... | |
class | ContactListener |
An interface for "listeners" for contacts. More... | |
class | DestructionListener |
Joints and fixtures are destroyed when their associated body is destroyed. Implement this listener so that you may nullify references to these joints and shapes. More... | |
struct | DistanceConf |
Distance Configuration. More... | |
class | DistanceJoint |
Distance Joint. More... | |
struct | DistanceJointDef |
Distance joint definition. This requires defining an anchor point on both bodies and the non-zero length of the distance joint. The definition uses local anchor points so that the initial configuration can violate the constraint slightly. This helps when saving and loading a game. More... | |
struct | DistanceOutput |
Distance Output. More... | |
class | DistanceProxy |
Distance Proxy. More... | |
class | DynamicTree |
A dynamic AABB tree broad-phase, inspired by Nathanael Presson's btDbvt. More... | |
class | EdgeShape |
Edge shape. More... | |
struct | Filter |
A holder for contact filtering data. More... | |
class | Fixed |
Fixed. More... | |
class | Fixture |
Fixture. More... | |
class | FixtureAtty |
Fixture Attorney. More... | |
struct | FixtureDef |
Fixture definition. More... | |
struct | FixtureProxy |
Fixture proxy. More... | |
class | FlagGuard |
class | FrictionJoint |
Friction joint. This is used for top-down friction. It provides 2D translational friction and angular friction. More... | |
struct | FrictionJointDef |
Friction joint definition. More... | |
class | GearJoint |
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. More... | |
struct | GearJointDef |
Gear joint definition. This definition requires two existing revolute or prismatic joints (any combination will work). More... | |
class | GrowableStack |
This is a growable LIFO stack with an initial capacity of N. If the stack size exceeds the initial capacity, the heap is used to increase the size of the stack. More... | |
struct | IndexPair |
Index pair. More... | |
struct | IndexPairSeparation |
Index pair separation. More... | |
struct | IndexSeparation |
Index separation. More... | |
class | InternalList |
class | Island |
Island. More... | |
class | Joint |
Base Joint class. More... | |
class | JointAtty |
struct | JointDef |
Abstract base Joint Definition class. More... | |
class | List |
struct | ListNode |
class | Manifold |
Manifold for two convex shapes. More... | |
struct | MassData |
Mass data. More... | |
struct | Mat22 |
A 2-by-2 matrix. More... | |
struct | Mat33 |
A 3-by-3 matrix. Stored in column-major order. More... | |
class | MotorJoint |
A motor joint is used to control the relative motion between two bodies. A typical usage is to control the movement of a dynamic body with respect to the ground. More... | |
struct | MotorJointDef |
Motor joint definition. More... | |
class | MouseJoint |
Mouse Joint. More... | |
struct | MouseJointDef |
Mouse joint definition. This requires a world target point, tuning parameters, and the time step. More... | |
struct | MovementConf |
class | PolygonShape |
Polygon shape. More... | |
struct | Position |
Positional data structure. More... | |
struct | PositionConstraint |
Contact Position Constraint. More... | |
struct | PositionSolution |
struct | PositionSolverManifold |
Position solver manifold. More... | |
struct | PreStepStats |
Pre-phase per-step statistics. More... | |
class | PrismaticJoint |
Prismatic Joint. More... | |
struct | PrismaticJointDef |
Prismatic joint definition. This requires defining a line of motion using an axis and an anchor point. The definition uses local anchor points and a local axis so that the initial configuration can violate the constraint slightly. The joint translation is zero when the local anchor points coincide in world space. Using local anchors and a local axis helps when saving and loading a game. More... | |
struct | Profile |
Profiling data. Times are in milliseconds. More... | |
struct | ProxyIdPair |
Proxy ID pair. More... | |
class | PulleyJoint |
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. More... | |
struct | PulleyJointDef |
Pulley joint definition. This requires two ground anchors, two dynamic body anchor points, and a pulley ratio. More... | |
class | QueryFixtureReporter |
Callback class for AABB queries. See World::Query. More... | |
class | RaiiWrapper |
class | RayCastFixtureReporter |
Callback class for ray casts. See World::RayCast. More... | |
struct | RayCastInput |
Ray-cast input data. More... | |
struct | RayCastOutput |
Ray-cast output data. More... | |
struct | RegStepStats |
Regular-phase per-step statistics. More... | |
class | RevoluteJoint |
Revolute Joint. More... | |
struct | RevoluteJointDef |
Revolute joint definition. This requires defining an anchor point where the bodies are joined. The definition uses local anchor points so that the initial configuration can violate the constraint slightly. You also need to specify the initial relative angle for joint limits. This helps when saving and loading a game. The local anchor points are measured from the body's origin rather than the center of mass because: More... | |
class | Rope |
struct | RopeDef |
class | RopeJoint |
A rope joint enforces a maximum distance between two points on two bodies. It has no other effect. Warning: if you attempt to change the maximum length during the simulation you will get some non-physical behavior. A model that would allow you to dynamically modify the length would have some sponginess, so I chose not to implement it that way. See DistanceJoint if you want to dynamically control length. More... | |
struct | RopeJointDef |
Rope joint definition. This requires two body anchor points and a maximum lengths. Note: by default the connected objects will not collide. see collideConnected in JointDef. More... | |
class | SeparationFinder |
Separation finder. More... | |
class | Shape |
Shape. More... | |
class | Simplex |
Simplex. More... | |
class | SimplexEdge |
Simplex edge. More... | |
class | Span |
class | StackAllocator |
Stack allocator. More... | |
class | StepConf |
Step configuration. More... | |
struct | StepStats |
Per-step statistics. More... | |
class | Sweep |
Sweep. More... | |
class | Timer |
Timer for profiling. This has platform specific code and may not work on every platform. More... | |
struct | ToiConf |
Time of impact configuration. More... | |
class | TOIOutput |
TimeOfImpact Output data. More... | |
struct | ToiStepStats |
TOI-phase per-step statistics. More... | |
struct | Transformation |
Transformation. More... | |
class | UnitVec2 |
struct | Vec3 |
A 2D column vector with 3 elements. More... | |
struct | Vector2D |
Vector 2D. More... | |
struct | Velocity |
Velocity related data structure. More... | |
class | VelocityConstraint |
Contact velocity constraint. More... | |
struct | Version |
Version numbering scheme. See http://en.wikipedia.org/wiki/Software_versioning. More... | |
class | VertexSet |
Vertex Set. More... | |
class | WeldJoint |
A weld joint essentially glues two bodies together. A weld joint may distort somewhat because the island constraint solver is approximate. More... | |
struct | WeldJointDef |
Weld joint definition. You need to specify local anchor points where they are attached and the relative body angle. The position of the anchor points is important for computing the reaction torque. More... | |
class | WheelJoint |
A wheel joint. This joint provides two degrees of freedom: translation along an axis fixed in bodyA and rotation in the plane. In other words, it is a point to line constraint with a rotational motor and a linear spring/damper. This joint is designed for vehicle suspensions. More... | |
struct | WheelJointDef |
Wheel joint definition. This requires defining a line of motion using an axis and an anchor point. The definition uses local anchor points and a local axis so that the initial configuration can violate the constraint slightly. The joint translation is zero when the local anchor points coincide in world space. Using local anchors and a local axis helps when saving and loading a game. More... | |
struct | Wider |
Wider. More... | |
struct | Wider< double > |
struct | Wider< Fixed32 > |
struct | Wider< float > |
struct | Wider< std::int16_t > |
struct | Wider< std::int32_t > |
struct | Wider< std::int64_t > |
struct | Wider< std::int8_t > |
struct | Wider< std::uint16_t > |
struct | Wider< std::uint32_t > |
struct | Wider< std::uint64_t > |
struct | Wider< std::uint8_t > |
struct | WitnessPoints |
Witness Points. More... | |
class | World |
World. More... | |
class | WorldManifold |
World Manifold. More... | |
struct | WorldQueryWrapper |
struct | WorldRayCastWrapper |
Enumerations | |
enum | PointState { PointState::NullState, PointState::AddState, PointState::PersistState, PointState::RemoveState } |
This is used for determining the state of contact points. More... | |
enum | BodyType { BodyType::Static = 0, BodyType::Kinematic, BodyType::Dynamic } |
Body Type. More... | |
enum | JointType { JointType::Unknown, JointType::Revolute, JointType::Prismatic, JointType::Distance, JointType::Pulley, JointType::Mouse, JointType::Gear, JointType::Wheel, JointType::Weld, JointType::Friction, JointType::Rope, JointType::Motor } |
Functions | |
template<> | |
constexpr AABB | GetInvalid () noexcept |
constexpr Length2D | GetCenter (const AABB aabb) noexcept |
Gets the center of the AABB. More... | |
constexpr Length2D | GetDimensions (const AABB aabb) noexcept |
constexpr Length2D | GetExtents (const AABB aabb) noexcept |
Gets the extents of the AABB (half-widths). More... | |
constexpr Length | GetPerimeter (const AABB aabb) noexcept |
Gets the perimeter length of the AABB. More... | |
constexpr AABB | GetEnclosingAABB (AABB a, AABB b) |
constexpr AABB | GetDisplacedAABB (AABB aabb, const Length2D displacement) |
constexpr AABB | GetFattenedAABB (AABB aabb, const Length amount) |
constexpr bool | operator== (const AABB lhs, const AABB rhs) |
constexpr bool | operator!= (const AABB lhs, const AABB rhs) |
constexpr bool | TestOverlap (const AABB a, const AABB b) noexcept |
AABB | ComputeAABB (const DistanceProxy &proxy, const Transformation xf) |
Given a transform, compute the associated axis aligned bounding box for a child shape. More... | |
AABB | ComputeAABB (const Shape &shape, const Transformation xf) |
AABB | ComputeAABB (const Body &body) |
AABB | GetAABB (const Fixture &fixture, child_count_t childIndex) noexcept |
Gets the fixture's AABB. More... | |
constexpr bool | operator== (ProxyIdPair lhs, ProxyIdPair rhs) |
constexpr bool | operator!= (ProxyIdPair lhs, ProxyIdPair rhs) |
bool | TestOverlap (const BroadPhase &bp, BroadPhase::size_type proxyIdA, BroadPhase::size_type proxyIdB) |
Manifold | CollideShapes (const DistanceProxy &shapeA, const Transformation &xfA, const DistanceProxy &shapeB, const Transformation &xfB, const Manifold::Conf conf=GetDefaultManifoldConf()) |
void | GetPointStates (PointStateArray &state1, PointStateArray &state2, const Manifold &manifold1, const Manifold &manifold2) |
Computes the point states given two manifolds. The states pertain to the transition from manifold1 to manifold2. So state1 is either persist or remove while state2 is either add or persist. More... | |
ClipList | ClipSegmentToLine (const ClipList &vIn, const UnitVec2 &normal, Length offset, ContactFeature::index_t indexA) |
Clipping for contact manifolds. More... | |
constexpr ContactFeature | GetVertexVertexContactFeature (ContactFeature::index_t a, ContactFeature::index_t b) noexcept |
constexpr ContactFeature | GetVertexFaceContactFeature (ContactFeature::index_t a, ContactFeature::index_t b) noexcept |
constexpr ContactFeature | GetFaceVertexContactFeature (ContactFeature::index_t a, ContactFeature::index_t b) noexcept |
constexpr ContactFeature | GetFaceFaceContactFeature (ContactFeature::index_t a, ContactFeature::index_t b) noexcept |
constexpr ContactFeature | Flip (ContactFeature val) noexcept |
Flips contact features information. More... | |
constexpr bool | operator== (ContactFeature lhs, ContactFeature rhs) noexcept |
constexpr bool | operator!= (ContactFeature lhs, ContactFeature rhs) noexcept |
WitnessPoints | GetWitnessPoints (const Simplex &simplex) noexcept |
Gets the witness points of the given simplex. More... | |
DistanceOutput | Distance (const DistanceProxy &proxyA, const Transformation &transformA, const DistanceProxy &proxyB, const Transformation &transformB, const DistanceConf conf=DistanceConf{}) |
Determines the closest points between two shapes. More... | |
DistanceProxy::size_type | GetSupportIndex (const DistanceProxy &proxy, const Length2D d) noexcept |
Gets the supporting vertex index in the given direction for the given distance proxy. More... | |
DistanceProxy | GetDistanceProxy (const Shape &shape, child_count_t index) |
Initialize the proxy using the given shape. More... | |
constexpr bool | operator== (IndexPair lhs, IndexPair rhs) |
constexpr bool | operator!= (IndexPair lhs, IndexPair rhs) |
constexpr Manifold::Conf | GetDefaultManifoldConf () noexcept |
bool | operator== (const Manifold::Point &lhs, const Manifold::Point &rhs) |
bool | operator!= (const Manifold::Point &lhs, const Manifold::Point &rhs) |
bool | operator== (const Manifold &lhs, const Manifold &rhs) |
Equality operator. More... | |
bool | operator!= (const Manifold &lhs, const Manifold &rhs) |
template<> | |
constexpr bool | IsValid (const Manifold &value) noexcept |
Manifold | GetManifold (const DistanceProxy &proxyA, const Transformation &transformA, const DistanceProxy &proxyB, const Transformation &transformB) |
Length2D | GetLocalPoint (const DistanceProxy &proxy, ContactFeature::Type type, ContactFeature::index_t index) |
const char * | GetName (Manifold::Type) noexcept |
Area | GetAreaOfCircle (Length radius) |
Area | GetAreaOfPolygon (Span< const Length2D > vertices) |
SecondMomentOfArea | GetPolarMoment (Span< const Length2D > vertices) |
Gets the polar moment of the area enclosed by the given vertices. More... | |
MassData | GetMassData (const Length r, const Density density, const Length2D location) |
Computes the mass data for a circular shape. More... | |
MassData | GetMassData (const Length r, const Density density, const Length2D v0, const Length2D v1) |
Computes the mass data for a linear shape. More... | |
MassData | GetMassData (const Fixture &f) |
Computes the mass data for the given fixture. More... | |
MassData | ComputeMassData (const Body &body) noexcept |
Computes the body's mass data. More... | |
RayCastOutput | RayCast (const AABB &aabb, const RayCastInput &input) |
RayCastOutput | RayCast (const Fixture &f, const RayCastInput &input, child_count_t childIndex) |
Cast a ray against the shape of the given fixture. More... | |
bool | IsLooped (const ChainShape &shape) noexcept |
child_count_t | GetNextIndex (const ChainShape &shape, child_count_t index) noexcept |
Length2D | GetEdge (const PolygonShape &shape, PolygonShape::vertex_count_t index) |
Gets the identified edge of the given polygon shape. More... | |
bool | Validate (const PolygonShape &shape) |
Validate convexity of the given shape. More... | |
void | SetAsBox (PolygonShape &shape, Length hx, Length hy, const Length2D center, Angle angle) noexcept |
Build vertices to represent an oriented box. More... | |
size_t | FindLowestRightMostVertex (Span< const Length2D > vertices) |
std::vector< Length2D > | GetConvexHullAsVector (Span< const Length2D > vertices) |
PolygonShape | Transform (PolygonShape value, Transformation xfm) noexcept |
bool | TestOverlap (const Shape &shapeA, child_count_t indexA, const Transformation &xfA, const Shape &shapeB, child_count_t indexB, const Transformation &xfB) |
Determine if two generic shapes overlap. More... | |
Length | GetVertexRadius (const Shape &shape) noexcept |
Gets the vertex radius of the given shape (in meters). More... | |
IndexPairSeparation | GetMaxSeparation (Span< const Length2D > verts1, Span< const UnitVec2 > norms1, Span< const Length2D > verts2, Length stop=MaxFloat *Meter) |
Gets the max separation information. More... | |
IndexPairSeparation | GetMaxSeparation (Span< const Length2D > verts1, Span< const UnitVec2 > norms1, const Transformation &xf1, Span< const Length2D > verts2, const Transformation &xf2, Length stop=MaxFloat *Meter) |
Gets the max separation information. More... | |
Length2D | GetScaledDelta (const Simplex &simplex, Simplex::size_type index) |
BOX2D_CONSTEXPR Length2D | GetClosestPoint (const Simplex &simplex) |
Gets the "closest point". More... | |
constexpr Length2D | GetPointDelta (const SimplexEdge &sv) |
Gets "w". More... | |
constexpr bool | operator== (const SimplexEdge &lhs, const SimplexEdge &rhs) |
constexpr bool | operator!= (const SimplexEdge &lhs, const SimplexEdge &rhs) |
TOIOutput | GetToiViaSat (const DistanceProxy &proxyA, const Sweep &sweepA, const DistanceProxy &proxyB, const Sweep &sweepB, const ToiConf conf=GetDefaultToiConf()) |
Gets the time of impact for two disjoint convex sets using the Separating Axis Theorem. More... | |
constexpr auto | GetDefaultToiConf () |
WorldManifold | GetWorldManifold (const Manifold &manifold, const Transformation &xfA, const Length radiusA, const Transformation &xfB, const Length radiusB) |
Gets the world manifold for the given data. More... | |
WorldManifold | GetWorldManifold (const Contact &contact) |
Gets the world manifold for the given data. More... | |
template<typename T , std::size_t S> | |
ArrayList< T, S > & | operator+= (ArrayList< T, S > &lhs, const typename ArrayList< T, S >::data_type &rhs) |
template<typename T , std::size_t S> | |
ArrayList< T, S > | operator+ (ArrayList< T, S > lhs, const typename ArrayList< T, S >::data_type &rhs) |
template<typename T > | |
void | Delete (const T *p, BlockAllocator &allocator) |
bool | operator== (const BlockAllocator &a, const BlockAllocator &b) |
bool | operator!= (const BlockAllocator &a, const BlockAllocator &b) |
void | Dump (const World &world) |
Dump the world into the log file. More... | |
void | Dump (const Body &body, size_t bodyIndex) |
Dump body to a log file. More... | |
void | Dump (const Joint &joint, size_t index) |
Dump joint to the log file. More... | |
void | Dump (const Fixture &fixture, size_t bodyIndex) |
Dump fixture to log file. More... | |
void | Dump (const DistanceJoint &joint, size_t index) |
Dump joint to dmLog. More... | |
void | Dump (const FrictionJoint &joint, size_t index) |
Dump joint to the log file. More... | |
void | Dump (const GearJoint &joint, size_t index) |
void | Dump (const MotorJoint &joint, size_t index) |
void | Dump (const MouseJoint &joint, size_t index) |
void | Dump (const PrismaticJoint &joint, size_t index) |
void | Dump (const PulleyJoint &joint, size_t index) |
Dump joint to dmLog. More... | |
void | Dump (const RevoluteJoint &joint, size_t index) |
void | Dump (const RopeJoint &joint, size_t index) |
void | Dump (const WeldJoint &joint, size_t index) |
void | Dump (const WheelJoint &joint, size_t index) |
constexpr Fixed32 | operator+ (Fixed32 lhs, Fixed32 rhs) noexcept |
constexpr Fixed32 | operator- (Fixed32 lhs, Fixed32 rhs) noexcept |
constexpr Fixed32 | operator* (Fixed32 lhs, Fixed32 rhs) noexcept |
constexpr Fixed32 | operator/ (Fixed32 lhs, Fixed32 rhs) noexcept |
constexpr Fixed32 | operator% (Fixed32 lhs, Fixed32 rhs) noexcept |
constexpr bool | operator== (Fixed32 lhs, Fixed32 rhs) noexcept |
constexpr bool | operator!= (Fixed32 lhs, Fixed32 rhs) noexcept |
constexpr bool | operator<= (Fixed32 lhs, Fixed32 rhs) noexcept |
constexpr bool | operator>= (Fixed32 lhs, Fixed32 rhs) noexcept |
constexpr bool | operator< (Fixed32 lhs, Fixed32 rhs) noexcept |
constexpr bool | operator> (Fixed32 lhs, Fixed32 rhs) noexcept |
template<class TYPE > | |
constexpr auto | Square (TYPE t) noexcept |
template<typename T > | |
auto | Sqrt (T t) |
template<typename T > | |
auto | Atan2 (T y, T x) |
template<typename T > | |
constexpr T | Abs (T a) |
template<typename T > | |
T | round (T value, unsigned precision=100000) |
template<> | |
float | round (float value, uint32_t precision) |
template<> | |
double | round (double value, uint32_t precision) |
template<> | |
long double | round (long double value, uint32_t precision) |
template<> | |
Fixed32 | round (Fixed32 value, uint32_t precision) |
template<> | |
Fixed64 | round (Fixed64 value, uint32_t precision) |
constexpr bool | almost_zero (float value) |
Gets whether a given value is almost zero. More... | |
constexpr bool | almost_zero (double value) |
Gets whether a given value is almost zero. More... | |
constexpr bool | almost_zero (long double value) |
Gets whether a given value is almost zero. More... | |
constexpr bool | almost_zero (Fixed32 value) |
Gets whether a given value is almost zero. More... | |
constexpr bool | almost_equal (float x, float y, int ulp=2) |
constexpr bool | almost_equal (double x, double y, int ulp=2) |
constexpr bool | almost_equal (long double x, long double y, int ulp=2) |
constexpr bool | almost_equal (Fixed32 x, Fixed32 y, int ulp=2) |
template<typename T > | |
T | Average (Span< const T > span) |
template<> | |
Vec2 | round (Vec2 value, std::uint32_t precision) |
template<class T > | |
Angle | GetAngle (T value) |
Gets the angle. More... | |
template<> | |
constexpr Vec3 | GetInvalid () noexcept |
template<typename T > | |
constexpr auto | GetLengthSquared (T value) noexcept |
Gets the square of the length/magnitude of the given value. For performance, use this instead of GetLength(T value) (if possible). More... | |
template<> | |
constexpr auto | GetLengthSquared (Vec3 value) noexcept |
template<typename T > | |
auto | GetLength (T value) |
template<> | |
constexpr bool | IsValid (const Vec3 &value) noexcept |
Does this vector contain finite coordinates? More... | |
template<typename T1 , typename T2 > | |
constexpr auto | Dot (const T1 a, const T2 b) noexcept |
Performs the dot product on two vectors (A and B). More... | |
template<> | |
constexpr auto | Dot (const Vec3 a, const Vec3 b) noexcept |
Perform the dot product on two vectors. More... | |
template<class T1 , class T2 > | |
constexpr auto | Cross (const T1 a, const T2 b) noexcept |
Performs the 2D analog of the cross product of two vectors. More... | |
template<> | |
constexpr auto | Cross (const Vec3 a, const Vec3 b) noexcept |
template<> | |
constexpr bool | IsValid (const Mat22 &value) noexcept |
template<> | |
constexpr Mat22 | GetInvalid () noexcept |
constexpr Vec2 | Solve (const Mat22 mat, const Vec2 b) noexcept |
Solve A * x = b, where b is a column vector. This is more efficient than computing the inverse in one-shot cases. More... | |
constexpr Mat22 | Invert (const Mat22 value) noexcept |
constexpr Vec3 | Solve33 (const Mat33 &mat, const Vec3 b) noexcept |
Solve A * x = b, where b is a column vector. This is more efficient than computing the inverse in one-shot cases. More... | |
constexpr Vec2 | Solve22 (const Mat33 &mat, const Vec2 b) noexcept |
Solve A * x = b, where b is a column vector. This is more efficient than computing the inverse in one-shot cases. Solve only the upper 2-by-2 matrix equation. More... | |
constexpr Mat33 | GetInverse22 (const Mat33 &value) noexcept |
Get the inverse of this matrix as a 2-by-2. Returns the zero matrix if singular. More... | |
constexpr Mat33 | GetSymInverse33 (const Mat33 &value) noexcept |
Get the symmetric inverse of this matrix as a 3-by-3. Returns the zero matrix if singular. More... | |
template<> | |
constexpr UnitVec2 | GetInvalid () noexcept |
template<> | |
constexpr bool | IsValid (const UnitVec2 &value) noexcept |
template<> | |
constexpr bool | IsValid (const Transformation &value) noexcept |
template<> | |
constexpr bool | IsValid (const Position &value) noexcept |
template<> | |
constexpr bool | IsValid (const Velocity &value) noexcept |
template<class T > | |
constexpr auto | GetRevPerpendicular (const T vector) noexcept |
Gets a vector counter-clockwise (reverse-clockwise) perpendicular to the given vector. More... | |
template<class T > | |
constexpr auto | GetFwdPerpendicular (const T vector) noexcept |
Gets a vector clockwise (forward-clockwise) perpendicular to the given vector. More... | |
constexpr Vec2 | Transform (const Vec2 v, const Mat22 &A) noexcept |
Multiply a matrix times a vector. If a rotation matrix is provided, then this transforms the vector from one frame to another. More... | |
constexpr Vec2 | InverseTransform (const Vec2 v, const Mat22 &A) noexcept |
Multiply a matrix transpose times a vector. If a rotation matrix is provided, then this transforms the vector from one frame to another (inverse transform). More... | |
constexpr Vec2 | operator+ (const UnitVec2 lhs, const UnitVec2 rhs) noexcept |
constexpr Vec2 | operator- (const UnitVec2 lhs, const UnitVec2 rhs) noexcept |
template<class T > | |
constexpr Vector2D< T > | operator* (const T s, const UnitVec2 u) noexcept |
template<class T > | |
constexpr Vector2D< T > | operator* (const UnitVec2 u, const T s) noexcept |
constexpr Vec2 | operator/ (const UnitVec2 u, const UnitVec2::data_type s) noexcept |
constexpr bool | operator== (const Vec3 lhs, const Vec3 rhs) noexcept |
constexpr bool | operator!= (const Vec3 lhs, const Vec3 rhs) noexcept |
constexpr bool | operator== (Transformation lhs, Transformation rhs) noexcept |
constexpr bool | operator!= (Transformation lhs, Transformation rhs) noexcept |
constexpr Vec3 & | operator+= (Vec3 &lhs, const Vec3 &rhs) noexcept |
constexpr Vec3 & | operator-= (Vec3 &lhs, const Vec3 &rhs) noexcept |
constexpr Vec3 & | operator*= (Vec3 &lhs, const RealNum rhs) noexcept |
constexpr Vec3 | operator* (const RealNum s, const Vec3 a) noexcept |
constexpr Vec3 | operator+ (const Vec3 a, const Vec3 b) noexcept |
Add two vectors component-wise. More... | |
constexpr Vec3 | operator- (const Vec3 a, const Vec3 b) noexcept |
Subtract two vectors component-wise. More... | |
constexpr Mat22 | operator+ (const Mat22 A, const Mat22 B) noexcept |
constexpr Mat22 | Mul (const Mat22 &A, const Mat22 &B) noexcept |
constexpr Mat22 | MulT (const Mat22 &A, const Mat22 &B) noexcept |
constexpr Vec3 | Transform (const Vec3 &v, const Mat33 &A) noexcept |
Multiply a matrix times a vector. More... | |
constexpr Vec2 | Transform (const Vec2 v, const Mat33 &A) noexcept |
Multiply a matrix times a vector. More... | |
template<class T > | |
constexpr auto | Rotate (const Vector2D< T > vector, const UnitVec2 &angle) noexcept |
Rotates a vector by a given angle. More... | |
template<class T > | |
constexpr auto | InverseRotate (const Vector2D< T > vector, const UnitVec2 &angle) noexcept |
Inverse rotate a vector. More... | |
constexpr Length2D | Transform (const Length2D v, const Transformation T) noexcept |
Transforms the given 2-D vector with the given transformation. More... | |
constexpr Length2D | InverseTransform (const Length2D v, const Transformation T) noexcept |
Inverse transforms the given 2-D vector with the given transformation. More... | |
constexpr Transformation | Mul (const Transformation &A, const Transformation &B) noexcept |
constexpr Transformation | MulT (const Transformation &A, const Transformation &B) noexcept |
template<> | |
Vec2 | Abs (Vec2 a) |
template<> | |
UnitVec2 | Abs (UnitVec2 a) |
Mat22 | Abs (const Mat22 &A) |
template<typename T > | |
constexpr T | Min (T a, T b) noexcept |
template<typename T > | |
constexpr T | Max (T a, T b) noexcept |
template<typename T > | |
constexpr T | Clamp (T value, T low, T high) noexcept |
Clamps the given value within the given range (inclusive). More... | |
template<typename T > | |
constexpr void | Swap (T &a, T &b) |
std::uint64_t | NextPowerOfTwo (std::uint64_t x) |
"Next Largest Power of 2 Given a binary integer value x, the next largest power of 2 can be computed by a SWAR algorithm that recursively "folds" the upper bits into the lower bits. This process yields a bit vector with the same most significant 1 as x, but all 1's below it. Adding 1 to that value yields the next largest power of 2. For a 64-bit value:" More... | |
constexpr bool | operator== (const Position &lhs, const Position &rhs) |
constexpr bool | operator!= (const Position &lhs, const Position &rhs) |
constexpr Position | operator- (const Position &value) |
constexpr Position | operator+ (const Position &value) |
constexpr Position & | operator+= (Position &lhs, const Position &rhs) |
constexpr Position | operator+ (const Position &lhs, const Position &rhs) |
constexpr Position & | operator-= (Position &lhs, const Position &rhs) |
constexpr Position | operator- (const Position &lhs, const Position &rhs) |
constexpr Position | operator* (const Position &pos, const RealNum scalar) |
constexpr Position | operator* (const RealNum scalar, const Position &pos) |
constexpr bool | operator== (const Velocity &lhs, const Velocity &rhs) |
constexpr bool | operator!= (const Velocity &lhs, const Velocity &rhs) |
constexpr Velocity & | operator*= (Velocity &lhs, const RealNum rhs) |
constexpr Velocity & | operator/= (Velocity &lhs, const RealNum rhs) |
constexpr Velocity & | operator+= (Velocity &lhs, const Velocity &rhs) |
constexpr Velocity | operator+ (const Velocity &lhs, const Velocity &rhs) |
constexpr Velocity & | operator-= (Velocity &lhs, const Velocity &rhs) |
constexpr Velocity | operator- (const Velocity &lhs, const Velocity &rhs) |
constexpr Velocity | operator- (const Velocity &value) |
constexpr Velocity | operator+ (const Velocity &value) |
constexpr Velocity | operator* (const Velocity &lhs, const RealNum rhs) |
constexpr Velocity | operator* (const RealNum lhs, const Velocity &rhs) |
constexpr Velocity | operator/ (const Velocity &lhs, const RealNum rhs) |
constexpr Transformation | GetTransformation (const Length2D ctr, const UnitVec2 rot, const Length2D localCtr) noexcept |
Transformation | GetTransformation (const Position pos, const Length2D local_ctr) noexcept |
Position | GetPosition (const Position pos0, const Position pos1, const RealNum beta) noexcept |
Gets the position between two positions at a given unit interval. More... | |
Transformation | GetTransformation (const Sweep &sweep, const RealNum beta) noexcept |
Gets the interpolated transform at a specific time. More... | |
Transformation | GetTransform0 (const Sweep &sweep) noexcept |
Gets the transform at "time" zero. More... | |
Transformation | GetTransform1 (const Sweep &sweep) noexcept |
Gets the transform at "time" one. More... | |
Angle | GetNormalized (Angle value) |
Sweep | GetAnglesNormalized (Sweep sweep) noexcept |
Gets a sweep with the given sweep's angles normalized. More... | |
RealNum | Normalize (Vec2 &vector) |
Converts the given vector into a unit vector and returns its original length. More... | |
bool | IsUnderActive (Velocity velocity, LinearVelocity linSleepTol, AngularVelocity angSleepTol) noexcept |
constexpr LinearVelocity2D | GetContactRelVelocity (const Velocity velA, const Length2D vcp_rA, const Velocity velB, const Length2D vcp_rB) noexcept |
Gets the contact relative velocity. More... | |
template<> | |
Vec2 | Average (Span< const Vec2 > span) |
Length2D | ComputeCentroid (const Span< const Length2D > &vertices) |
Computes the centroid of a counter-clockwise array of 3 or more vertices. More... | |
template<typename T > | |
constexpr T | GetModuloNext (T value, T count) noexcept |
template<typename T > | |
constexpr T | GetModuloPrev (T value, T count) noexcept |
constexpr Angle | GetRevRotationalAngle (Angle a1, Angle a2) noexcept |
Gets the reverse (counter) clockwise rotational angle to go from angle 1 to angle 2. More... | |
constexpr Vec2 | GetVec2 (const UnitVec2 value) |
template<class T > | |
UnitVec2 | GetUnitVector (const Vector2D< T > value, const UnitVec2 fallback=UnitVec2::GetDefaultFallback()) |
Gets the unit vector for the given value. More... | |
template<class T > | |
UnitVec2 | GetUnitVector (const Vector2D< T > value, T &magnitude, const UnitVec2 fallback=UnitVec2::GetDefaultFallback()) |
Gets the unit vector for the given value. More... | |
template<> | |
UnitVec2 | GetUnitVector (const Vector2D< RealNum > value, RealNum &magnitude, const UnitVec2 fallback) |
::std::ostream & | operator<< (::std::ostream &os, const Vec2 &value) |
::std::ostream & | operator<< (::std::ostream &os, const UnitVec2 &value) |
::std::ostream & | operator<< (::std::ostream &os, const Fixed32 &value) |
void * | alloc (size_t size) |
Implement this function to use your own memory allocator. More... | |
void * | realloc (void *ptr, size_t new_size) |
Implement this function to use your own memory allocator. More... | |
void | free (void *mem) |
If you implement alloc, you should also implement this function. More... | |
template<class... T> | |
void | NOT_USED (T &&...) |
constexpr RealNum | StripUnit (const RealNum value) |
template<typename T > | |
constexpr size_t | max_list_size () |
Maximum list size. More... | |
template<> | |
constexpr size_t | max_list_size< Body > () |
template<> | |
constexpr size_t | max_list_size< Contact > () |
template<> | |
constexpr size_t | max_list_size< Joint > () |
template<typename T > | |
constexpr T | GetInvalid () noexcept |
template<> | |
constexpr float | GetInvalid () noexcept |
template<> | |
constexpr double | GetInvalid () noexcept |
template<> | |
constexpr long double | GetInvalid () noexcept |
template<> | |
constexpr Fixed32 | GetInvalid () noexcept |
template<> | |
constexpr Fixed64 | GetInvalid () noexcept |
template<> | |
constexpr size_t | GetInvalid () noexcept |
template<typename T > | |
constexpr bool | IsValid (const T &value) noexcept |
template<> | |
constexpr bool | IsValid (const size_t &x) noexcept |
template<typename T > | |
T * | realloc (T *ptr, size_t size) |
constexpr UnitVec2 | GetXAxis (UnitVec2 rot) noexcept |
Get the x-axis. More... | |
constexpr UnitVec2 | GetYAxis (UnitVec2 rot) noexcept |
Get the u-axis ("u"??? is that a typo??? Anyway, this is the reverse perpendicular vector of rot as a directional vector) More... | |
constexpr bool | operator== (const UnitVec2 a, const UnitVec2 b) noexcept |
constexpr bool | operator!= (const UnitVec2 a, const UnitVec2 b) noexcept |
constexpr UnitVec2 | GetRevPerpendicular (const UnitVec2 vector) noexcept |
Gets a vector counter-clockwise (reverse-clockwise) perpendicular to the given vector. More... | |
constexpr UnitVec2 | GetFwdPerpendicular (const UnitVec2 vector) noexcept |
Gets a vector clockwise (forward-clockwise) perpendicular to the given vector. More... | |
constexpr UnitVec2 | Rotate (const UnitVec2 vector, const UnitVec2 &angle) noexcept |
Rotates a vector by a given angle. More... | |
constexpr UnitVec2 | InverseRotate (const UnitVec2 vector, const UnitVec2 &angle) noexcept |
Inverse rotate a vector. More... | |
constexpr UnitVec2::data_type | GetX (const UnitVec2 value) |
constexpr UnitVec2::data_type | GetY (const UnitVec2 value) |
template<typename TYPE > | |
constexpr Vector2D< TYPE >::data_type | GetX (const Vector2D< TYPE > value) |
template<typename TYPE > | |
constexpr Vector2D< TYPE >::data_type | GetY (const Vector2D< TYPE > value) |
template<typename TYPE > | |
constexpr bool | operator== (const Vector2D< TYPE > a, const Vector2D< TYPE > b) noexcept |
template<typename TYPE > | |
constexpr bool | operator!= (const Vector2D< TYPE > a, const Vector2D< TYPE > b) noexcept |
template<typename TYPE > | |
constexpr Vector2D< TYPE > | operator+ (const Vector2D< TYPE > a, const Vector2D< TYPE > b) noexcept |
Add two vectors component-wise. More... | |
template<typename TYPE > | |
constexpr Vector2D< TYPE > | operator- (const Vector2D< TYPE > a, const Vector2D< TYPE > b) noexcept |
Subtract two vectors component-wise. More... | |
template<typename TYPE > | |
constexpr Vector2D< TYPE > & | operator+= (Vector2D< TYPE > &lhs, const Vector2D< TYPE > rhs) noexcept |
Increment the left hand side value by the right hand side value. More... | |
template<typename TYPE > | |
constexpr Vector2D< TYPE > & | operator-= (Vector2D< TYPE > &lhs, const Vector2D< TYPE > rhs) noexcept |
Decrement the left hand side value by the right hand side value. More... | |
template<typename TYPE > | |
constexpr Vector2D< TYPE > & | operator*= (Vector2D< TYPE > &lhs, const RealNum rhs) noexcept |
template<typename TYPE > | |
constexpr Vector2D< TYPE > & | operator/= (Vector2D< TYPE > &lhs, const RealNum rhs) noexcept |
template<typename TYPE1 , typename TYPE2 , typename OUT_TYPE = decltype(TYPE1{0} * TYPE2{0})> | |
constexpr Vector2D< OUT_TYPE > | operator* (const TYPE1 s, const Vector2D< TYPE2 > a) noexcept |
template<typename TYPE1 , typename TYPE2 , typename OUT_TYPE = decltype(TYPE1{0} * TYPE2{0})> | |
constexpr Vector2D< OUT_TYPE > | operator* (const Vector2D< TYPE1 > a, const TYPE2 s) noexcept |
template<typename TYPE1 , typename TYPE2 , typename OUT_TYPE = decltype(TYPE1{0} / TYPE2{0})> | |
constexpr Vector2D< OUT_TYPE > | operator/ (const Vector2D< TYPE1 > a, const TYPE2 s) noexcept |
constexpr Vec2 | StripUnits (const Vector2D< RealNum > value) |
template<> | |
constexpr Vec2 | GetInvalid () noexcept |
template<typename TYPE > | |
constexpr bool | IsValid (const Vector2D< TYPE > &value) noexcept |
Does this vector contain finite coordinates? More... | |
const FixtureDef & | GetDefaultFixtureDef () noexcept |
bool | Awaken (Body &body) noexcept |
Awakens the body if it's asleep. More... | |
bool | Unawaken (Body &body) noexcept |
Puts the body to sleep if it's awake. More... | |
bool | ShouldCollide (const Body &lhs, const Body &rhs) noexcept |
Should collide. More... | |
void | DestroyFixtures (Body &body) |
Position | GetPosition1 (const Body &body) noexcept |
Mass | GetMass (const Body &body) noexcept |
Gets the total mass of the body. More... | |
void | ApplyLinearAcceleration (Body &body, const LinearAcceleration2D amount) |
void | SetForce (Body &body, const Force2D force, const Length2D point) noexcept |
void | ApplyForce (Body &body, const Force2D force, const Length2D point) noexcept |
Apply a force at a world point. More... | |
void | ApplyForceToCenter (Body &body, const Force2D force) noexcept |
Apply a force to the center of mass. More... | |
void | SetTorque (Body &body, const Torque torque) noexcept |
void | ApplyTorque (Body &body, const Torque torque) noexcept |
Apply a torque. More... | |
void | ApplyLinearImpulse (Body &body, const Momentum2D impulse, const Length2D point) noexcept |
Apply an impulse at a point. More... | |
void | ApplyAngularImpulse (Body &body, AngularMomentum impulse) noexcept |
Apply an angular impulse. More... | |
Force2D | GetCentripetalForce (const Body &body, const Length2D axis) |
RotInertia | GetRotInertia (const Body &body) noexcept |
Gets the rotational inertia of the body. More... | |
RotInertia | GetLocalInertia (const Body &body) noexcept |
Gets the rotational inertia of the body about the local origin. More... | |
MassData | GetMassData (const Body &body) noexcept |
Gets the mass data of the body. More... | |
LinearVelocity2D | GetLinearVelocity (const Body &body) noexcept |
Gets the linear velocity of the center of mass. More... | |
AngularVelocity | GetAngularVelocity (const Body &body) noexcept |
Gets the angular velocity. More... | |
void | SetLinearVelocity (Body &body, const LinearVelocity2D v) noexcept |
Sets the linear velocity of the center of mass. More... | |
void | SetAngularVelocity (Body &body, AngularVelocity omega) noexcept |
Sets the angular velocity. More... | |
Length2D | GetWorldPoint (const Body &body, const Length2D localPoint) noexcept |
Gets the world coordinates of a point given in coordinates relative to the body's origin. More... | |
Length2D | GetWorldVector (const Body &body, const Length2D localVector) noexcept |
Gets the world coordinates of a vector given the local coordinates. More... | |
UnitVec2 | GetWorldVector (const Body &body, const UnitVec2 localVector) noexcept |
Length2D | GetLocalPoint (const Body &body, const Length2D worldPoint) noexcept |
Gets a local point relative to the body's origin given a world point. More... | |
UnitVec2 | GetLocalVector (const Body &body, const UnitVec2 uv) noexcept |
Gets a locally oriented unit vector given a world oriented unit vector. More... | |
LinearVelocity2D | GetLinearVelocityFromWorldPoint (const Body &body, const Length2D worldPoint) noexcept |
Gets the linear velocity from a world point attached to this body. More... | |
LinearVelocity2D | GetLinearVelocityFromLocalPoint (const Body &body, const Length2D localPoint) noexcept |
Gets the linear velocity from a local point. More... | |
Force2D | GetForce (const Body &body) noexcept |
Torque | GetTorque (const Body &body) noexcept |
Velocity | GetVelocity (const Body &body, Time h) noexcept |
Gets the velocity of the body after the given time accounting for the body's acceleration. More... | |
size_t | GetWorldIndex (const Body *body) |
size_t | GetFixtureCount (const Body &body) |
void | RotateAboutWorldPoint (Body &body, Angle amount, Length2D worldPoint) |
Rotates a body a given amount around a point in world coordinates. More... | |
void | RotateAboutLocalPoint (Body &body, Angle amount, Length2D localPoint) |
Rotates a body a given amount around a point in body local coordinates. More... | |
BodyConstraint | GetBodyConstraint (const Body &body, Time time=0) noexcept |
RealNum | MixFriction (RealNum friction1, RealNum friction2) |
Friction mixing law. The idea is to allow either fixture to drive the resulting friction to zero. For example, anything slides on ice. More... | |
RealNum | MixRestitution (RealNum restitution1, RealNum restitution2) noexcept |
Restitution mixing law. The idea is allow for anything to bounce off an inelastic surface. For example, a superball bounces on anything. More... | |
bool | HasSensor (const Contact &contact) noexcept |
bool | IsImpenetrable (const Contact &contact) noexcept |
void | SetAwake (Contact &c) noexcept |
void | ResetFriction (Contact &contact) |
Resets the friction mixture to the default value. More... | |
void | ResetRestitution (Contact &contact) noexcept |
Reset the restitution to the default value. More... | |
TOIOutput | CalcToi (const Contact &contact, const ToiConf conf) |
PositionSolution | operator+ (PositionSolution lhs, PositionSolution rhs) |
PositionSolution | operator- (PositionSolution lhs, PositionSolution rhs) |
PositionSolution | SolvePositionConstraint (const PositionConstraint &pc, const bool moveA, const bool moveB, ConstraintSolverConf conf) |
Solves the given position constraint. More... | |
ConstraintSolverConf | GetDefaultPositionSolverConf () |
Length | SolvePositionConstraints (Span< PositionConstraint > positionConstraints, ConstraintSolverConf conf=GetDefaultPositionSolverConf()) |
Solves the given position constraints. More... | |
ConstraintSolverConf | GetDefaultToiPositionSolverConf () |
Length | SolvePositionConstraints (Span< PositionConstraint > positionConstraints, const BodyConstraint *bodiesA, const BodyConstraint *bodiesB, ConstraintSolverConf conf=GetDefaultToiPositionSolverConf()) |
Solves the given position constraints. More... | |
Momentum | SolveVelocityConstraint (VelocityConstraint &vc) |
Solves the velocity constraint. More... | |
PositionSolverManifold | GetPSM (const Manifold &manifold, Manifold::size_type index, const Transformation &xfA, const Transformation &xfB) |
Gets the normal-point-separation data in world coordinates for the given inputs. More... | |
PositionSolverManifold | GetPSM (const Manifold &manifold, Manifold::size_type index, Position pos_a, Length2D lc_ctr_a, Position pos_b, Length2D lc_ctr_b) |
Gets the normal-point-separation data in world coordinates for the given inputs. More... | |
UnitVec2 | GetNormal (const VelocityConstraint &vc) noexcept |
Gets the normal of the velocity constraint contact in world coordinates. More... | |
UnitVec2 | GetTangent (const VelocityConstraint &vc) noexcept |
InvMass | GetInvMass (const VelocityConstraint &vc) noexcept |
Length2D | GetPointRelPosA (const VelocityConstraint &vc, VelocityConstraint::size_type index) |
Length2D | GetPointRelPosB (const VelocityConstraint &vc, VelocityConstraint::size_type index) |
LinearVelocity | GetVelocityBiasAtPoint (const VelocityConstraint &vc, VelocityConstraint::size_type index) |
Mass | GetNormalMassAtPoint (const VelocityConstraint &vc, VelocityConstraint::size_type index) |
Mass | GetTangentMassAtPoint (const VelocityConstraint &vc, VelocityConstraint::size_type index) |
Momentum | GetNormalImpulseAtPoint (const VelocityConstraint &vc, VelocityConstraint::size_type index) |
Momentum | GetTangentImpulseAtPoint (const VelocityConstraint &vc, VelocityConstraint::size_type index) |
Momentum2D | GetNormalImpulses (const VelocityConstraint &vc) |
Momentum2D | GetTangentImpulses (const VelocityConstraint &vc) |
void | SetNormalImpulseAtPoint (VelocityConstraint &vc, VelocityConstraint::size_type index, Momentum value) |
void | SetTangentImpulseAtPoint (VelocityConstraint &vc, VelocityConstraint::size_type index, Momentum value) |
void | SetNormalImpulses (VelocityConstraint &vc, const Momentum2D impulses) |
void | SetTangentImpulses (VelocityConstraint &vc, const Momentum2D impulses) |
bool | TestPoint (const Fixture &f, const Length2D p) noexcept |
Test a point for containment in a fixture. More... | |
void | SetAwake (Fixture &f) noexcept |
Sets the associated body's sleep status to awake. More... | |
Transformation | GetTransformation (const Fixture &f) noexcept |
Gets the transformation associated with the given fixture. More... | |
bool | IsFullOfBodies (const Island &island) |
bool | IsFullOfContacts (const Island &island) |
std::size_t | Count (const Island &island, const Body *entry) |
std::size_t | Count (const Island &island, const Contact *entry) |
std::size_t | Count (const Island &island, const Joint *entry) |
bool | IsEnabled (const Joint &j) noexcept |
Short-cut function to determine if both bodies are enabled. More... | |
void | SetAwake (Joint &j) noexcept |
size_t | GetWorldIndex (const Joint *joint) |
Length | GetCurrentLengthA (const PulleyJoint &joint) |
Get the current length of the segment attached to bodyA. More... | |
Length | GetCurrentLengthB (const PulleyJoint &joint) |
Get the current length of the segment attached to bodyB. More... | |
Angle | GetJointAngle (const RevoluteJoint &joint) |
Get the current joint angle in radians. More... | |
AngularVelocity | GetJointSpeed (const RevoluteJoint &joint) |
Get the current joint angle speed in radians per second. More... | |
Length | GetMaxRegLinearCorrection (const StepConf &conf) noexcept |
bool | IsMaxTranslationWithinTolerance (const StepConf &conf) noexcept |
StepStats | Step (World &world, Time timeStep, World::ts_iters_type velocityIterations=8, World::ts_iters_type positionIterations=3) |
Steps the world ahead by a given time amount. More... | |
size_t | GetFixtureCount (const World &world) noexcept |
Gets the count of fixtures in the given world. More... | |
size_t | GetShapeCount (const World &world) noexcept |
Gets the count of unique shapes in the given world. More... | |
size_t | GetAwakeCount (const World &world) noexcept |
Gets the count of awake bodies in the given world. More... | |
size_t | Awaken (World &world) |
Awakens all of the bodies in the given world. More... | |
void | ClearForces (World &world) noexcept |
Clears forces. More... | |
bool | IsActive (const Contact &contact) noexcept |
World::Bodies::size_type | GetBodyCount (const World &world) noexcept |
Gets the body count in the given world. More... | |
joint_count_t | GetJointCount (const World &world) noexcept |
Gets the count of joints in the given world. More... | |
World::Contacts::size_type | GetContactCount (const World &world) noexcept |
Gets the count of contacts in the given world. More... | |
Variables | |
constexpr auto | Vec2_zero = Vec2{0, 0} |
An all zero Vec2 value. More... | |
constexpr auto | Vec3_zero = Vec3{0, 0, 0} |
An all zero Vec3 value. More... | |
constexpr auto | Mat22_zero = Mat22(Vec2_zero, Vec2_zero) |
An all zero Mat22 value. More... | |
constexpr auto | Mat22_identity = Mat22(Vec2{1, 0}, Vec2{0, 1}) |
Identity value for Mat22 objects. More... | |
constexpr auto | Mat33_zero = Mat33(Vec3_zero, Vec3_zero, Vec3_zero) |
constexpr auto | Transform_identity = Transformation{Vec2_zero * Meter, UnitVec2::GetRight()} |
constexpr auto | Pi = RealNum(3.14159265358979323846264338327950288) |
Pi. More... | |
constexpr auto | Second = RealNum{1} |
constexpr auto | Hertz = RealNum{1} |
constexpr auto | Meter = RealNum{1} |
constexpr auto | MeterPerSecond = RealNum{1} |
constexpr auto | MeterPerSquareSecond = RealNum{1} |
constexpr auto | Kilogram = RealNum{1} |
constexpr auto | SquareMeter = RealNum{1} |
constexpr auto | KilogramPerSquareMeter = RealNum{1} |
constexpr auto | Radian = RealNum{1} |
constexpr auto | Degree = Pi / RealNum{180} |
constexpr auto | SquareRadian = Radian * Radian |
constexpr auto | RadianPerSecond = RealNum{1} |
constexpr auto | RadianPerSquareSecond = RealNum{1} |
constexpr auto | Newton = RealNum{1} |
constexpr auto | NewtonMeter = RealNum{1} |
constexpr auto | NewtonSecond = RealNum{1} |
constexpr auto | MaxFloat = std::numeric_limits<RealNum>::max() |
constexpr auto | MaxManifoldPoints = std::uint8_t{2} |
Maximum manifold points. This is the maximum number of contact points between two convex shapes. Do not change this value. More... | |
constexpr auto | MaxShapeVertices = std::uint8_t{254} |
Maximum number of vertices for any shape type. More... | |
constexpr auto | DefaultLinearSlop = Length{Meter / RealNum{1000}} |
Default linear slop. More... | |
constexpr auto | DefaultAabbExtension = DefaultLinearSlop * RealNum{20} |
constexpr auto | DefaultDistanceMultiplier = RealNum{2} |
constexpr auto | DefaultAngularSlop = (Pi * RealNum{2} * Radian) / RealNum{180} |
Default angular slop. More... | |
constexpr auto | DefaultMaxLinearCorrection = DefaultLinearSlop * RealNum{40} |
Default maximum linear correction. More... | |
constexpr auto | DefaultMaxAngularCorrection = DefaultAngularSlop * RealNum{4} |
Default maximum angular correction. More... | |
constexpr auto | DefaultMaxToiIters = std::uint8_t{20} |
Default maximum time of impact iterations. More... | |
constexpr auto | DefaultMaxToiRootIters = std::uint8_t{30} |
Default maximum time of impact root iterator count. More... | |
constexpr auto | DefaultMaxDistanceIters = std::uint8_t{20} |
Default max number of distance iterations. More... | |
constexpr auto | DefaultMaxSubSteps = std::uint8_t{48} |
Default maximum number of sub steps. More... | |
constexpr auto | DefaultVelocityThreshold = (RealNum{8} / RealNum{10}) * MeterPerSecond |
Default velocity threshold. More... | |
constexpr auto | MaxBodies |
Maximum number of bodies in a world (65534 based off uint16_t and eliminating one value for invalid). More... | |
constexpr auto | MaxContacts = contact_count_t{MaxBodies} * contact_count_t{MaxBodies - 1} / contact_count_t{2} |
Maximum number of contacts in a world (2147319811). More... | |
constexpr auto | MaxJoints |
Maximum number of joints in a world (65534 based off std::uint16_t and eliminating one value for invalid). More... | |
constexpr auto | DefaultStepTime = Time{Second / RealNum{60}} |
constexpr auto | DefaultStepFrequency = Frequency{Hertz * RealNum{60}} |
constexpr auto | DefaultMinStillTimeToSleep = Time{Second / RealNum{2}} |
Default minimum still time to sleep. More... | |
constexpr auto | DefaultLinearSleepTolerance = RealNum{0.01f} * MeterPerSecond |
Default linear sleep tolerance. More... | |
constexpr auto | DefaultAngularSleepTolerance = RealNum{(Pi * 2) / 180} * RadianPerSecond |
Default angular sleep tolerance. More... | |
constexpr auto | BuiltVersion = Version{3, 0, 0} |
constexpr auto | EarthlyGravity = LinearAcceleration2D{RealNum{0} * MeterPerSquareSecond, RealNum{-9.8f} * MeterPerSquareSecond} |
Earthly gravity. More... | |
Namespace for all Box2D related names.
using box2d::Angle = typedef RealNum |
using box2d::AngularAcceleration = typedef RealNum |
using box2d::AngularMomentum = typedef RealNum |
using box2d::AngularVelocity = typedef RealNum |
using box2d::Area = typedef RealNum |
using box2d::body_count_t = typedef std::remove_const<decltype(MaxBodies)>::type |
Body count type.
typedef std::unordered_map< const Body *, BodyConstraint > box2d::BodyConstraints |
using box2d::child_count_t = typedef unsigned |
Child count type.
Relating to "children" of Shape.
using box2d::ClipList = typedef ArrayList<ClipVertex, MaxManifoldPoints> |
Clip list for ClipSegmentToLine.
using box2d::contact_count_t = typedef Wider<body_count_t>::type |
Contact count type.
using box2d::Density = typedef RealNum |
using box2d::Fixed32 = typedef Fixed<std::int32_t,14> |
using box2d::Fixed64 = typedef Fixed<std::int64_t,24> |
using box2d::Force = typedef RealNum |
using box2d::Force2D = typedef Vector2D<Force> |
using box2d::Frequency = typedef RealNum |
using box2d::InvMass = typedef RealNum |
using box2d::InvRotInertia = typedef RealNum |
using box2d::island_count_t = typedef size_t |
using box2d::joint_count_t = typedef std::remove_const<decltype(MaxJoints)>::type |
Joint count type.
using box2d::Length = typedef RealNum |
using box2d::Length2D = typedef Vector2D<Length> |
using box2d::LinearAcceleration = typedef RealNum |
using box2d::LinearAcceleration2D = typedef Vector2D<LinearAcceleration> |
using box2d::LinearVelocity = typedef RealNum |
using box2d::LinearVelocity2D = typedef Vector2D<LinearVelocity> |
using box2d::Mass = typedef RealNum |
using box2d::Momentum = typedef RealNum |
using box2d::Momentum2D = typedef Vector2D<Momentum> |
using box2d::PointStateArray = typedef std::array<PointState,MaxManifoldPoints> |
using box2d::PositionConstraints = typedef std::vector<PositionConstraint> |
using box2d::RealNum = typedef float |
Real-number type.
This is the number type underlying numerical calculations conceptually involving real-numbers. Ideally the implementation of this type doesn't suffer from things like: catastrophic cancellation, catastrophic division, overflows, nor underflows.
While dividing 1 by a RealNum, caching the result, and then doing multiplications with the result may well be faster (than repeatedly dividing), dividing 1 by RealNum can also result in an underflow situation that's then compounded every time it's multiplied with other values.
Meanwhile, dividing every value by RealNum isolates any underflows to the particular division where underflow occurs.
using box2d::RotInertia = typedef RealNum |
using box2d::SecondMomentOfArea = typedef RealNum |
using box2d::size_t = typedef std::size_t |
Size type for sizing data.
using box2d::Time = typedef RealNum |
using box2d::Torque = typedef RealNum |
using box2d::ts_iters_t = typedef std::uint8_t |
Time step iterations type.
A type for countining iterations per time-step.
using box2d::Vec2 = typedef Vector2D<RealNum> |
Vector 2D of RealNum.
RealNum
type (or 8 using RealNum of float). using box2d::VelocityConstraints = typedef std::vector<VelocityConstraint> |
|
strong |
Body Type.
|
strong |
|
strong |
|
inline |
T * box2d::alloc | ( | size_t | size | ) |
Implement this function to use your own memory allocator.
|
inline |
|
inline |
|
inline |
|
inline |
Gets whether a given value is almost zero.
An almost zero value is "subnormal". Dividing by these values can lead to odd results like a divide by zero trap occuring.
true
if the given value is almost zero, false
otherwise.
|
inline |
Gets whether a given value is almost zero.
An almost zero value is "subnormal". Dividing by these values can lead to odd results like a divide by zero trap occuring.
true
if the given value is almost zero, false
otherwise.
|
inline |
Gets whether a given value is almost zero.
An almost zero value is "subnormal". Dividing by these values can lead to odd results like a divide by zero trap occuring.
true
if the given value is almost zero, false
otherwise.
|
inline |
Gets whether a given value is almost zero.
An almost zero value is "subnormal". Dividing by these values can lead to odd results like a divide by zero trap occuring.
true
if the given value is almost zero, false
otherwise.
|
inlinenoexcept |
Apply an angular impulse.
body | Body to apply the angular impulse to. |
impulse | the angular impulse in units of kg*m*m/s |
Apply a force at a world point.
|
inline |
|
inlinenoexcept |
Apply an impulse at a point.
body | Body to apply the impulse to. |
impulse | the world impulse vector, usually in N-seconds or kg-m/s. |
point | the world position of the point of application. |
Apply a torque.
body | Body to apply the torque to. |
torque | about the z-axis (out of the screen), usually in N-m. |
|
inline |
|
inline |
|
inlinenoexcept |
Awakens the body if it's asleep.
Awakens all of the bodies in the given world.
Calls all of the world's bodies' SetAwake
method.
SetAwake
method that returned true.
|
inlinenoexcept |
Clamps the given value within the given range (inclusive).
value | Value to clamp. |
low | Lowest value to return or NaN to keep the low-end unbounded. |
high | Highest value to return or NaN to keep the high-end unbounded. |
|
noexcept |
Clears forces.
Manually clear the force buffer on all bodies.
ClipList box2d::ClipSegmentToLine | ( | const ClipList & | vIn, |
const UnitVec2 & | normal, | ||
Length | offset, | ||
ContactFeature::index_t | indexA | ||
) |
Clipping for contact manifolds.
This returns an array of points from the given line that are inside of the plane as defined by a given normal and offset.
vIn | Clip list of two points defining the line. |
normal | Normal of the plane with which to determine intersection. |
offset | Offset of the plane with which to determine intersection. |
indexA | Index of vertex A. |
Manifold box2d::CollideShapes | ( | const DistanceProxy & | shapeA, |
const Transformation & | xfA, | ||
const DistanceProxy & | shapeB, | ||
const Transformation & | xfB, | ||
const Manifold::Conf | conf = GetDefaultManifoldConf() |
||
) |
AABB box2d::ComputeAABB | ( | const DistanceProxy & | proxy, |
const Transformation | xf | ||
) |
Given a transform, compute the associated axis aligned bounding box for a child shape.
proxy | Distance proxy for the child shape. |
xf | World transform of the shape. |
AABB box2d::ComputeAABB | ( | const Shape & | shape, |
const Transformation | xf | ||
) |
Computes the centroid of a counter-clockwise array of 3 or more vertices.
Computes the body's mass data.
This basically accumulates the mass data over all fixtures.
|
inlinenoexcept |
Performs the 2D analog of the cross product of two vectors.
This is defined as the result of: (a.x * b.y) - (a.y * b.x)
.
a | Vector A. |
b | Vector B. |
|
inline |
void box2d::DestroyFixtures | ( | Body & | body | ) |
DistanceOutput box2d::Distance | ( | const DistanceProxy & | proxyA, |
const Transformation & | transformA, | ||
const DistanceProxy & | proxyB, | ||
const Transformation & | transformB, | ||
const DistanceConf | conf = DistanceConf{} |
||
) |
Determines the closest points between two shapes.
Supports any combination of: CircleShape, PolygonShape, EdgeShape. The simplex cache is input/output.
proxyA | Proxy A. |
transformA | Transoform of A. |
proxyB | Proxy B. |
transformB | Transoform of B. |
conf | Configuration to use including the simplex cache for assisting the determination. |
DefaultMaxDistanceIters
is zero.
|
inlinenoexcept |
Performs the dot product on two vectors (A and B).
The dot product of two vectors is defined as: the magnitude of vector A, mulitiplied by, the magnitude of vector B, multiplied by, the cosine of the angle between the two vectors (A and B). Thus the dot product of two vectors is a value ranging between plus and minus the magnitudes of each vector times each other. The middle value of 0 indicates that two vectors are perpendicular to each other (at an angle of +/- 90 degrees from each other).
a | Vector A. |
b | Vector B. |
Perform the dot product on two vectors.
void box2d::Dump | ( | const World & | world | ) |
Dump the world into the log file.
void box2d::Dump | ( | const DistanceJoint & | joint, |
size_t | index | ||
) |
Dump joint to dmLog.
void box2d::Dump | ( | const FrictionJoint & | joint, |
size_t | index | ||
) |
Dump joint to the log file.
void box2d::Dump | ( | const MotorJoint & | joint, |
size_t | index | ||
) |
void box2d::Dump | ( | const MouseJoint & | joint, |
size_t | index | ||
) |
void box2d::Dump | ( | const PrismaticJoint & | joint, |
size_t | index | ||
) |
void box2d::Dump | ( | const PulleyJoint & | joint, |
size_t | index | ||
) |
Dump joint to dmLog.
void box2d::Dump | ( | const RevoluteJoint & | joint, |
size_t | index | ||
) |
void box2d::Dump | ( | const WheelJoint & | joint, |
size_t | index | ||
) |
|
noexcept |
Flips contact features information.
void box2d::free | ( | void * | mem | ) |
If you implement alloc, you should also implement this function.
|
noexcept |
Gets the fixture's AABB.
|
inline |
Gets the angle.
|
inlinenoexcept |
Gets the angular velocity.
body | Body to get the angular velocity for. |
Gets the count of awake bodies in the given world.
|
noexcept |
|
inlinenoexcept |
Gets the body count in the given world.
|
inline |
Gets the "closest point".
|
inlinenoexcept |
Gets the count of contacts in the given world.
|
inlinenoexcept |
Gets the contact relative velocity.
Length box2d::GetCurrentLengthA | ( | const PulleyJoint & | joint | ) |
Get the current length of the segment attached to bodyA.
Length box2d::GetCurrentLengthB | ( | const PulleyJoint & | joint | ) |
Get the current length of the segment attached to bodyB.
|
noexcept |
|
inlinenoexcept |
|
inline |
constexpr auto box2d::GetDefaultToiConf | ( | ) |
|
inline |
DistanceProxy box2d::GetDistanceProxy | ( | const Shape & | shape, |
child_count_t | index | ||
) |
Initialize the proxy using the given shape.
Length2D box2d::GetEdge | ( | const PolygonShape & | shape, |
PolygonShape::vertex_count_t | index | ||
) |
Gets the identified edge of the given polygon shape.
Gets the extents of the AABB (half-widths).
|
noexcept |
|
noexcept |
Gets the count of fixtures in the given world.
Gets a vector clockwise (forward-clockwise) perpendicular to the given vector.
This takes a vector of form (x, y) and returns the vector (y, -x).
vector | Vector to return a clockwise perpendicular equivalent for. |
|
inlinenoexcept |
Gets a vector clockwise (forward-clockwise) perpendicular to the given vector.
This takes a vector of form (x, y) and returns the vector (y, -x).
vector | Vector to return a clockwise perpendicular equivalent for. |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Get the inverse of this matrix as a 2-by-2. Returns the zero matrix if singular.
|
inlinenoexcept |
Angle box2d::GetJointAngle | ( | const RevoluteJoint & | joint | ) |
Get the current joint angle in radians.
|
inlinenoexcept |
Gets the count of joints in the given world.
AngularVelocity box2d::GetJointSpeed | ( | const RevoluteJoint & | joint | ) |
Get the current joint angle speed in radians per second.
|
inline |
|
inlinenoexcept |
Gets the square of the length/magnitude of the given value. For performance, use this instead of GetLength(T value) (if possible).
|
inlinenoexcept |
|
inlinenoexcept |
Gets the linear velocity of the center of mass.
body | Body to get the linear velocity for. |
|
inlinenoexcept |
Gets the linear velocity from a local point.
body | Body to get the linear velocity for. |
localPoint | point in local coordinates. |
|
inlinenoexcept |
Gets the linear velocity from a world point attached to this body.
body | Body to get the linear velocity for. |
worldPoint | point in world coordinates. |
|
inlinenoexcept |
Gets the rotational inertia of the body about the local origin.
Length2D box2d::GetLocalPoint | ( | const DistanceProxy & | proxy, |
ContactFeature::Type | type, | ||
ContactFeature::index_t | index | ||
) |
Gets a local point relative to the body's origin given a world point.
body | Body that the returned point should be relative to. |
worldPoint | point in world coordinates. |
Gets a locally oriented unit vector given a world oriented unit vector.
body | Body that the returned vector should be relative to. |
uv | Unit vector in world orientation. |
Manifold box2d::GetManifold | ( | const DistanceProxy & | proxyA, |
const Transformation & | transformA, | ||
const DistanceProxy & | proxyB, | ||
const Transformation & | transformB | ||
) |
Gets the total mass of the body.
Computes the mass data for a circular shape.
r | Radius of the circlular shape. |
density | Areal density of mass. |
location | Location of the center of the shape. |
MassData box2d::GetMassData | ( | const Length | r, |
const Density | density, | ||
const Length2D | v0, | ||
const Length2D | v1 | ||
) |
Computes the mass data for a linear shape.
r | Radius of the vertices of the linear shape. |
density | Areal density of mass. |
v0 | Location of vertex zero. |
v1 | Location of vertex one. |
Use the fixture's areal mass density times the shape's second moment of area to derive I.
Computes the mass data for the given fixture.
The mass data is based on the density and the shape of the fixture. The rotational inertia is about the shape's origin.
f | Fixture to compute the mass data for. |
Gets the mass data of the body.
IndexPairSeparation box2d::GetMaxSeparation | ( | Span< const Length2D > | verts1, |
Span< const UnitVec2 > | norms1, | ||
Span< const Length2D > | verts2, | ||
Length | stop = MaxFloat * Meter |
||
) |
Gets the max separation information.
verts1
and norms1
, the index of the vertex from verts2
(that had the maximum separation distance from each other in the direction of that normal), and the maximal distance. IndexPairSeparation box2d::GetMaxSeparation | ( | Span< const Length2D > | verts1, |
Span< const UnitVec2 > | norms1, | ||
const Transformation & | xf1, | ||
Span< const Length2D > | verts2, | ||
const Transformation & | xf2, | ||
Length | stop = MaxFloat * Meter |
||
) |
Gets the max separation information.
verts1
and norms1
, the index of the vertex from verts2
(that had the maximum separation distance from each other in the direction of that normal), and the maximal distance.
|
inlinenoexcept |
|
inlinenoexcept |
|
noexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Gets the normal of the velocity constraint contact in world coordinates.
SetNormal
method.
|
inline |
|
inline |
|
inline |
Gets the perimeter length of the AABB.
|
inline |
Gets "w".
|
inline |
|
inline |
void box2d::GetPointStates | ( | PointStateArray & | state1, |
PointStateArray & | state2, | ||
const Manifold & | manifold1, | ||
const Manifold & | manifold2 | ||
) |
Computes the point states given two manifolds. The states pertain to the transition from manifold1 to manifold2. So state1 is either persist or remove while state2 is either add or persist.
SecondMomentOfArea box2d::GetPolarMoment | ( | Span< const Length2D > | vertices | ) |
Gets the polar moment of the area enclosed by the given vertices.
vertices | Collection of three or more vertices. |
|
inlinenoexcept |
Gets the position between two positions at a given unit interval.
pos0 | Position at unit interval value of 0. |
pos1 | Position at unit interval value of 1. |
beta | Unit interval (value between 0 and 1) of travel between pos0 and pos1. |
|
inline |
Gets the normal-point-separation data in world coordinates for the given inputs.
PositionSolverManifold box2d::GetPSM | ( | const Manifold & | manifold, |
Manifold::size_type | index, | ||
const Transformation & | xfA, | ||
const Transformation & | xfB | ||
) |
Gets the normal-point-separation data in world coordinates for the given inputs.
Gets a vector counter-clockwise (reverse-clockwise) perpendicular to the given vector.
This takes a vector of form (x, y) and returns the vector (-y, x).
vector | Vector to return a counter-clockwise perpendicular equivalent for. |
|
inlinenoexcept |
Gets a vector counter-clockwise (reverse-clockwise) perpendicular to the given vector.
This takes a vector of form (x, y) and returns the vector (-y, x).
vector | Vector to return a counter-clockwise perpendicular equivalent for. |
Gets the reverse (counter) clockwise rotational angle to go from angle 1 to angle 2.
|
inlinenoexcept |
Gets the rotational inertia of the body.
body | Body to get the rotational inertia for. |
|
inline |
Gets the count of unique shapes in the given world.
|
noexcept |
Gets the supporting vertex index in the given direction for the given distance proxy.
This finds the vertex that's most significantly in the direction of the given vector and returns its index.
proxy | Distance proxy object to find index in if a valid index exists for it. |
d | Direction vector to find index for. |
< Index of vertex that when dotted with d has the max value.
< Max dot value.
Get the symmetric inverse of this matrix as a 3-by-3. Returns the zero matrix if singular.
|
inlinenoexcept |
|
inline |
|
inline |
|
inline |
TOIOutput box2d::GetToiViaSat | ( | const DistanceProxy & | proxyA, |
const Sweep & | sweepA, | ||
const DistanceProxy & | proxyB, | ||
const Sweep & | sweepB, | ||
const ToiConf | conf = GetDefaultToiConf() |
||
) |
Gets the time of impact for two disjoint convex sets using the Separating Axis Theorem.
Computes the upper bound on time before two shapes penetrate too much. Time is represented as a fraction between [0,tMax]. This uses a swept separating axis and may miss some intermediate, non-tunneling collision. If you change the time interval, you should call this function again.
proxyA | Proxy A. The proxy's vertex count must be 1 or more. |
sweepA | Sweep A. Sweep of motion for shape represented by proxy A. |
proxyB | Proxy B. The proxy's vertex count must be 1 or more. |
sweepB | Sweep B. Sweep of motion for shape represented by proxy B. |
conf | Configuration details for on calculation. Like the targetted depth of penetration. |
|
inlinenoexcept |
Gets the transform at "time" zero.
sweep | Sweep data to get the transform from. |
|
inlinenoexcept |
Gets the transform at "time" one.
sweep | Sweep data to get the transform from. |
|
noexcept |
Gets the transformation associated with the given fixture.
nullptr
as its associated body.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Gets the interpolated transform at a specific time.
sweep | Sweep data to get the transform from. |
beta | Time factor in [0,1], where 0 indicates alpha0. |
|
inline |
Gets the unit vector for the given value.
value | Value to get the unit vector for. |
fallback | Fallback unit vector value to use in case a unit vector can't effectively be calculated from the given value. |
|
inline |
Gets the unit vector for the given value.
value | Value to get the unit vector for. |
magnitude | Returns the calculated magnitude of the given vector. |
fallback | Fallback unit vector value to use in case a unit vector can't effectively be calculated from the given value. |
|
inline |
Gets the velocity of the body after the given time accounting for the body's acceleration.
body | Body to get the velocity for. |
h | Time elapsed to get velocity for. Behavior is undefined if this value is invalid. |
|
inline |
|
noexcept |
Gets the vertex radius of the given shape (in meters).
Gets the radius (in meters) of every vertex of this shape. This is used for collision handling.
|
noexcept |
|
noexcept |
Gets the witness points of the given simplex.
box2d::size_t box2d::GetWorldIndex | ( | const Body * | body | ) |
WorldManifold box2d::GetWorldManifold | ( | const Manifold & | manifold, |
const Transformation & | xfA, | ||
const Length | radiusA, | ||
const Transformation & | xfB, | ||
const Length | radiusB | ||
) |
Gets the world manifold for the given data.
manifold | Manifold to use. Uses the manifold's type, local point, local normal, point-count, and the indexed-points' local point data. |
xfA | Transformation A. |
radiusA | Radius of shape A. |
xfB | Transformation B. |
radiusB | Radius of shape B. |
WorldManifold box2d::GetWorldManifold | ( | const Contact & | contact | ) |
Gets the world manifold for the given data.
GetWorldManifold(const Manifold&, const Transformation&, const RealNum, const Transformation& xfB, const RealNum)
function.contact | Contact to return a world manifold for. |
Gets the world coordinates of a point given in coordinates relative to the body's origin.
body | Body that the given point is relative to. |
localPoint | a point measured relative the the body's origin. |
Gets the world coordinates of a vector given the local coordinates.
body | Body that the given vector is relative to. |
localVector | a vector fixed in the body. |
|
inline |
|
inline |
|
inline |
|
inline |
Get the u-axis ("u"??? is that a typo??? Anyway, this is the reverse perpendicular vector of rot as a directional vector)
|
noexcept |
|
inlinenoexcept |
Inverse rotate a vector.
|
inlinenoexcept |
Inverse rotate a vector.
This is the inverse of rotating a vector - it undoes what rotate does.
Multiply a matrix transpose times a vector. If a rotation matrix is provided, then this transforms the vector from one frame to another (inverse transform).
|
inlinenoexcept |
Inverse transforms the given 2-D vector with the given transformation.
Inverse translate and rotate the given 2-D vector according to the translation and rotation defined by the given transformation.
Transform
(with the same transformation again) will result in the original vector being returned. Transform
. v | 2-D vector to inverse transform (inverse translate and inverse rotate). |
T | Transformation (a translation and rotation) to invertedly apply to the given vector. |
|
noexcept |
|
noexcept |
Short-cut function to determine if both bodies are enabled.
|
inline |
|
inline |
|
noexcept |
|
inlinenoexcept |
|
noexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Does this vector contain finite coordinates?
|
inlinenoexcept |
Does this vector contain finite coordinates?
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
constexpr size_t box2d::max_list_size | ( | ) |
Maximum list size.
constexpr size_t box2d::max_list_size< Body > | ( | ) |
constexpr size_t box2d::max_list_size< Contact > | ( | ) |
constexpr size_t box2d::max_list_size< Joint > | ( | ) |
|
inlinenoexcept |
Friction mixing law. The idea is to allow either fixture to drive the resulting friction to zero. For example, anything slides on ice.
Restitution mixing law. The idea is allow for anything to bounce off an inelastic surface. For example, a superball bounces on anything.
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
"Next Largest Power of 2 Given a binary integer value x, the next largest power of 2 can be computed by a SWAR algorithm that recursively "folds" the upper bits into the lower bits. This process yields a bit vector with the same most significant 1 as x, but all 1's below it. Adding 1 to that value yields the next largest power of 2. For a 64-bit value:"
Converts the given vector into a unit vector and returns its original length.
void box2d::NOT_USED | ( | T && | ... | ) |
|
inline |
|
noexcept |
|
inlinenoexcept |
|
inline |
|
inline |
bool box2d::operator!= | ( | const Manifold::Point & | lhs, |
const Manifold::Point & | rhs | ||
) |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
noexcept |
|
inline |
|
inlinenoexcept |
Add two vectors component-wise.
ArrayList<T, S> box2d::operator+ | ( | ArrayList< T, S > | lhs, |
const typename ArrayList< T, S >::data_type & | rhs | ||
) |
Add two vectors component-wise.
|
noexcept |
Increment the left hand side value by the right hand side value.
ArrayList<T, S>& box2d::operator+= | ( | ArrayList< T, S > & | lhs, |
const typename ArrayList< T, S >::data_type & | rhs | ||
) |
|
inline |
|
inlinenoexcept |
Subtract two vectors component-wise.
Subtract two vectors component-wise.
|
noexcept |
Decrement the left hand side value by the right hand side value.
|
noexcept |
|
inlinenoexcept |
|
noexcept |
std::ostream & box2d::operator<< | ( | ::std::ostream & | os, |
const Vec2 & | value | ||
) |
std::ostream & box2d::operator<< | ( | ::std::ostream & | os, |
const UnitVec2 & | value | ||
) |
std::ostream & box2d::operator<< | ( | ::std::ostream & | os, |
const Fixed32 & | value | ||
) |
|
inline |
|
noexcept |
|
inlinenoexcept |
|
inline |
|
inline |
bool box2d::operator== | ( | const Manifold::Point & | lhs, |
const Manifold::Point & | rhs | ||
) |
Equality operator.
|
inlinenoexcept |
RayCastOutput box2d::RayCast | ( | const AABB & | aabb, |
const RayCastInput & | input | ||
) |
RayCastOutput box2d::RayCast | ( | const Fixture & | f, |
const RayCastInput & | input, | ||
child_count_t | childIndex | ||
) |
Cast a ray against the shape of the given fixture.
f | Fixture. |
input | the ray-cast input parameters. |
childIndex | Child index. |
void * box2d::realloc | ( | void * | ptr, |
size_t | new_size | ||
) |
Implement this function to use your own memory allocator.
T* box2d::realloc | ( | T * | ptr, |
size_t | size | ||
) |
void box2d::ResetFriction | ( | Contact & | contact | ) |
Resets the friction mixture to the default value.
|
noexcept |
Reset the restitution to the default value.
Rotates a vector by a given angle.
|
inlinenoexcept |
Rotates a vector by a given angle.
Rotates a body a given amount around a point in body local coordinates.
This changes both the linear and angular positions of the body.
RotateAboutWorldPoint
function. body | Body to rotate. |
amount | Amount to rotate body by (in counter-clockwise direction). |
localPoint | Point in local coordinates. |
Rotates a body a given amount around a point in world coordinates.
This changes both the linear and angular positions of the body.
body | Body to rotate. |
amount | Amount to rotate body by (in counter-clockwise direction). |
worldPoint | Point in world coordinates. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinenoexcept |
Sets the angular velocity.
body | Body to set the angular velocity of. |
omega | the new angular velocity in radians/second. |
|
noexcept |
Build vertices to represent an oriented box.
shape | Shape to set as a box. |
hx | the half-width. |
hy | the half-height. |
center | the center of the box in local coordinates. |
angle | the rotation of the box in local coordinates. |
|
noexcept |
|
noexcept |
Sets the associated body's sleep status to awake.
f | Fixture whose body should be awoken. |
|
noexcept |
|
inlinenoexcept |
Sets the linear velocity of the center of mass.
body | Body to set the linear velocity of. |
v | the new linear velocity of the center of mass. |
|
inline |
|
inline |
|
inline |
|
inline |
Should collide.
Determines whether a body should possibly be able to collide with the other body.
Solve A * x = b, where b is a column vector. This is more efficient than computing the inverse in one-shot cases.
Solve A * x = b, where b is a column vector. This is more efficient than computing the inverse in one-shot cases. Solve only the upper 2-by-2 matrix equation.
Solve A * x = b, where b is a column vector. This is more efficient than computing the inverse in one-shot cases.
PositionSolution box2d::SolvePositionConstraint | ( | const PositionConstraint & | pc, |
const bool | moveA, | ||
const bool | moveB, | ||
ConstraintSolverConf | conf | ||
) |
Solves the given position constraint.
This pushes apart the two given positions for every point in the contact position constraint and returns the minimum separation value from the position solver manifold for each point.
Length box2d::SolvePositionConstraints | ( | Span< PositionConstraint > | positionConstraints, |
ConstraintSolverConf | conf = GetDefaultPositionSolverConf() |
||
) |
Solves the given position constraints.
This updates positions (and nothing else) by calling the position constraint solving function.
-conf.linearSlop
because code won't push the separation above this amount to begin with. Length box2d::SolvePositionConstraints | ( | Span< PositionConstraint > | positionConstraints, |
const BodyConstraint * | bodiesA, | ||
const BodyConstraint * | bodiesB, | ||
ConstraintSolverConf | conf = GetDefaultToiPositionSolverConf() |
||
) |
Solves the given position constraints.
This updates positions (and nothing else) for the two bodies identified by the given indexes by calling the position constraint solving function.
ConstraintSolverConf.max_separation
because code won't push the separation above this amount to begin with.positionConstraints | Positions constraints. |
bodiesA | Pointer to body constraint for body A. |
bodiesB | Pointer to body constraint for body B. |
conf | Configuration for solving the constraint. |
Momentum box2d::SolveVelocityConstraint | ( | VelocityConstraint & | vc | ) |
Solves the velocity constraint.
This updates the tangent and normal impulses of the velocity constraint points of the given velocity constraint and updates the given velocities.
|
inline |
|
inlinenoexcept |
StepStats box2d::Step | ( | World & | world, |
Time | timeStep, | ||
World::ts_iters_type | velocityIterations = 8 , |
||
World::ts_iters_type | positionIterations = 3 |
||
) |
Steps the world ahead by a given time amount.
Performs position and velocity updating, sleeping of non-moving bodies, updating of the contacts, and notifying the contact listener of begin-contact, end-contact, pre-solve, and post-solve events. If the given velocity and position iterations are more than zero, this method also respectively performs velocity and position resolution of the contacting bodies.
world | World to step. |
timeStep | Amount of time to simulate (in seconds). This should not vary. |
velocityIterations | Number of iterations for the velocity constraint solver. |
positionIterations | Number of iterations for the position constraint solver. The position constraint solver resolves the positions of bodies that overlap. |
|
inline |
bool box2d::TestOverlap | ( | const Shape & | shapeA, |
child_count_t | indexA, | ||
const Transformation & | xfA, | ||
const Shape & | shapeB, | ||
child_count_t | indexB, | ||
const Transformation & | xfB | ||
) |
Determine if two generic shapes overlap.
|
inline |
Test a point for containment in a fixture.
f | Fixture to use for test. |
p | Point in world coordinates. |
|
inlinenoexcept |
Multiply a matrix times a vector. If a rotation matrix is provided, then this transforms the vector from one frame to another.
Multiply a matrix times a vector.
Multiply a matrix times a vector.
|
inlinenoexcept |
Transforms the given 2-D vector with the given transformation.
Rotate and translate the given 2-D linear position according to the rotation and translation defined by the given transformation.
InverseTransform
(with the same transformation again) will result in the original vector being returned. InverseTransform
. v | 2-D position to transform (to rotate and then translate). |
T | Transformation (a translation and rotation) to apply to the given vector. |
|
inlinenoexcept |
Puts the body to sleep if it's awake.
bool box2d::Validate | ( | const PolygonShape & | shape | ) |
Validate convexity of the given shape.
constexpr auto box2d::BuiltVersion = Version{3, 0, 0} |
constexpr auto box2d::DefaultAabbExtension = DefaultLinearSlop * RealNum{20} |
constexpr auto box2d::DefaultAngularSleepTolerance = RealNum{(Pi * 2) / 180} * RadianPerSecond |
Default angular sleep tolerance.
A body cannot sleep if its angular velocity is above this amount.
Default angular slop.
A small angle used as a collision and constraint tolerance. Usually it is chosen to be numerically significant, but visually insignificant.
constexpr auto box2d::DefaultDistanceMultiplier = RealNum{2} |
constexpr auto box2d::DefaultLinearSleepTolerance = RealNum{0.01f} * MeterPerSecond |
Default linear sleep tolerance.
A body cannot sleep if the magnitude of its linear velocity is above this amount.
Default linear slop.
Length used as a collision and constraint tolerance. Usually chosen to be numerically significant, but visually insignificant. Lower or raise to decrease or increase respectively the minimum of space between bodies at rest.
constexpr auto box2d::DefaultMaxAngularCorrection = DefaultAngularSlop * RealNum{4} |
Default maximum angular correction.
constexpr auto box2d::DefaultMaxDistanceIters = std::uint8_t{20} |
Default max number of distance iterations.
constexpr auto box2d::DefaultMaxLinearCorrection = DefaultLinearSlop * RealNum{40} |
Default maximum linear correction.
The maximum linear position correction used when solving constraints. This helps to prevent overshoot.
constexpr auto box2d::DefaultMaxSubSteps = std::uint8_t{48} |
Default maximum number of sub steps.
This is the default maximum number of sub-steps per contact in continuous physics simulation. In other words, this is the default maximum number of times in a world step that a contact will have continuous collision resolution done for it.
constexpr auto box2d::DefaultMaxToiIters = std::uint8_t{20} |
Default maximum time of impact iterations.
constexpr auto box2d::DefaultMaxToiRootIters = std::uint8_t{30} |
Default maximum time of impact root iterator count.
Default minimum still time to sleep.
The default minimum time bodies must be still for bodies to be put to sleep.
constexpr auto box2d::DefaultVelocityThreshold = (RealNum{8} / RealNum{10}) * MeterPerSecond |
Default velocity threshold.
constexpr auto box2d::EarthlyGravity = LinearAcceleration2D{RealNum{0} * MeterPerSquareSecond, RealNum{-9.8f} * MeterPerSquareSecond} |
Earthly gravity.
An approximation of Earth's average gravity at sea-level.
constexpr auto box2d::Hertz = RealNum{1} |
constexpr auto box2d::Kilogram = RealNum{1} |
constexpr auto box2d::KilogramPerSquareMeter = RealNum{1} |
constexpr auto box2d::MaxBodies |
Maximum number of bodies in a world (65534 based off uint16_t and eliminating one value for invalid).
constexpr auto box2d::MaxContacts = contact_count_t{MaxBodies} * contact_count_t{MaxBodies - 1} / contact_count_t{2} |
Maximum number of contacts in a world (2147319811).
Uses the formula for the maximum number of edges in an undirectional graph of MaxBodies nodes. This occurs when every possible body is connected to every other body.
constexpr auto box2d::MaxFloat = std::numeric_limits<RealNum>::max() |
constexpr auto box2d::MaxJoints |
Maximum number of joints in a world (65534 based off std::uint16_t and eliminating one value for invalid).
constexpr auto box2d::MaxManifoldPoints = std::uint8_t{2} |
Maximum manifold points. This is the maximum number of contact points between two convex shapes. Do not change this value.
constexpr auto box2d::MaxShapeVertices = std::uint8_t{254} |
Maximum number of vertices for any shape type.
constexpr auto box2d::Meter = RealNum{1} |
constexpr auto box2d::MeterPerSecond = RealNum{1} |
constexpr auto box2d::MeterPerSquareSecond = RealNum{1} |
constexpr auto box2d::Newton = RealNum{1} |
constexpr auto box2d::NewtonMeter = RealNum{1} |
constexpr auto box2d::NewtonSecond = RealNum{1} |
constexpr auto box2d::Pi = RealNum(3.14159265358979323846264338327950288) |
Pi.
While the include file definition of M_PI may be a POSIX compliance requirement and initially attractive to use, it's apparently not a C++ standards requirement and casually including it pollutes the namespace of all code that uses this library. Whatever the case, MSVS2017 doesn't make it part of the cmath include without enabling _USE_MATH_DEFINES. So rather than add yet more C-preprocessor macros to all sources that this library may be compiled with, it's simply hard-coded in here instead using a C++ mechanism that also keeps it with the enclosing namespace.
constexpr auto box2d::Radian = RealNum{1} |
constexpr auto box2d::RadianPerSecond = RealNum{1} |
constexpr auto box2d::RadianPerSquareSecond = RealNum{1} |
constexpr auto box2d::Second = RealNum{1} |
constexpr auto box2d::SquareMeter = RealNum{1} |
constexpr auto box2d::Transform_identity = Transformation{Vec2_zero * Meter, UnitVec2::GetRight()} |