Gem Illuminator
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Triangle Class Reference

The Triangle class represents a triangle in three dimensional space. More...

#include <triangle.h>

Public Member Functions

 Triangle ()
 Creates a new degenerated Triangle, with all points in (0, 0, 0). More...
 
 Triangle (const QVector3D &a, const QVector3D &b, const QVector3D &c)
 Creates a new Triangle, with specified points. It is expected, that points a, b and c are ordered counter clock wise. More...
 
 Triangle (const Triangle &triangle)
 Creates a new Triangle with data copied from given triangle. More...
 
 ~Triangle ()
 
Triangleoperator= (const Triangle &triangle)
 
const QVector3D & a () const
 
void setA (const QVector3D &a)
 
const QVector3D & b () const
 
void setB (const QVector3D &b)
 
const QVector3D & c () const
 
void setC (const QVector3D &c)
 
const QVector3D & normal () const
 Returns normal of triangle. The vertices a(), b() and c() ordered counter clockwise are expected to describe outer side of triangle. More...
 
QList< QVector3D > vertices () const
 Convenience method. All vertices are returned in QList. More...
 
QVector3D reflect (const QVector3D &incidentVector) const
 Reflects incoming ray at outer side of triangle. More...
 

Protected Member Functions

void calculateNormal () const
 

Protected Attributes

QVector3D * m_a
 
QVector3D * m_b
 
QVector3D * m_c
 
QVector3D * m_normal
 

Detailed Description

The Triangle class represents a triangle in three dimensional space.

Mostly this is a data class storing the vertices and is easy copyable. Also, some helper functions are implemented.

Constructor & Destructor Documentation

Triangle::Triangle ( )

Creates a new degenerated Triangle, with all points in (0, 0, 0).

Triangle::Triangle ( const QVector3D &  a,
const QVector3D &  b,
const QVector3D &  c 
)

Creates a new Triangle, with specified points. It is expected, that points a, b and c are ordered counter clock wise.

Parameters
aFirst vertex.
bSecond vertex.
cThird vertex.
Triangle::Triangle ( const Triangle triangle)

Creates a new Triangle with data copied from given triangle.

Parameters
triangleThe Triangle, that will be copied.
Triangle::~Triangle ( )

Member Function Documentation

const QVector3D & Triangle::a ( ) const
const QVector3D & Triangle::b ( ) const
const QVector3D & Triangle::c ( ) const
void Triangle::calculateNormal ( ) const
protected
const QVector3D & Triangle::normal ( ) const

Returns normal of triangle. The vertices a(), b() and c() ordered counter clockwise are expected to describe outer side of triangle.

Returns
Triangle & Triangle::operator= ( const Triangle triangle)
QVector3D Triangle::reflect ( const QVector3D &  incidentVector) const

Reflects incoming ray at outer side of triangle.

Parameters
incidentVectorThe vector that will be reflected.
Returns
Reflected vector.
void Triangle::setA ( const QVector3D &  a)
void Triangle::setB ( const QVector3D &  b)
void Triangle::setC ( const QVector3D &  c)
QList< QVector3D > Triangle::vertices ( ) const

Convenience method. All vertices are returned in QList.

Returns
QList of vertices. Containing a(), b() and c() in this order.

Member Data Documentation

QVector3D* Triangle::m_a
protected
QVector3D* Triangle::m_b
protected
QVector3D* Triangle::m_c
protected
QVector3D* Triangle::m_normal
mutableprotected

The documentation for this class was generated from the following files: