Core 1.0
Public Member Functions | Protected Attributes | Friends | List of all members
Capsule2 Class Reference

A line-swept-cricle. More...

#include <capsule.h>

Inheritance diagram for Capsule2:
Axis2

Public Member Functions

 Capsule2 ()
 Empty.
 
 Capsule2 (const Vector2 &, const Vector2 &, const double &)
 Creates a capsule. More...
 
 ~Capsule2 ()
 Empty.
 
bool Inside (const Vector2 &) const
 Check if a point is inside the capsule. More...
 
double R (const Vector2 &) const
 Computes the squared distance between a point and the capsule. More...
 
double Signed (const Vector2 &) const
 Computes the signed distance between a point and the capsule. More...
 
bool Intersect (const Ray2 &) const
 Check the intersection between a capsule and a ray. More...
 
int Intersect (const Ray2 &, double &, double &) const
 Compute the intersections between a capsule and a ray. More...
 
Box2 GetBox () const
 Computes the tight bounding box of the capsule. More...
 
double Area () const
 Compute the surface area.
 
Vector2 Vertex (int) const
 Return one of the end vertexes of the axis.
 

Protected Attributes

double r = 1.0
 Radius.
 
- Protected Attributes inherited from Axis2
Vector2 b = Vector2(1.0, 0.0)
 End vertices of the axis.
 
Vector2 axis = Vector2::X
 Normalized axis vector.
 
double length = 1.0
 Length of the axis.
 

Friends

std::ostream & operator<< (std::ostream &, const Capsule2 &)
 Overloaded. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Axis2
double Radial (const Vector2 &, Vector2 &, Vector2 &) const
 Compute the radial coordinates of a point. More...
 
Vector2 Radial (const Vector2 &) const
 Compute the radial coordinates of a point. More...
 
 Axis2 ()
 Empty.
 
 Axis2 (const Vector2 &, const Vector2 &)
 Creates an axis given end vertices. More...
 
 ~Axis2 ()
 Empty.
 
Vector2 Vertex (int) const
 Return one of the end vertexes of the axis.
 
Vector2 Point (const double &) const
 Compute a point on the axis.
 
Vector2 GetAxis () const
 Returns the normalized axis vector.
 
constexpr double Length () const
 Return the axis length.
 
Vector2 Symmetric (const Vector2 &) const
 Symmetric point. More...
 
Circle2 Symmetric (const Circle2 &) const
 Symmetric circle. More...
 
Box2 Symmetric (const Box2 &) const
 Symmetric box. More...
 

Detailed Description

A line-swept-cricle.

Constructor & Destructor Documentation

◆ Capsule2()

Capsule2::Capsule2 ( const Vector2 a,
const Vector2 b,
const double &  r 
)
explicit

Creates a capsule.

Parameters
a,bVertices
rRadius.

Member Function Documentation

◆ GetBox()

Box2 Capsule2::GetBox ( ) const

Computes the tight bounding box of the capsule.

See also
Circle::GetBox()

◆ Inside()

bool Capsule2::Inside ( const Vector2 p) const

Check if a point is inside the capsule.

Parameters
pPoint.

◆ Intersect() [1/2]

bool Capsule2::Intersect ( const Ray2 ray) const

Check the intersection between a capsule and a ray.

Parameters
rayThe normalized ray.

◆ Intersect() [2/2]

int Capsule2::Intersect ( const Ray2 ray,
double &  ta,
double &  tb 
) const

Compute the intersections between a capsule and a ray.

Parameters
rayThe ray.
ta,tbIntersection depths.

◆ R()

double Capsule2::R ( const Vector2 p) const

Computes the squared distance between a point and the capsule.

Parameters
pPoint.

◆ Signed()

double Capsule2::Signed ( const Vector2 p) const

Computes the signed distance between a point and the capsule.

Parameters
pPoint.

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  s,
const Capsule2 c 
)
friend

Overloaded.

Parameters
sStream.
cCapsule.