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

Point shape. More...

#include <Point.h>

Inheritance diagram for Shapes::CPoint:
Collaboration diagram for Shapes::CPoint:

Public Member Functions

 CPoint (const CPointDesc &)
 Constructor.
 
 CPoint (const Vector2 &)
 Constructor.
 
const bool CollisionDetected (CContactDesc &) const
 Collision detection.
 
- 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 Rotate (const Vector2 &, float)
 Rotate.
 
virtual void Reset ()
 Reset orientation.
 
virtual void move ()
 Translate.
 

Additional Inherited Members

- 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

A point has no dimensions, only position and elasticity.

Constructor & Destructor Documentation

◆ CPoint() [1/2]

CPoint::CPoint ( const CPointDesc & r)

Constructs a point described by a point descriptor.

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

◆ CPoint() [2/2]

CPoint::CPoint ( const Vector2 & p)

Constructs a point at a given position.

Parameters
pPosition.

Member Function Documentation

◆ CollisionDetected()

const bool CPoint::CollisionDetected ( CContactDesc & c) const
virtual

Collision detection with a dynamic circle.

Parameters
c[in, out] Contact descriptor for this collision.
Returns
true if there was a collision.

Reimplemented from Shapes::CShape.

Here is the call graph for this function:
Here is the caller graph for this function: