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

Arc descriptor. More...

#include <Arc.h>

Inheritance diagram for Shapes::CArcDesc:
Collaboration diagram for Shapes::CArcDesc:

Public Member Functions

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

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 Shapes::CCircleDesc
float m_fRadius = 0.0f
 Radius.
 
- Public Attributes inherited from Shapes::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()

const float CArcDesc::GetAngle0 ( ) const

Reader function for angle 0.

Returns
Angle 0.

◆ GetAngle1()

const float CArcDesc::GetAngle1 ( ) const

Reader function for angle 1.

Returns
Angle 1.

◆ GetEndPts()

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

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 normalize them first.

Parameters
a0The first angle.
a1The second angle.
Here is the call graph for this function: