Core 1.0
Public Member Functions | Static Public Attributes | Friends | List of all members
Hexagonal Class Reference

Vertical hexagonal prism. More...

#include <hexagon.h>

Inheritance diagram for Hexagonal:
Hexagon2

Public Member Functions

 Hexagonal ()
 Heights. More...
 
 Hexagonal (const Vector2 &, const double &, const double &, const double &)
 Create a hexagonal prism. More...
 
 Hexagonal (const Hexagon2 &, const double &, const double &)
 Create a hexagonal prism. More...
 
 ~Hexagonal ()
 Empty.
 
Vector Center (int) const
 Return the base or apex vertex of the hexagonal prism. More...
 
double Radius () const
 Return the radius of the hexagonal cell.
 
Vector Vertex (int) const
 Return the coordinates of the k-th vertex. More...
 
Vector Radial (int) const
 Return the radial vector of the k-th vertex. More...
 
Vector Edge (int) const
 Return the edge vector connecting vertexes k and k+1. More...
 
Vector Normal (int) const
 Return the normal vector to the k-th edge connecting vertexes k and k+1. More...
 
double Area () const
 Return the normal vector to the k-th edge connecting vertexes k and k+1. More...
 
double Volume () const
 Volume of the hexagonal prism.
 
Box GetBox () const
 Comput the bounding box of the hexagonal prism.
 
double Signed (const Vector &) const
 Compute the Euclidean signed distance to the hexagonal prism. More...
 
double R (const Vector &) const
 Compute the squared distance to the hexagonal prism. More...
 

Static Public Attributes

static const Hexagonal Unit = Hexagonal(Vector2::Null, 1.0, 0.0, 1.0)
 Unit hexagonal prism.
 

Friends

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

Additional Inherited Members

- Protected Member Functions inherited from Hexagon2
 Hexagon2 ()
 Empty.
 
 Hexagon2 (const Vector2 &, const double &)
 Create an hexagon. More...
 
 Hexagon2 (const double &)
 Create an hexagon. More...
 
void Translate (const Vector2 &)
 Translate a hexagon. More...
 
void Scale (const double &)
 Scale a hexagon. More...
 
double Width () const
 Width of the hexagon.
 
double Height () const
 Height of the hexagon.
 
bool Inside (const Vector2 &) const
 Test if a point is inside. More...
 
bool Intersect (const Hexagon2 &) const
 Check if two hexagons intersect. More...
 
double R (const Vector2 &) const
 Compute the squared Euclidean distance to the hexagon. More...
 
double Signed (const Vector2 &) const
 Compute the signed Euclidean distance to the hexagon. More...
 
Vector2 Normal (const Vector2 &) const
 Computes the distance vector between a hexagon and a point. More...
 
Vector2 Center () const
 Return the center of the hexagonal cell.
 
double Radius () const
 Return the radius of the hexagonal cell.
 
Vector2 Radial (int) const
 Return the radial vector of the k-th vertex. More...
 
Vector2 Edge (int) const
 Return the edge vector connecting vertexes k and k+1. More...
 
Vector2 Vertex (int) const
 Return the coordinates of the k-th vertex. More...
 
Box2 GetBox () const
 Compute the bounding box of a hexagon.
 
double Area () const
 Area of the hexagon.
 
double Perimeter () const
 Perimeter of the hexagon.
 
bool Intersect (const Circle2 &) const
 Check the intersection with a circle. More...
 
void Draw (QGraphicsScene &, const QPen &=QPen(), const QBrush &=QBrush()) const
 Draws an hexagon. More...
 
- Static Protected Member Functions inherited from Hexagon2
static int Sector (const Vector2 &)
 Compute the sector given an input direction. More...
 
- Protected Attributes inherited from Hexagon2
Vector2 c = Vector2::Null
 Center.
 
double r = 1.0
 Radius.
 
- Static Protected Attributes inherited from Hexagon2
static const Vector2 vertex [6]
 Array of vertices.
 
static const Vector2 normal [6]
 Array of normal vectors to the edges.
 
static const Vector2 edge [6]
 Unit edge vectors.
 
static const double Alpha = sqrt(3.0) / 2.0
 Constant sin(π/6)=√3/2.
 

Detailed Description

Vertical hexagonal prism.

Constructor & Destructor Documentation

◆ Hexagonal() [1/3]

Hexagonal::Hexagonal ( )
inline

Heights.

Empty

◆ Hexagonal() [2/3]

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

Create a hexagonal prism.

Parameters
cCenter.
rRadius.
a,bCap heights.

◆ Hexagonal() [3/3]

Hexagonal::Hexagonal ( const Hexagon2 h,
const double &  a,
const double &  b 
)
explicit

Create a hexagonal prism.

Parameters
hHexagon.
a,bCap heights.

Member Function Documentation

◆ Area()

double Hexagonal::Area ( ) const
inline

Return the normal vector to the k-th edge connecting vertexes k and k+1.

Parameters
kIndex, should be in [0,5].

Area of the hexagonal prism.

◆ Center()

Vector Hexagonal::Center ( int  k) const
inline

Return the base or apex vertex of the hexagonal prism.

Parameters
kIndex.

◆ Edge()

Vector Hexagonal::Edge ( int  k) const
inline

Return the edge vector connecting vertexes k and k+1.

Parameters
kIndex, should be in [0,5].

◆ Normal()

Vector Hexagonal::Normal ( int  k) const
inline

Return the normal vector to the k-th edge connecting vertexes k and k+1.

Parameters
kIndex, should be in [0,5].

◆ R()

double Hexagonal::R ( const Vector p) const

Compute the squared distance to the hexagonal prism.

Internally, call Hexagon2::R(const Vector2&).

Parameters
pPoint.

◆ Radial()

Vector Hexagonal::Radial ( int  k) const
inline

Return the radial vector of the k-th vertex.

Parameters
kIndex, should be in [0,5].

◆ Signed()

double Hexagonal::Signed ( const Vector p) const

Compute the Euclidean signed distance to the hexagonal prism.

Internally, call Hexagon2::R(const Vector2&).

Parameters
pPoint.

◆ Vertex()

Vector Hexagonal::Vertex ( int  k) const
inline

Return the coordinates of the k-th vertex.

Parameters
kIndex, should be in [0,5] for lower cap, in [6,11] for upper cap.

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  s,
const Hexagonal hex 
)
friend

Overloaded.

Parameters
sStream.
hexThe hexagonal prism.