![]() |
Colliding Shapes
Ian Parberry's "Introduction to Game Physics"
|
Line segment descriptor. More...
#include <LineSeg.h>
Public Member Functions | |
CLineSegDesc () | |
Constructor. More... | |
CLineSegDesc (const Vector2 &, const Vector2 &, float=1.0f) | |
Constructor. More... | |
void | SetEndPts (const Vector2 &, const Vector2 &) |
void | GetEndPts (Vector2 &, Vector2 &) |
Set end points. More... | |
const Vector2 & | GetEndPt0 () |
Get end point 0. More... | |
const Vector2 & | GetEndPt1 () |
Get end point 1. More... | |
const Vector2 & | GetNormal () |
Get normal. More... | |
float | GetGradient () |
Get gradient. More... | |
![]() | |
CShapeDesc (eShape) | |
Constructor. More... | |
CShapeDesc () | |
Default constructor. More... | |
Protected Attributes | |
Vector2 | m_vPt0 |
Point 0. | |
Vector2 | m_vPt1 |
Point 1. | |
Vector2 | m_vNormal |
Normal. | |
float | m_fGradient = 0.0f |
Gradient. | |
Additional Inherited Members | |
![]() | |
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. | |
The line segment descriptor describes a line segment.
CLineSegDesc::CLineSegDesc | ( | ) |
The default contructor creates a line segment descriptor whose end points are the origin.
CLineSegDesc::CLineSegDesc | ( | const Vector2 & | p0, |
const Vector2 & | p1, | ||
float | e = 1.0f |
||
) |
This constructor creates a line segment descriptor given the line segment's end points and elasticity.
p0 | End point. |
p1 | End point. |
e | Elasticity, defaults to 1.0f. |
const Vector2 & CLineSegDesc::GetEndPt0 | ( | ) |
< Reader function for end point 0.
const Vector2 & CLineSegDesc::GetEndPt1 | ( | ) |
< Reader function for end point 1.
void CLineSegDesc::GetEndPts | ( | Vector2 & | p0, |
Vector2 & | p1 | ||
) |
Get end points.
Reader function for the positions of the end points.
p0 | [out] Leftmost end point. |
p1 | [out] Other end point. |
float CLineSegDesc::GetGradient | ( | ) |
Reader function for the gradient.
const Vector2 & CLineSegDesc::GetNormal | ( | ) |
< Reader function for normal.
void CLineSegDesc::SetEndPts | ( | const Vector2 & | p0, |
const Vector2 & | p1 | ||
) |
Set the end points of this line segment descriptor, ensuring that the first point is to the left of the second point so that the gradient is computed correctly. Also computes the normal vector (which will be counterclockwise from the vector that points from the first and point to the second one in the order in which they are given as parameters,.
p0 | First end point. |
p1 | Second end point. |