The Shapes Library
Game Physics with Bespoke Code
Loading...
Searching...
No Matches
Shapes::CKinematicArc Class Reference

Kinematic arc shape. More...

#include <Arc.h>

Inheritance diagram for Shapes::CKinematicArc:
Collaboration diagram for Shapes::CKinematicArc:

Public Member Functions

 CKinematicArc (CArcDesc &)
 Constructor.
 
void Rotate (const Vector2 &, float)
 Rotate.
 
void Reset ()
 Reset orientation.
 
- Public Member Functions inherited from Shapes::CArc
 CArc (CArcDesc &)
 Constructor.
 
const bool CollisionDetected (CContactDesc &) const
 Collision detection.
 
const bool PtInSector (const Vector2 &) const
 Point in sector test.
 
void GetEndPts (Vector2 &, Vector2 &) const
 Get end points.
 
void GetTangents (Vector2 &, Vector2 &) const
 Get tangents.

 
- Public Member Functions inherited from Shapes::CCircle
 CCircle (const CCircleDesc &)
 Constructor.
 
const bool CollisionDetected (CContactDesc &) const
 Collision detection.
 
const bool PtInCircle (const Vector2 &) const
 Point in circle test.
 
const Vector2 ClosestPt (const Vector2 &) const
 Closest point on circle.
 
const bool Tangents (const Vector2 &, Vector2 &, Vector2 &) const
 Tangents through external point.
 
const bool Tangents (const CCircle *, CLineSegDesc &, CLineSegDesc &) const
 Common tangents.
 
const bool Tangent (const CCircle *, CLineSegDesc &) const
 Common tangent.
 
const float GetRadius () const
 Get radius.
 
- Public Member Functions inherited from Shapes::CShape
 CShape (const CShapeDesc &)
 Constructor.
 
virtual ~CShape ()
 Destructor.
 
const eShape GetShapeType () const
 Get shape type.
 
const eMotion GetMotionType () const
 Get motion type.
 
const CAabb2DGetAABB () const
 Get AABB.
 
const bool GetSensor () const
 Is this shape a sensor?
 
const Vector2 & GetPos () const
 Get position.
 
void SetPos (const Vector2 &)
 Set position.
 
void SetAABBPoint (const Vector2 &)
 Set AABB point.
 
void AddAABBPoint (const Vector2 &)
 Add AABB point.
 
void SetCanCollide (bool=true)
 Turn collisions on or off.
 
const bool GetCanCollide () const
 Get whether shape can collide.
 
const bool GetRotating () const
 Get whether rotating.
 
void SetRotating (bool)
 Start or stop rotating.
 
const float GetOrientation () const
 Get orientation.
 
void SetOrientation (float)
 Set orientation.
 
const float GetRotSpeed () const
 Get rotation speed.
 
void SetRotSpeed (float)
 Set rotation speed.
 
const Vector2 & GetRotCenter () const
 Get rotation speed.
 
void SetRotCenter (const Vector2 &)
 Set center of rotation.
 
const float GetElasticity () const
 Get elasticity.
 
void * GetUserPtr () const
 Get user pointer.
 
void SetUserPtr (void *)
 Set user pointer.
 
virtual void move ()
 Translate.
 

Private Attributes

Vector2 m_vOriginalPos
 Original position.
 
float m_vOriginalAngle0
 Original angle 0.
 
float m_vOriginalAngle1
 Original angle 1.
 

Additional Inherited Members

- Protected Member Functions inherited from Shapes::CArc
void Update ()
 Update from angles and radius.
 
const float PtToAngle (const Vector2 &) const
 Point to angle.
 
- Protected Attributes inherited from Shapes::CArc
Vector2 m_vPt0
 Point 0.
 
Vector2 m_vPt1
 Point 1.
 
float m_fAngle0
 Angle from center to point 0.
 
float m_fAngle1
 Angle from center to point 1.
 
Vector2 m_vTangent0
 Tangent at point 0.
 
Vector2 m_vTangent1
 Tangent at point 1.
 
- Protected Attributes inherited from Shapes::CCircle
float m_fRadius = 0.0f
 Radius.
 
float m_fRadiusSq = 0.0f
 Radius squared, for fast distance calc.
 
- Protected Attributes inherited from Shapes::CShape
eShape m_eShapeType = eShape::Unknown
 Type of shape.
 
eMotion m_eMotionType = eMotion::Static
 How shape moves.
 
float m_fElasticity = 1.0f
 Elasticity, aka restitution, bounciness.
 
bool m_bIsSensor = false
 Sensor only, no rebound on collision.
 
CAabb2D m_cAABB
 Axially aligned bounding box in World Space.
 
bool m_bCanCollide = true
 Can collide with other shapes.
 
float m_fOrientation = 0.0f
 Orientation angle.
 
void * m_pUser
 Spare pointer for user in case they might need one.
 
Vector2 m_vRotCenter
 Center of rotation.
 
float m_fRotSpeed = 0.0f
 Rotation speed.
 
bool m_bRotating = false
 Whether rotating.
 
- Static Protected Attributes inherited from Shapes::CShapeCommon
static float m_fGravity = 0.0f
 Gravitational constant.
 
static float m_fTimeStep = 0.0f
 Time step per animation frame (fictional).
 

Detailed Description

An arc shape whose motion type is kinematic.

Constructor & Destructor Documentation

◆ CKinematicArc()

CKinematicArc::CKinematicArc ( CArcDesc & r)

Constructs a kinematic arc described by an arc descriptor.

Parameters
rArc descriptor.
Here is the call graph for this function:

Member Function Documentation

◆ Reset()

void CKinematicArc::Reset ( )
virtual

Reset to original orientation.

Reimplemented from Shapes::CShape.

Here is the call graph for this function:

◆ Rotate()

void CKinematicArc::Rotate ( const Vector2 & p,
float a )
virtual

Rotate to a given orientation from original orientation.

Parameters
pCenter of rotation.
aAngle increment from original orientation.

Reimplemented from Shapes::CShape.

Here is the call graph for this function: