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

class which represents a box (cuboid). It is derived by class ObjectShape This class is mainly used for the octree calculation, but can also be used for general purposes More...

#include <box.h>

Inheritance diagram for GOAT::raytracing::Box:
GOAT::raytracing::ObjectShape

Public Member Functions

void binRead (std::ifstream &is)
 reads object from a binary file
void binWrite (std::ofstream &os)
 writes object to a binary file
 Box ()
 Box (const Box &B)
 copy constructor
 Box (const maths::Vector< double > &P, const maths::Vector< double > &d, std::complex< double > n, double r0=1.0, const maths::Matrix< std::complex< double > > alpha=maths::CUNITY, const maths::Vector< double > Ex=maths::ex, const maths::Vector< double > Ey=maths::ey, const maths::Vector< double > Ez=maths::ez)
 Box (const maths::Vector< double > bound0, const maths::Vector< double > bound1)
 Box (const ObjectShape &F)
maths::Vector< double > calcCoM ()
 calculates center of mass (needed by setCenter2CoM () )
void calcDiag ()
double distance (const maths::Vector< double > &p, const maths::Vector< double > &k)
 calculates the distance between a ray, described by the position vector p and its directional vector k
maths::Vector< double > getD () const
 getthe Size of the box as a vector with its edge lenghts
double getSize ()
 returns a vector with the side lengths as its components
void initQuad ()
 calculates the circumferent cuboid
bool isInside (const maths::Vector< double > &Ps)
 returns true, if Ps is inside the box
bool next (const maths::Vector< double > &p, const maths::Vector< double > &k, maths::Vector< double > &pout)
 calculates the next crossing point between a ray represented by the position
maths::Vector< double > norm (const maths::Vector< double > &p)
 normal vector at the position p
void scale (double sf)
 sets scaling factor
void setD (maths::Vector< double > D)
void setOctree (bool isOctree)
 box belongs to an octree calculation
void setPos (double x, double y, double z)
 sets the position P and the corresponding bounds
void setPos (maths::Vector< double > r)
 sets reference point P
void setr0 (double r0)
 sets the radius of the calculation sphere
double volume ()
 returns the volume of the box
 ~Box ()
 destructor
Public Member Functions inherited from GOAT::raytracing::ObjectShape
std::complex< double > getn ()
 returns refractive index for inelastic (RRT) calculation
std::complex< double > getninel ()
 returns refractive index
bool getVisible ()
 show the visiblity state (used in GOATvis)
bool isActive ()
 returns true if the object should be considered for inelastic calculation
bool isOutsideWorld ()
 Test if bounding box is (partly) outside the calculation space.
 ObjectShape ()
 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.
 ObjectShape (const ObjectShape &F)
void rotate (maths::Vector< double > A, double phi)
 sets the matrix for the transformation between object's coordinate system and outer coordinate system, A: rotation axis, phi: angle for rotation around A
void scale (double sf)
 sets scaling of the shape by the factor sf
void setActive (bool active)
 sets flag if the object is inelastic active, i.e. it will be considered for inelastic calculation
void setAlpha (double Alpha)
 sets rotation angle around x-axis
void setBeta (double Beta)
 sets rotation angle around y-axis
void setCenter (maths::Vector< double > P)
 sets Center to P (check, if function is necessary)
void setCenter2CoM ()
 Calculates the center of mass (CoM) and sets the object's reference point to the CoM.
void setGamma (double Gamma)
 sets rotation angle around z-axis
void setMatrix (double alpha, double beta, double gamma)
 sets the matrix for the transformation between object's coordinate system and outer coordinate system, alpha, beta, gamma: angles (rotation around x-, y- and z-axis) to calculate transformation matrix
void setMatrix (maths::Matrix< double > H)
 sets the matrix for the transformation between object's coordinate system and outer coordinate system, H: transformation matrix
void setn (std::complex< double > n)
 sets refractive index
void setninel (std::complex< double > ninel)
 sets refractive index for inelastic (RRT) calculation
void setPolMatrix (maths::Matrix< std::complex< double > >alpha)
 sets polarisability matrix
void setVisible (bool visible)
 set visiblity (used in GOATvis)
int Type ()
 returns the object's type

Public Attributes

maths::Vector< double > bounds [2]
 positions of the two opposite corners (with box in the center)
maths::Vector< double > d
 extensions of the box in x-, y- and z-direction
maths::Vector< double > diag [3]
 diagonal
Public Attributes inherited from GOAT::raytracing::ObjectShape
bool Active
 should the object be considered for inelastic (RRT) calculations?
maths::Matrix< std::complex< double > > alpha
 polarisability matrix
maths::Vector< double > e [3]
 unity vectors, describing the directions of the local coordinate system
double Ealpha
double Ebeta
double Egamma
 angles through which the object was rotated (around the x- (Ealpha), then the y- (Ebeta) and finally the z-axis (Egamma))
maths::Matrix< double > H
std::complex< double > n
 refractive index of the object
std::function< std::complex< double >(double)> nfunc
NFUNCTYPE nfuncType =NFUNCTYPE::vacuum
std::complex< double > ninel
 refractive index of the object, used for inelastic (RRT) calculation
maths::Vector< double > P
 position of the object
maths::Vector< double > por
 corners of the circumferent cuboid (lower left corner and upper right corner)
maths::Vector< double > pul
maths::Matrix< double > R
 matrices for the transformation in the local coordinate system (H) and back to the calculation system (R)
double r0
 radius of the calculation sphere
double rho
 mass density in \( kg/m^3 \)
double sf =1
 scaling factor, it is used to scale the shape of the object
int type
 type of the object
bool visible =true

Private Attributes

bool isOctree = false
 used for Octree calculation

Detailed Description

class which represents a box (cuboid). It is derived by class ObjectShape This class is mainly used for the octree calculation, but can also be used for general purposes

Definition at line 16 of file box.h.

Constructor & Destructor Documentation

◆ Box() [1/5]

GOAT::raytracing::Box::Box ( )

◆ Box() [2/5]

GOAT::raytracing::Box::Box ( const ObjectShape & F)

◆ Box() [3/5]

GOAT::raytracing::Box::Box ( const Box & B)

copy constructor

◆ Box() [4/5]

GOAT::raytracing::Box::Box ( const maths::Vector< double > & P,
const maths::Vector< double > & d,
std::complex< double > n,
double r0 = 1.0,
const maths::Matrix< std::complex< double > > alpha = maths::CUNITY,
const maths::Vector< double > Ex = maths::ex,
const maths::Vector< double > Ey = maths::ey,
const maths::Vector< double > Ez = maths::ez )

Main constructor.

Parameters
PPosition of the box (mid point)
dVector with the edge lengths in x-, y- and z-direction
n(Complex) refractive index
r0Radius of the calculation sphere (needed by the next routine)
alphaPolarisability matrix
ExLocal coordinate system (first axis, usually x)
EyLocal coordinate system (second axis, usually y)
EzLocal coordinate system (third axis, usually z)

◆ Box() [5/5]

GOAT::raytracing::Box::Box ( const maths::Vector< double > bound0,
const maths::Vector< double > bound1 )

This constructor is mainly intented for internal use in the octree algorithm, therefore the refractive index is not set (it keeps on the default value). The Box is defined by two opposite corners (minimal and maximal x,y and z coordinates) stored in the vectors bound0 and bound1. Location vector p is set to zero. isOctree will be set to true

Parameters
bound0corner with the lowest x,y and z coordinates
bound1corner with the highest x,y and z coordinates

◆ ~Box()

GOAT::raytracing::Box::~Box ( )

destructor

Member Function Documentation

◆ binRead()

void GOAT::raytracing::Box::binRead ( std::ifstream & is)
virtual

reads object from a binary file

Implements GOAT::raytracing::ObjectShape.

◆ binWrite()

