Box2D  3.0.0
A Real-Time-Oriented 2-D Physics Engine
Classes | Public Member Functions | Static Public Member Functions | List of all members
box2d::CircleShape Class Reference

Circle shape. More...

#include <CircleShape.hpp>

Inheritance diagram for box2d::CircleShape:
box2d::Shape

Classes

struct  Conf
 

Public Member Functions

 CircleShape (const Conf &conf=GetDefaultConf()) noexcept
 Initializing constructor. More...
 
 CircleShape (const Length radius, const Conf &conf=GetDefaultConf()) noexcept
 
 CircleShape (const CircleShape &)=default
 
CircleShapeoperator= (const CircleShape &other)=default
 
child_count_t GetChildCount () const noexcept override
 Gets the number of child primitives. More...
 
DistanceProxy GetChild (child_count_t index) const noexcept override
 Gets the child for the given index. More...
 
bool TestPoint (const Transformation &xf, const Length2D p) const noexcept override
 Tests a point for containment in this shape. More...
 
MassData GetMassData () const noexcept override
 Computes the mass properties of this shape using its dimensions and density. The inertia tensor is computed about the local origin. More...
 
RayCastOutput RayCast (const RayCastInput &input, const Transformation &xf, child_count_t childIndex) const noexcept override
 Cast a ray against a child shape. More...
 
void Accept (Visitor &visitor) const override
 Accepts a visitor. More...
 
Length GetRadius () const noexcept
 Gets the "radius" of the shape. More...
 
void SetRadius (Length radius) noexcept
 
Length2D GetLocation () const noexcept
 Gets the location of the center of this circle shape. More...
 
void SetLocation (const Length2D value) noexcept
 
- Public Member Functions inherited from box2d::Shape
 Shape ()=delete
 Default constructor is deleted. More...
 
 Shape (const Conf &conf) noexcept
 Initializing constructor. More...
 
 Shape (const Shape &)=default
 
virtual ~Shape ()=default
 
Length GetVertexRadius () const noexcept
 Gets the vertex radius. More...
 
void SetVertexRadius (Length vertexRadius)
 
Density GetDensity () const noexcept
 Gets the density of this fixture. More...
 
void SetDensity (Density density) noexcept
 Sets the density of this fixture. More...
 
RealNum GetFriction () const noexcept
 Gets the coefficient of friction. More...
 
void SetFriction (RealNum friction) noexcept
 Sets the coefficient of friction. This will not change the friction of existing contacts. More...
 
RealNum GetRestitution () const noexcept
 Gets the coefficient of restitution. More...
 
void SetRestitution (RealNum restitution) noexcept
 Sets the coefficient of restitution. This will not change the restitution of existing contacts. More...
 

Static Public Member Functions

static Length GetDefaultRadius () noexcept
 
static Conf GetDefaultConf () noexcept
 

Detailed Description

Circle shape.

Constructor & Destructor Documentation

◆ CircleShape() [1/3]

box2d::CircleShape::CircleShape ( const Conf conf = GetDefaultConf())
inlineexplicitnoexcept

Initializing constructor.

Note
Behavior is undefined if a negative radius is given.

◆ CircleShape() [2/3]

box2d::CircleShape::CircleShape ( const Length  radius,
const Conf conf = GetDefaultConf() 
)
inlineexplicitnoexcept

◆ CircleShape() [3/3]

box2d::CircleShape::CircleShape ( const CircleShape )
default

Member Function Documentation

◆ Accept()

void box2d::CircleShape::Accept ( Visitor visitor) const
inlineoverridevirtual

Accepts a visitor.

Implements box2d::Shape.

◆ GetChild()

DistanceProxy box2d::CircleShape::GetChild ( child_count_t  index) const
inlineoverridevirtualnoexcept

Gets the child for the given index.

Note
The shape must remain in scope while the proxy is in use.

Implements box2d::Shape.

◆ GetChildCount()

child_count_t box2d::CircleShape::GetChildCount ( ) const
inlineoverridevirtualnoexcept

Gets the number of child primitives.

Returns
Positive non-zero count.

Implements box2d::Shape.

◆ GetDefaultConf()

static Conf box2d::CircleShape::GetDefaultConf ( )
inlinestaticnoexcept

◆ GetDefaultRadius()

static Length box2d::CircleShape::GetDefaultRadius ( )
inlinestaticnoexcept

◆ GetLocation()

Length2D box2d::CircleShape::GetLocation ( ) const
inlinenoexcept

Gets the location of the center of this circle shape.

Returns
The origin (0, 0) unless explicitly set otherwise on construction or via the set location method.
See also
SetPosition.

◆ GetMassData()

MassData CircleShape::GetMassData ( ) const
overridevirtualnoexcept

Computes the mass properties of this shape using its dimensions and density. The inertia tensor is computed about the local origin.

Note
Behavior is undefined if the density is negative.
Returns
Mass data for this shape.

Implements box2d::Shape.

◆ GetRadius()

Length box2d::CircleShape::GetRadius ( ) const
inlinenoexcept

Gets the "radius" of the shape.

Returns
Non-negative distance.

◆ operator=()

CircleShape& box2d::CircleShape::operator= ( const CircleShape other)
default

◆ RayCast()

RayCastOutput CircleShape::RayCast ( const RayCastInput input,
const Transformation xf,
child_count_t  childIndex 
) const
overridevirtualnoexcept

Cast a ray against a child shape.

Parameters
inputthe ray-cast input parameters.
xfthe transform to be applied to the shape.
childIndexthe child shape index

Implements box2d::Shape.

◆ SetLocation()

void box2d::CircleShape::SetLocation ( const Length2D  value)
inlinenoexcept

◆ SetRadius()

void box2d::CircleShape::SetRadius ( Length  radius)
inlinenoexcept

◆ TestPoint()

bool CircleShape::TestPoint ( const Transformation xf,
const Length2D  p 
) const
overridevirtualnoexcept

Tests a point for containment in this shape.

Parameters
xfthe shape world transform.
pa point in world coordinates.
Returns
true if point is contained in this shape, false otherwise.

Implements box2d::Shape.


The documentation for this class was generated from the following files: