GOAT (Geometrical optics application tool) 0.1
Loading...
Searching...
No Matches
GOAT::raytracing::triangle Class Reference

This class describes a triangle, represented by its corner points. It is intented for internal purposes. The triangle class is mainly used in class surface. More...

#include <triangle.h>

Public Member Functions

double area ()
void binRead (std::ifstream &is)
void binWrite (std::ofstream &os)
int calcIntersectionPoint (maths::Vector< double > r, maths::Vector< double > k, double &t, maths::Vector< double > &p, double eps=1E-5)
int calcIntersectionPoint (maths::Vector< double > r, maths::Vector< double > k, maths::Vector< double > &p, double eps=1E-5)
 Calculates the intersection point between the triangle and a straight line represented by a point r and the direction vector k.
void calcSideVectors ()
double distance (maths::Vector< double > p, maths::Vector< double > k)
maths::Vector< double > getnorm (void)
 returns the surface normal n
triangleoperator= (const triangle &dr)
 Assignment operator.
maths::Vector< double > & operator[] (int i)
const maths::Vector< double > & operator[] (int i) const
 Operator, gives back the Position of i-th corner.
void setnorm (maths::Vector< double > n)
 sets the surface normal n to the given value
void setnorm (void)
 calculates the surface normal n with help of the corner points
 triangle ()
 triangle (const triangle &d)
 Copy constructor.
 triangle (maths::Vector< double > ip1, maths::Vector< double > ip2, maths::Vector< double > ip3, maths::Vector< double > P)
 triangle (maths::Vector< double > P1, maths::Vector< double > P2, maths::Vector< double > P3)
 ~triangle ()
 Destructor.

Public Attributes

maths::Vector< double > f [3]
 vectors which represents the sides of the triangle. For details refer to function calcSideVectors()
maths::Vector< double > n
 normal of the triangle
maths::Vector< double > P [3]
 corner points of the triangle
double u
double v
 auxiliary variables for internal use

Friends

class surface

Detailed Description

This class describes a triangle, represented by its corner points. It is intented for internal purposes. The triangle class is mainly used in class surface.

Definition at line 12 of file triangle.h.

Constructor & Destructor Documentation

◆ triangle() [1/4]

GOAT::raytracing::triangle::triangle ( )

◆ triangle() [2/4]

GOAT::raytracing::triangle::triangle ( maths::Vector< double > P1,
maths::Vector< double > P2,
maths::Vector< double > P3 )

Constructor of the class triangle

Parameters
P1,P2,P3: corner points of the triangle

◆ triangle() [3/4]

GOAT::raytracing::triangle::triangle ( maths::Vector< double > ip1,
maths::Vector< double > ip2,
maths::Vector< double > ip3,
maths::Vector< double > P )

Constructor of the class triangle, the triangle is represented by a reference point and the three distance vectors between the reference point and the three corners of the triangle.

Parameters
P0reference point
ip1,ip2,ip3: Vectors from the reference point P0 to the corner points

◆ triangle() [4/4]

GOAT::raytracing::triangle::triangle ( const triangle & d)

Copy constructor.

◆ ~triangle()

GOAT::raytracing::triangle::~triangle ( )

Destructor.

Member Function Documentation

◆ area()

double GOAT::raytracing::triangle::area ( )
inline

this function returns the surface area of the triangle

Definition at line 23 of file triangle.h.

◆ binRead()

void GOAT::raytracing::triangle::binRead ( std::ifstream & is)

◆ binWrite()

void GOAT::raytracing::triangle::binWrite ( std::ofstream & os)

◆ calcIntersectionPoint() [1/2]

int GOAT::raytracing::triangle::calcIntersectionPoint ( maths::Vector< double > r,
maths::Vector< double > k,
double & t,
maths::Vector< double > & p,
double eps = 1E-5 )

◆ calcIntersectionPoint() [2/2]

int GOAT::raytracing::triangle::calcIntersectionPoint ( maths::Vector< double > r,
maths::Vector< double > k,
maths::Vector< double > & p,
double eps = 1E-5 )

Calculates the intersection point between the triangle and a straight line represented by a point r and the direction vector k.

Parameters
rreference point on the straight line
kdirection vector of the straight line
pintersection point (return parameter)
epsaccuracy (optional)
Returns
0: no intersection found 1: intersection point found

◆ calcSideVectors()

void GOAT::raytracing::triangle::calcSideVectors ( )
inline

Definition at line 31 of file triangle.h.

◆ distance()

double GOAT::raytracing::triangle::distance ( maths::Vector< double > p,
maths::Vector< double > k )

◆ getnorm()

maths::Vector< double > GOAT::raytracing::triangle::getnorm ( void )

returns the surface normal n

◆ operator=()

triangle & GOAT::raytracing::triangle::operator= ( const triangle & dr)

Assignment operator.

◆ operator[]() [1/2]

maths::Vector< double > & GOAT::raytracing::triangle::operator[] ( int i)

This operator returns the i-th corner point of the triangle

Parameters
i
Returns
Vector of the i-th corner

◆ operator[]() [2/2]

const maths::Vector< double > & GOAT::raytracing::triangle::operator[] ( int i) const

Operator, gives back the Position of i-th corner.

This operator returns the i-th corner point of the triangle

Parameters
i
Returns
Vector of the i-th corner

◆ setnorm() [1/2]

void GOAT::raytracing::triangle::setnorm ( maths::Vector< double > n)
inline

sets the surface normal n to the given value

Definition at line 49 of file triangle.h.

◆ setnorm() [2/2]

void GOAT::raytracing::triangle::setnorm ( void )

calculates the surface normal n with help of the corner points

◆ surface

friend class surface
friend

Definition at line 81 of file triangle.h.

Member Data Documentation

◆ f

maths::Vector<double> GOAT::raytracing::triangle::f[3]

vectors which represents the sides of the triangle. For details refer to function calcSideVectors()

Definition at line 18 of file triangle.h.

◆ n

maths::Vector<double> GOAT::raytracing::triangle::n

normal of the triangle

Definition at line 17 of file triangle.h.

◆ P

maths::Vector<double> GOAT::raytracing::triangle::P[3]

corner points of the triangle

Definition at line 16 of file triangle.h.

◆ u

double GOAT::raytracing::triangle::u

Definition at line 15 of file triangle.h.

◆ v

double GOAT::raytracing::triangle::v

auxiliary variables for internal use

Definition at line 15 of file triangle.h.


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