void GOAT::raytracing::Box::binWrite ( std::ofstream & os)
virtual

writes object to a binary file

Implements GOAT::raytracing::ObjectShape.

◆ calcCoM()

maths::Vector< double > GOAT::raytracing::Box::calcCoM ( )
inlinevirtual

calculates center of mass (needed by setCenter2CoM () )

Implements GOAT::raytracing::ObjectShape.

Definition at line 95 of file box.h.

◆ calcDiag()

void GOAT::raytracing::Box::calcDiag ( )
inline

Definition at line 66 of file box.h.

◆ distance()

double GOAT::raytracing::Box::distance ( const maths::Vector< double > & p,
const maths::Vector< double > & k )

calculates the distance between a ray, described by the position vector p and its directional vector k

◆ getD()

maths::Vector< double > GOAT::raytracing::Box::getD ( ) const
inline

getthe Size of the box as a vector with its edge lenghts

Definition at line 82 of file box.h.

◆ getSize()

double GOAT::raytracing::Box::getSize ( )
inline

returns a vector with the side lengths as its components

Definition at line 63 of file box.h.

◆ initQuad()

void GOAT::raytracing::Box::initQuad ( )
virtual

calculates the circumferent cuboid

Implements GOAT::raytracing::ObjectShape.

◆ isInside()

bool GOAT::raytracing::Box::isInside ( const maths::Vector< double > & Ps)
virtual

returns true, if Ps is inside the box

Implements GOAT::raytracing::ObjectShape.

◆ next()

bool GOAT::raytracing::Box::next ( const maths::Vector< double > & p,
const maths::Vector< double > & k,
maths::Vector< double > & pout )
virtual

calculates the next crossing point between a ray represented by the position

Implements GOAT::raytracing::ObjectShape.

◆ norm()

maths::Vector< double > GOAT::raytracing::Box::norm ( const maths::Vector< double > & p)
virtual

normal vector at the position p

Implements GOAT::raytracing::ObjectShape.

◆ scale()

void GOAT::raytracing::Box::scale ( double sf)

sets scaling factor

◆ setD()

void GOAT::raytracing::Box::setD ( maths::Vector< double > D)
inline
Parameters
Dsets the extensions in x-, y- and z-direction

Definition at line 83 of file box.h.

◆ setOctree()

void GOAT::raytracing::Box::setOctree ( bool isOctree)
inline

box belongs to an octree calculation

Definition at line 96 of file box.h.

◆ setPos() [1/2]

void GOAT::raytracing::Box::setPos ( double x,
double y,
double z )
inlinevirtual

sets the position P and the corresponding bounds

Implements GOAT::raytracing::ObjectShape.

Definition at line 81 of file box.h.

◆ setPos() [2/2]

void GOAT::raytracing::Box::setPos ( maths::Vector< double > r)
inlinevirtual

sets reference point P

Implements GOAT::raytracing::ObjectShape.

Definition at line 73 of file box.h.

◆ setr0()

void GOAT::raytracing::Box::setr0 ( double r0)
virtual

sets the radius of the calculation sphere

Implements GOAT::raytracing::ObjectShape.

◆ volume()

double GOAT::raytracing::Box::volume ( )
inlinevirtual

returns the volume of the box

Implements GOAT::raytracing::ObjectShape.

Definition at line 62 of file box.h.

Member Data Documentation

◆ bounds

maths::Vector<double> GOAT::raytracing::Box::bounds[2]

positions of the two opposite corners (with box in the center)

Definition at line 92 of file box.h.

◆ d

maths::Vector<double> GOAT::raytracing::Box::d

extensions of the box in x-, y- and z-direction

Definition at line 93 of file box.h.

◆ diag

maths::Vector<double> GOAT::raytracing::Box::diag[3]

diagonal

Definition at line 94 of file box.h.

◆ isOctree

bool GOAT::raytracing::Box::isOctree = false
private

used for Octree calculation

Definition at line 21 of file box.h.


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