GOAT (Geometrical optics application tool) 0.1
Loading...
Searching...
No Matches
triangle.h
Go to the documentation of this file.
1#pragma once
2#include "vector.h"
3#include "matrix.h"
4namespace GOAT
5{
6 namespace raytracing
7 {
13 {
14 public:
15 double u, v;
19
23 double area()
24 {
26 h1 = P[1] - P[0];
27 h2 = P[2] - P[0];
28 return abs(h1 % h2) / 2.0;
29 }
30
32 {
33 f[0] = P[1] - P[0];
34 f[1] = P[2] - P[1];
35 f[2] = P[0] - P[2];
36 }
48 void setnorm(void);
49 void setnorm(maths::Vector<double> n) { this->n = n; }
This class represents a threedimensional (numeric) Matrix as a template.
Definition matrix.h:23
Template class for threedimensional vectors.
Definition vector.h:57
This class describes a triangle, represented by its corner points. It is intented for internal purpos...
Definition triangle.h:13
triangle(maths::Vector< double > P1, maths::Vector< double > P2, maths::Vector< double > P3)
double v
auxiliary variables for internal use
Definition triangle.h:15
triangle & operator=(const triangle &dr)
Assignment operator.
void binRead(std::ifstream &is)
maths::Vector< double > getnorm(void)
returns the surface normal n
void binWrite(std::ofstream &os)
void setnorm(maths::Vector< double > n)
sets the surface normal n to the given value
Definition triangle.h:49
maths::Vector< double > & operator[](int i)
maths::Vector< double > n
normal of the triangle
Definition triangle.h:17
maths::Vector< double > f[3]
vectors which represents the sides of the triangle. For details refer to function calcSideVectors()
Definition triangle.h:18
double distance(maths::Vector< double > p, maths::Vector< double > k)
const maths::Vector< double > & operator[](int i) const
Operator, gives back the Position of i-th corner.
void setnorm(void)
calculates the surface normal n with help of the corner points
triangle(maths::Vector< double > ip1, maths::Vector< double > ip2, maths::Vector< double > ip3, maths::Vector< double > P)
int calcIntersectionPoint(maths::Vector< double > r, maths::Vector< double > k, double &t, maths::Vector< double > &p, double eps=1E-5)
triangle(const triangle &d)
Copy constructor.
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 a...
maths::Vector< double > P[3]
corner points of the triangle
Definition triangle.h:16
This file contains the definition of a template for 3x3 matrices, which can be used together with the...
Raytracer used for ultrashort pulse calculation with raytracing only.
Definition asphericLens.h:6
surface operator-(const surface &s, const maths::Vector< double > &v)
subtracts vector v from all corners of the triangle list of the surface object s
triangle operator/(const triangle &dr, double a)
divide the corners of the triangle dr by the scalar a
surface operator+(const surface &s, const maths::Vector< double > &v)
{
std::ostream & operator<<(std::ostream &os, Box B)
output operator for the Box class
surface operator*(const maths::Matrix< double > &M, const surface &s)
This class is used for the iray class. This class is intended for internal use only....
Definition fresnel.h:7
This file contains the Vector template class and some useful functions around this class.