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

This class represents an ellipsoid This class represents an ellipsoid, defined by its half axis a, b and c according to the formula: \(\frac{x^2}{a^2}+\frac{y^2}{b^2}+\frac{z^2}{c^2}=1\). More...

#include <ellipsoid.h>

Inheritance diagram for GOAT::raytracing::Ellipsoid:
GOAT::raytracing::ObjectShape

Public Member Functions

double a ()
 Returns the length of the first half axis.
double b ()
 Returns the length of the second half axis.
void binRead (std::ifstream &os)
 Reads informatopn about an ellipsoid from a binary file.
void binWrite (std::ofstream &os)
 Writes information about the ellipsoid in a binary file.
double c ()
 Returns the length of the third half axis.
maths::Vector< double > calcCoM ()
 Calculates the center of mass, which is in the case of an ellipsoid simply its center, P.
maths::Matrix< double > computeInertia ()
 Calculates the inertia matrix of the ellipsoid.
 Ellipsoid ()
 Ellipsoid (const Ellipsoid &E)
 Copy Constructor.
 Ellipsoid (const maths::Vector< double > &P, const maths::Vector< double > &r, 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 for class Ellipsoid.
 Ellipsoid (const ObjectShape &)
maths::Vector< double > getr ()
 Returns a vector, where its components are the lengths of the three half axis.
void initQuad ()
 Sets the circumscribing cuboid (for use in inelastic calculations)
bool isInside (const maths::Vector< double > &p)
 Checks if a certain position is inside the object.
bool next (const maths::Vector< double > &Ps, const maths::Vector< double > &K, maths::Vector< double > &pout)
 Calculates the next intersection point with a ray, which is represented by a reference point and the direction vector.
maths::Vector< double > norm (const maths::Vector< double > &p)
 calculates the surface normal of the ellipsoid at a certain point (p must be on the surface)
Ellipsoidoperator= (Ellipsoid &f)
Ellipsoidoperator= (Ellipsoid f)
void scale (double sf)
 Set the scaling factor (the half axis will be multiplied by this factor)
void seta (double a, bool VConst=false)
void setb (double b, bool VConst=false)
void setc (double c, bool VConst=false)
void setPos (double x, double y, double z)
 Sets the position of the ellipsoid(center) to a vector, represented by its components x,y and z.
void setPos (maths::Vector< double > r)
 Set the position of the ellipsoid (center) to r.
void setr (double a, double b, double c)
 Sets the lengths of the three half axis, represented by a, b and c.
void setr (maths::Vector< double > &r)
 Sets the lengths of the three half axis, represented by the components of r.
void setr0 (double r0)
 defines the radius of the calculation sphere
double volume ()
 Calculates the volume of the ellipsoid.
 ~Ellipsoid ()
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 > P2
 Square of the position vector P: P2=(P[0]^2,P[1]^2,P[2]^2) (for internal use only)
maths::Vector< double > r
 GOAT::maths::Vector, where its components represent the lengths of the corresponding half axis.
maths::Vector< double > r_2
 GOAT::maths::Vector, where its components represent the square of lengths of the corresponding half axis (for internal use only)
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

Friends

std::ostream & operator<< (std::ostream &os, Ellipsoid E)

Detailed Description

This class represents an ellipsoid This class represents an ellipsoid, defined by its half axis a, b and c according to the formula: \(\frac{x^2}{a^2}+\frac{y^2}{b^2}+\frac{z^2}{c^2}=1\).

Definition at line 20 of file ellipsoid.h.

Constructor & Destructor Documentation

◆ ~Ellipsoid()

GOAT::raytracing::Ellipsoid::~Ellipsoid ( )
inline

Definition at line 24 of file ellipsoid.h.

◆ Ellipsoid() [1/4]

GOAT::raytracing::Ellipsoid::Ellipsoid ( )

◆ Ellipsoid() [2/4]

GOAT::raytracing::Ellipsoid::Ellipsoid ( const ObjectShape & )

◆ Ellipsoid() [3/4]

GOAT::raytracing::Ellipsoid::Ellipsoid ( const Ellipsoid & E)

Copy Constructor.

◆ Ellipsoid() [4/4]

GOAT::raytracing::Ellipsoid::Ellipsoid ( const maths::Vector< double > & P,
const maths::Vector< double > & r,
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 for class Ellipsoid.

Parameters
PPosition of the ellipsoid (center of the ellipsoid)
rThe components of this vector represents the length of the half axis along the x-, y- and z-axis
n(Complex) refractive index
r0Radius of the calculation sphere (optional, needed by next()). If the Scene class is used, the radius of the Scene class will be used for the calculation
alphaPolarisability (for inelastic calculations only) Directions of the local coordinate system
Ex
Ey
Ez

Member Function Documentation

◆ a()

double GOAT::raytracing::Ellipsoid::a ( )
inline

Returns the length of the first half axis.

Definition at line 87 of file ellipsoid.h.

◆ b()

double GOAT::raytracing::Ellipsoid::b ( )
inline

Returns the length of the second half axis.

Definition at line 88 of file ellipsoid.h.

◆ binRead()

void GOAT::raytracing::Ellipsoid::binRead ( std::ifstream & os)
virtual

Reads informatopn about an ellipsoid from a binary file.

Implements GOAT::raytracing::ObjectShape.

◆ binWrite()

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

Writes information about the ellipsoid in a binary file.

Implements GOAT::raytracing::ObjectShape.

◆ c()

double GOAT::raytracing::Ellipsoid::c ( )
inline

Returns the length of the third half axis.

Definition at line 89 of file ellipsoid.h.

◆ calcCoM()

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

Calculates the center of mass, which is in the case of an ellipsoid simply its center, P.

Implements GOAT::raytracing::ObjectShape.

Definition at line 108 of file ellipsoid.h.

◆ computeInertia()

maths::Matrix< double > GOAT::raytracing::Ellipsoid::computeInertia ( )

Calculates the inertia matrix of the ellipsoid.

◆ getr()

maths::Vector< double > GOAT::raytracing::Ellipsoid::getr ( )
inline

Returns a vector, where its components are the lengths of the three half axis.

Definition at line 90 of file ellipsoid.h.

◆ initQuad()

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

Sets the circumscribing cuboid (for use in inelastic calculations)

Implements GOAT::raytracing::ObjectShape.

◆ isInside()

bool GOAT::raytracing::Ellipsoid::isInside ( const maths::Vector< double > & p)
virtual

Checks if a certain position is inside the object.

Parameters
pPosition to check
Returns
true, if the position is inside otherwise false.

Implements GOAT::raytracing::ObjectShape.

◆ next()

bool GOAT::raytracing::Ellipsoid::next ( const maths::Vector< double > & Ps,
const maths::Vector< double > & K,
maths::Vector< double > & pout )
virtual

Calculates the next intersection point with a ray, which is represented by a reference point and the direction vector.

Parameters
PsReference point of the ray
KDirection of the ray
poutIntersection point (zero if not found)
Returns
true, if an intersection point was found, otherwise false

Implements GOAT::raytracing::ObjectShape.

◆ norm()

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

calculates the surface normal of the ellipsoid at a certain point (p must be on the surface)

Parameters
pPoint at which the normal will be calculated
Returns
surface normal

Implements GOAT::raytracing::ObjectShape.

◆ operator=() [1/2]

Ellipsoid & GOAT::raytracing::Ellipsoid::operator= ( Ellipsoid & f)

◆ operator=() [2/2]

Ellipsoid & GOAT::raytracing::Ellipsoid::operator= ( Ellipsoid f)

◆ scale()

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

Set the scaling factor (the half axis will be multiplied by this factor)

◆ seta()

void GOAT::raytracing::Ellipsoid::seta ( double a,
bool VConst = false )

Changes the length of the first half axis. If VConst is set true, the lengths of the other half axis are changed by the factor \(\sqrt{\frac{a_{old}}{a_{new}}}\), otherwise the other half axis remain the same

◆ setb()

void GOAT::raytracing::Ellipsoid::setb ( double b,
bool VConst = false )

Changes the length of the second half axis. If VConst is set true, the lengths of the other half axis are changed by the factor \(\sqrt{\frac{b_{old}}{b_{new}}}\) to keep the volume constant, otherwise the other half axis remain the same

◆ setc()

void GOAT::raytracing::Ellipsoid::setc ( double c,
bool VConst = false )

Changes the length of the third half axis. If VConst is set true, the lengths of the other half axis are changed by the factor \(\sqrt{\frac{c_{old}}{c_{new}}}\) to keep the volume constant, otherwise the other half axis remain the same

◆ setPos() [1/2]

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

Sets the position of the ellipsoid(center) to a vector, represented by its components x,y and z.

Implements GOAT::raytracing::ObjectShape.

Definition at line 92 of file ellipsoid.h.

◆ setPos() [2/2]

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

Set the position of the ellipsoid (center) to r.

Implements GOAT::raytracing::ObjectShape.

Definition at line 91 of file ellipsoid.h.

◆ setr() [1/2]

void GOAT::raytracing::Ellipsoid::setr ( double a,
double b,
double c )

Sets the lengths of the three half axis, represented by a, b and c.

◆ setr() [2/2]

void GOAT::raytracing::Ellipsoid::setr ( maths::Vector< double > & r)

Sets the lengths of the three half axis, represented by the components of r.

◆ setr0()

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

defines the radius of the calculation sphere

Implements GOAT::raytracing::ObjectShape.

◆ volume()

double GOAT::raytracing::Ellipsoid::volume ( )
virtual

Calculates the volume of the ellipsoid.

Implements GOAT::raytracing::ObjectShape.

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
Ellipsoid E )
friend

Member Data Documentation

◆ P2

maths::Vector<double> GOAT::raytracing::Ellipsoid::P2

Square of the position vector P: P2=(P[0]^2,P[1]^2,P[2]^2) (for internal use only)

Definition at line 114 of file ellipsoid.h.

◆ r

maths::Vector<double> GOAT::raytracing::Ellipsoid::r

GOAT::maths::Vector, where its components represent the lengths of the corresponding half axis.

Definition at line 112 of file ellipsoid.h.

◆ r_2

maths::Vector<double> GOAT::raytracing::Ellipsoid::r_2

GOAT::maths::Vector, where its components represent the square of lengths of the corresponding half axis (for internal use only)

Definition at line 113 of file ellipsoid.h.


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