GOAT (Geometrical optics application tool) 0.1
Loading...
Searching...
No Matches
objectshape.h
Go to the documentation of this file.
1/***************************************************************************
2 objectshape.h - description
3 -------------------
4 begin : Wed Oct 24 2001
5 copyright : (C) 2001 by Thomas Weigel
6 email : weigel@lat.ruhr-uni-bochum.de
7 ***************************************************************************/
8
9
13#pragma once
14
15#ifndef INF
16#define INF 1.0/0.0
17#endif
18#include "matrix.h"
19#include "vector.h"
20
21#include <fstream>
22// #include <time.h>
23namespace GOAT {
24 namespace raytracing {
25#define OBJECTSHAPE_NO_SHAPE -1 //F/< No shape defined
26#define OBJECTSHAPE_ELLIPSOID 10000
27#define OBJECTSHAPE_SURFACE 10001
28#define OBJECTSHAPE_CONE 10002
29#define OBJECTSHAPE_ASPHERIC_LENS 10003
30#define OBJECTSHAPE_SPHERIC_LENS 10004
31#define OBJECTSHAPE_BOX 10005
32#define OBJECTSHAPE_CYLINDER 10006
33#define OBJECTSHAPE_VORTEX_PLATE 10007
34
35
36#define FUNSURF 2
37#define SUPERELLIPSOID_D 17
38#define SUPERELLIPSOID 4
39#define ZYLINDER 5
40#define KREISKEGEL 6
41#define KEGELSTUMPF 7
42#define COMPOUND 8
43#define SPIEGEL 12
44#define SUPERELLIPSOID_N 10
45#define ERYTHROCYTE 11
46#define KEGELSTUMPF_HOHL 9
47#define HOHLFASER 13
48#define NINCTYPES 14
49#define LINSE 15
50#define ZYLINDER_HEXAGONAL 16
51#define BOX 3
52#define EPS 1E-10*r0
53
54 enum class NFUNCTYPE { vacuum, air, bk7, silica, lasf5, pmma };
55
61 public:
64
65
75 std::complex<double> n,
76 GOAT::maths::Matrix<std::complex<double> > alpha,
77 const maths::Vector<double>& Ex = maths::ex,
78 const maths::Vector<double>& Ey = maths::ey,
79 const maths::Vector<double>& Ez = maths::ez,
80 const int type = -1
81 );
82
83
84 virtual void binWrite(std::ofstream& os) = 0;
85 virtual void binRead(std::ifstream& os) = 0;
86 void scale(double sf);
87 virtual bool next(const maths::Vector<double>& p, const maths::Vector<double>& k,
88 maths::Vector<double>& pout) = 0;
89
91 virtual bool isInside(const maths::Vector<double>& p) = 0;
92 virtual double volume() = 0;
93
97 int Type() { return type; }
98 virtual void initQuad() = 0;
99 virtual void setr0(double r0) = 0;
101 void setMatrix(double alpha, double beta, double gamma);
102 void rotate(maths::Vector<double> A, double phi);
103
104 virtual void setPos(maths::Vector<double> r) = 0;
105 virtual void setPos(double x, double y, double z) = 0;
107 void setn(std::complex<double> n) { this->n = n; }
108 void setninel(std::complex<double> ninel) { this->ninel = ninel; }
109 std::complex<double> getninel() { return ninel; }
110 std::complex<double> getn() { return n; }
111 void setPolMatrix(maths::Matrix<std::complex<double> >alpha) { this->alpha = alpha; }
112 bool isActive() { return Active; }
113 void setActive(bool active) { Active = active; }
114 void setAlpha(double Alpha) { setMatrix(Alpha, Ebeta, Egamma); }
115 void setBeta(double Beta) { setMatrix(Ealpha, Beta, Egamma); }
116 void setGamma(double Gamma) { setMatrix(Ealpha, Ebeta, Gamma); }
117 void setVisible(bool visible) { this->visible = visible; }
118 bool getVisible() { return visible; }
121 std::complex<double> n;
122 std::complex<double> ninel;
124 int type;
127 double Ealpha, Ebeta, Egamma;
128 double r0;
129 double sf=1;
130 bool Active;
131 double rho;
132 /*
133 * @brief Used in the visualization part (GOATvis) => if true object will be visualized
134 * If this parameter is true, GOATvis will show the full representation of the object in the scene dialog otherwise only the bounding box is shown.
135 * This parameter can be used e.g. for very heavy surface object to safe memory.
136 */
137 bool visible=true;
138 std::function <std::complex<double>(double)> nfunc;
140 };
141
144 }
145}
146
This class represents a threedimensional (numeric) Matrix as a template.
Definition matrix.h:23
Template class for threedimensional vectors.
Definition vector.h:57
Abstract base class for all volume objects This abstract class provides a template for all volume obj...
Definition objectshape.h:60
maths::Matrix< double > H
void setMatrix(maths::Matrix< double > H)
sets the matrix for the transformation between object's coordinate system and outer coordinate system...
virtual double volume()=0
returns the volume of the object
double sf
scaling factor, it is used to scale the shape of the object
virtual void binRead(std::ifstream &os)=0
binary reading from file
maths::Vector< double > por
corners of the circumferent cuboid (lower left corner and upper right corner)
int type
type of the object
bool getVisible()
show the visiblity state (used in GOATvis)
bool Active
should the object be considered for inelastic (RRT) calculations?
void setCenter(maths::Vector< double > P)
sets Center to P (check, if function is necessary)
virtual void binWrite(std::ofstream &os)=0
binary writing to file
void setBeta(double Beta)
sets rotation angle around y-axis
double rho
mass density in
void setGamma(double Gamma)
sets rotation angle around z-axis
std::function< std::complex< double >(double)> nfunc
void setVisible(bool visible)
set visiblity (used in GOATvis)
maths::Matrix< std::complex< double > > alpha
polarisability matrix
ObjectShape(const ObjectShape &F)
virtual maths::Vector< double > calcCoM()=0
calculates center of mass (needed by setCenter2CoM () )
maths::Vector< double > pul
std::complex< double > ninel
refractive index of the object, used for inelastic (RRT) calculation
maths::Vector< double > P
position of the object
double Egamma
angles through which the object was rotated (around the x- (Ealpha), then the y- (Ebeta) and finally ...
void scale(double sf)
sets scaling of the shape by the factor sf
virtual bool isInside(const maths::Vector< double > &p)=0
checks if point P is inside the object
virtual void setPos(double x, double y, double z)=0
sets reference point P
void setPolMatrix(maths::Matrix< std::complex< double > >alpha)
sets polarisability matrix
maths::Matrix< double > R
matrices for the transformation in the local coordinate system (H) and back to the calculation system...
bool isOutsideWorld()
Test if bounding box is (partly) outside the calculation space.
virtual void initQuad()=0
calculates the circumferent cuboid (needed e.g. for the inelastic scattering calculations)
virtual void setr0(double r0)=0
defines the radius of the calculation sphere
void setMatrix(double alpha, double beta, double gamma)
sets the matrix for the transformation between object's coordinate system and outer coordinate system...
void rotate(maths::Vector< double > A, double phi)
sets the matrix for the transformation between object's coordinate system and outer coordinate system...
void setActive(bool active)
sets flag if the object is inelastic active, i.e. it will be considered for inelastic calculation
double r0
radius of the calculation sphere
void setAlpha(double Alpha)
sets rotation angle around x-axis
void setn(std::complex< double > n)
sets refractive index
void setninel(std::complex< double > ninel)
sets refractive index for inelastic (RRT) calculation
bool isActive()
returns true if the object should be considered for inelastic calculation
std::complex< double > n
refractive index of the object
std::complex< double > getninel()
returns refractive index
virtual bool next(const maths::Vector< double > &p, const maths::Vector< double > &k, maths::Vector< double > &pout)=0
searches for the next (nearest) intersection of a ray with the object, p: current position of the ray...
ObjectShape(const maths::Vector< double > &P, std::complex< double > n, GOAT::maths::Matrix< std::complex< double > > alpha, const maths::Vector< double > &Ex=maths::ex, const maths::Vector< double > &Ey=maths::ey, const maths::Vector< double > &Ez=maths::ez, const int type=-1)
Constructor, as template for all derived classes.
maths::Vector< double > e[3]
unity vectors, describing the directions of the local coordinate system
void setCenter2CoM()
Calculates the center of mass (CoM) and sets the object's reference point to the CoM.
std::complex< double > getn()
returns refractive index for inelastic (RRT) calculation
virtual maths::Vector< double > norm(const maths::Vector< double > &P)=0
surface normal at the point P
virtual void setPos(maths::Vector< double > r)=0
sets reference point P
int Type()
returns the object's type
Definition objectshape.h:97
This file contains the definition of a template for 3x3 matrices, which can be used together with the...
bool intersectionTest(ObjectShape &A, ObjectShape &B)
Test if object A and object B may intersect each other (i.e. the bounding boxes around the objects in...
maths::Matrix< double > computeInertia(ObjectShape *F)
calculates inertia matrix
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.