Colliding Shapes
Ian Parberry's "Introduction to Game Physics"
Public Member Functions | Private Attributes | List of all members
CArcDesc Class Reference

Arc descriptor. More...

#include <Arc.h>

Inheritance diagram for CArcDesc:
CCircleDesc CShapeDesc

Public Member Functions

 CArcDesc ()
 Constructor. More...
 
 CArcDesc (const Vector2 &, float, float, float, float=1.0f)
 Constructor. More...
 
void SetAngles (float, float)
 Set the angles. More...
 
void GetEndPts (Vector2 &, Vector2 &)
 Get end points. More...
 
float GetAngle0 ()
 Get angle 0. More...
 
float GetAngle1 ()
 Get angle 1. More...
 
- Public Member Functions inherited from CCircleDesc
 CCircleDesc ()
 Constructor. More...
 
 CCircleDesc (const Vector2 &, float, float=1.0f)
 Constructor. More...
 
- Public Member Functions inherited from CShapeDesc
 CShapeDesc (eShape)
 Constructor. More...
 
 CShapeDesc ()
 Default constructor. More...
 

Private Attributes

Vector2 m_vPt0
 Point 0.
 
Vector2 m_vPt1
 Point 1.
 
float m_fAngle0 = 0.0f
 Angle from center to point 0.
 
float m_fAngle1 = 0.0f
 Angle from center to point 1.
 
Vector2 m_vTangent0
 Tangent at point 0.
 
Vector2 m_vTangent1
 Tangent at point 1.
 

Additional Inherited Members

- Public Attributes inherited from CCircleDesc
float m_fRadius = 0.0f
 Radius.
 
- Public Attributes inherited from CShapeDesc
eShape m_eShapeType = eShape::Unknown
 Type of shape.
 
Vector2 m_vPos
 Position.
 
float m_fElasticity = 1.0f
 Elasticity, aka restitution, bounciness.
 
eMotion m_eMotionType = eMotion::Static
 How shape moves.
 
bool m_bIsSensor = false
 Sensor only, no rebound.
 

Detailed Description

The arc descriptor describes an arc shape.

Constructor & Destructor Documentation

◆ CArcDesc() [1/2]

CArcDesc::CArcDesc ( )

The default contructor creates an arc descriptor whose angles are zero.

◆ CArcDesc() [2/2]

CArcDesc::CArcDesc ( const Vector2 &  p0,
float  r,
float  a0,
float  a1,
float  e = 1.0f 
)

This constructor creates an arc descriptor given the arc's center, radius, angles, and elasticity.

Parameters
p0Position of center.
rRadius.
a0First angle.
a1Second angle.
eElasticity.

Member Function Documentation

◆ GetAngle0()

float CArcDesc::GetAngle0 ( )

Reader function for angle 0.

Returns
Angle 0.

◆ GetAngle1()

float CArcDesc::GetAngle1 ( )

Reader function for angle 1.

Returns
Angle 1.

◆ GetEndPts()

void CArcDesc::GetEndPts ( Vector2 &  p0,
Vector2 &  p1 
)

Calculate the end points from the arc center, angles, and radius. Assumes that these values have already been set.

Parameters
p0[out] An end point.
p1[out] Another end point.

◆ SetAngles()

void CArcDesc::SetAngles ( float  a0,
float  a1 
)

Set the arc descriptor's angles, making sure to normalzie them first.

Parameters
a0The first angle.
a1The second angle.